Flow123d
sorption_mob.cc
Go to the documentation of this file.
1 #include <boost/foreach.hpp>
2 
3 #include "reaction/reaction.hh"
4 #include "reaction/isotherm.hh"
6 
7 #include "system/system.hh"
8 #include "system/sys_profiler.hh"
9 
10 #include "mesh/mesh.h"
11 
12 using namespace std;
13 
14 namespace IT = Input::Type;
15 
16 
18  = IT::Record("SorptionMobile", "Information about all the limited solubility affected adsorptions.")
21  .declare_key("output_fields", IT::Array(make_output_selection("conc_solid", "SorptionMobile_Output")),
22  IT::Default("conc_solid"), "List of fields to write to output stream.");
23 
24 
25 
27  : SorptionDual(init_mesh, in_rec)
28 {
29  //DBGMSG("SorptionMob constructor.\n");
30  data_ = new EqData("conc_solid");
31  output_selection = make_output_selection("conc_solid", "SorptionMobile_Output");
32 }
33 
35 {
36 }
37 
38 /*
39 double SorptionMob::compute_sorbing_scale(double por_m, double por_imm)
40 {
41  double phi = por_m/(por_m + por_imm);
42  return phi;
43 }
44 */
45 
47 {
48  START_TIMER("SorptionMob::isotherm_reinit");
49 
50  double rock_density = data_->rock_density.value(elem.centre(),elem);
51 
52  double por_m = data_->porosity.value(elem.centre(),elem);
53  double por_imm = immob_porosity_.value(elem.centre(),elem);
54  double phi = por_m/(por_m + por_imm);
55 
56  // List of types of isotherms in particular regions
57  arma::uvec adsorption_type = data_->sorption_type.value(elem.centre(),elem);
58  arma::Col<double> mult_coef_vec = data_->isotherm_mult.value(elem.centre(),elem);
59  arma::Col<double> second_coef_vec = data_->isotherm_other.value(elem.centre(),elem);
60 
61  for(int i_subst = 0; i_subst < n_substances_; i_subst++)
62  {
63  double mult_coef = mult_coef_vec[i_subst];
64  double second_coef = second_coef_vec[i_subst];
65  Isotherm & isotherm = isotherms_vec[i_subst];
66 
67  //scales are different for the case of sorption in mobile and immobile pores
68  double scale_aqua, scale_sorbed;
69  scale_aqua = por_m;
70  scale_sorbed = phi * (1 - por_m - por_imm) * rock_density * molar_masses[i_subst];
71  if(scale_sorbed == 0.0)
72  xprintf(UsrErr, "Parameter scale_sorbed (phi * (1 - por_m - por_imm) * rock_density * molar_masses[i_subst]) is equal to zero.");
73  bool limited_solubility_on;
74  double table_limit;
75  if (solubility_vec_[i_subst] <= 0.0) {
76  limited_solubility_on = false;
77  table_limit=table_limit_[i_subst];
78 
79  } else {
80  limited_solubility_on = true;
81  table_limit=solubility_vec_[i_subst];
82  }
83  isotherm.reinit(Isotherm::SorptionType(adsorption_type[i_subst]), limited_solubility_on,
84  solvent_density, scale_aqua, scale_sorbed, table_limit, mult_coef, second_coef);
85 
86  }
87 
88  END_TIMER("SorptionMob::isotherm_reinit");
89 }