Flow123d  jenkins-Flow123d-windows32-release-multijob-28
sorption_base.cc
Go to the documentation of this file.
1 #include <boost/foreach.hpp>
2 
3 #include "reaction/reaction.hh"
8 #include "reaction/isotherm.hh"
10 
11 #include "system/system.hh"
12 #include "system/sys_profiler.hh"
13 
14 #include "la/distribution.hh"
15 #include "mesh/mesh.h"
16 #include "mesh/elements.h"
17 #include "input/type_selection.hh"
18 
19 #include "fields/field_set.hh"
21 
22 
23 using namespace std;
24 using namespace Input::Type;
25 
27  .add_value(Isotherm::none,"none", "No adsorption considered.")
28  .add_value(Isotherm::linear, "linear",
29  "Linear isotherm runs the concentration exchange between liquid and solid.")
30  .add_value(Isotherm::langmuir, "langmuir",
31  "Langmuir isotherm runs the concentration exchange between liquid and solid.")
32  .add_value(Isotherm::freundlich, "freundlich",
33  "Freundlich isotherm runs the concentration exchange between liquid and solid.");
34 
35 
36 
38  = Record("Adsorption", "AUXILIARY RECORD. Should not be directly part of the input tree.")
39  .declare_key("substances", Array(String()), Default::obligatory(),
40  "Names of the substances that take part in the adsorption model.")
41  .declare_key("solvent_density", Double(), Default("1.0"),
42  "Density of the solvent.")
43  .declare_key("substeps", Integer(), Default("1000"),
44  "Number of equidistant substeps, molar mass and isotherm intersections")
45  .declare_key("molar_mass", Array(Double()), Default::obligatory(),
46  "Specifies molar masses of all the adsorbing species.")
47  .declare_key("solubility", Array(Double(0.0)), Default::optional(), //("-1.0"), //
48  "Specifies solubility limits of all the adsorbing species.")
49  .declare_key("table_limits", Array(Double(0.0)), Default::optional(), //("-1.0"), //
50  "Specifies highest aqueous concentration in interpolation table.")
51  .declare_key("input_fields", Array(EqData("").input_data_set_.make_field_descriptor_type("Sorption")), Default::obligatory(), //
52  "Containes region specific data necessary to construct isotherms.")//;
53  .declare_key("reaction_liquid", ReactionTerm::input_type, Default::optional(), "Reaction model following the sorption in the liquid.")
54  .declare_key("reaction_solid", ReactionTerm::input_type, Default::optional(), "Reaction model following the sorption in the solid.");
55 
56 
57 SorptionBase::EqData::EqData(const string &output_field_name)
58 {
59  ADD_FIELD(rock_density, "Rock matrix density.", "0.0");
60 
61  ADD_FIELD(sorption_type,"Considered adsorption is described by selected isotherm."); //
62  sorption_type.input_selection(&sorption_type_selection);
63 
64  ADD_FIELD(isotherm_mult,"Multiplication parameters (k, omega) in either Langmuir c_s = omega * (alpha*c_a)/(1- alpha*c_a) or in linear c_s = k * c_a isothermal description.","1.0");
65 
66  ADD_FIELD(isotherm_other,"Second parameters (alpha, ...) defining isotherm c_s = omega * (alpha*c_a)/(1- alpha*c_a).","1.0");
67  ADD_FIELD(init_conc_solid, "Initial solid concentration of substances."
68  " Vector, one value for every substance.", "0");
69 
70  rock_density.units("");
71  init_conc_solid.units("M/L^3");
72 
73  input_data_set_ += *this;
74 
75  // porosity field is set from governing equation (transport) later
76  // hence we do not add it to the input_data_set_
77  *this += porosity
78  .name("porosity")
79  .units("1")
80  .flags(FieldFlag::input_copy);
81 
82  output_fields += *this;
83  output_fields += conc_solid.name(output_field_name).units("M/L^3");
84 }
85 
87 {
88  IT::Record rec;
89  switch(fact)
90  {
91  case SorptionRecord::mobile:
92  rec = IT::Record("SorptionMobile", "Adsorption model in the mobile zone, following the dual porosity model.")
95  .declare_key("output_fields", IT::Array(make_output_selection("conc_solid", "SorptionMobile_Output")),
96  IT::Default("conc_solid"), "List of fields to write to output stream.");
97  break;
98  case SorptionRecord::immobile:
99  rec = IT::Record("SorptionImmobile", "Adsorption model in the immobile zone, following the dual porosity model.")
102  .declare_key("output_fields", IT::Array(make_output_selection("conc_immobile_solid", "SorptionImmobile_Output")),
103  IT::Default("conc_immobile_solid"), "List of fields to write to output stream.");
104  break;
105 
106  default:
107  rec = IT::Record("Sorption", "Adsorption model in the reaction term of transport.")
110  .declare_key("output_fields", IT::Array(make_output_selection("conc_solid", "Sorption_Output")),
111  IT::Default("conc_solid"), "List of fields to write to output stream.");
112  break;
113  }
114  return rec;
115 }
116 
117 
119  : ReactionTerm(init_mesh, in_rec),
120  data_(nullptr)
121 {
122  // creating reaction from input and setting their parameters
123  make_reactions();
124 }
125 
126 
128 {
129  if(reaction_liquid != nullptr) delete reaction_liquid;
130  if(reaction_solid != nullptr) delete reaction_solid;
131  if (data_ != nullptr) delete data_;
132 
133  VecScatterDestroy(&(vconc_out_scatter));
134  VecDestroy(vconc_solid);
135  VecDestroy(vconc_solid_out);
136 
137  for (unsigned int sbi = 0; sbi < names_.size(); sbi++)
138  {
139  //no mpi vectors
140  xfree(conc_solid[sbi]);
141  xfree(conc_solid_out[sbi]);
142  }
143  xfree(conc_solid);
145 }
146 
148 {
149  //DBGMSG("SorptionBase init_from_input\n");
151 
152  reactions_it = input_record_.find<Input::AbstractRecord>("reaction_liquid");
153  if ( reactions_it )
154  {
155  if (reactions_it->type() == LinearReaction::input_type ) {
156  reaction_liquid = new LinearReaction(*mesh_, *reactions_it);
157  } else
158  if (reactions_it->type() == PadeApproximant::input_type) {
159  reaction_liquid = new PadeApproximant(*mesh_, *reactions_it);
160  } else
161  if (reactions_it->type() == SorptionBase::input_type ) {
162  xprintf(UsrErr, "Sorption model cannot have another descendant sorption model.\n");
163  } else
164  if (reactions_it->type() == DualPorosity::input_type ) {
165  xprintf(UsrErr, "Sorption model cannot have descendant dual porosity model.\n");
166  } else
167  if (reactions_it->type() == Semchem_interface::input_type )
168  {
169  xprintf(UsrErr, "Semchem chemistry model is not supported at current time.\n");
170  } else
171  {
172  xprintf(UsrErr, "Unknown reactions type in Sorption model.\n");
173  }
174  } else
175  {
176  reaction_liquid = nullptr;
177  }
178 
179  reactions_it = input_record_.find<Input::AbstractRecord>("reaction_solid");
180  if ( reactions_it )
181  {
182  if (reactions_it->type() == LinearReaction::input_type ) {
183  reaction_solid = new LinearReaction(*mesh_, *reactions_it);
184  } else
185  if (reactions_it->type() == PadeApproximant::input_type) {
186  reaction_solid = new PadeApproximant(*mesh_, *reactions_it);
187  } else
188  if (reactions_it->type() == SorptionBase::input_type ) {
189  xprintf(UsrErr, "Sorption model cannot have another descendant sorption model.\n");
190  } else
191  if (reactions_it->type() == DualPorosity::input_type ) {
192  xprintf(UsrErr, "Sorption model cannot have descendant dual porosity model.\n");
193  } else
194  if (reactions_it->type() == Semchem_interface::input_type )
195  {
196  xprintf(UsrErr, "Semchem chemistry model is not supported at current time.\n");
197  } else
198  {
199  xprintf(UsrErr, "Unknown reactions type in Sorption model.\n");
200  }
201  } else
202  {
203  reaction_solid = nullptr;
204  }
205 }
206 
208 {
209  //DBGMSG("SorptionBase - initialize.\n");
210  ASSERT(distribution_ != nullptr, "Distribution has not been set yet.\n");
211  ASSERT(time_ != nullptr, "Time governor has not been set yet.\n");
212  ASSERT(output_stream_,"Null output stream.");
213  ASSERT_LESS(0, names_.size());
214 
215  initialize_substance_ids(); //computes present substances and sets indices
216  initialize_from_input(); //reads non-field data from input
217 
218  //isotherms array resized bellow
219  unsigned int nr_of_regions = mesh_->region_db().bulk_size();
220  isotherms.resize(nr_of_regions);
221  for(unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
222  {
223  isotherms[i_reg].resize(n_substances_);
224  for(unsigned int i_subst = 0; i_subst < n_substances_; i_subst++)
225  {
226  isotherms[i_reg][i_subst] = Isotherm();
227  }
228  }
229 
230  //allocating new array for sorbed concentrations
231  conc_solid = (double**) xmalloc(names_.size() * sizeof(double*));//new double * [n_substances_];
232  conc_solid_out = (double**) xmalloc(names_.size() * sizeof(double*));
233  for (unsigned int sbi = 0; sbi < names_.size(); sbi++)
234  {
235  conc_solid[sbi] = (double*) xmalloc(distribution_->lsize() * sizeof(double));//new double[ nr_of_local_elm ];
236  conc_solid_out[sbi] = (double*) xmalloc(distribution_->size() * sizeof(double));
237  //zero initialization of solid concentration for all substances
238  for(unsigned int i=0; i < distribution_->lsize(); i++)
239  conc_solid[sbi][i] = 0;
240  }
241 
243 
245 
246  if(reaction_liquid != nullptr)
247  {
252  }
253  if(reaction_solid != nullptr)
254  {
259  }
260 }
261 
262 
264 {
265  Input::Array substances_array = input_record_.val<Input::Array>("substances");
266  unsigned int k, global_idx, i_subst = 0;
267  bool found;
268  Input::Iterator<string> spec_iter = substances_array.begin<string>();
269 
270  for(; spec_iter != substances_array.end(); ++spec_iter, i_subst++)
271  {
272  //finding the name of a substance in the global array of names
273  found = false;
274  for(k = 0; k < names_.size(); k++)
275  {
276  if (*spec_iter == names_[k])
277  {
278  global_idx = k;
279  found = true;
280  break;
281  }
282  }
283 
284  if(!found)
285  xprintf(UsrErr,"Wrong name of %d-th substance - not found in global set of transported substances.\n",
286  i_subst);
287 
288  //finding the global index of substance in the local array
289  found = false;
290  for(k = 0; k < substance_global_idx_.size(); k++)
291  {
292  if(substance_global_idx_[k] == global_idx)
293  {
294  found = true;
295  break;
296  }
297  }
298 
299  if(!found)
300  substance_global_idx_.push_back(global_idx);
301 
302  }
304 }
305 
307 {
308  n_interpolation_steps_ = input_record_.val<int>("substeps");
309  if(n_interpolation_steps_ < 1)
310  xprintf(UsrErr,"Number of 'substeps'=%d in isotherm interpolation table must be be >0.\n",
312 
313  // Common data for all the isotherms loaded bellow
314  solvent_density_ = input_record_.val<double>("solvent_density");
315 
316  molar_masses_.resize( n_substances_ );
317 
318  Input::Array molar_mass_array = input_record_.val<Input::Array>("molar_mass");
319 
320  if (molar_mass_array.size() == molar_masses_.size() ) molar_mass_array.copy_to( molar_masses_ );
321  else xprintf(UsrErr,"Number of molar masses %d has to match number of adsorbing species %d.\n",
322  molar_mass_array.size(), molar_masses_.size());
323 
324  Input::Iterator<Input::Array> solub_iter = input_record_.find<Input::Array>("solubility");
325  if( solub_iter )
326  {
327  solub_iter->copy_to(solubility_vec_);
328  if (solubility_vec_.size() != n_substances_)
329  {
330  xprintf(UsrErr,"Number of given solubility limits %d has to match number of adsorbing species %d.\n",
332  }
333  }else{
334  // fill solubility_vec_ with zeros or resize it at least
336  }
337 
338  Input::Iterator<Input::Array> interp_table_limits = input_record_.find<Input::Array>("table_limits");
339  if( interp_table_limits )
340  {
341  interp_table_limits->copy_to(table_limit_);
342  if (table_limit_.size() != n_substances_)
343  {
344  xprintf(UsrErr,"Number of given table limits %d has to match number of adsorbing species %d.\n",
345  table_limit_.size(), n_substances_);
346  }
347  }else{
348  // fill table_limit_ with zeros or resize it at least
349  table_limit_.resize(n_substances_);
350  }
351 }
352 
354 {
355  ASSERT(n_substances_ > 0, "Number of substances is wrong, they might have not been set yet.\n");
357 
358 
359  // read fields from input file
361 
362  data_->set_mesh(*mesh_);
364 
365  //initialization of output
366  output_array = input_record_.val<Input::Array>("output_fields");
367  //initialization of output
371  for (unsigned int sbi=0; sbi<names_.size(); sbi++)
372  {
373  // create shared pointer to a FieldElementwise and push this Field to output_field on all regions
374  std::shared_ptr<FieldElementwise<3, FieldValue<3>::Scalar> > output_field_ptr(
376  data_->conc_solid[sbi].set_field(mesh_->region_db().get_region_set("ALL"), output_field_ptr, 0);
377  }
380 }
381 
382 
384 {
385  //DBGMSG("SorptionBase - zero_time_step.\n");
386  ASSERT(distribution_ != nullptr, "Distribution has not been set yet.\n");
387  ASSERT(time_ != nullptr, "Time governor has not been set yet.\n");
388  ASSERT(output_stream_,"Null output stream.");
389  ASSERT_LESS(0, names_.size());
390 
391  data_->set_time(*time_);
393  make_tables();
394 
395  // write initial condition
399 
401  if(reaction_solid != nullptr) reaction_solid->zero_time_step();
402 }
403 
405 {
406  for (unsigned int loc_el = 0; loc_el < distribution_->lsize(); loc_el++)
407  {
408  unsigned int index = el_4_loc_[loc_el];
409  ElementAccessor<3> ele_acc = mesh_->element_accessor(index);
410  arma::vec value = data_->init_conc_solid.value(ele_acc.centre(),
411  ele_acc);
412 
413  //setting initial solid concentration for substances involved in adsorption
414  for (unsigned int sbi = 0; sbi < n_substances_; sbi++)
415  {
416  int subst_id = substance_global_idx_[sbi];
417  conc_solid[subst_id][loc_el] = value(sbi);
418  }
419  }
420 }
421 
422 
424 {
425  //DBGMSG("Sorption - update_solution\n");
426  data_->set_time(*time_); // set to the last computed time
427 
428  // if parameters changed during last time step, reinit isotherms and eventualy
429  // update interpolation tables in the case of constant rock matrix parameters
430  if(data_->changed())
431  make_tables();
432 
433 
434  START_TIMER("Sorption");
435  for (unsigned int loc_el = 0; loc_el < distribution_->lsize(); loc_el++)
436  {
438  }
439  END_TIMER("Sorption");
440 
443 }
444 
446 {
447  ElementAccessor<3> elm;
448  BOOST_FOREACH(const Region &reg_iter, this->mesh_->region_db().get_region_set("BULK") )
449  {
450  int reg_idx = reg_iter.bulk_idx();
451 
452  if(data_->is_constant(reg_iter))
453  {
454  ElementAccessor<3> elm(this->mesh_, reg_iter); // constant element accessor
455  isotherm_reinit(isotherms[reg_idx],elm);
456  for(unsigned int i_subst = 0; i_subst < n_substances_; i_subst++)
457  {
458  isotherms[reg_idx][i_subst].make_table(n_interpolation_steps_);
459  }
460  }
461  }
462 }
463 
464 double **SorptionBase::compute_reaction(double **concentrations, int loc_el)
465 {
466  //DBGMSG("compute_reaction\n");
467  ElementFullIter elem = mesh_->element(el_4_loc_[loc_el]);
468  int reg_idx = elem->region().bulk_idx();
469  unsigned int i_subst, subst_id;
470 
471  std::vector<Isotherm> & isotherms_vec = isotherms[reg_idx];
472 
473  // Constant value of rock density and mobile porosity over the whole region
474  // => interpolation_table is precomputed
475  if (isotherms_vec[0].is_precomputed())
476  {
477  for(i_subst = 0; i_subst < n_substances_; i_subst++)
478  {
479  subst_id = substance_global_idx_[i_subst];
480  //DBGMSG("on s_%d precomputed %d\n",subst_id, isotherms_vec[i_subst].is_precomputed());
481 
482  isotherms_vec[i_subst].interpolate(concentration_matrix_[subst_id][loc_el],
483  conc_solid[subst_id][loc_el]);
484  }
485  }
486  else
487  {
488  isotherm_reinit(isotherms_vec, elem->element_accessor());
489 
490  for(i_subst = 0; i_subst < n_substances_; i_subst++)
491  {
492  subst_id = substance_global_idx_[i_subst];
493  isotherms_vec[i_subst].compute(concentration_matrix_[subst_id][loc_el],
494  conc_solid[subst_id][loc_el]);
495  }
496  }
497 
498  return concentrations;
499 }
500 
501 
502 /**************************************** OUTPUT ***************************************************/
503 
505 {
506  int sbi, n_subst, ierr;
507  n_subst = names_.size();
508 
509  vconc_solid = (Vec*) xmalloc(n_subst * (sizeof(Vec)));
510  vconc_solid_out = (Vec*) xmalloc(n_subst * (sizeof(Vec))); // extend to all
511 
512  for (sbi = 0; sbi < n_subst; sbi++) {
513  ierr = VecCreateMPIWithArray(PETSC_COMM_WORLD,1, distribution_->lsize(), mesh_->n_elements(), conc_solid[sbi],
514  &vconc_solid[sbi]);
515  VecZeroEntries(vconc_solid[sbi]);
516 
517  ierr = VecCreateSeqWithArray(PETSC_COMM_SELF,1, mesh_->n_elements(), conc_solid_out[sbi], &vconc_solid_out[sbi]);
518  VecZeroEntries(vconc_solid_out[sbi]);
519  }
520 
521  // creating output vector scatter
522  IS is;
523  ISCreateGeneral(PETSC_COMM_SELF, mesh_->n_elements(), row_4_el_, PETSC_COPY_VALUES, &is); //WithArray
524  VecScatterCreate(vconc_solid[0], is, vconc_solid_out[0], PETSC_NULL, &vconc_out_scatter);
525  ISDestroy(&(is));
526 }
527 
528 
530 {
531  unsigned int sbi;
532  //PetscViewer inviewer;
533 
534  for (sbi = 0; sbi < names_.size(); sbi++) {
535  VecScatterBegin(vconc_out_scatter, vconc_solid[sbi], vconc_solid_out[sbi], INSERT_VALUES, SCATTER_FORWARD);
536  VecScatterEnd(vconc_out_scatter, vconc_solid[sbi], vconc_solid_out[sbi], INSERT_VALUES, SCATTER_FORWARD);
537  }
538  //VecView(transport->vconc[0],PETSC_VIEWER_STDOUT_WORLD);
539  //VecView(transport->vconc_out[0],PETSC_VIEWER_STDOUT_WORLD);
540 }
541 
542 
544 {
545  //DBGMSG("Sorption output\n");
547 
548  int rank;
549  MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
550  if (rank == 0)
551  {
552  // Register fresh output data
555  }
556 
557  //it can call only linear reaction which has no output at the moment
558  //if(reaction) reaction->output_data();
559 
560  //for synchronization when measuring time by Profiler
562 }
void output_type(OutputTime::DiscreteSpace rt)
Definition: field_set.hh:194
unsigned int size() const
get global size
void set_input_list(Input::Array input_list)
Definition: field_set.hh:164
Iterator< ValueType > begin() const
virtual void zero_time_step()
Definition: equation.hh:97
void allocate_output_mpi(void)
Allocates petsc vectors, prepares them for output and creates vector scatter.
void set_limit_side(LimitSide side)
Definition: field_set.hh:171
MultiField< 3, FieldValue< 3 >::Scalar > conc_solid
Calculated sorbed concentrations, for output only.
OutputTime * output_stream_
Pointer to a transport output stream.
Definition: reaction.hh:112
void make_reactions()
void init(const vector< string > &names)
Definition: field.impl.hh:487
Accessor to input data conforming to declared Array.
Definition: accessors.hh:521
double solvent_density_
ReactionTerm * reaction_liquid
std::vector< std::vector< Isotherm > > isotherms
virtual ~SorptionBase(void)
void initialize_substance_ids()
Reads names of substances from input and creates indexing to global vector of substance,.
double ** concentration_matrix_
Definition: reaction.hh:95
unsigned int bulk_size() const
Definition: region.cc:256
virtual void initialize()
Initialize fields.
Definition: equation.hh:114
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:39
EqData(const string &output_field_name)
Collect all fields.
Input::Type::Selection output_selection
Vec * vconc_solid_out
PETSC sorbed concentration vector output (gathered - sequential)
double ** compute_reaction(double **concentrations, int loc_el)
vector< string > names_
Names belonging to substances.
Definition: reaction.hh:109
???
void zero_time_step() override
static Input::Type::Record input_type
RegionSet get_region_set(const string &set_name) const
Definition: region.cc:365
static Input::Type::Record input_type
Definition: mesh.h:108
Iterator< Ret > find(const string &key) const
int * row_4_el_
Indices of rows belonging to elements.
Definition: reaction.hh:100
std::vector< double > molar_masses_
Record & derive_from(AbstractRecord &parent)
Definition: type_record.cc:172
const RegionDB & region_db() const
Definition: mesh.h:148
ElementAccessor< 3 > element_accessor(unsigned int idx, bool boundary=false)
Definition: mesh.cc:733
static Input::Type::Selection sorption_type_selection
Field< 3, FieldValue< 3 >::Vector > init_conc_solid
Initial sorbed concentrations.
std::vector< double > table_limit_
Class for declaration of the integral input data.
Definition: type_base.hh:341
#define ADD_FIELD(name,...)
Definition: field_set.hh:260
Class for declaration of inputs sequences.
Definition: type_base.hh:230
std::vector< unsigned int > substance_global_idx_
Mapping from local indexing of substances to global.
void initialize_fields()
Initializes field sets.
IteratorBase end() const
static Input::Type::AbstractRecord input_type
Definition: reaction.hh:24
unsigned int n_elements() const
Definition: mesh.h:137
#define ASSERT(...)
Definition: global_defs.h:120
Class for declaration of the input data that are floating point numbers.
Definition: type_base.hh:376
static Input::Type::Record input_type
Distribution * distribution_
Pointer to reference to distribution of elements between processors.
Definition: reaction.hh:103
void output_data(void) override
Output method.
static constexpr Mask input_copy
A field that is input of its equation and cna not read from input, thus muzt be set by copy...
Definition: field_flag.hh:29
Vec * vconc_solid
PETSC sorbed concentration vector (parallel).
FieldSet output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
void initialize_from_input()
Initializes private members of sorption from the input record.
std::vector< double > solubility_vec_
Selection & add_value(const int value, const std::string &key, const std::string &description="")
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
unsigned int n_interpolation_steps_
const Ret val(const string &key) const
#define xprintf(...)
Definition: system.hh:104
void make_tables(void)
#define ASSERT_LESS(a, b)
Definition: global_defs.h:163
#define START_TIMER(tag)
Starts a timer with specified tag.
Mesh * mesh_
Definition: equation.hh:227
virtual void isotherm_reinit(std::vector< Isotherm > &isotherms, const ElementAccessor< 3 > &elm)=0
Reinitializes the isotherm.
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Definition: field.hh:399
ReactionTerm * reaction_solid
static Input::Type::Record input_type
static Input::Type::Record record_factory(SorptionRecord::Type)
Creates the input record for different cases of sorption model (simple or in dual porosity)...
double ** conc_solid_out
sorbed concentration array output (gathered - sequential)
void output_vector_gather(void) override
Gathers all the parallel vectors to enable them to be output.
Input::Array output_array
void update_solution(void) override
Updates the solution.
static Input::Type::AbstractRecord input_type
void * xmalloc(size_t size)
Memory allocation with checking.
Definition: system.cc:218
void set_time(const TimeGovernor &time)
Definition: field_set.hh:186
Accessor to the polymorphic input data of a type given by an AbstracRecord object.
Definition: accessors.hh:423
#define MPI_Comm_rank
Definition: mpi.h:236
virtual void set_time_governor(TimeGovernor &time)
Definition: equation.cc:80
Record & copy_keys(const Record &other)
Definition: type_record.cc:186
Definition: system.hh:75
Support classes for parallel programing.
void set_n_components(unsigned int n_comp)
Definition: field_set.hh:151
void copy_to(Container &out) const
virtual void update_solution()
Definition: equation.hh:105
void output(OutputTime *stream)
Definition: field_set.cc:137
Input::Record input_record_
Definition: equation.hh:230
int * el_4_loc_
Indices of elements belonging to local dofs.
Definition: reaction.hh:98
void add_admissible_field_names(const Input::Array &in_array, const Input::Type::Selection &in_sel)
Registers names of output fields that can be written using this stream.
Definition: output.cc:231
void set_initial_condition()
Reads and sets initial condition for concentration in solid.
bool is_constant(Region reg) const
Definition: field_set.cc:129
ReactionTerm & names(const std::vector< string > &names)
Sets the names of substances considered in transport.
Definition: reaction.hh:46
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Definition: region.hh:83
#define MPI_COMM_WORLD
Definition: mpi.h:123
#define END_TIMER(tag)
Ends a timer with specified tag.
arma::vec::fixed< spacedim > centre() const
Definition: accessors.hh:81
double ** conc_solid
void set_mesh(const Mesh &mesh)
Definition: field_set.hh:157
unsigned int size() const
Record type proxy class.
Definition: type_record.hh:161
VecScatter vconc_out_scatter
Output vector scatter.
unsigned int n_substances_
#define xfree(p)
Definition: system.hh:112
#define MPI_Barrier(comm)
Definition: mpi.h:531
EqData * data_
Pointer to equation data. The object is constructed in descendants.
ReactionTerm & concentration_matrix(double **concentration, Distribution *conc_distr, int *el_4_loc, int *row_4_el)
Definition: reaction.hh:57
void set_mesh(const Mesh &mesh) override
Definition: field.impl.hh:534
bool changed() const
Definition: field_set.cc:121
Template for classes storing finite set of named values.
TimeGovernor * time_
Definition: equation.hh:228
ElementVector element
Vector of elements of the mesh.
Definition: mesh.h:198
FieldSet input_data_set_
Input data set - fields in this set are read from the input file.
unsigned int lsize(int proc) const
get local size
Record & declare_key(const string &key, const KeyType &type, const Default &default_value, const string &description)
Definition: type_record.cc:390
void initialize() override
Prepares the object to usage.