Flow123d  JS_before_hm-2115-gf629a871a
sorption.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.cc
15  * @brief
16  */
17 
18 #include <vector>
19 #include <limits>
20 
21 #include "reaction/isotherm.hh"
22 #include "reaction/sorption.hh"
23 #include "system/sys_profiler.hh"
24 #include "system/asserts.hh"
25 #include "mesh/accessors.hh"
26 #include "input/factory.hh"
27 
28 FLOW123D_FORCE_LINK_IN_CHILD(sorptionMobile)
29 FLOW123D_FORCE_LINK_IN_CHILD(sorptionImmobile)
31 
32 
33 /********************************* SORPTION_SIMPLE *********************************************************/
34 /********************************* *********************************************************/
35 
36 const IT::Record & SorptionSimple::get_input_type() {
37  return IT::Record("Sorption", "Sorption model in the reaction term of transport.")
40  .declare_key("output", make_output_type("Sorption", "conc_solid", "Concentration solution in the solid phase."),
41  IT::Default("{ \"fields\": [ \"conc_solid\" ] }"),
42  "Setting of the fields output.")
43 
44  .close();
45 }
46 
48  : SorptionBase(init_mesh, in_rec)
49 {
50  eq_fields_ = std::make_shared<EqFields>("conc_solid", "Concentration solution in the solid phase.");
51  this->eq_fieldset_ = eq_fields_.get();
52  this->eq_fields_base_ = std::static_pointer_cast<ReactionTerm::EqFields>(eq_fields_);
53 }
54 
55 const int SorptionSimple::registrar =
56  Input::register_class< SorptionSimple, Mesh &, Input::Record >("Sorption") +
58 
60 {}
61 
63 {
64  double rock_density = eq_fields_->rock_density.value(elem.centre(),elem);
65  double por_m = eq_fields_->porosity.value(elem.centre(),elem);
66 
67  this->common_ele_data.scale_aqua = por_m;
68  this->common_ele_data.scale_sorbed = (1 - por_m) * rock_density;
70 }
71 
72 
73 /*********************************** *********************************************************/
74 /*********************************** SORPTION_DUAL *********************************************************/
75 /*********************************** *********************************************************/
76 
77 SorptionDual::EqFields::EqFields(const string &output_field_name, const string &output_field_desc)
78 : SorptionBase::EqFields(output_field_name, output_field_desc)
79 {
80  *this+=immob_porosity_
82  .name("porosity_immobile")
83  .set_limits(0.0);
84 }
85 
87  const string &output_conc_name,
88  const string &output_conc_desc)
89  : SorptionBase(init_mesh, in_rec)
90 {
91  eq_fields_dual_ = std::make_shared<EqFields>(output_conc_name, output_conc_desc);
92  this->eq_fieldset_ = eq_fields_dual_.get();
93  this->eq_fields_base_ = std::static_pointer_cast<ReactionTerm::EqFields>(eq_fields_dual_);
94  this->eq_fields_ = std::static_pointer_cast<SorptionBase::EqFields>(eq_fields_dual_);
95 }
96 
98 {}
99 
100 /********************************** *******************************************************/
101 /*********************************** SORPTION_MOBILE *******************************************************/
102 /********************************** *******************************************************/
103 
105  return IT::Record("SorptionMobile", "Sorption model in the mobile zone, following the dual porosity model.")
108  .declare_key("output", make_output_type("SorptionMobile", "conc_solid", "Concentration solution in the solid mobile phase."),
109  IT::Default("{ \"fields\": [ \"conc_solid\" ] }"),
110  "Setting of the fields output.")
111 
112  .close();
113 }
114 
115 
116 const int SorptionMob::registrar =
117  Input::register_class< SorptionMob, Mesh &, Input::Record >("SorptionMobile") +
119 
120 
122  : SorptionDual(init_mesh, in_rec, "conc_solid", "Concentration solution in the solid mobile phase.")
123 {}
124 
125 
127 {}
128 
130 {
131  double rock_density = eq_fields_dual_->rock_density.value(elem.centre(),elem);
132  double por_m = eq_fields_dual_->porosity.value(elem.centre(),elem);
133  double por_imm = eq_fields_dual_->immob_porosity_.value(elem.centre(),elem);
134  double phi = por_m/(por_m + por_imm);
135 
136  this->common_ele_data.scale_aqua = por_m;
137  this->common_ele_data.scale_sorbed = phi * (1 - por_m - por_imm) * rock_density;
138  this->common_ele_data.no_sorbing_surface_cond = 1-por_m-por_imm;
139 }
140 
141 
142 /*********************************** *****************************************************/
143 /*********************************** SORPTION_IMMOBILE *****************************************************/
144 /*********************************** *****************************************************/
145 
147  return IT::Record("SorptionImmobile", "Sorption model in the immobile zone, following the dual porosity model.")
150  .declare_key("output", make_output_type("SorptionImmobile", "conc_immobile_solid", "Concentration solution in the solid immobile phase."),
151  IT::Default("{ \"fields\": [ \"conc_immobile_solid\" ] }"),
152  "Setting of the fields output.")
153 
154  .close();
155 }
156 
157 const int SorptionImmob::registrar =
158  Input::register_class< SorptionImmob, Mesh &, Input::Record >("SorptionImmobile") +
160 
162 : SorptionDual(init_mesh, in_rec, "conc_immobile_solid", "Concentration solution in the solid immobile phase.")
163 {}
164 
166 {}
167 
169 {
170  double rock_density = eq_fields_dual_->rock_density.value(elem.centre(),elem);
171  double por_m = eq_fields_dual_->porosity.value(elem.centre(),elem);
172  double por_imm = eq_fields_dual_->immob_porosity_.value(elem.centre(),elem);
173  double phi = por_m/(por_m + por_imm);
174 
175  this->common_ele_data.scale_aqua = por_m;
176  this->common_ele_data.scale_sorbed = (1 - phi) * (1 - por_m - por_imm) * rock_density;
177  this->common_ele_data.no_sorbing_surface_cond = 1-por_m-por_imm;
178 }
SorptionDual::SorptionDual
SorptionDual(Mesh &init_mesh, Input::Record in_rec, const string &output_conc_name, const string &output_conc_desc)
Constructor.
Definition: sorption.cc:86
SorptionImmob::SorptionImmob
SorptionImmob(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: sorption.cc:161
SorptionSimple::compute_common_ele_data
void compute_common_ele_data(const ElementAccessor< 3 > &elem) override
Computes CommonElementData.
Definition: sorption.cc:62
SorptionBase::get_input_type
static const Input::Type::Record & get_input_type()
Definition: sorption_base.cc:54
ReactionTerm::it_abstract_immobile_term
static Input::Type::Abstract & it_abstract_immobile_term()
Definition: reaction_term.cc:37
SorptionMob::SorptionMob
SorptionMob(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: sorption.cc:121
SorptionSimple::registrar
static const int registrar
Registrar of class to factory.
Definition: sorption.hh:71
factory.hh
SorptionMob::~SorptionMob
~SorptionMob(void)
Destructor.
Definition: sorption.cc:126
SorptionImmob::~SorptionImmob
~SorptionImmob(void)
Destructor.
Definition: sorption.cc:165
ReactionTerm::EqFields::EqFields
EqFields()
Constructor.
Definition: reaction_term.hh:69
SorptionSimple::~SorptionSimple
~SorptionSimple(void)
Destructor.
Definition: sorption.cc:59
asserts.hh
Definitions of ASSERTS.
SorptionBase::eq_fields_
std::shared_ptr< EqFields > eq_fields_
Pointer to equation fields. The object is constructed in descendants.
Definition: sorption_base.hh:201
FLOW123D_FORCE_LINK_IN_CHILD
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:157
ElementAccessor< 3 >
SorptionImmob::compute_common_ele_data
void compute_common_ele_data(const ElementAccessor< 3 > &elem) override
Computes CommonElementData.
Definition: sorption.cc:168
FieldCommon::set_limits
FieldCommon & set_limits(double min, double max=std::numeric_limits< double >::max())
Definition: field_common.hh:158
SorptionBase::CommonElementData::no_sorbing_surface_cond
double no_sorbing_surface_cond
Definition: sorption_base.hh:252
SorptionBase
Definition: sorption_base.hh:59
FieldCommon::flags_add
FieldCommon & flags_add(FieldFlag::Flags::Mask mask)
Definition: field_common.hh:197
Input::Type::Record::size
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602
Input::Type::Default
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
Input::Type::Record::derive_from
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:196
accessors.hh
SorptionBase::make_output_type
static Input::Type::Instance make_output_type(const string &equation_name, const string &output_field_name, const string &output_field_desc)
Definition: sorption_base.hh:74
SorptionImmob::get_input_type
static const Input::Type::Record & get_input_type()
Definition: sorption.cc:146
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
sys_profiler.hh
sorption.hh
This file contains classes representing sorption model. Sorption model can be computed both in case t...
SorptionMob::compute_common_ele_data
void compute_common_ele_data(const ElementAccessor< 3 > &elem) override
Computes CommonElementData.
Definition: sorption.cc:129
SorptionBase::CommonElementData::scale_sorbed
double scale_sorbed
Definition: sorption_base.hh:251
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
SorptionDual::~SorptionDual
~SorptionDual(void)
Destructor.
Definition: sorption.cc:97
isotherm.hh
SorptionSimple
Simple sorption model without dual porosity.
Definition: sorption.hh:52
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
SorptionMob::get_input_type
static const Input::Type::Record & get_input_type()
Definition: sorption.cc:104
Input::Type
Definition: balance.hh:41
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
Mesh
Definition: mesh.h:355
Input::Type::Record::copy_keys
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:216
ReactionTerm::it_abstract_term
static Input::Type::Abstract & it_abstract_term()
Definition: reaction_term.cc:25
SorptionMob::registrar
static const int registrar
Registrar of class to factory.
Definition: sorption.hh:132
ReactionTerm::eq_fields_base_
std::shared_ptr< EqFields > eq_fields_base_
Equation data - all fields needs in assembly class.
Definition: reaction_term.hh:149
SorptionDual::EqFields
Definition: sorption.hh:81
SorptionDual::eq_fields_dual_
std::shared_ptr< EqFields > eq_fields_dual_
Overwrites SorptionBase::eq_fields_.
Definition: sorption.hh:106
SorptionBase::CommonElementData::scale_aqua
double scale_aqua
Definition: sorption_base.hh:250
SorptionSimple::get_input_type
static const Input::Type::Record & get_input_type()
Definition: sorption.cc:36
EquationBase::eq_fieldset_
FieldSet * eq_fieldset_
Definition: equation.hh:229
ReactionTerm::it_abstract_mobile_term
static Input::Type::Abstract & it_abstract_mobile_term()
Definition: reaction_term.cc:31
SorptionDual
Abstract class of sorption model in case dual porosity is considered.
Definition: sorption.hh:78
SorptionSimple::SorptionSimple
SorptionSimple(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: sorption.cc:47
SorptionDual::EqFields::immob_porosity_
Field< 3, FieldValue< 3 >::Scalar > immob_porosity_
Definition: sorption.hh:85
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
SorptionImmob::registrar
static const int registrar
Registrar of class to factory.
Definition: sorption.hh:158
SorptionBase::common_ele_data
struct SorptionBase::CommonElementData common_ele_data