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