Flow123d  master-e663071
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 #include "system/index_types.hh"
24 
25 #include "mesh/mesh.h"
26 #include "mesh/partitioning.hh"
27 #include "mesh/accessors.hh"
28 #include "mesh/range_wrapper.hh"
29 #include "mesh/neighbours.h"
30 #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 "tools/mixed.hh"
43 #include "coupling/balance.hh"
44 #include "input/accessors.hh"
45 #include "input/input_type.hh"
46 
48 #include "fields/field_values.hh"
49 #include "fields/field_fe.hh"
51 #include "fields/generic_field.hh"
52 
53 #include "reaction/isotherm.hh" // SorptionType enum
54 
55 #include "fem/fe_p.hh"
56 #include "fem/fe_values.hh"
58 
59 
60 FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport)
61 
62 
63 namespace IT = Input::Type;
64 
65 /********************************************************************************
66  * Static methods and data members
67  */
68 const string _equation_name = "Solute_Advection_FV";
69 
71  Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(_equation_name) +
73 
75 {
76  return IT::Record(_equation_name, "Finite volume method, explicit in time, for advection only solute transport.")
79  .declare_key("input_fields", IT::Array(
80  EqFields().make_field_descriptor_type(_equation_name)),
82  "")
83  .declare_key("output",
84  EqFields().output_fields.make_output_type(_equation_name, ""),
85  IT::Default("{ \"fields\": [ \"conc\" ] }"),
86  "Specification of output fields and output times.")
87  .close();
88 }
89 
90 
92 {
93  *this += bc_conc.name("bc_conc")
94  .description("Boundary condition for concentration of substances.")
95  .input_default("0.0")
96  .units( UnitSI().kg().m(-3) );
97 
98  *this += init_conc.name("init_conc")
99  .description("Initial values for concentration of substances.")
100  .input_default("0.0")
101  .units( UnitSI().kg().m(-3) );
102 
103  output_fields += *this;
104  output_fields += conc_mobile.name("conc")
105  .units( UnitSI().kg().m(-3) )
107  .description("Concentration solution.");
108  output_fields += region_id.name("region_id")
111  .description("Region ids.");
112  output_fields += subdomain.name("subdomain")
115  .description("Subdomain ids of the domain decomposition.");
116 
117  this->add_coords_field();
118  this->set_default_fieldset();
119 }
120 
121 
122 /********************************************************************************
123  * ConvectionTransport
124  */
126 : ConcentrationTransportBase(init_mesh, in_rec),
127  input_rec(in_rec)
128 {
129  START_TIMER("ConvectionTransport");
130  eq_data_ = make_shared<EqData>();
131  eq_fields_ = make_shared<EqFields>();
132  this->eq_fieldset_ = eq_fields_;
133 
134  eq_data_->transport_matrix_time = -1.0; // or -infty
135  eq_data_->transport_bc_time = -1.0;
136  eq_data_->is_convection_matrix_scaled = false;
137  is_src_term_scaled = false;
138  is_bc_term_scaled = false;
139 
140  //initialization of DOF handler
141  MixedPtr<FE_P_disc> fe(0);
142  eq_data_->dh_ = make_shared<DOFHandlerMultiDim>(init_mesh);
143  shared_ptr<DiscreteSpace> ds = make_shared<EqualOrderDiscreteSpace>( &init_mesh, fe);
144  eq_data_->dh_->distribute_dofs(ds);
145  vcumulative_corr = nullptr;
146 
147 }
148 
150 {
152 
154 
155  eq_fields_->set_components(eq_data_->substances_.names());
156  eq_fields_->set_input_list( input_rec.val<Input::Array>("input_fields"), *time_ );
157  eq_fields_->set_mesh(*mesh_);
158 
161 
162  Input::Array user_fields_arr;
163  if (input_rec.opt_val("user_fields", user_fields_arr)) {
164  this->init_user_fields(user_fields_arr, eq_fields_->output_fields);
165  }
166 
167  // register output vectors
168  eq_fields_->output_fields.set_components(eq_data_->substances_.names());
169  eq_fields_->output_fields.set_mesh(*mesh_);
170  eq_fields_->output_fields.output_type(OutputTime::ELEM_DATA);
171  eq_fields_->conc_mobile.setup_components();
174  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
175  {
176  // create shared pointer to a FieldFE and push this Field to output_field on all regions
177  eq_fields_->conc_mobile_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(eq_data_->dh_);
178  eq_fields_->conc_mobile[sbi].set(eq_fields_->conc_mobile_fe[sbi], 0);
179  }
180  //output_stream_->add_admissible_field_names(input_rec.val<Input::Array>("output_fields"));
181  //output_stream_->mark_output_times(*time_);
182 
183  eq_fields_->output_fields.initialize(output_stream_, mesh_, input_rec.val<Input::Record>("output"), time() );
184  //cout << "Transport." << endl;
185  //cout << time().marks();
186 
187  balance_->allocate(mesh_->get_el_ds()->lsize(), 1);
188  eq_data_->balance_ = this->balance();
189  eq_data_->set_time_governor(this->time_);
190  eq_data_->max_edg_sides = max(this->mesh_->max_edge_sides(1), max(this->mesh_->max_edge_sides(2), this->mesh_->max_edge_sides(3)));
191 
197 }
198 
199 
201 {
202  return eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
203 }
204 
205 
206 
208 {
209  unsigned int sbi;
210 
211  if (vcumulative_corr) {
212  //Destroy mpi vectors at first
213  chkerr(MatDestroy(&eq_data_->tm));
214  chkerr(VecDestroy(&eq_data_->mass_diag));
215  chkerr(VecDestroy(&vpmass_diag));
216 
217  for (sbi = 0; sbi < n_substances(); sbi++) {
218  // mpi vectors
219  chkerr(VecDestroy(&vpconc[sbi]));
220  chkerr(VecDestroy(&eq_data_->bcvcorr[sbi]));
221  chkerr(VecDestroy(&vcumulative_corr[sbi]));
222  }
223 
224  // arrays of mpi vectors
225  delete vpconc;
226  delete eq_data_->bcvcorr;
227  delete vcumulative_corr;
228 
229  // assembly objects
230  delete mass_assembly_;
231  delete init_cond_assembly_;
233  delete matrix_mpi_assembly_;
234  }
235 }
236 
237 
238 
239 
240 
241 //=============================================================================
242 // ALLOCATE OF TRANSPORT VARIABLES (ELEMENT & NODES)
243 //=============================================================================
245 
246  eq_fields_->conc_mobile_fe.resize(this->n_substances());
247 }
248 
249 //=============================================================================
250 // ALLOCATION OF TRANSPORT VECTORS (MPI)
251 //=============================================================================
253 
254  int sbi, n_subst, lsize;
255  n_subst = n_substances();
256  lsize = mesh_->get_el_ds()->lsize();
257 
258  MPI_Barrier(PETSC_COMM_WORLD);
259 
260  vpconc = new Vec[n_subst];
261  eq_data_->bcvcorr = new Vec[n_subst];
262  vcumulative_corr = new Vec[n_subst];
263  eq_data_->tm_diag.reserve(eq_data_->n_substances());
264  eq_data_->corr_vec.reserve(eq_data_->n_substances());
265 
266 
267  for (sbi = 0; sbi < n_subst; sbi++) {
268  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &eq_data_->bcvcorr[sbi]);
269  VecZeroEntries(eq_data_->bcvcorr[sbi]);
270 
271  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &vpconc[sbi]);
272  VecZeroEntries(vpconc[sbi]);
273 
274  // SOURCES
275  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &vcumulative_corr[sbi]);
276 
277  eq_data_->corr_vec.emplace_back(lsize, PETSC_COMM_WORLD);
278 
279  eq_data_->tm_diag.emplace_back(lsize, PETSC_COMM_WORLD);
280 
281  VecZeroEntries(vcumulative_corr[sbi]);
282  }
283 
284 
285  MatCreateAIJ(PETSC_COMM_WORLD, lsize, lsize, mesh_->n_elements(),
286  mesh_->n_elements(), 16, PETSC_NULL, 4, PETSC_NULL, &eq_data_->tm);
287 
288  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &eq_data_->mass_diag);
289  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &vpmass_diag);
290 
291  eq_data_->alloc_transport_structs_mpi(lsize);
292 }
293 
294 
296 {
297  ASSERT_EQ(time_->tlevel(), 0);
298 
299  eq_fields_->mark_input_times(*time_);
300  eq_fields_->set_time(time_->step(), LimitSide::right);
301  std::stringstream ss; // print warning message with table of uninitialized fields
302  if ( FieldCommon::print_message_table(ss, "convection transport") ) {
303  WarningOut() << ss.str();
304  }
305 
306  //set_initial_condition();
308  //create_mass_matrix();
310 
311  START_TIMER("Convection balance zero time step");
312 
313  START_TIMER("convection_matrix_assembly");
314  //create_transport_matrix_mpi();
316  END_TIMER("convection_matrix_assembly");
317  START_TIMER("sources_reinit_set_bc");
318  //conc_sources_bdr_conditions();
320  END_TIMER("sources_reinit_set_bc");
321 
322  // write initial condition
323  output_data();
324 }
325 
326 
328 {
329  ASSERT_PTR(eq_data_->dh_).error( "Null DOF handler object.\n" );
330  // read changed status before setting time
331  bool changed_flux = eq_fields_->flow_flux.changed();
332  eq_fields_->set_time(time_->step(), LimitSide::right); // set to the last computed time
333 
334  START_TIMER("data reinit");
335 
336  bool cfl_changed = false;
337 
338  // if FLOW or DATA changed ---------------------> recompute transport matrix
339  if (changed_flux)
340  {
341  START_TIMER("convection_matrix_assembly");
342  //create_transport_matrix_mpi();
344  END_TIMER("convection_matrix_assembly");
345  eq_data_->is_convection_matrix_scaled=false;
346  cfl_changed = true;
347  DebugOut() << "CFL changed - flow.\n";
348  }
349 
350  if (eq_data_->is_mass_diag_changed)
351  {
352  //create_mass_matrix();
354  cfl_changed = true;
355  DebugOut() << "CFL changed - mass matrix.\n";
356  }
357 
358  // if DATA changed ---------------------> recompute concentration sources (rhs and matrix diagonal)
359  if( eq_fields_->sources_density.changed() || eq_fields_->sources_conc.changed() || eq_fields_->sources_sigma.changed()
360  || eq_fields_->cross_section.changed() || eq_fields_->flow_flux.changed() || eq_fields_->porosity.changed()
361  || eq_fields_->water_content.changed() || eq_fields_->bc_conc.changed() )
362  {
363  START_TIMER("sources_reinit_set_bc");
364  //conc_sources_bdr_conditions();
366  END_TIMER("sources_reinit_set_bc");
367  if( eq_data_->sources_changed_ ) {
368  is_src_term_scaled = false;
369  cfl_changed = true;
370  }
371  if (eq_fields_->flow_flux.changed() || eq_fields_->porosity.changed()
372  || eq_fields_->water_content.changed() || eq_fields_->bc_conc.changed() ) is_bc_term_scaled = false;
373  DebugOut() << "CFL changed - source.\n";
374  }
375 
376  // now resolve the CFL condition
377  if(cfl_changed)
378  {
379  // find maximum of sum of contribution from flow and sources: MAX(vcfl_flow_ + vcfl_source_)
380  Vec cfl;
381  VecCreateMPI(PETSC_COMM_WORLD, mesh_->get_el_ds()->lsize(), PETSC_DETERMINE, &cfl);
382  VecWAXPY(cfl, 1.0, eq_data_->cfl_flow_.petsc_vec(), eq_data_->cfl_source_.petsc_vec());
383  VecMaxPointwiseDivide(cfl, eq_data_->mass_diag, &cfl_max_step);
384  // get a reciprocal value as a time constraint
386  DebugOut().fmt("CFL constraint (transport): {}\n", cfl_max_step);
387  }
388 
389  END_TIMER("data reinit");
390 
391  // return time constraint
392  time_constraint = cfl_max_step;
393  return cfl_changed;
394 }
395 
397 
398  START_TIMER("convection-one step");
399 
400  // proceed to next time - which we are about to compute
401  // explicit scheme looks one step back and uses data from previous time
402  // (data time set previously in assess_time_constraint())
403  time_->next_time();
404 
405  double dt_new = time_->dt(), // current time step we are about to compute
406  dt_scaled = dt_new / time_->last_dt(); // scaling ratio to previous time step
407 
408  START_TIMER("time step rescaling");
409 
410  // if FLOW or DATA or BC or DT changed ---------------------> rescale boundary condition
412  {
413  DebugOut() << "BC - rescale dt.\n";
414  //choose between fresh scaling with new dt or rescaling to a new dt
415  double dt = (!is_bc_term_scaled) ? dt_new : dt_scaled;
416  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
417  VecScale(eq_data_->bcvcorr[sbi], dt);
418  is_bc_term_scaled = true;
419  }
420 
421 
422  // if DATA or TIME STEP changed -----------------------> rescale source term
424  DebugOut() << "SRC - rescale dt.\n";
425  //choose between fresh scaling with new dt or rescaling to a new dt
426  double dt = (!is_src_term_scaled) ? dt_new : dt_scaled;
427  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
428  {
429  VecScale(eq_data_->corr_vec[sbi].petsc_vec(), dt);
430  VecScale(eq_data_->tm_diag[sbi].petsc_vec(), dt);
431  }
432  is_src_term_scaled = true;
433  }
434 
435  // if DATA or TIME STEP changed -----------------------> rescale transport matrix
436  if ( !eq_data_->is_convection_matrix_scaled || time_->is_changed_dt()) {
437  DebugOut() << "TM - rescale dt.\n";
438  //choose between fresh scaling with new dt or rescaling to a new dt
439  double dt = (!eq_data_->is_convection_matrix_scaled) ? dt_new : dt_scaled;
440 
441  MatScale(eq_data_->tm, dt);
442  eq_data_->is_convection_matrix_scaled = true;
443  }
444 
445  END_TIMER("time step rescaling");
446 
447 
448  eq_fields_->set_time(time_->step(), LimitSide::right); // set to the last computed time
449  if (eq_fields_->cross_section.changed() || eq_fields_->water_content.changed() || eq_fields_->porosity.changed())
450  {
451  VecCopy(eq_data_->mass_diag, vpmass_diag);
452  //create_mass_matrix();
454  } else eq_data_->is_mass_diag_changed = false;
455 
456 
457  // Compute new concentrations for every substance.
458 
459  for (unsigned int sbi = 0; sbi < n_substances(); sbi++) {
460  // one step in MOBILE phase
461  START_TIMER("mat mult");
462  Vec vconc = eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
463 
464  // tm_diag is a diagonal part of transport matrix, which depends on substance data (sources_sigma)
465  // Wwe need keep transport matrix independent of substance, therefore we keep this diagonal part
466  // separately in a vector tm_diag.
467  // Computation: first, we compute this diagonal addition D*pconc and save it temporaly into RHS
468 
469  // RHS = D*pconc, where D is diagonal matrix represented by a vector
470  VecPointwiseMult(vcumulative_corr[sbi], eq_data_->tm_diag[sbi].petsc_vec(), vconc); //w = x.*y
471 
472  // Then we add boundary terms ans other source terms into RHS.
473  // RHS = 1.0 * bcvcorr + 1.0 * corr_vec + 1.0 * rhs
474  VecAXPBYPCZ(vcumulative_corr[sbi], 1.0, 1.0, 1.0, eq_data_->bcvcorr[sbi], eq_data_->corr_vec[sbi].petsc_vec()); //z = ax + by + cz
475 
476  // Then we set the new previous concentration.
477  VecCopy(vconc, vpconc[sbi]); // pconc = conc
478  // And finally proceed with transport matrix multiplication.
479  if (eq_data_->is_mass_diag_changed) {
480  VecPointwiseMult(vconc, vconc, vpmass_diag); // vconc*=vpmass_diag
481  MatMultAdd(eq_data_->tm, vpconc[sbi], vconc, vconc); // vconc+=tm*vpconc
482  VecAXPY(vconc, 1, vcumulative_corr[sbi]); // vconc+=vcumulative_corr
483  VecPointwiseDivide(vconc, vconc, eq_data_->mass_diag); // vconc/=mass_diag
484  } else {
485  MatMultAdd(eq_data_->tm, vpconc[sbi], vcumulative_corr[sbi], vconc); // vconc =tm*vpconc+vcumulative_corr
486  VecPointwiseDivide(vconc, vconc, eq_data_->mass_diag); // vconc/=mass_diag
487  VecAXPY(vconc, 1, vpconc[sbi]); // vconc+=vpconc
488  }
489 
490  END_TIMER("mat mult");
491  }
492 
493  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
494  balance_->calculate_cumulative(sbi, vpconc[sbi]);
495 
496  END_TIMER("convection-one step");
497 }
498 
499 
500 void ConvectionTransport::set_target_time(double target_time)
501 {
502 
503  //sets target_mark_type (it is fixed) to be met in next_time()
504  time_->marks().add(TimeMark(target_time, target_mark_type));
505 
506  // This is done every time TOS calls update_solution.
507  // If CFL condition is changed, time fixation will change later from TOS.
508 
509  // Set the same constraint as was set last time.
510 
511  // TODO: fix this hack, remove this method completely, leaving just the first line at the calling point
512  // in TransportOperatorSplitting::update_solution()
513  // doing this directly leads to choose of large time step violationg CFL condition
514  if (cfl_max_step > time_->dt()*1e-10)
515  time_->set_upper_constraint(cfl_max_step, "CFL condition used from previous step.");
516 
517  // fixing convection time governor till next target_mark_type (got from TOS or other)
518  // may have marks for data changes
520 }
521 
522 
524  return eq_fields_->conc_mobile_fe;
525 }
526 
527 
529 
530  eq_fields_->output_fields.set_time(time().step(), LimitSide::right);
531  eq_fields_->output_fields.output(time().step());
532 
533  START_TIMER("TOS-balance");
534  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
535  balance_->calculate_instant(sbi, eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec());
536  balance_->output();
537  END_TIMER("TOS-balance");
538 }
539 
540 void ConvectionTransport::set_balance_object(std::shared_ptr<Balance> balance)
541 {
542  balance_ = balance;
543  eq_data_->subst_idx = balance_->add_quantities(eq_data_->substances_.names());
544  eq_data_->balance_ = this->balance();
545 }
FieldCommon::units
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
Definition: field_common.hh:153
LimitSide::right
@ right
EquationBase::user_fields_template
static Input::Type::Record & user_fields_template(std::string equation_name)
Template Record with common key user_fields for derived equations.
Definition: equation.cc:46
MeshBase::max_edge_sides
unsigned int max_edge_sides(unsigned int dim) const
Definition: mesh.h:145
_equation_name
const string _equation_name
Definition: transport.cc:68
EquationBase::mesh_
Mesh * mesh_
Definition: equation.hh:240
ConvectionTransport::set_balance_object
void set_balance_object(std::shared_ptr< Balance > balance) override
Definition: transport.cc:540
ConvectionTransport::is_bc_term_scaled
bool is_bc_term_scaled
Definition: transport.h:300
ConvectionTransport::EqFields::region_id
Field< 3, FieldValue< 3 >::Scalar > region_id
Definition: transport.h:108
TimeGovernor::dt
double dt() const
Definition: time_governor.hh:565
UnitSI::dimensionless
static UnitSI & dimensionless()
Returns dimensionless unit.
Definition: unit_si.cc:55
sparse_graph.hh
Distributed sparse graphs, partitioning.
Distribution::lsize
unsigned int lsize(int proc) const
get local size
Definition: distribution.hh:115
time_governor.hh
Basic time management class.
TimeGovernor::end_time
double end_time() const
End time.
Definition: time_governor.hh:591
ConvectionTransport::get_input_type
static const Input::Type::Record & get_input_type()
Definition: transport.cc:74
EquationBase::eq_fieldset_
std::shared_ptr< FieldSet > eq_fieldset_
Definition: equation.hh:249
field_algo_base.hh
neighbours.h
GenericAssembly::set_min_edge_sides
void set_min_edge_sides(unsigned int val)
Definition: generic_assembly.hh:199
ConvectionTransport::matrix_mpi_assembly_
GenericAssembly< MatrixMpiAssemblyConvection > * matrix_mpi_assembly_
Definition: transport.h:325
MeshBase::get_el_ds
Distribution * get_el_ds() const
Definition: mesh.h:119
TimeGovernor::equation_fixed_mark_type
TimeMark::Type equation_fixed_mark_type() const
Definition: time_governor.hh:481
EquationBase::time_
TimeGovernor * time_
Definition: equation.hh:241
distribution.hh
Support classes for parallel programing.
ConvectionTransport::EqFields::output_fields
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
Definition: transport.h:115
ConvectionTransport::EqFields::conc_mobile
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
Definition: transport.h:111
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:555
EquationBase::time
TimeGovernor & time()
Definition: equation.hh:151
fe_values.hh
Class FEValues calculates finite element data on the actual cells such as shape function values,...
chkerr
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
Definition: system.hh:142
FLOW123D_FORCE_LINK_IN_CHILD
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:104
ConvectionTransport::~ConvectionTransport
virtual ~ConvectionTransport()
Definition: transport.cc:207
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > >
ConvectionTransport::eq_data_
std::shared_ptr< EqData > eq_data_
Definition: transport.h:292
system.hh
OutputTime::ELEM_DATA
@ ELEM_DATA
Definition: output_time.hh:111
FieldCommon::flags
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Definition: field_common.hh:192
ConvectionTransport::n_substances
unsigned int n_substances() override
Returns number of transported substances.
Definition: transport.h:271
ConvectionTransport::EqFields::bc_conc
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
Definition: transport.h:103
ConvectionTransport::vcumulative_corr
Vec * vcumulative_corr
Definition: transport.h:313
field_fe.hh
ConvectionTransport::output_stream_
std::shared_ptr< OutputTime > output_stream_
Definition: transport.h:318
EquationBase::init_user_fields
void init_user_fields(Input::Array user_fields, FieldSet &output_fields)
Definition: equation.cc:84
index_types.hh
ConvectionTransport::init_cond_assembly_
GenericAssembly< InitCondAssemblyConvection > * init_cond_assembly_
Definition: transport.h:323
ConvectionTransport::EqFields::init_conc
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
Definition: transport.h:106
GenericAssembly::assemble
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
Definition: generic_assembly.hh:209
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
fe_p.hh
Definitions of basic Lagrangean finite elements with polynomial shape functions.
Input::Type::Record::size
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602
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:196
EquationBase::balance
std::shared_ptr< Balance > balance() const
Definition: equation.hh:189
TimeMark
Class used for marking specified times at which some events occur.
Definition: time_marks.hh:45
ConvectionTransport::alloc_transport_structs_mpi
void alloc_transport_structs_mpi()
Definition: transport.cc:252
accessors.hh
assembly_convection.hh
EquationBase::balance_
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
Definition: equation.hh:252
FieldSet::set_default_fieldset
void set_default_fieldset()
Definition: field_set.hh:394
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
sys_profiler.hh
ConvectionTransport::input_rec
const Input::Record input_rec
Record with input specification.
Definition: transport.h:316
ConvectionTransport::evaluate_time_constraint
bool evaluate_time_constraint(double &time_constraint) override
Definition: transport.cc:327
ConvectionTransport::registrar
static const int registrar
Registrar of class to factory.
Definition: transport.h:286
TimeGovernor::tlevel
int tlevel() const
Definition: time_governor.hh:607
ConvectionTransport::zero_time_step
void zero_time_step() override
Definition: transport.cc:295
quadrature_lib.hh
Definitions of particular quadrature rules on simplices.
ConvectionTransport::EqFields
Definition: transport.h:88
accessors.hh
ConvectionTransport::vpmass_diag
Vec vpmass_diag
Definition: transport.h:309
TimeGovernor::step
const TimeStep & step(int index=-1) const
Definition: time_governor.cc:756
ConvectionTransport::output_data
virtual void output_data() override
Write computed fields.
Definition: transport.cc:528
output_time.hh
ConvectionTransport::conc_sources_bdr_assembly_
GenericAssembly< ConcSourcesBdrAssemblyConvection > * conc_sources_bdr_assembly_
Definition: transport.h:324
field_values.hh
GenericField::subdomain
static auto subdomain(Mesh &mesh) -> IndexField
Definition: generic_field.impl.hh:58
Input::Type::Default::obligatory
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
FieldCommon::print_message_table
static bool print_message_table(ostream &stream, std::string equation_name)
Definition: field_common.cc:96
ConvectionTransport::EqFields::EqFields
EqFields()
Definition: transport.cc:91
UnitSI
Class for representation SI units of Fields.
Definition: unit_si.hh:40
FieldSet::add_coords_field
void add_coords_field()
Definition: field_set.cc:251
ASSERT_EQ
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
Input::Record::opt_val
bool opt_val(const string &key, Ret &value) const
Definition: accessors_impl.hh:107
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:503
isotherm.hh
ConvectionTransport::eq_fields_
std::shared_ptr< EqFields > eq_fields_
Definition: transport.h:291
mesh.h
TimeMarks::add
TimeMark add(const TimeMark &mark)
Definition: time_marks.cc:81
Input::Type::Record::close
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
generic_field.hh
Input::Type
Definition: balance.hh:41
partitioning.hh
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
GenericField::region_id
static auto region_id(Mesh &mesh) -> IndexField
Definition: generic_field.impl.hh:39
ConvectionTransport::get_component_vec
Vec get_component_vec(unsigned int sbi) override
Return PETSc vector with solution for sbi-th substance.
Definition: transport.cc:200
FieldCommon::input_default
FieldCommon & input_default(const string &input_default)
Definition: field_common.hh:140
ConvectionTransport::get_p0_interpolation
FieldFEScalarVec & get_p0_interpolation() override
Getter for P0 interpolation by FieldFE.
Definition: transport.cc:523
input_type.hh
ConcentrationTransportBase
Definition: transport_operator_splitting.hh:61
ConvectionTransport::is_src_term_scaled
bool is_src_term_scaled
Definition: transport.h:300
Mesh
Definition: mesh.h:362
Input::Type::Record::copy_keys
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:216
ConvectionTransport::EqFields::subdomain
Field< 3, FieldValue< 3 >::Scalar > subdomain
Definition: transport.h:109
Input::Type::Array
Class for declaration of inputs sequences.
Definition: type_base.hh:339
TimeGovernor::marks
static TimeMarks & marks()
Definition: time_governor.hh:338
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:304
WarningOut
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:278
fe_value_handler.hh
MixedPtr< FE_P_disc >
ConvectionTransport::update_solution
void update_solution() override
Definition: transport.cc:396
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
TimeGovernor::is_changed_dt
bool is_changed_dt() const
Definition: time_governor.hh:529
ConvectionTransport::ConvectionTransport
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
Definition: transport.cc:125
balance.hh
ConvectionTransport::mass_assembly_
GenericAssembly< MassAssemblyConvection > * mass_assembly_
general assembly objects, hold assembly objects of appropriate dimension
Definition: transport.h:322
ConvectionTransport::set_target_time
void set_target_time(double target_time) override
Definition: transport.cc:500
MeshBase::n_elements
unsigned int n_elements() const
Definition: mesh.h:111
ConvectionTransport::alloc_transport_vectors
void alloc_transport_vectors()
Definition: transport.cc:244
FieldCommon::description
FieldCommon & description(const string &description)
Definition: field_common.hh:128
TransportEqFields
Definition: transport_operator_splitting.hh:137
DebugOut
#define DebugOut()
Macro defining 'debug' record of log.
Definition: logger.hh:284
ASSERT_PTR
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
Definition: asserts.hh:341
TimeGovernor::next_time
void next_time()
Proceed to the next time according to current estimated time step.
Definition: time_governor.cc:670
ConvectionTransport::vpconc
Vec * vpconc
Definition: transport.h:312
ConvectionTransport::cfl_max_step
double cfl_max_step
Time step constraint coming from CFL condition.
Definition: transport.h:305
ConvectionTransport::initialize
void initialize() override
Definition: transport.cc:149
TimeGovernor::fix_dt_until_mark
double fix_dt_until_mark()
Fixing time step until fixed time mark.
Definition: time_governor.cc:597
mixed.hh
START_TIMER
#define START_TIMER(tag)
Starts a timer with specified tag.
Definition: sys_profiler.hh:115
GenericAssembly< MassAssemblyConvection >
MPI_Barrier
#define MPI_Barrier(comm)
Definition: mpi.h:531
END_TIMER
#define END_TIMER(tag)
Ends a timer with specified tag.
Definition: sys_profiler.hh:149
TimeGovernor::last_dt
double last_dt() const
Definition: time_governor.hh:548
FieldCommon::name
FieldCommon & name(const string &name)
Definition: field_common.hh:121
range_wrapper.hh
Implementation of range helper class.