Flow123d  release_3.0.0-968-gc87a28e79
sorption_base.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 sorption_base.cc
15  * @brief
16  */
17 
23 #include "reaction/isotherm.hh"
24 
25 #include "system/system.hh"
26 #include "system/sys_profiler.hh"
27 
28 #include "la/distribution.hh"
29 #include "mesh/mesh.h"
30 #include "mesh/elements.h"
31 #include "mesh/accessors.hh"
32 #include "input/type_selection.hh"
33 
34 #include "fields/field_set.hh"
35 #include "fields/field_fe.hh"
37 
38 using namespace Input::Type;
39 
41  return Selection("SorptionType")
42  .add_value(Isotherm::none,"none", "No sorption considered.")
43  .add_value(Isotherm::linear, "linear",
44  "Linear isotherm runs the concentration exchange between liquid and solid.")
45  .add_value(Isotherm::langmuir, "langmuir",
46  "Langmuir isotherm runs the concentration exchange between liquid and solid.")
47  .add_value(Isotherm::freundlich, "freundlich",
48  "Freundlich isotherm runs the concentration exchange between liquid and solid.")
49  .close();
50 }
51 
52 
53 
55  return Record("SorptionAux", "AUXILIARY RECORD. Should not be directly part of the input tree.")
56  .declare_key("substances", Array(String(),1), Default::obligatory(),
57  "Names of the substances that take part in the sorption model.")
58  .declare_key("solvent_density", Double(0.0), Default("1.0"),
59  "Density of the solvent.")
60  .declare_key("substeps", Integer(1), Default("1000"),
61  "Number of equidistant substeps, molar mass and isotherm intersections")
62  .declare_key("solubility", Array(Double(0.0)), Default::optional(), //("-1.0"), //
63  "Specifies solubility limits of all the sorbing species.")
64  .declare_key("table_limits", Array(Double(-1.0)), Default::optional(), //("-1.0"), //
65  "Specifies the highest aqueous concentration in the isotherm function interpolation table. "
66  "Use any negative value for an automatic choice according to current maximal concentration (default and recommended). "
67  "Use '0' to always evaluate isotherm function directly (can be very slow). "
68  "Use a positive value to set the interpolation table limit manually "
69  "(if aqueous concentration is higher, then the isotherm function is evaluated directly).")
70  .declare_key("input_fields", Array(EqData("","").input_data_set_.make_field_descriptor_type("Sorption")), Default::obligatory(), //
71  "Containes region specific data necessary to construct isotherms.")//;
72  .declare_key("reaction_liquid", ReactionTerm::it_abstract_reaction(), Default::optional(), "Reaction model following the sorption in the liquid.")
73  .declare_key("reaction_solid", ReactionTerm::it_abstract_reaction(), Default::optional(), "Reaction model following the sorption in the solid.")
74  .close();
75 }
76 
77 
78 SorptionBase::EqData::EqData(const string &output_field_name, const string &output_field_desc)
79 {
80  *this += rock_density.name("rock_density")
81  .description("Rock matrix density.")
82  .input_default("0.0")
83  .units( UnitSI().kg().m(-3) );
84 
85  *this += sorption_type.name("sorption_type")
86  .description("Considered sorption is described by selected isotherm.\n"
87  "If porosity on an element is equal to 1.0 (or even higher), meaning no sorbing surface, then type 'none' will be selected automatically.")
88  .input_selection(get_sorption_type_selection())
89  .units( UnitSI::dimensionless() );
90 
91  *this += distribution_coefficient.name("distribution_coefficient")
92  .description("Distribution coefficient (( $k_l, k_F, k_L $)) of linear, Freundlich or Langmuir isotherm respectively.")
93  .input_default("1.0")
94  .units( UnitSI().m(3).kg(-1) );
95 
96  *this += isotherm_other.name("isotherm_other")
97  .description("Additional parameter (($ \\alpha $)) of nonlinear isotherms.")
98  .input_default("1.0")
99  .units( UnitSI::dimensionless() );
100 
101  *this += init_conc_solid.name("init_conc_solid")
102  .description("Initial solid concentration of substances. It is a vector: one value for every substance.")
103  .input_default("0")
104  .units( UnitSI().dimensionless() );
105 
106  input_data_set_ += *this;
107 
108  // porosity field is set from governing equation (transport) later
109  // hence we do not add it to the input_data_set_
110  *this += porosity
111  .name("porosity")
112  .units( UnitSI::dimensionless() )
113  .flags(FieldFlag::input_copy)
114  .set_limits(0.0);
115 
116  output_fields += *this;
117  output_fields += conc_solid.name(output_field_name)
118  .description(output_field_desc)
119  .units( UnitSI().dimensionless() )
121 }
122 
123 
125  : ReactionTerm(init_mesh, in_rec),
126  data_(nullptr)
127 {
128  // creating reaction from input and setting their parameters
129  make_reactions();
130 }
131 
132 
134 {
135  if (data_ != nullptr) delete data_;
136 
137  //for (unsigned int sbi = 0; sbi < substances_.size(); sbi++)
138  //{
139  // //no mpi vectors
140  // delete [] conc_solid[sbi];
141  //}
142  delete [] conc_solid;
143 }
144 
146 {
148 
149  reactions_it = input_record_.find<Input::AbstractRecord>("reaction_liquid");
150  if ( reactions_it )
151  {
152  // TODO: allowed instances in this case are only
153  // FirstOrderReaction, RadioactiveDecay
154  reaction_liquid = (*reactions_it).factory< ReactionTerm, Mesh &, Input::Record >(*mesh_, *reactions_it);
155  } else
156  {
157  reaction_liquid = nullptr;
158  }
159 
160  reactions_it = input_record_.find<Input::AbstractRecord>("reaction_solid");
161  if ( reactions_it )
162  {
163  // TODO: allowed instances in this case are only
164  // FirstOrderReaction, RadioactiveDecay
165  reaction_solid = (*reactions_it).factory< ReactionTerm, Mesh &, Input::Record >(*mesh_, *reactions_it);
166  } else
167  {
168  reaction_solid = nullptr;
169  }
170 }
171 
173 {
174  ASSERT_PTR(distribution_).error("Distribution has not been set yet.\n");
175  ASSERT_PTR(time_).error("Time governor has not been set yet.\n");
176  ASSERT(output_stream_).error("Null output stream.");
177  ASSERT_LT(0, substances_.size());
178 
179  initialize_substance_ids(); //computes present substances and sets indices
180  initialize_from_input(); //reads non-field data from input
181 
182  //isotherms array resized bellow
183  unsigned int nr_of_regions = mesh_->region_db().bulk_size();
184  isotherms.resize(nr_of_regions);
185  max_conc.resize(nr_of_regions);
186  for(unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
187  {
188  isotherms[i_reg].resize(n_substances_);
189  max_conc[i_reg].resize(n_substances_, 0.0);
190  for(unsigned int i_subst = 0; i_subst < n_substances_; i_subst++)
191  {
192  isotherms[i_reg][i_subst] = Isotherm();
193  }
194  }
195 
196  //allocating new array for sorbed concentrations
197  conc_solid = new double* [substances_.size()];
198  conc_solid_out.clear();
199  conc_solid_out.resize( substances_.size() );
200  for (unsigned int sbi = 0; sbi < substances_.size(); sbi++)
201  {
202  conc_solid[sbi] = new double [distribution_->lsize()];
203  //zero initialization of solid concentration for all substances
204  for(unsigned int i=0; i < distribution_->lsize(); i++)
205  conc_solid[sbi][i] = 0;
206  }
207 
209 
210  if(reaction_liquid)
211  {
212  reaction_liquid->substances(substances_)
213  .concentration_matrix(concentration_matrix_, distribution_, el_4_loc_, row_4_el_)
214  .set_dh(this->dof_handler_)
215  .set_time_governor(*time_);
216  reaction_liquid->initialize();
217  }
218  if(reaction_solid)
219  {
220  reaction_solid->substances(substances_)
221  .concentration_matrix(conc_solid, distribution_, el_4_loc_, row_4_el_)
222  .set_dh(this->dof_handler_)
223  .set_time_governor(*time_);
224  reaction_solid->initialize();
225  }
226 }
227 
228 
230 {
231  Input::Array substances_array = input_record_.val<Input::Array>("substances");
232  unsigned int k, global_idx, i_subst = 0;
233  bool found;
234  Input::Iterator<string> spec_iter = substances_array.begin<string>();
235 
236  for(; spec_iter != substances_array.end(); ++spec_iter, i_subst++)
237  {
238  //finding the name of a substance in the global array of names
239  found = false;
240  for(k = 0; k < substances_.size(); k++)
241  {
242  if (*spec_iter == substances_[k].name())
243  {
244  global_idx = k;
245  found = true;
246  break;
247  }
248  }
249 
250  if(!found)
251  THROW(ReactionTerm::ExcUnknownSubstance()
252  << ReactionTerm::EI_Substance(*spec_iter)
253  << substances_array.ei_address());
254 
255  //finding the global index of substance in the local array
256  found = false;
257  for(k = 0; k < substance_global_idx_.size(); k++)
258  {
259  if(substance_global_idx_[k] == global_idx)
260  {
261  found = true;
262  break;
263  }
264  }
265 
266  if(!found)
267  {
268  substance_global_idx_.push_back(global_idx);
269  }
270 
271  }
273 }
274 
276 {
277  // read number of interpolation steps - value checked by the record definition
278  n_interpolation_steps_ = input_record_.val<int>("substeps");
279 
280  // read the density of solvent - value checked by the record definition
281  solvent_density_ = input_record_.val<double>("solvent_density");
282 
283  // read the solubility vector
284  Input::Iterator<Input::Array> solub_iter = input_record_.find<Input::Array>("solubility");
285  if( solub_iter )
286  {
287  if (solub_iter->Array::size() != n_substances_)
288  {
289  THROW(SorptionBase::ExcSubstanceCountMatch()
290  << SorptionBase::EI_ArrayName("solubility")
292  // there is no way to get ei_address from 'solub_iter', only as a string
293  }
294 
295  else solub_iter->copy_to(solubility_vec_);
296  }
297  else{
298  // fill solubility_vec_ with zeros
299  solubility_vec_.clear();
300  solubility_vec_.resize(n_substances_,0.0);
301  }
302 
303  // read the interpolation table limits
304  Input::Iterator<Input::Array> interp_table_limits = input_record_.find<Input::Array>("table_limits");
305  if( interp_table_limits )
306  {
307  if (interp_table_limits->Array::size() != n_substances_)
308  {
309  THROW(SorptionBase::ExcSubstanceCountMatch()
310  << SorptionBase::EI_ArrayName("table_limits")
312  // there is no way to get ei_address from 'interp_table_limits', only as a string
313  }
314 
315  else interp_table_limits->copy_to(table_limit_);
316  }
317  else{
318  // fill table_limit_ with negative values -> automatic limit
319  table_limit_.clear();
320  table_limit_.resize(n_substances_,-1.0);
321  }
322 }
323 
325 {
326  ASSERT_GT(n_substances_, 0).error("Number of substances is wrong, they might have not been set yet.\n");
327 
328  // create vector of substances that are involved in sorption
329  // and initialize data_ with their names
330  std::vector<std::string> substances_sorption;
331  for (unsigned int i : substance_global_idx_)
332  substances_sorption.push_back(substances_[i].name());
333  data_->set_components(substances_sorption);
334 
335  // read fields from input file
337 
338  data_->set_mesh(*mesh_);
339 
340  //initialization of output
341  //output_array = input_record_.val<Input::Array>("output_fields");
346  for (unsigned int sbi=0; sbi<substances_.size(); sbi++)
347  {
348  // create shared pointer to a FieldFE and push this Field to output_field on all regions
349  std::shared_ptr<FieldFE<3, FieldValue<3>::Scalar> > output_field_ptr = make_shared< FieldFE<3, FieldValue<3>::Scalar> >();
350  conc_solid_out[sbi] = output_field_ptr->set_fe_data(this->dof_handler_);
351  data_->conc_solid[sbi].set_field(mesh_->region_db().get_region_set("ALL"), output_field_ptr, 0);
352  double *out_array;
353  VecGetArray(conc_solid_out[sbi].petsc_vec(), &out_array);
354  conc_solid[sbi] = out_array;
355  VecRestoreArray(conc_solid_out[sbi].petsc_vec(), &out_array);
356  }
357  //output_stream_->add_admissible_field_names(output_array);
359 }
360 
361 
363 {
364  ASSERT_PTR(distribution_).error("Distribution has not been set yet.\n");
365  ASSERT_PTR(time_).error("Time governor has not been set yet.\n");
366  ASSERT(output_stream_).error("Null output stream.");
367  ASSERT_LT(0, substances_.size());
368 
370  std::stringstream ss; // print warning message with table of uninitialized fields
371  if ( FieldCommon::print_message_table(ss, "sorption") ) {
372  WarningOut() << ss.str();
373  }
375 
376  update_max_conc();
377  make_tables();
378 
379  // write initial condition
380  //data_->output_fields.set_time(time_->step(), LimitSide::right);
381  //data_->output_fields.output(output_stream_);
382 
383  if(reaction_liquid) reaction_liquid->zero_time_step();
384  if(reaction_solid) reaction_solid->zero_time_step();
385 
386  output_data();
387 }
388 
390 {
391  for (unsigned int loc_el = 0; loc_el < distribution_->lsize(); loc_el++)
392  {
393  unsigned int index = el_4_loc_[loc_el];
394  ElementAccessor<3> ele_acc = mesh_->element_accessor(index);
395 
396  //setting initial solid concentration for substances involved in adsorption
397  for (unsigned int sbi = 0; sbi < n_substances_; sbi++)
398  {
399  int subst_id = substance_global_idx_[sbi];
400  conc_solid[subst_id][loc_el] = data_->init_conc_solid[sbi].value(ele_acc.centre(), ele_acc);
401  }
402  }
403 }
404 
405 
407 {
408  data_->set_time(time_->step(), LimitSide::right); // set to the last computed time
409 
410  // if parameters changed during last time step, reinit isotherms and eventualy
411  // update interpolation tables in the case of constant rock matrix parameters
412  make_tables();
413  clear_max_conc();
414 
415  START_TIMER("Sorption");
416  for (unsigned int loc_el = 0; loc_el < distribution_->lsize(); loc_el++)
417  {
419  }
420  END_TIMER("Sorption");
421 
422  if(reaction_liquid) reaction_liquid->update_solution();
423  if(reaction_solid) reaction_solid->update_solution();
424 }
425 
426 void SorptionBase::isotherm_reinit(unsigned int i_subst, const ElementAccessor<3> &elem)
427 {
428  START_TIMER("SorptionBase::isotherm_reinit");
429 
430  double mult_coef = data_->distribution_coefficient[i_subst].value(elem.centre(),elem);
431  double second_coef = data_->isotherm_other[i_subst].value(elem.centre(),elem);
432 
433  int reg_idx = elem.region().bulk_idx();
434  Isotherm & isotherm = isotherms[reg_idx][i_subst];
435 
436  bool limited_solubility_on = solubility_vec_[i_subst] > 0.0;
437 
438  // in case of no sorbing surface, set isotherm type None
439  if( common_ele_data.no_sorbing_surface_cond <= std::numeric_limits<double>::epsilon())
440  {
441  isotherm.reinit(Isotherm::none, false, solvent_density_,
443  0,0,0);
444  return;
445  }
446 
447  if ( common_ele_data.scale_sorbed <= 0.0)
448  xprintf(UsrErr, "Scaling parameter in sorption is not positive. Check the input for rock density and molar mass of %d. substance.",i_subst);
449 
450  isotherm.reinit(Isotherm::SorptionType(data_->sorption_type[i_subst].value(elem.centre(),elem)),
451  limited_solubility_on, solvent_density_,
453  solubility_vec_[i_subst], mult_coef, second_coef);
454 }
455 
457 {
458  for(unsigned int i_subst = 0; i_subst < n_substances_; i_subst++)
459  {
460  isotherm_reinit(i_subst, elem);
461  }
462 }
463 
465 {
466  unsigned int reg_idx, i_subst;
467 
468  // clear max concetrations array
469  unsigned int nr_of_regions = mesh_->region_db().bulk_size();
470  for(reg_idx = 0; reg_idx < nr_of_regions; reg_idx++)
471  for(i_subst = 0; i_subst < n_substances_; i_subst++)
472  max_conc[reg_idx][i_subst] = 0.0;
473 }
474 
476 {
477  unsigned int reg_idx, i_subst, subst_id;
478 
479  clear_max_conc();
480 
481  for (unsigned int loc_el = 0; loc_el < distribution_->lsize(); loc_el++){
483  reg_idx = ele.region().bulk_idx();
484  for(i_subst = 0; i_subst < n_substances_; i_subst++){
485  subst_id = substance_global_idx_[i_subst];
486  max_conc[reg_idx][i_subst] = std::max(max_conc[reg_idx][i_subst], concentration_matrix_[subst_id][loc_el]);
487  }
488  }
489 }
490 
492 {
493  START_TIMER("SorptionBase::make_tables");
494  try
495  {
496  ElementAccessor<3> elm;
497  for(const Region &reg_iter: this->mesh_->region_db().get_region_set("BULK"))
498  {
499  int reg_idx = reg_iter.bulk_idx();
500  // true if data has been changed and are constant on the region
501  bool call_reinit = data_->changed() && data_->is_constant(reg_iter);
502 
503  if(call_reinit)
504  {
505  ElementAccessor<3> elm(this->mesh_, reg_iter);
506 // DebugOut().fmt("isotherm reinit\n");
508  isotherm_reinit_all(elm);
509  }
510 
511  // find table limit and create interpolation table for every substance
512  for(unsigned int i_subst = 0; i_subst < n_substances_; i_subst++){
513 
514  // clear interpolation tables, if not spacially constant OR switched off
515  if(! data_->is_constant(reg_iter) || table_limit_[i_subst] == 0.0){
516  isotherms[reg_idx][i_subst].clear_table();
517 // DebugOut().fmt("limit: 0.0 -> clear table\n");
518  continue;
519  }
520 
521  // if true then make_table will be called at the end
522  bool call_make_table = call_reinit;
523  // initialy try to keep the current table limit (it is zero at zero time step)
524  double subst_table_limit = isotherms[reg_idx][i_subst].table_limit();
525 
526  // if automatic, possibly remake tables with doubled range when table maximum was reached
527  if(table_limit_[i_subst] < 0.0)
528  {
529  if(subst_table_limit < max_conc[reg_idx][i_subst])
530  {
531  call_make_table = true;
532  subst_table_limit = 2*max_conc[reg_idx][i_subst];
533 // DebugOut().fmt("limit: max conc\n");
534  }
535  }
536  // if not automatic, set given table limit
537  else
538  {
539  subst_table_limit = table_limit_[i_subst];
540  }
541 
542  if(call_make_table){
543  isotherms[reg_idx][i_subst].make_table(n_interpolation_steps_, subst_table_limit);
544 // DebugOut().fmt("reg: {} i_subst {}: table_limit = {}\n", reg_idx, i_subst, isotherms[reg_idx][i_subst].table_limit());
545  }
546  }
547  }
548  }
549  catch(ExceptionBase const &e)
550  {
551  e << input_record_.ei_address();
552  throw;
553  }
554 }
555 
556 double **SorptionBase::compute_reaction(double **concentrations, int loc_el)
557 {
559  int reg_idx = elem.region().bulk_idx();
560  unsigned int i_subst, subst_id;
561  // for checking, that the common element data are computed once at maximum
562  bool is_common_ele_data_valid = false;
563 
564  try{
565  for(i_subst = 0; i_subst < n_substances_; i_subst++)
566  {
567  subst_id = substance_global_idx_[i_subst];
568  Isotherm & isotherm = isotherms[reg_idx][i_subst];
569  if (isotherm.is_precomputed()){
570 // DebugOut().fmt("isotherms precomputed - interpolate, subst[{}]\n", i_subst);
571  isotherm.interpolate(concentration_matrix_[subst_id][loc_el],
572  conc_solid[subst_id][loc_el]);
573  }
574  else{
575 // DebugOut().fmt("isotherms reinit - compute , subst[{}]\n", i_subst);
576  if(! is_common_ele_data_valid){
578  is_common_ele_data_valid = true;
579  }
580 
581  isotherm_reinit(i_subst, elem);
582  isotherm.compute(concentration_matrix_[subst_id][loc_el],
583  conc_solid[subst_id][loc_el]);
584  }
585 
586  // update maximal concentration per region (optimization for interpolation)
587  if(table_limit_[i_subst] < 0)
588  max_conc[reg_idx][i_subst] = std::max(max_conc[reg_idx][i_subst],
589  concentration_matrix_[subst_id][loc_el]);
590  }
591  }
592  catch(ExceptionBase const &e)
593  {
594  e << input_record_.ei_address();
595  throw;
596  }
597 
598  return concentrations;
599 }
600 
601 
602 /**************************************** OUTPUT ***************************************************/
603 
605 {
607  // Register fresh output data
608  data_->output_fields.output(time().step());
609 }
LimitSide::right
@ right
SorptionBase::table_limit_
std::vector< double > table_limit_
Definition: sorption_base.hh:212
ReactionTerm::output_stream_
std::shared_ptr< OutputTime > output_stream_
Pointer to a transport output stream.
Definition: reaction_term.hh:144
EquationBase::mesh_
Mesh * mesh_
Definition: equation.hh:221
SorptionBase::get_input_type
static const Input::Type::Record & get_input_type()
Definition: sorption_base.cc:54
SorptionBase::data_
EqData * data_
Pointer to equation data. The object is constructed in descendants.
Definition: sorption_base.hh:194
MultiField::setup_components
void setup_components()
Definition: multi_field.impl.hh:261
ASSERT_GT
#define ASSERT_GT(a, b)
Definition of comparative assert macro (Greater Than)
Definition: asserts.hh:311
UnitSI::dimensionless
static UnitSI & dimensionless()
Returns dimensionless unit.
Definition: unit_si.cc:55
SorptionBase::reaction_liquid
std::shared_ptr< ReactionTerm > reaction_liquid
Definition: sorption_base.hh:239
SorptionBase::initialize_substance_ids
void initialize_substance_ids()
Reads names of substances from input and creates indexing to global vector of substance.
Definition: sorption_base.cc:229
FieldSet::set_time
bool set_time(const TimeStep &time, LimitSide limit_side)
Definition: field_set.cc:157
SorptionBase::reaction_solid
std::shared_ptr< ReactionTerm > reaction_solid
Definition: sorption_base.hh:240
FieldSet::is_constant
bool is_constant(Region reg) const
Definition: field_set.cc:173
Distribution::lsize
unsigned int lsize(int proc) const
get local size
Definition: distribution.hh:115
UsrErr
@ UsrErr
Definition: system.hh:64
ReactionTerm::ReactionTerm
ReactionTerm(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: reaction_term.cc:51
EquationOutput::initialize
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
Definition: equation_output.cc:109
ExceptionBase
Base of exceptions used in Flow123d.
Definition: exceptions.hh:75
SubstanceList::size
unsigned int size() const
Definition: substance.hh:87
SorptionBase::clear_max_conc
void clear_max_conc()
Sets max conc to zeros on all regins.
Definition: sorption_base.cc:464
ASSERT
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Definition: asserts.hh:346
EquationBase::time_
TimeGovernor * time_
Definition: equation.hh:222
SorptionBase::initialize_from_input
void initialize_from_input()
Initializes private members of sorption from the input record.
Definition: sorption_base.cc:275
distribution.hh
Support classes for parallel programing.
SorptionBase::EqData::output_fields
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
Definition: sorption_base.hh:105
Input::Type::Integer
Class for declaration of the integral input data.
Definition: type_base.hh:483
Input::Record::val
const Ret val(const string &key) const
Definition: accessors_impl.hh:31
SorptionBase::output_field_ptr
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > output_field_ptr
Fields correspond with conc_solid_out.
Definition: sorption_base.hh:250
EquationBase::time
TimeGovernor & time()
Definition: equation.hh:146
Input::Type::Selection::close
const Selection & close() const
Close the Selection, no more values can be added.
Definition: type_selection.cc:65
FieldSet::set_input_list
void set_input_list(Input::Array input_list, const TimeGovernor &tg)
Definition: field_set.hh:190
FieldSet::output_type
void output_type(OutputTime::DiscreteSpace rt)
Definition: field_set.hh:211
SorptionBase::initialize_fields
void initialize_fields()
Initializes field sets.
Definition: sorption_base.cc:324
SorptionBase::n_interpolation_steps_
unsigned int n_interpolation_steps_
Definition: sorption_base.hh:199
SorptionBase::update_max_conc
void update_max_conc()
Computes maximal aqueous concentration at the current step.
Definition: sorption_base.cc:475
Input::Type::Double
Class for declaration of the input data that are floating point numbers.
Definition: type_base.hh:534
field_set.hh
THROW
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
std::vector< std::string >
ElementAccessor< 3 >
SorptionBase::solubility_vec_
std::vector< double > solubility_vec_
Definition: sorption_base.hh:208
FieldSet::changed
bool changed() const
Definition: field_set.cc:165
system.hh
OutputTime::ELEM_DATA
@ ELEM_DATA
Definition: output_time.hh:107
SorptionBase::EqData::sorption_type
MultiField< 3, FieldValue< 3 >::Enum > sorption_type
Discrete need Selection for initialization.
Definition: sorption_base.hh:87
sorption_base.hh
Class SorptionBase is abstract class representing model of sorption in transport.
SorptionBase::CommonElementData::no_sorbing_surface_cond
double no_sorbing_surface_cond
Definition: sorption_base.hh:259
field_fe.hh
type_selection.hh
ReactionTerm::dof_handler_
std::shared_ptr< DOFHandlerMultiDim > dof_handler_
Pointer to DOF handler used through the reaction tree.
Definition: reaction_term.hh:147
Input::Array::begin
Iterator< ValueType > begin() const
Definition: accessors_impl.hh:145
SorptionBase::isotherm_reinit
void isotherm_reinit(unsigned int i_subst, const ElementAccessor< 3 > &elm)
Reinitializes the isotherm.
Definition: sorption_base.cc:426
Isotherm::interpolate
void interpolate(double &c_aqua, double &c_sorbed)
Definition: isotherm.cc:84
SorptionBase::output_data
void output_data(void) override
Output method.
Definition: sorption_base.cc:604
ASSERT_LT
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than)
Definition: asserts.hh:295
SorptionBase::compute_common_ele_data
virtual void compute_common_ele_data(const ElementAccessor< 3 > &elem)=0
ReactionTerm::concentration_matrix_
double ** concentration_matrix_
Definition: reaction_term.hh:127
Isotherm::compute
void compute(double &c_aqua, double &c_sorbed)
Definition: isotherm.cc:68
SubstanceList::names
const std::vector< std::string > & names()
Definition: substance.hh:85
Region
Definition: region.hh:146
Isotherm::SorptionType
SorptionType
Type of adsorption isotherm.
Definition: isotherm.hh:174
Input::Iterator
Definition: accessors.hh:143
SorptionBase::EqData::init_conc_solid
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_solid
Initial sorbed concentrations.
Definition: sorption_base.hh:96
Input::Type::Default
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
SorptionBase::make_reactions
void make_reactions()
Definition: sorption_base.cc:145
SorptionBase::EqData::EqData
EqData(const string &output_field_name, const string &output_field_desc)
Collect all fields.
Definition: sorption_base.cc:78
SorptionBase::SorptionBase
SorptionBase()
FieldSet::set_components
void set_components(const std::vector< string > &names)
Definition: field_set.hh:177
Isotherm::none
@ none
Definition: isotherm.hh:175
accessors.hh
SorptionBase::EqData
Definition: sorption_base.hh:76
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
elements.h
ReactionTerm::it_abstract_reaction
static Input::Type::Abstract & it_abstract_reaction()
Definition: reaction_term.cc:43
sys_profiler.hh
SorptionBase::set_initial_condition
void set_initial_condition()
Reads and sets initial condition for concentration in solid.
Definition: sorption_base.cc:389
RegionDB::bulk_size
unsigned int bulk_size() const
Definition: region.cc:268
xprintf
#define xprintf(...)
Definition: system.hh:92
SorptionBase::zero_time_step
void zero_time_step() override
Definition: sorption_base.cc:362
SorptionBase::EqData::get_sorption_type_selection
static const Input::Type::Selection & get_sorption_type_selection()
Definition: sorption_base.cc:40
TimeGovernor::step
const TimeStep & step(int index=-1) const
Definition: time_governor.cc:726
ReactionTerm::el_4_loc_
LongIdx * el_4_loc_
Indices of elements belonging to local dofs.
Definition: reaction_term.hh:130
Input::AbstractRecord
Accessor to the polymorphic input data of a type given by an AbstracRecord object.
Definition: accessors.hh:458
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
Input::Record::ei_address
EI_Address ei_address() const
Definition: accessors.cc:178
UnitSI
Class for representation SI units of Fields.
Definition: unit_si.hh:40
ReactionTerm::distribution_
Distribution * distribution_
Pointer to reference to distribution of elements between processors.
Definition: reaction_term.hh:135
Mesh::region_db
const RegionDB & region_db() const
Definition: mesh.h:147
EquationBase::input_record_
Input::Record input_record_
Definition: equation.hh:223
RegionDB::get_region_set
RegionSet get_region_set(const std::string &set_name) const
Definition: region.cc:328
SorptionBase::CommonElementData::scale_sorbed
double scale_sorbed
Definition: sorption_base.hh:258
first_order_reaction.hh
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
SorptionBase::~SorptionBase
virtual ~SorptionBase(void)
Definition: sorption_base.cc:133
SorptionBase::compute_reaction
double ** compute_reaction(double **concentrations, int loc_el) override
Definition: sorption_base.cc:556
isotherm.hh
mesh.h
ReactionTerm::substances_
SubstanceList substances_
Names belonging to substances.
Definition: reaction_term.hh:141
Input::Type::Selection
Template for classes storing finite set of named values.
Definition: type_selection.hh:65
Input::Record::find
Iterator< Ret > find(const string &key) const
Definition: accessors_impl.hh:91
Isotherm::is_precomputed
bool is_precomputed(void)
Definition: isotherm.hh:239
FieldFlag::input_copy
static constexpr Mask input_copy
Definition: field_flag.hh:44
Input::Type::Record::close
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:303
Input::Type
Definition: balance.hh:38
SorptionBase::isotherms
std::vector< std::vector< Isotherm > > isotherms
Definition: sorption_base.hh:224
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
SorptionBase::update_solution
void update_solution(void) override
Updates the solution.
Definition: sorption_base.cc:406
SorptionBase::solvent_density_
double solvent_density_
Definition: sorption_base.hh:204
SorptionBase::substance_global_idx_
std::vector< unsigned int > substance_global_idx_
Mapping from local indexing of substances to global.
Definition: sorption_base.hh:229
FieldCommon::set_components
void set_components(const std::vector< string > &names)
Definition: field_common.hh:195
SorptionBase::make_tables
void make_tables(void)
Definition: sorption_base.cc:491
EquationOutput::output
void output(TimeStep step)
Definition: equation_output.cc:186
Mesh
Definition: mesh.h:80
Input::Type::Array
Class for declaration of inputs sequences.
Definition: type_base.hh:339
Isotherm::freundlich
@ freundlich
Definition: isotherm.hh:177
dual_porosity.hh
Class Dual_por_exchange implements the model of dual porosity.
Input::Type::String
Class for declaration of the input data that are in string format.
Definition: type_base.hh:582
Input::Array
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
SorptionBase::EqData::input_data_set_
FieldSet input_data_set_
Input data set - fields in this set are read from the input file.
Definition: sorption_base.hh:102
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
SorptionBase::n_substances_
unsigned int n_substances_
Definition: sorption_base.hh:226
ElementAccessor::region
Region region() const
Definition: accessors.hh:95
fe_value_handler.hh
SorptionBase::conc_solid
double ** conc_solid
Definition: sorption_base.hh:234
Isotherm
Definition: isotherm.hh:158
SorptionBase::isotherm_reinit_all
void isotherm_reinit_all(const ElementAccessor< 3 > &elm)
Calls isotherm_reinit for all isotherms.
Definition: sorption_base.cc:456
ReactionTerm::row_4_el_
LongIdx * row_4_el_
Indices of rows belonging to elements.
Definition: reaction_term.hh:132
SorptionBase::max_conc
std::vector< std::vector< double > > max_conc
Definition: sorption_base.hh:217
SorptionBase::EqData::conc_solid
MultiField< 3, FieldValue< 3 >::Scalar > conc_solid
Calculated sorbed concentrations, for output only.
Definition: sorption_base.hh:99
SorptionBase::CommonElementData::scale_aqua
double scale_aqua
Definition: sorption_base.hh:257
SorptionBase::conc_solid_out
std::vector< VectorMPI > conc_solid_out
sorbed concentration array output (gathered - sequential)
Definition: sorption_base.hh:244
Isotherm::langmuir
@ langmuir
Definition: isotherm.hh:178
SorptionBase::initialize
void initialize() override
Prepares the object to usage.
Definition: sorption_base.cc:172
Input::Array::ei_address
EI_Address ei_address() const
Definition: accessors.cc:314
SorptionBase::EqData::isotherm_other
MultiField< 3, FieldValue< 3 >::Scalar > isotherm_other
Langmuir sorption coeficients alpha (in fraction c_s = omega * (alpha*c_a)/(1- alpha*c_a)).
Definition: sorption_base.hh:94
reaction_term.hh
Class ReactionTerm is an abstract class representing reaction term in transport.
Input::Type::Selection::add_value
Selection & add_value(const int value, const std::string &key, const std::string &description="", TypeBase::attribute_map attributes=TypeBase::attribute_map())
Adds one new value with name given by key to the Selection.
Definition: type_selection.cc:50
ReactionTerm
Definition: reaction_term.hh:44
ASSERT_PTR
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
Definition: asserts.hh:335
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
radioactive_decay.hh
SorptionBase::EqData::distribution_coefficient
MultiField< 3, FieldValue< 3 >::Scalar > distribution_coefficient
Multiplication coefficients (k, omega) for all types of isotherms.
Definition: sorption_base.hh:92
Input::Type::Default::optional
static Default optional()
The factory function to make an empty default value which is optional.
Definition: type_record.hh:124
Isotherm::linear
@ linear
Definition: isotherm.hh:176
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
Input::Array::end
IteratorBase end() const
Definition: accessors_impl.hh:157
FieldSet::make_field_descriptor_type
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
Definition: field_set.cc:62
Isotherm::reinit
void reinit(enum SorptionType sorption_type, bool limited_solubility_on, double aqua_density, double scale_aqua, double scale_sorbed, double c_aqua_limit, double mult_coef, double second_coef)
Definition: isotherm.cc:44
END_TIMER
#define END_TIMER(tag)
Ends a timer with specified tag.
Definition: sys_profiler.hh:153
ElementAccessor::centre
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Definition: accessors.hh:285
SorptionBase::common_ele_data
struct SorptionBase::CommonElementData common_ele_data