18 #include <boost/foreach.hpp> 45 "Linear isotherm runs the concentration exchange between liquid and solid.")
47 "Langmuir isotherm runs the concentration exchange between liquid and solid.")
49 "Freundlich isotherm runs the concentration exchange between liquid and solid.")
56 return Record(
"Sorption",
"AUXILIARY RECORD. Should not be directly part of the input tree.")
58 "Names of the substances that take part in the sorption model.")
60 "Density of the solvent.")
62 "Number of equidistant substeps, molar mass and isotherm intersections")
64 "Specifies solubility limits of all the sorbing species.")
66 "Specifies highest aqueous concentration in interpolation table.")
68 "Containes region specific data necessary to construct isotherms.")
77 ADD_FIELD(rock_density,
"Rock matrix density.",
"0.0");
78 rock_density.units(
UnitSI().kg().m(-3) );
80 ADD_FIELD(sorption_type,
"Considered sorption is described by selected isotherm. If porosity on an element is equal or even higher than 1.0 (meaning no sorbing surface), then type 'none' will be selected automatically.");
81 sorption_type.input_selection(&get_sorption_type_selection());
84 ADD_FIELD(isotherm_mult,
"Multiplication parameters (k, omega) in either Langmuir c_s = omega * (alpha*c_a)/(1- alpha*c_a) or in linear c_s = k * c_a isothermal description.",
"1.0");
85 isotherm_mult.units(
UnitSI().mol().kg(-1) );
87 ADD_FIELD(isotherm_other,
"Second parameters (alpha, ...) defining isotherm c_s = omega * (alpha*c_a)/(1- alpha*c_a).",
"1.0");
90 ADD_FIELD(init_conc_solid,
"Initial solid concentration of substances." 91 " Vector, one value for every substance.",
"0");
92 init_conc_solid.units(
UnitSI().mol().kg(-1) );
94 input_data_set_ += *
this;
103 output_fields += *
this;
174 for(
unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
177 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
204 .set_time_governor(*
time_);
211 .set_time_governor(*
time_);
220 unsigned int k, global_idx, i_subst = 0;
224 for(; spec_iter != substances_array.
end(); ++spec_iter, i_subst++)
239 THROW(ReactionTerm::ExcUnknownSubstance()
240 << ReactionTerm::EI_Substance(*spec_iter)
277 THROW(SorptionBase::ExcSubstanceCountMatch()
278 << SorptionBase::EI_ArrayName(
"solubility")
293 if( interp_table_limits )
297 THROW(SorptionBase::ExcSubstanceCountMatch()
298 << SorptionBase::EI_ArrayName(
"table_limits")
320 substances_sorption.push_back(
substances_[i].name());
417 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
434 int reg_idx = elem->region().bulk_idx();
435 unsigned int i_subst, subst_id;
442 if (isotherms_vec[0].is_precomputed())
470 return concentrations;
483 for (sbi = 0; sbi < n_subst; sbi++) {
void output_type(OutputTime::DiscreteSpace rt)
unsigned int size() const
get global size
void set_input_list(Input::Array input_list)
std::shared_ptr< ReactionTerm > reaction_solid
void allocate_output_mpi(void)
Allocates petsc vectors, prepares them for output and creates vector scatter.
#define ADD_FIELD(name,...)
MultiField< 3, FieldValue< 3 >::Scalar > conc_solid
Calculated sorbed concentrations, for output only.
std::vector< VectorSeqDouble > conc_solid_out
sorbed concentration array output (gathered - sequential)
std::vector< std::vector< Isotherm > > isotherms
virtual ~SorptionBase(void)
void initialize_substance_ids()
Reads names of substances from input and creates indexing to global vector of substance.
double ** concentration_matrix_
unsigned int bulk_size() const
const std::vector< std::string > & names()
EqData(const string &output_field_name)
Collect all fields.
static Input::Type::Abstract & get_input_type()
void set_time(const TimeStep &time, LimitSide limit_side)
double ** compute_reaction(double **concentrations, int loc_el)
SubstanceList substances_
Names belonging to substances.
void zero_time_step() override
RegionSet get_region_set(const string &set_name) const
int * row_4_el_
Indices of rows belonging to elements.
static const Input::Type::Selection & get_sorption_type_selection()
const RegionDB & region_db() const
ElementAccessor< 3 > element_accessor(unsigned int idx, bool boundary=false)
const TimeStep & step(int index=-1) const
std::vector< double > table_limit_
unsigned int size() const
std::shared_ptr< OutputTime > output_stream_
Pointer to a transport output stream.
ReactionTerm(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Class ReactionTerm is an abstract class representing reaction term in transport.
std::vector< unsigned int > substance_global_idx_
Mapping from local indexing of substances to global.
void initialize_fields()
Initializes field sets.
Class Dual_por_exchange implements the model of dual porosity.
unsigned int n_elements() const
Distribution * distribution_
Pointer to reference to distribution of elements between processors.
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
void output_data(void) override
Output method.
static constexpr Mask input_copy
A field that is input of its equation and can not read from input, thus must be set by copy...
Vec * vconc_solid
PETSC sorbed concentration vector (parallel).
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_solid
Initial sorbed concentrations.
FieldSet output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
void initialize_from_input()
Initializes private members of sorption from the input record.
std::vector< double > solubility_vec_
unsigned int n_interpolation_steps_
#define START_TIMER(tag)
Starts a timer with specified tag.
#define OLD_ASSERT_LESS(a, b)
virtual void isotherm_reinit(std::vector< Isotherm > &isotherms, const ElementAccessor< 3 > &elm)=0
Reinitializes the isotherm.
void output_vector_gather(void) override
Gathers all the parallel vectors to enable them to be output.
Input::Array output_array
void update_solution(void) override
Updates the solution.
void * xmalloc(size_t size)
Memory allocation with checking.
Support classes for parallel programing.
Class SorptionBase is abstract class representing model of sorption in transport. ...
virtual MultiFieldValue::return_type value(const Point &p, const ElementAccessor< spacedim > &elm) const
Input::Record input_record_
void output(std::shared_ptr< OutputTime > stream)
void set_components(const std::vector< string > &names)
int * el_4_loc_
Indices of elements belonging to local dofs.
void set_initial_condition()
Reads and sets initial condition for concentration in solid.
bool is_constant(Region reg) const
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
#define END_TIMER(tag)
Ends a timer with specified tag.
arma::vec::fixed< spacedim > centre() const
void set_mesh(const Mesh &mesh)
void set_components(const std::vector< string > &names)
static const Input::Type::Record & get_input_type()
VecScatter vconc_out_scatter
Output vector scatter.
Base of exceptions used in Flow123d.
unsigned int n_substances_
Class for representation SI units of Fields.
EqData * data_
Pointer to equation data. The object is constructed in descendants.
static UnitSI & dimensionless()
Returns dimensionless unit.
Other possible transformation of coordinates:
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
ElementVector element
Vector of elements of the mesh.
FieldSet input_data_set_
Input data set - fields in this set are read from the input file.
std::shared_ptr< ReactionTerm > reaction_liquid
unsigned int lsize(int proc) const
get local size
void initialize() override
Prepares the object to usage.