Flow123d  release_3.0.0-973-g92f55e826
transport.cc
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file transport.cc
15  * @ingroup transport
16  * @brief Transport
17  */
18 
19 #include <memory>
20 
21 #include "system/system.hh"
22 #include "system/sys_profiler.hh"
23 
24 #include "mesh/side_impl.hh"
25 #include "mesh/long_idx.hh"
26 #include "mesh/mesh.h"
27 #include "mesh/partitioning.hh"
28 #include "mesh/accessors.hh"
29 #include "mesh/range_wrapper.hh"
30 #include "mesh/neighbours.h"
31 #include "transport/transport.h"
32 
33 #include "la/distribution.hh"
34 
35 #include "la/sparse_graph.hh"
36 #include <iostream>
37 #include <iomanip>
38 #include <string>
39 
40 #include "io/output_time.hh"
41 #include "tools/time_governor.hh"
42 #include "coupling/balance.hh"
43 #include "input/accessors.hh"
44 #include "input/input_type.hh"
45 
47 #include "fields/field_values.hh"
48 #include "fields/field_fe.hh"
50 #include "fields/generic_field.hh"
51 
52 #include "reaction/isotherm.hh" // SorptionType enum
53 #include "flow/mh_dofhandler.hh"
54 
55 
56 FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport);
57 
58 
59 namespace IT = Input::Type;
60 
61 const string _equation_name = "Solute_Advection_FV";
62 
64  Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(_equation_name) +
66 
68 {
69  return IT::Record(_equation_name, "Finite volume method, explicit in time, for advection only solute transport.")
71  .declare_key("input_fields", IT::Array(
72  EqData().make_field_descriptor_type(_equation_name)),
74  "")
75  .declare_key("output",
76  EqData().output_fields.make_output_type(_equation_name, ""),
77  IT::Default("{ \"fields\": [ \"conc\" ] }"),
78  "Specification of output fields and output times.")
79  .close();
80 }
81 
82 
84 {
85  *this += bc_conc.name("bc_conc")
86  .description("Boundary condition for concentration of substances.")
87  .input_default("0.0")
88  .units( UnitSI().kg().m(-3) );
89 
90  *this += init_conc.name("init_conc")
91  .description("Initial values for concentration of substances.")
92  .input_default("0.0")
93  .units( UnitSI().kg().m(-3) );
94 
95  output_fields += *this;
96  output_fields += conc_mobile.name("conc")
97  .units( UnitSI().kg().m(-3) )
99  .description("Concentration solution.");
100  output_fields += region_id.name("region_id")
103  .description("Region ids.");
104  output_fields += subdomain.name("subdomain")
107  .description("Subdomain ids of the domain decomposition.");
108 }
109 
110 
112 : ConcentrationTransportBase(init_mesh, in_rec),
113  is_mass_diag_changed(false),
114  input_rec(in_rec),
115  mh_dh(nullptr),
116  sources_corr(nullptr)
117 {
118  START_TIMER("ConvectionTransport");
119  this->eq_data_ = &data_;
120 
121  transport_matrix_time = -1.0; // or -infty
122  transport_bc_time = -1.0;
124  is_src_term_scaled = false;
125  is_bc_term_scaled = false;
126 }
127 
129 {
131 
133 
135  data_.set_input_list( input_rec.val<Input::Array>("input_fields"), *time_ );
136  data_.set_mesh(*mesh_);
137 
141 
142  // register output vectors
149  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
150  {
151  // create shared pointer to a FieldFE and push this Field to output_field on all regions
152  output_field_ptr[sbi] = create_field<3, FieldValue<3>::Scalar>(out_conc[sbi], *mesh_, 1);
153  data_.conc_mobile[sbi].set_field(mesh_->region_db().get_region_set("ALL"), output_field_ptr[sbi], 0);
154  }
155  //output_stream_->add_admissible_field_names(input_rec.val<Input::Array>("output_fields"));
156  //output_stream_->mark_output_times(*time_);
157 
159  //cout << "Transport." << endl;
160  //cout << time().marks();
161 
162  balance_->allocate(el_ds->lsize(), 1);
163 
164 }
165 
166 
167 //=============================================================================
168 // MAKE TRANSPORT
169 //=============================================================================
171 
172 // int * id_4_old = new int[mesh_->n_elements()];
173 // int i = 0;
174 // for (auto ele : mesh_->elements_range()) id_4_old[i++] = ele.index();
175 // mesh_->get_part()->id_maps(mesh_->n_elements(), id_4_old, el_ds, el_4_loc, row_4_el);
176 // delete[] id_4_old;
177  el_ds = mesh_->get_el_ds();
180 
181  // TODO: make output of partitioning is usefull but makes outputs different
182  // on different number of processors, which breaks tests.
183  //
184  // Possible solution:
185  // - have flag in ini file to turn this output ON
186  // - possibility to have different ref_output for different num of proc.
187  // - or do not test such kind of output
188  //
189  //for (auto ele : mesh_->elements_range()) {
190  // ele->pid()=el_ds->get_proc(row_4_el[ele.index()]);
191  //}
192 
193 }
194 
195 
196 
198 {
199  unsigned int sbi;
200 
201  if (sources_corr) {
202  //Destroy mpi vectors at first
203  chkerr(MatDestroy(&tm));
204  chkerr(VecDestroy(&mass_diag));
205  chkerr(VecDestroy(&vpmass_diag));
206  chkerr(VecDestroy(&vcfl_flow_));
207  chkerr(VecDestroy(&vcfl_source_));
208  delete cfl_flow_;
209  delete cfl_source_;
210 
211  for (sbi = 0; sbi < n_substances(); sbi++) {
212  // mpi vectors
213  chkerr(VecDestroy(&vconc[sbi]));
214  chkerr(VecDestroy(&vpconc[sbi]));
215  chkerr(VecDestroy(&bcvcorr[sbi]));
216  chkerr(VecDestroy(&vcumulative_corr[sbi]));
217  chkerr(VecDestroy(&v_tm_diag[sbi]));
218  chkerr(VecDestroy(&v_sources_corr[sbi]));
219 
220  // arrays of arrays
221  delete conc[sbi];
222  delete cumulative_corr[sbi];
223  delete tm_diag[sbi];
224  delete sources_corr[sbi];
225  }
226 
227  // arrays of mpi vectors
228  delete vconc;
229  delete vpconc;
230  delete bcvcorr;
231  delete vcumulative_corr;
232  delete v_tm_diag;
233  delete v_sources_corr;
234 
235  // arrays of arrays
236  delete conc;
237  delete cumulative_corr;
238  delete tm_diag;
239  delete sources_corr;
240  }
241 }
242 
243 
244 
245 
246 
248 {
249  for (auto elem : mesh_->elements_range()) {
250  if (!el_ds->is_local(row_4_el[ elem.idx() ])) continue;
251 
252  LongIdx index = row_4_el[ elem.idx() ] - el_ds->begin();
253  ElementAccessor<3> ele_acc = mesh_->element_accessor( elem.idx() );
254 
255  for (unsigned int sbi=0; sbi<n_substances(); sbi++) // Optimize: SWAP LOOPS
256  conc[sbi][index] = data_.init_conc[sbi].value(elem.centre(), ele_acc);
257  }
258 
259 }
260 
261 //=============================================================================
262 // ALLOCATE OF TRANSPORT VARIABLES (ELEMENT & NODES)
263 //=============================================================================
265 
266  unsigned int i, sbi, n_subst;
267  n_subst = n_substances();
268 
269  sources_corr = new double*[n_subst];
270  tm_diag = new double*[n_subst];
271  cumulative_corr = new double*[n_subst];
272  for (sbi = 0; sbi < n_subst; sbi++) {
273  cumulative_corr[sbi] = new double[el_ds->lsize()];
274  sources_corr[sbi] = new double[el_ds->lsize()];
275  tm_diag[sbi] = new double[el_ds->lsize()];
276  }
277 
278  conc = new double*[n_subst];
279  out_conc.clear();
280  out_conc.resize(n_subst);
281  output_field_ptr.clear();
282  output_field_ptr.resize(n_subst);
283  for (sbi = 0; sbi < n_subst; sbi++) {
284  conc[sbi] = new double[el_ds->lsize()];
285  out_conc[sbi].resize( el_ds->size() );
286  for (i = 0; i < el_ds->lsize(); i++) {
287  conc[sbi][i] = 0.0;
288  }
289  }
290 
291  cfl_flow_ = new double[el_ds->lsize()];
292  cfl_source_ = new double[el_ds->lsize()];
293 }
294 
295 //=============================================================================
296 // ALLOCATION OF TRANSPORT VECTORS (MPI)
297 //=============================================================================
299 
300  int sbi, n_subst, rank, np;
301  n_subst = n_substances();
302 
303  MPI_Barrier(PETSC_COMM_WORLD);
304  MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
305  MPI_Comm_size(PETSC_COMM_WORLD, &np);
306 
307  vconc = new Vec[n_subst];
308  vpconc = new Vec[n_subst];
309  bcvcorr = new Vec[n_subst];
310  vcumulative_corr = new Vec[n_subst];
311  v_tm_diag = new Vec[n_subst];
312  v_sources_corr = new Vec[n_subst];
313 
314 
315  for (sbi = 0; sbi < n_subst; sbi++) {
316  VecCreateMPI(PETSC_COMM_WORLD, el_ds->lsize(), mesh_->n_elements(), &bcvcorr[sbi]);
317  VecZeroEntries(bcvcorr[sbi]);
318  VecCreateMPIWithArray(PETSC_COMM_WORLD,1, el_ds->lsize(), mesh_->n_elements(), conc[sbi],
319  &vconc[sbi]);
320 
321  VecCreateMPI(PETSC_COMM_WORLD, el_ds->lsize(), mesh_->n_elements(), &vpconc[sbi]);
322  VecZeroEntries(vconc[sbi]);
323  VecZeroEntries(vpconc[sbi]);
324 
325  // SOURCES
326  VecCreateMPIWithArray(PETSC_COMM_WORLD,1, el_ds->lsize(), mesh_->n_elements(),
327  cumulative_corr[sbi],&vcumulative_corr[sbi]);
328 
329  VecCreateMPIWithArray(PETSC_COMM_WORLD,1, el_ds->lsize(), mesh_->n_elements(),
330  sources_corr[sbi],&v_sources_corr[sbi]);
331 
332  VecCreateMPIWithArray(PETSC_COMM_WORLD,1, el_ds->lsize(), mesh_->n_elements(),
333  tm_diag[sbi],&v_tm_diag[sbi]);
334 
335  VecZeroEntries(vcumulative_corr[sbi]);
336  VecZeroEntries(out_conc[sbi].petsc_vec());
337  }
338 
339 
340  MatCreateAIJ(PETSC_COMM_WORLD, el_ds->lsize(), el_ds->lsize(), mesh_->n_elements(),
341  mesh_->n_elements(), 16, PETSC_NULL, 4, PETSC_NULL, &tm);
342 
343  VecCreateMPI(PETSC_COMM_WORLD, el_ds->lsize(), mesh_->n_elements(), &mass_diag);
344  VecCreateMPI(PETSC_COMM_WORLD, el_ds->lsize(), mesh_->n_elements(), &vpmass_diag);
345 
346  VecCreateMPIWithArray(PETSC_COMM_WORLD,1, el_ds->lsize(), mesh_->n_elements(),
348  VecCreateMPIWithArray(PETSC_COMM_WORLD,1, el_ds->lsize(), mesh_->n_elements(),
350 }
351 
352 
354 {
355  START_TIMER ("set_boundary_conditions");
356 
357  ElementAccessor<3> elm;
358 
359  unsigned int sbi, loc_el;
360 
361  // Assembly bcvcorr vector
362  for(sbi=0; sbi < n_substances(); sbi++) VecZeroEntries(bcvcorr[sbi]);
363 
364  balance_->start_flux_assembly(subst_idx);
365 
366  for (loc_el = 0; loc_el < el_ds->lsize(); loc_el++) {
367  elm = mesh_->element_accessor( el_4_loc[loc_el] );
368  if (elm->boundary_idx_ != NULL) {
369  LongIdx new_i = row_4_el[ elm.idx() ];
370 
371  for (unsigned int si=0; si<elm->n_sides(); si++) {
372  Boundary *b = elm.side(si)->cond();
373  if (b != NULL) {
374  double flux = mh_dh->side_flux( *(elm.side(si)) );
375  if (flux < 0.0) {
376  double aij = -(flux / elm.measure() );
377 
378  for (sbi=0; sbi<n_substances(); sbi++)
379  {
380  double value = data_.bc_conc[sbi].value( b->element_accessor().centre(), b->element_accessor() );
381 
382  VecSetValue(bcvcorr[sbi], new_i, value * aij, ADD_VALUES);
383 
384  // CAUTION: It seems that PETSc possibly optimize allocated space during assembly.
385  // So we have to add also values that may be non-zero in future due to changing velocity field.
386  balance_->add_flux_matrix_values(subst_idx[sbi], elm.side(si), {row_4_el[el_4_loc[loc_el]]}, {0.});
387  balance_->add_flux_vec_value(subst_idx[sbi], elm.side(si), flux*value);
388  }
389  } else {
390  for (sbi=0; sbi<n_substances(); sbi++)
391  VecSetValue(bcvcorr[sbi], new_i, 0, ADD_VALUES);
392 
393  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
394  {
395  balance_->add_flux_matrix_values(subst_idx[sbi], elm.side(si), {row_4_el[el_4_loc[loc_el]]}, {flux});
396  balance_->add_flux_vec_value(subst_idx[sbi], elm.side(si), 0);
397  }
398  }
399  }
400  }
401 
402  }
403  }
404 
405  balance_->finish_flux_assembly(subst_idx);
406 
407  for (sbi=0; sbi<n_substances(); sbi++) VecAssemblyBegin(bcvcorr[sbi]);
408  for (sbi=0; sbi<n_substances(); sbi++) VecAssemblyEnd(bcvcorr[sbi]);
409 
410  // we are calling set_boundary_conditions() after next_time() and
411  // we are using data from t() before, so we need to set corresponding bc time
413 }
414 
415 
416 //=============================================================================
417 // COMPUTE SOURCES
418 //=============================================================================
420 
421  //temporary variables
422  unsigned int loc_el, sbi;
423  double csection, source, diag;
424 
425  ElementAccessor<3> ele_acc;
426  arma::vec3 p;
427 
428  //TODO: would it be possible to check the change in data for chosen substance? (may be in multifields?)
429 
430  //checking if the data were changed
431  if( (data_.sources_density.changed() )
432  || (data_.sources_conc.changed() )
433  || (data_.sources_sigma.changed() )
434  || (data_.cross_section.changed()))
435  {
436  START_TIMER("sources_reinit");
437  balance_->start_source_assembly(subst_idx);
438 
439  for (loc_el = 0; loc_el < el_ds->lsize(); loc_el++)
440  {
441  ele_acc = mesh_->element_accessor( el_4_loc[loc_el] );
442  p = ele_acc.centre();
443  csection = data_.cross_section.value(p, ele_acc);
444 
445  // read for all substances
446  double max_cfl=0;
447  for (sbi = 0; sbi < n_substances(); sbi++)
448  {
449  double src_sigma = data_.sources_sigma[sbi].value(p, ele_acc);
450 
451  source = csection * (data_.sources_density[sbi].value(p, ele_acc) + src_sigma * data_.sources_conc[sbi].value(p, ele_acc));
452  // addition to RHS
453  sources_corr[sbi][loc_el] = source;
454  // addition to diagonal of the transport matrix
455  diag = src_sigma * csection;
456  tm_diag[sbi][loc_el] = - diag;
457 
458  // compute maximal cfl condition over all substances
459  max_cfl = std::max(max_cfl, fabs(diag));
460 
461  balance_->add_source_matrix_values(sbi, ele_acc.region().bulk_idx(), {row_4_el[el_4_loc[loc_el]]},
462  {- src_sigma * ele_acc.measure() * csection});
463  balance_->add_source_vec_values(sbi, ele_acc.region().bulk_idx(), {row_4_el[el_4_loc[loc_el]]},
464  {source * ele_acc.measure()});
465  }
466 
467  cfl_source_[loc_el] = max_cfl;
468  }
469 
470  balance_->finish_source_assembly(subst_idx);
471 
472  END_TIMER("sources_reinit");
473  }
474 }
475 
476 
477 
479 {
481 
484  std::stringstream ss; // print warning message with table of uninitialized fields
485  if ( FieldCommon::print_message_table(ss, "convection transport") ) {
486  WarningOut() << ss.str();
487  }
488 
491 
492  START_TIMER("Convection balance zero time step");
493 
497 
498  // write initial condition
499  output_data();
500 }
501 
502 
504 {
505  OLD_ASSERT(mh_dh, "Null MH object.\n" );
506  data_.set_time(time_->step(), LimitSide::right); // set to the last computed time
507 
508  START_TIMER("data reinit");
509 
510  bool cfl_changed = false;
511 
512  // if FLOW or DATA changed ---------------------> recompute transport matrix
514  {
517  cfl_changed = true;
518  DebugOut() << "CFL changed - flow.\n";
519  }
520 
522  {
524  cfl_changed = true;
525  DebugOut() << "CFL changed - mass matrix.\n";
526  }
527 
528  // if DATA changed ---------------------> recompute concentration sources (rhs and matrix diagonal)
531  {
533  is_src_term_scaled = false;
534  cfl_changed = true;
535  DebugOut() << "CFL changed - source.\n";
536  }
537 
538  // now resolve the CFL condition
539  if(cfl_changed)
540  {
541  // find maximum of sum of contribution from flow and sources: MAX(vcfl_flow_ + vcfl_source_)
542  Vec cfl;
543  VecCreateMPI(PETSC_COMM_WORLD, el_ds->lsize(),PETSC_DETERMINE, &cfl);
544  VecWAXPY(cfl, 1.0, vcfl_flow_, vcfl_source_);
545  VecMaxPointwiseDivide(cfl,mass_diag, &cfl_max_step);
546  // get a reciprocal value as a time constraint
548  DebugOut().fmt("CFL constraint (transport): {}\n", cfl_max_step);
549  }
550 
551  // although it does not influence CFL, compute BC so the full system is assembled
553  || data_.porosity.changed()
555  || data_.bc_conc.changed() )
556  {
558  is_bc_term_scaled = false;
559  }
560 
561  END_TIMER("data reinit");
562 
563  // return time constraint
564  time_constraint = cfl_max_step;
565  return cfl_changed;
566 }
567 
569 
570  START_TIMER("convection-one step");
571 
572  // proceed to next time - which we are about to compute
573  // explicit scheme looks one step back and uses data from previous time
574  // (data time set previously in assess_time_constraint())
575  time_->next_time();
576 
577  double dt_new = time_->dt(), // current time step we are about to compute
578  dt_scaled = dt_new / time_->last_dt(); // scaling ratio to previous time step
579 
580  START_TIMER("time step rescaling");
581 
582  // if FLOW or DATA or BC or DT changed ---------------------> rescale boundary condition
584  {
585  DebugOut() << "BC - rescale dt.\n";
586  //choose between fresh scaling with new dt or rescaling to a new dt
587  double dt = (!is_bc_term_scaled) ? dt_new : dt_scaled;
588  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
589  VecScale(bcvcorr[sbi], dt);
590  is_bc_term_scaled = true;
591  }
592 
593 
594  // if DATA or TIME STEP changed -----------------------> rescale source term
596  DebugOut() << "SRC - rescale dt.\n";
597  //choose between fresh scaling with new dt or rescaling to a new dt
598  double dt = (!is_src_term_scaled) ? dt_new : dt_scaled;
599  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
600  {
601  VecScale(v_sources_corr[sbi], dt);
602  VecScale(v_tm_diag[sbi], dt);
603  }
604  is_src_term_scaled = true;
605  }
606 
607  // if DATA or TIME STEP changed -----------------------> rescale transport matrix
609  DebugOut() << "TM - rescale dt.\n";
610  //choose between fresh scaling with new dt or rescaling to a new dt
611  double dt = (!is_convection_matrix_scaled) ? dt_new : dt_scaled;
612 
613  MatScale(tm, dt);
615  }
616 
617  END_TIMER("time step rescaling");
618 
619 
620  data_.set_time(time_->step(), LimitSide::right); // set to the last computed time
622  {
623  VecCopy(mass_diag, vpmass_diag);
625  } else is_mass_diag_changed = false;
626 
627 
628  // Compute new concentrations for every substance.
629 
630  for (unsigned int sbi = 0; sbi < n_substances(); sbi++) {
631  // one step in MOBILE phase
632  START_TIMER("mat mult");
633 
634  // tm_diag is a diagonal part of transport matrix, which depends on substance data (sources_sigma)
635  // Wwe need keep transport matrix independent of substance, therefore we keep this diagonal part
636  // separately in a vector tm_diag.
637  // Computation: first, we compute this diagonal addition D*pconc and save it temporaly into RHS
638 
639  // RHS = D*pconc, where D is diagonal matrix represented by a vector
640  VecPointwiseMult(vcumulative_corr[sbi], v_tm_diag[sbi], vconc[sbi]); //w = x.*y
641 
642  // Then we add boundary terms ans other source terms into RHS.
643  // RHS = 1.0 * bcvcorr + 1.0 * v_sources_corr + 1.0 * rhs
644  VecAXPBYPCZ(vcumulative_corr[sbi], 1.0, 1.0, 1.0, bcvcorr[sbi], v_sources_corr[sbi]); //z = ax + by + cz
645 
646  // Then we set the new previous concentration.
647  VecCopy(vconc[sbi], vpconc[sbi]); // pconc = conc
648  // And finally proceed with transport matrix multiplication.
649  if (is_mass_diag_changed) {
650  VecPointwiseMult(vconc[sbi], vconc[sbi], vpmass_diag); // vconc*=vpmass_diag
651  MatMultAdd(tm, vpconc[sbi], vconc[sbi], vconc[sbi]); // vconc+=tm*vpconc
652  VecAXPY(vconc[sbi], 1, vcumulative_corr[sbi]); // vconc+=vcumulative_corr
653  VecPointwiseDivide(vconc[sbi], vconc[sbi], mass_diag); // vconc/=mass_diag
654  } else {
655  MatMultAdd(tm, vpconc[sbi], vcumulative_corr[sbi], vconc[sbi]); // vconc =tm*vpconc+vcumulative_corr
656  VecPointwiseDivide(vconc[sbi], vconc[sbi], mass_diag); // vconc/=mass_diag
657  VecAXPY(vconc[sbi], 1, vpconc[sbi]); // vconc+=vpconc
658  }
659 
660  END_TIMER("mat mult");
661  }
662 
663  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
664  balance_->calculate_cumulative(sbi, vpconc[sbi]);
665 
666  END_TIMER("convection-one step");
667 }
668 
669 
670 void ConvectionTransport::set_target_time(double target_time)
671 {
672 
673  //sets target_mark_type (it is fixed) to be met in next_time()
674  time_->marks().add(TimeMark(target_time, target_mark_type));
675 
676  // This is done every time TOS calls update_solution.
677  // If CFL condition is changed, time fixation will change later from TOS.
678 
679  // Set the same constraint as was set last time.
680 
681  // TODO: fix this hack, remove this method completely, leaving just the first line at the calling point
682  // in TransportOperatorSplitting::update_solution()
683  // doing this directly leads to choose of large time step violationg CFL condition
684  if (cfl_max_step > time_->dt()*1e-10)
685  time_->set_upper_constraint(cfl_max_step, "CFL condition used from previous step.");
686 
687  // fixing convection time governor till next target_mark_type (got from TOS or other)
688  // may have marks for data changes
690 }
691 
692 
694 {
695  ElementAccessor<3> elm;
696 
697  VecZeroEntries(mass_diag);
698 
699  balance_->start_mass_assembly(subst_idx);
700 
701  for (unsigned int loc_el = 0; loc_el < el_ds->lsize(); loc_el++) {
702  elm = mesh_->element_accessor( el_4_loc[loc_el] );
703 
704  double csection = data_.cross_section.value(elm.centre(), elm);
705  //double por_m = data_.porosity.value(elm.centre(), elm->element_accessor());
706  double por_m = data_.water_content.value(elm.centre(), elm);
707 
708  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
709  balance_->add_mass_matrix_values(subst_idx[sbi], elm.region().bulk_idx(), {row_4_el[el_4_loc[loc_el]]}, {csection*por_m*elm.measure()} );
710 
711  VecSetValue(mass_diag, row_4_el[ elm.idx() ], csection*por_m, INSERT_VALUES);
712  }
713 
714  balance_->finish_mass_assembly(subst_idx);
715 
716  VecAssemblyBegin(mass_diag);
717  VecAssemblyEnd(mass_diag);
718 
719  is_mass_diag_changed = true;
720 }
721 
722 
723 //=============================================================================
724 // CREATE TRANSPORT MATRIX
725 //=============================================================================
727 
728  START_TIMER("convection_matrix_assembly");
729 
730  ElementAccessor<3> el2;
731  ElementAccessor<3> elm;
732  const Edge *edg;
733  int j, np, rank;
734  LongIdx new_j, new_i;
735  double aij, aii;
736 
737  MatZeroEntries(tm);
738 
739  MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
740  MPI_Comm_size(PETSC_COMM_WORLD, &np);
741 
742  double flux, flux2, edg_flux;
743 
744  aii = 0.0;
745 
746  for (unsigned int loc_el = 0; loc_el < el_ds->lsize(); loc_el++) {
747  elm = mesh_->element_accessor( el_4_loc[loc_el] );
748  new_i = row_4_el[ elm.idx() ];
749 
750  for (unsigned int si=0; si<elm->n_sides(); si++) {
751  // same dim
752  flux = mh_dh->side_flux( *(elm.side(si)) );
753  if (elm.side(si)->cond() == NULL) {
754  edg = elm.side(si)->edge();
755  edg_flux = 0;
756  for( int s=0; s < edg->n_sides; s++) {
757  flux2 = mh_dh->side_flux( *(edg->side(s)) );
758  if ( flux2 > 0) edg_flux+= flux2;
759  }
760  for(unsigned int s=0; s<edg->n_sides; s++)
761  // this test should also eliminate sides facing to lower dim. elements in comp. neighboring
762  // These edges on these sides should have just one side
763  if (edg->side(s) != elm.side(si)) {
764  j = edg->side(s)->element().idx();
765  new_j = row_4_el[j];
766 
767  flux2 = mh_dh->side_flux( *(edg->side(s)));
768  if ( flux2 > 0.0 && flux <0.0)
769  aij = -(flux * flux2 / ( edg_flux * elm.measure() ) );
770  else aij =0;
771  MatSetValue(tm, new_i, new_j, aij, INSERT_VALUES);
772  }
773  }
774  if (flux > 0.0)
775  aii -= (flux / elm.measure() );
776  } // end same dim //ELEMENT_SIDES
777 
778  for (unsigned int n=0; n<elm->n_neighs_vb(); n++) // comp model
779  {
780  el2 = mesh_->element_accessor( elm->neigh_vb[n]->side()->element().idx() ); // higher dim. el.
781  ASSERT( el2.idx() != elm.idx() ).error("Elm. same\n");
782  new_j = row_4_el[ el2.idx() ];
783  flux = mh_dh->side_flux( *(elm->neigh_vb[n]->side()) );
784 
785  // volume source - out-flow from higher dimension
786  if (flux > 0.0) aij = flux / elm.measure();
787  else aij=0;
788  MatSetValue(tm, new_i, new_j, aij, INSERT_VALUES);
789  // out flow from higher dim. already accounted
790 
791  // volume drain - in-flow to higher dimension
792  if (flux < 0.0) {
793  aii -= (-flux) / elm.measure(); // diagonal drain
794  aij = (-flux) / el2.measure();
795  } else aij=0;
796  MatSetValue(tm, new_j, new_i, aij, INSERT_VALUES);
797  }
798 
799  MatSetValue(tm, new_i, new_i, aii, INSERT_VALUES);
800 
801  cfl_flow_[loc_el] = fabs(aii);
802  aii = 0.0;
803  } // END ELEMENTS
804 
805  MatAssemblyBegin(tm, MAT_FINAL_ASSEMBLY);
806  MatAssemblyEnd(tm, MAT_FINAL_ASSEMBLY);
807 
809  END_TIMER("convection_matrix_assembly");
810 
812 }
813 
814 
815 
816 
817 
818 //=============================================================================
819 // OUTPUT VECTOR GATHER
820 //=============================================================================
822 
823  unsigned int sbi;
824  IS is;
825 
826  ISCreateGeneral(PETSC_COMM_SELF, mesh_->n_elements(), row_4_el, PETSC_COPY_VALUES, &is); //WithArray
827  VecScatterCreate(vconc[0], is, out_conc[0].petsc_vec(), PETSC_NULL, &vconc_out_scatter);
828  for (sbi = 0; sbi < n_substances(); sbi++) {
829  VecScatterBegin(vconc_out_scatter, vconc[sbi], out_conc[sbi].petsc_vec(), INSERT_VALUES, SCATTER_FORWARD);
830  VecScatterEnd(vconc_out_scatter, vconc[sbi], out_conc[sbi].petsc_vec(), INSERT_VALUES, SCATTER_FORWARD);
831  }
832  chkerr(VecScatterDestroy(&(vconc_out_scatter)));
833  chkerr(ISDestroy(&(is)));
834 }
835 
836 
838  return conc;
839 }
840 
841 void ConvectionTransport::get_par_info(LongIdx * &el_4_loc_out, Distribution * &el_distribution_out){
842  el_4_loc_out = this->el_4_loc;
843  el_distribution_out = this->el_ds;
844  return;
845 }
846 
847 //int *ConvectionTransport::get_el_4_loc(){
848 // return el_4_loc;
849 //}
850 
852  return row_4_el;
853 }
854 
855 
856 
858 
860  //if ( data_.output_fields.is_field_output_time(data_.conc_mobile, time().step()) ) {
862  //}
863 
864  for (unsigned int sbi = 0; sbi < n_substances(); sbi++) {
866  }
867 
868  data_.output_fields.output(time().step());
869 
870  START_TIMER("TOS-balance");
871  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
872  balance_->calculate_instant(sbi, vconc[sbi]);
873  balance_->output();
874  END_TIMER("TOS-balance");
875 }
876 
877 void ConvectionTransport::set_balance_object(std::shared_ptr<Balance> balance)
878 {
879  balance_ = balance;
880  subst_idx = balance_->add_quantities(substances_.names());
881 }
FieldCommon::units
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
Definition: field_common.hh:140
LimitSide::right
@ right
OLD_ASSERT_EQUAL
#define OLD_ASSERT_EQUAL(a, b)
Definition: global_defs.h:133
Element::n_neighs_vb
unsigned int n_neighs_vb() const
Return number of neighbours.
Definition: elements.h:70
TransportEqData::sources_sigma
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc)
Definition: transport_operator_splitting.hh:165
_equation_name
const string _equation_name
Definition: transport.cc:61
Mesh::get_el_ds
Distribution * get_el_ds() const
Definition: mesh.h:168
EquationBase::mesh_
Mesh * mesh_
Definition: equation.hh:221
ConvectionTransport::set_balance_object
void set_balance_object(std::shared_ptr< Balance > balance) override
Definition: transport.cc:877
ConvectionTransport::out_conc
std::vector< VectorMPI > out_conc
Definition: transport.h:307
ConvectionTransport::EqData::conc_mobile
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
Definition: transport.h:103
ConvectionTransport::is_bc_term_scaled
bool is_bc_term_scaled
Definition: transport.h:265
ConvectionTransport::vcfl_flow_
Vec vcfl_flow_
Parallel vector for flow contribution to CFL condition.
Definition: transport.h:278
Boundary
Definition: boundaries.h:48
ConvectionTransport::mass_diag
Vec mass_diag
Definition: transport.h:285
MultiField::setup_components
void setup_components()
Definition: multi_field.impl.hh:261
ConvectionTransport::create_mass_matrix
void create_mass_matrix()
Definition: transport.cc:693
TimeGovernor::dt
double dt() const
Definition: time_governor.hh:542
UnitSI::dimensionless
static UnitSI & dimensionless()
Returns dimensionless unit.
Definition: unit_si.cc:55
ConvectionTransport::EqData::init_conc
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
Definition: transport.h:99
ConvectionTransport::row_4_el
LongIdx * row_4_el
Definition: transport.h:320
sparse_graph.hh
Distributed sparse graphs, partitioning.
FieldSet::set_time
bool set_time(const TimeStep &time, LimitSide limit_side)
Definition: field_set.cc:157
Distribution::lsize
unsigned int lsize(int proc) const
get local size
Definition: distribution.hh:115
EquationBase::eq_data_
FieldSet * eq_data_
Definition: equation.hh:230
TransportEqData::sources_density
MultiField< 3, FieldValue< 3 >::Scalar > sources_density
Concentration sources - density of substance source, only positive part is used.
Definition: transport_operator_splitting.hh:163
time_governor.hh
Basic time management class.
TimeGovernor::end_time
double end_time() const
End time.
Definition: time_governor.hh:568
ConvectionTransport::get_input_type
static const Input::Type::Record & get_input_type()
Definition: transport.cc:67
mh_dofhandler.hh
field_algo_base.hh
neighbours.h
EquationOutput::initialize
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
Definition: equation_output.cc:109
ASSERT
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Definition: asserts.hh:346
TransportEqData
Definition: transport_operator_splitting.hh:147
ConvectionTransport::transport_matrix_time
double transport_matrix_time
Definition: transport.h:293
LongIdx
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
Definition: long_idx.hh:22
Mesh::elements_range
virtual Range< ElementAccessor< 3 > > elements_range() const
Returns range of bulk elements.
Definition: mesh.cc:1116
TimeGovernor::equation_fixed_mark_type
TimeMark::Type equation_fixed_mark_type() const
Definition: time_governor.hh:458
EquationBase::time_
TimeGovernor * time_
Definition: equation.hh:222
distribution.hh
Support classes for parallel programing.
ConvectionTransport::output_field_ptr
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > output_field_ptr
Fields correspond with out_conc.
Definition: transport.h:312
ConvectionTransport::sources_corr
double ** sources_corr
Definition: transport.h:271
TransportEqData::sources_conc
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc
Definition: transport_operator_splitting.hh:166
Input::Record::val
const Ret val(const string &key) const
Definition: accessors_impl.hh:31
TimeGovernor::set_upper_constraint
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
Definition: time_governor.cc:525
EquationBase::time
TimeGovernor & time()
Definition: equation.hh:146
FieldSet::mark_input_times
void mark_input_times(const TimeGovernor &tg)
Definition: field_set.hh:218
FieldSet::set_input_list
void set_input_list(Input::Array input_list, const TimeGovernor &tg)
Definition: field_set.hh:190
Neighbour::side
SideIter side()
Definition: neighbours.h:147
value
static constexpr bool value
Definition: json.hpp:87
FieldSet::output_type
void output_type(OutputTime::DiscreteSpace rt)
Definition: field_set.hh:211
ConvectionTransport::el_ds
Distribution * el_ds
Definition: transport.h:322
chkerr
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
Definition: system.hh:147
MH_DofHandler::side_flux
double side_flux(const Side &side) const
temporary replacement for DofHandler accessor, flux through given side
Definition: mh_dofhandler.cc:273
ConvectionTransport::~ConvectionTransport
virtual ~ConvectionTransport()
Definition: transport.cc:197
ElementAccessor< 3 >
Side::edge
const Edge * edge() const
Definition: side_impl.hh:66
Distribution::size
unsigned int size() const
get global size
Definition: distribution.hh:118
ConvectionTransport::get_row_4_el
LongIdx * get_row_4_el() override
Return global array of order of elements within parallel vector.
Definition: transport.cc:851
system.hh
OutputTime::ELEM_DATA
@ ELEM_DATA
Definition: output_time.hh:107
arma::vec3
Definition: doxy_dummy_defs.hh:17
FieldCommon::flags
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Definition: field_common.hh:179
ConvectionTransport::n_substances
unsigned int n_substances() override
Returns number of transported substances.
Definition: transport.h:202
Mesh::get_row_4_el
LongIdx * get_row_4_el() const
Definition: mesh.h:171
ConvectionTransport::output_vector_gather
void output_vector_gather()
Definition: transport.cc:821
ConvectionTransport::vcumulative_corr
Vec * vcumulative_corr
Definition: transport.h:304
field_fe.hh
ConvectionTransport::output_stream_
std::shared_ptr< OutputTime > output_stream_
Definition: transport.h:317
ConvectionTransport::transport_bc_time
double transport_bc_time
Time of the last update of the boundary condition terms.
Definition: transport.h:294
TransportEqData::porosity
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity - usually saturated water content in the case of unsaturated flow model.
Definition: transport_operator_splitting.hh:151
Side::cond
Boundary * cond() const
Definition: side_impl.hh:71
FieldFlag::equation_external_output
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Definition: field_flag.hh:58
ConvectionTransport::is_mass_diag_changed
bool is_mass_diag_changed
Flag indicates that porosity or cross_section changed during last time.
Definition: transport.h:268
MPI_Comm_rank
#define MPI_Comm_rank
Definition: mpi.h:236
ConvectionTransport::cumulative_corr
double ** cumulative_corr
Definition: transport.h:305
ConvectionTransport::vconc
Vec * vconc
Concentration vectors for mobile phase.
Definition: transport.h:297
SubstanceList::names
const std::vector< std::string > & names()
Definition: substance.hh:85
Input::Type::Record::size
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:598
Input::Type::Default
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
Input::Type::Record::derive_from
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:195
Distribution
Definition: distribution.hh:50
MPI_Comm_size
#define MPI_Comm_size
Definition: mpi.h:235
TimeMark
Class used for marking specified times at which some events occur.
Definition: time_marks.hh:45
ConvectionTransport::EqData
Definition: transport.h:83
ConvectionTransport::alloc_transport_structs_mpi
void alloc_transport_structs_mpi()
Definition: transport.cc:298
FieldSet::set_components
void set_components(const std::vector< string > &names)
Definition: field_set.hh:177
ConvectionTransport::EqData::EqData
EqData()
Definition: transport.cc:83
accessors.hh
ConvectionTransport::bcvcorr
Vec * bcvcorr
Definition: transport.h:303
EquationBase::balance_
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
Definition: equation.hh:233
ConvectionTransport::is_convection_matrix_scaled
bool is_convection_matrix_scaled
Definition: transport.h:265
ConvectionTransport::cfl_source_
double * cfl_source_
Definition: transport.h:280
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
FieldFlag::equation_result
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
Definition: field_flag.hh:55
ConvectionTransport::data_
EqData data_
Definition: transport.h:257
Edge::n_sides
int n_sides
Definition: edges.h:36
sys_profiler.hh
ConvectionTransport::input_rec
const Input::Record input_rec
Record with input specification.
Definition: transport.h:315
ConvectionTransport::evaluate_time_constraint
bool evaluate_time_constraint(double &time_constraint) override
Definition: transport.cc:503
ConvectionTransport::registrar
static const int registrar
Registrar of class to factory.
Definition: transport.h:252
Edge::side
SideIter side(const unsigned int i) const
Definition: edges.h:31
TimeGovernor::tlevel
int tlevel() const
Definition: time_governor.hh:584
ConvectionTransport::zero_time_step
void zero_time_step() override
Definition: transport.cc:478
ConvectionTransport::v_tm_diag
Vec * v_tm_diag
Definition: transport.h:287
ConvectionTransport::set_initial_condition
void set_initial_condition()
Definition: transport.cc:247
ConvectionTransport::mh_dh
const MH_DofHandler * mh_dh
Definition: transport.h:332
accessors.hh
ConvectionTransport::vpmass_diag
Vec vpmass_diag
Definition: transport.h:286
TimeGovernor::step
const TimeStep & step(int index=-1) const
Definition: time_governor.cc:726
ConvectionTransport::vcfl_source_
Vec vcfl_source_
Parallel vector for source term contribution to CFL condition.
Definition: transport.h:279
ConvectionTransport::output_data
virtual void output_data() override
Write computed fields.
Definition: transport.cc:857
output_time.hh
ConvectionTransport::EqData::output_fields
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
Definition: transport.h:107
field_values.hh
GenericField::subdomain
static auto subdomain(Mesh &mesh) -> IndexField
Definition: generic_field.impl.hh:57
Input::Type::Default::obligatory
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
ConvectionTransport::subst_idx
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
Definition: transport.h:335
ConvectionTransport::EqData::bc_conc
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
Definition: transport.h:96
ConvectionTransport::v_sources_corr
Vec * v_sources_corr
Definition: transport.h:272
FieldCommon::print_message_table
static bool print_message_table(ostream &stream, std::string equation_name)
Definition: field_common.cc:96
UnitSI
Class for representation SI units of Fields.
Definition: unit_si.hh:40
Mesh::region_db
const RegionDB & region_db() const
Definition: mesh.h:147
RegionDB::get_region_set
RegionSet get_region_set(const std::string &set_name) const
Definition: region.cc:328
Input::Type::Record::declare_key
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:501
FLOW123D_FORCE_LINK_IN_CHILD
FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport)
Side::element
ElementAccessor< 3 > element() const
Definition: side_impl.hh:53
FieldCommon::changed
bool changed() const
Definition: field_common.hh:337
isotherm.hh
TimeGovernor::last_t
double last_t() const
Definition: time_governor.hh:533
ConvectionTransport::conc
double ** conc
Concentrations for phase, substance, element.
Definition: transport.h:299
TransportEqData::cross_section
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: transport_operator_splitting.hh:160
mesh.h
Boundary::element_accessor
ElementAccessor< 3 > element_accessor()
Definition: boundaries.cc:48
TimeMarks::add
TimeMark add(const TimeMark &mark)
Definition: time_marks.cc:81
ConvectionTransport::substances_
SubstanceList substances_
Transported substances.
Definition: transport.h:325
Input::Type::Record::close
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:303
generic_field.hh
Input::Type
Definition: balance.hh:38
partitioning.hh
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
ConvectionTransport::tm
Mat tm
Definition: transport.h:284
Field::value
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Definition: field.hh:392
Element::neigh_vb
Neighbour ** neigh_vb
Definition: elements.h:87
GenericField::region_id
static auto region_id(Mesh &mesh) -> IndexField
Definition: generic_field.impl.hh:38
ConvectionTransport::EqData::subdomain
Field< 3, FieldValue< 3 >::Scalar > subdomain
Definition: transport.h:102
FieldCommon::input_default
FieldCommon & input_default(const string &input_default)
Definition: field_common.hh:127
EquationOutput::output
void output(TimeStep step)
Definition: equation_output.cc:186
input_type.hh
ConcentrationTransportBase
Definition: transport_operator_splitting.hh:61
ConvectionTransport::is_src_term_scaled
bool is_src_term_scaled
Definition: transport.h:265
Mesh
Definition: mesh.h:80
ConvectionTransport::make_transport_partitioning
void make_transport_partitioning()
Definition: transport.cc:170
Element::n_sides
unsigned int n_sides() const
Definition: elements.h:135
ConvectionTransport::get_concentration_matrix
double ** get_concentration_matrix() override
Getter for array of concentrations per element.
Definition: transport.cc:837
Input::Type::Array
Class for declaration of inputs sequences.
Definition: type_base.hh:339
TimeGovernor::marks
static TimeMarks & marks()
Definition: time_governor.hh:315
OLD_ASSERT
#define OLD_ASSERT(...)
Definition: global_defs.h:131
TransportEqData::water_content
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content - result of unsaturated water flow model or porosity.
Definition: transport_operator_splitting.hh:157
Edge
Definition: edges.h:26
Input::Array
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
ConvectionTransport::target_mark_type
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
Definition: transport.h:275
FieldSet::set_mesh
void set_mesh(const Mesh &mesh)
Definition: field_set.hh:183
WarningOut
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:246
ConvectionTransport::el_4_loc
LongIdx * el_4_loc
Definition: transport.h:321
ElementAccessor::region
Region region() const
Definition: accessors.hh:95
fe_value_handler.hh
side_impl.hh
ConvectionTransport::update_solution
void update_solution() override
Definition: transport.cc:568
transport.h
ConcentrationTransportBase::get_input_type
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
Definition: transport_operator_splitting.cc:62
ElementAccessor::idx
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
Definition: accessors.hh:111
ConvectionTransport::compute_concentration_sources
void compute_concentration_sources()
Assembles concentration sources for each substance. note: the source of concentration is multiplied b...
Definition: transport.cc:419
fill_output_data
void fill_output_data(VectorMPI &vec_seq, std::shared_ptr< FieldFE< spacedim, Value > > field_ptr)
Definition: field_fe.hh:309
TimeGovernor::is_changed_dt
bool is_changed_dt() const
Definition: time_governor.hh:506
long_idx.hh
ConvectionTransport::ConvectionTransport
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
Definition: transport.cc:111
balance.hh
ConvectionTransport::get_par_info
void get_par_info(LongIdx *&el_4_loc, Distribution *&el_ds) override
Return array of indices of local elements and parallel distribution of elements.
Definition: transport.cc:841
ConvectionTransport::set_target_time
void set_target_time(double target_time) override
Definition: transport.cc:670
ConvectionTransport::alloc_transport_vectors
void alloc_transport_vectors()
Definition: transport.cc:264
FieldCommon::description
FieldCommon & description(const string &description)
Definition: field_common.hh:115
MH_DofHandler::time_changed
double time_changed() const
Definition: mh_dofhandler.hh:55
ConvectionTransport::vconc_out_scatter
VecScatter vconc_out_scatter
Definition: transport.h:283
Mesh::n_elements
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
Definition: mesh.h:355
ConvectionTransport::tm_diag
double ** tm_diag
Definition: transport.h:288
DebugOut
#define DebugOut()
Macro defining 'debug' record of log.
Definition: logger.hh:252
ElementAccessor::side
SideIter side(const unsigned int loc_index)
Definition: accessors.hh:137
TimeGovernor::next_time
void next_time()
Proceed to the next time according to current estimated time step.
Definition: time_governor.cc:640
Mesh::element_accessor
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
Definition: mesh.cc:802
ConvectionTransport::vpconc
Vec * vpconc
Definition: transport.h:302
ConvectionTransport::cfl_max_step
double cfl_max_step
Time step constraint coming from CFL condition.
Definition: transport.h:276
ConvectionTransport::initialize
void initialize() override
Definition: transport.cc:128
TimeGovernor::fix_dt_until_mark
double fix_dt_until_mark()
Fixing time step until fixed time mark.
Definition: time_governor.cc:567
RegionIdx::bulk_idx
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Definition: region.hh:91
START_TIMER
#define START_TIMER(tag)
Starts a timer with specified tag.
Definition: sys_profiler.hh:119
ConvectionTransport::set_boundary_conditions
void set_boundary_conditions()
Definition: transport.cc:353
Distribution::is_local
bool is_local(unsigned int idx) const
identify local index
Definition: distribution.hh:120
MPI_Barrier
#define MPI_Barrier(comm)
Definition: mpi.h:531
Element::boundary_idx_
unsigned int * boundary_idx_
Definition: elements.h:83
ConvectionTransport::cfl_flow_
double * cfl_flow_
Definition: transport.h:280
ConvectionTransport::EqData::region_id
Field< 3, FieldValue< 3 >::Scalar > region_id
Definition: transport.h:101
ElementAccessor::measure
double measure() const
Computes the measure of the element.
Definition: accessors.hh:254
END_TIMER
#define END_TIMER(tag)
Ends a timer with specified tag.
Definition: sys_profiler.hh:153
ConvectionTransport::create_transport_matrix_mpi
void create_transport_matrix_mpi()
Definition: transport.cc:726
TimeGovernor::last_dt
double last_dt() const
Definition: time_governor.hh:525
FieldCommon::name
FieldCommon & name(const string &name)
Definition: field_common.hh:108
range_wrapper.hh
Implementation of range helper class.
ElementAccessor::centre
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Definition: accessors.hh:285
Distribution::begin
unsigned int begin(int proc) const
get starting local index
Definition: distribution.hh:109
Mesh::get_el_4_loc
LongIdx * get_el_4_loc() const
Definition: mesh.h:174
TimeGovernor::t
double t() const
Definition: time_governor.hh:519