Flow123d  release_3.0.0-506-g34af125
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 "mesh/accessors.hh"
25 #include "input/factory.hh"
26 
27 FLOW123D_FORCE_LINK_IN_CHILD(sorptionMobile)
28 FLOW123D_FORCE_LINK_IN_CHILD(sorptionImmobile)
30 
31 
32 /********************************* SORPTION_SIMPLE *********************************************************/
33 /********************************* *********************************************************/
34 
35 const IT::Record & SorptionSimple::get_input_type() {
36  return IT::Record("Sorption", "Sorption model in the reaction term of transport.")
39  //.declare_key("output_fields", IT::Array(make_output_selection("conc_solid", "Sorption_Output")),
40  // IT::Default("\"conc_solid\""), "List of fields to write to output stream.")
41  .declare_key("output", make_output_type("Sorption", "conc_solid"),
42  IT::Default("{ \"fields\": [ \"conc_solid\" ] }"),
43  "Setting of the fields output.")
44 
45  .close();
46 }
47 
49  : SorptionBase(init_mesh, in_rec)
50 {
51  data_ = new EqData("conc_solid");
52  this->eq_data_ = data_;
53  //output_selection = make_output_selection(
54  // "SorptionSimple_output_fields",
55  // "Selection of field names of Simple Sorption model available for output.");
56 }
57 
58 const int SorptionSimple::registrar =
59  Input::register_class< SorptionSimple, Mesh &, Input::Record >("Sorption") +
61 
63 {}
64 
66 {
67  double rock_density = data_->rock_density.value(elem.centre(),elem);
68  double por_m = data_->porosity.value(elem.centre(),elem);
69 
70  this->common_ele_data.scale_aqua = por_m;
71  this->common_ele_data.scale_sorbed = (1 - por_m) * rock_density;
73 }
74 
75 
76 /*********************************** *********************************************************/
77 /*********************************** SORPTION_DUAL *********************************************************/
78 /*********************************** *********************************************************/
79 
81  const string &output_conc_name,
82  const string &output_selection_name)
83  : SorptionBase(init_mesh, in_rec)
84 {
85  data_ = new EqData(output_conc_name);
88  .name("porosity_immobile")
89  .set_limits(0.0);
90  this->eq_data_ = data_;
91  //output_selection = make_output_selection(output_conc_name, output_selection_name);
92 }
93 
95 {}
96 
97 /********************************** *******************************************************/
98 /*********************************** SORPTION_MOBILE *******************************************************/
99 /********************************** *******************************************************/
100 
102  return IT::Record("SorptionMobile", "Sorption model in the mobile zone, following the dual porosity model.")
105  //.declare_key("output_fields", IT::Array(make_output_selection("conc_solid", "SorptionMobile_Output")),
106  // IT::Default("\"conc_solid\""), "List of fields to write to output stream.")
107  .declare_key("output", make_output_type("SorptionMobile", "conc_solid"),
108  IT::Default("{ \"fields\": [ \"conc_solid\" ] }"),
109  "Setting of the fields output.")
110 
111  .close();
112 }
113 
114 
115 const int SorptionMob::registrar =
116  Input::register_class< SorptionMob, Mesh &, Input::Record >("SorptionMobile") +
118 
119 
121  : SorptionDual(init_mesh, in_rec, "conc_solid", "SorptionMobile_Output")
122 {}
123 
124 
126 {}
127 
129 {
130  double rock_density = data_->rock_density.value(elem.centre(),elem);
131  double por_m = data_->porosity.value(elem.centre(),elem);
132  double por_imm = immob_porosity_.value(elem.centre(),elem);
133  double phi = por_m/(por_m + por_imm);
134 
135  this->common_ele_data.scale_aqua = por_m;
136  this->common_ele_data.scale_sorbed = phi * (1 - por_m - por_imm) * rock_density;
137  this->common_ele_data.no_sorbing_surface_cond = 1-por_m-por_imm;
138 }
139 
140 
141 /*********************************** *****************************************************/
142 /*********************************** SORPTION_IMMOBILE *****************************************************/
143 /*********************************** *****************************************************/
144 
146  return IT::Record("SorptionImmobile", "Sorption model in the immobile zone, following the dual porosity model.")
149  //.declare_key("output_fields", IT::Array(make_output_selection("conc_immobile_solid", "SorptionImmobile_Output")),
150  // IT::Default("\"conc_immobile_solid\""), "List of fields to write to output stream.")
151  .declare_key("output", make_output_type("SorptionImmobile", "conc_immobile_solid"),
152  IT::Default("{ \"fields\": [ \"conc_immobile_solid\" ] }"),
153  "Setting of the fields output.")
154 
155  .close();
156 }
157 
158 const int SorptionImmob::registrar =
159  Input::register_class< SorptionImmob, Mesh &, Input::Record >("SorptionImmobile") +
161 
163 : SorptionDual(init_mesh, in_rec, "conc_immobile_solid", "SorptionImmobile_Output")
164 {}
165 
167 {}
168 
170 {
171  double rock_density = data_->rock_density.value(elem.centre(),elem);
172  double por_m = data_->porosity.value(elem.centre(),elem);
173  double por_imm = immob_porosity_.value(elem.centre(),elem);
174  double phi = por_m/(por_m + por_imm);
175 
176  this->common_ele_data.scale_aqua = por_m;
177  this->common_ele_data.scale_sorbed = (1 - phi) * (1 - por_m - por_imm) * rock_density;
178  this->common_ele_data.no_sorbing_surface_cond = 1-por_m-por_imm;
179 }
FieldSet * eq_data_
Definition: equation.hh:232
void compute_common_ele_data(const ElementAccessor< 3 > &elem) override
Computes CommonElementData.
Definition: sorption.cc:65
~SorptionDual(void)
Destructor.
Definition: sorption.cc:94
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:598
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
FieldCommon & flags_add(FieldFlag::Flags::Mask mask)
~SorptionMob(void)
Destructor.
Definition: sorption.cc:125
void compute_common_ele_data(const ElementAccessor< 3 > &elem) override
Computes CommonElementData.
Definition: sorption.cc:169
Abstract class of sorption model in case dual porosity is considered.
Definition: sorption.hh:78
Field< 3, FieldValue< 3 >::Scalar > rock_density
Rock matrix density.
Definition: mesh.h:80
static const Input::Type::Record & get_input_type()
Definition: sorption.cc:35
static Input::Type::Abstract & it_abstract_mobile_term()
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:303
void compute_common_ele_data(const ElementAccessor< 3 > &elem) override
Computes CommonElementData.
Definition: sorption.cc:128
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Definition: accessors.hh:285
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:195
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field copied from transport.
Field< 3, FieldValue< 3 >::Scalar > immob_porosity_
Definition: sorption.hh:99
static constexpr Mask input_copy
Definition: field_flag.hh:44
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
static const Input::Type::Record & get_input_type()
Definition: sorption.cc:101
static Input::Type::Abstract & it_abstract_immobile_term()
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Definition: field.hh:389
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
static Input::Type::Instance make_output_type(const string &equation_name, const string &output_field_name)
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:215
static Input::Type::Abstract & it_abstract_term()
SorptionImmob(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: sorption.cc:162
static const int registrar
Registrar of class to factory.
Definition: sorption.hh:71
SorptionSimple(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: sorption.cc:48
static const int registrar
Registrar of class to factory.
Definition: sorption.hh:151
~SorptionSimple(void)
Destructor.
Definition: sorption.cc:62
FieldCommon & name(const string &name)
static const int registrar
Registrar of class to factory.
Definition: sorption.hh:125
Simple sorption model without dual porosity.
Definition: sorption.hh:52
Record type proxy class.
Definition: type_record.hh:182
static const Input::Type::Record & get_input_type()
FieldCommon & set_limits(double min, double max=std::numeric_limits< double >::max())
SorptionDual(Mesh &init_mesh, Input::Record in_rec, const string &output_conc_name, const string &output_selection_name)
Constructor.
Definition: sorption.cc:80
EqData * data_
Pointer to equation data. The object is constructed in descendants.
Other possible transformation of coordinates:
static const Input::Type::Record & get_input_type()
Definition: sorption.cc:145
This file contains classes representing sorption model. Sorption model can be computed both in case t...
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:180
SorptionMob(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Definition: sorption.cc:120
struct SorptionBase::CommonElementData common_ele_data
~SorptionImmob(void)
Destructor.
Definition: sorption.cc:166