Flow123d
sorption_immob.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 
16  = IT::Record("SorptionImmobile", "Information about all the limited solubility affected adsorptions.")
19  .declare_key("output_fields", IT::Array(make_output_selection("conc_immobile_solid", "SorptionImmobile_Output")),
20  IT::Default("conc_immobile_solid"), "List of fields to write to output stream.");
21 
22 
23 
25  : SorptionDual(init_mesh, in_rec)
26 {
27  //DBGMSG("SorptionImmob constructor.\n");
28  data_ = new EqData("conc_immobile_solid");
29  output_selection = make_output_selection("conc_immobile_solid", "SorptionImmobile_Output");
30 }
31 
33 {
34 }
35 
36 /*
37 double SorptionImmob::compute_sorbing_scale(double por_m, double por_imm)
38 {
39  double phi = por_imm / (por_m + por_imm);
40  return phi;
41 }
42 */
43 
45 {
46  START_TIMER("SorptionImmob::isotherm_reinit");
47 
48  double rock_density = data_->rock_density.value(elem.centre(),elem);
49 
50  double por_m = data_->porosity.value(elem.centre(),elem);
51  double por_imm = immob_porosity_.value(elem.centre(),elem);
52  //double phi = por_imm / (por_m + por_imm); // = 1-phi
53  double phi = por_m/(por_m + por_imm);
54 
55  // List of types of isotherms in particular regions
56  arma::uvec adsorption_type = data_->sorption_type.value(elem.centre(),elem);
57  arma::Col<double> mult_coef_vec = data_->isotherm_mult.value(elem.centre(),elem);
58  arma::Col<double> second_coef_vec = data_->isotherm_other.value(elem.centre(),elem);
59 
60  for(int i_subst = 0; i_subst < n_substances_; i_subst++)
61  {
62  double mult_coef = mult_coef_vec[i_subst];
63  double second_coef = second_coef_vec[i_subst];
64  Isotherm & isotherm = isotherms_vec[i_subst];
65 
66  //scales are different for the case of sorption in mobile and immobile pores
67  double scale_aqua, scale_sorbed;
68  scale_aqua = por_imm;
69  scale_sorbed = (1 - phi) * (1 - por_m - por_imm) * rock_density * molar_masses[i_subst];
70  if(scale_sorbed == 0.0)
71  xprintf(UsrErr, "Parameter scale_sorbed ((1 - phi) * (1 - por_m - por_imm) * rock_density * molar_masses[i_subst]) is equal to zero.");
72  bool limited_solubility_on;
73  double table_limit;
74  if (solubility_vec_[i_subst] <= 0.0) {
75  limited_solubility_on = false;
76  table_limit=table_limit_[i_subst];
77 
78  } else {
79  limited_solubility_on = true;
80  table_limit=solubility_vec_[i_subst];
81  }
82  isotherm.reinit(Isotherm::SorptionType(adsorption_type[i_subst]), limited_solubility_on,
83  solvent_density, scale_aqua, scale_sorbed, table_limit, mult_coef, second_coef);
84 
85  }
86 
87  END_TIMER("SorptionImmob::isotherm_reinit");
88 }
89 
90 
91