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(
"SorptionAux",
"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(distribution_coefficient,
"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 distribution_coefficient.units(
UnitSI().m(3).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;
104 output_fields += *
this;
177 for(
unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
180 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
207 .set_time_governor(*
time_);
214 .set_time_governor(*
time_);
223 unsigned int k, global_idx, i_subst = 0;
227 for(; spec_iter != substances_array.
end(); ++spec_iter, i_subst++)
242 THROW(ReactionTerm::ExcUnknownSubstance()
243 << ReactionTerm::EI_Substance(*spec_iter)
280 THROW(SorptionBase::ExcSubstanceCountMatch()
281 << SorptionBase::EI_ArrayName(
"solubility")
296 if( interp_table_limits )
300 THROW(SorptionBase::ExcSubstanceCountMatch()
301 << SorptionBase::EI_ArrayName(
"table_limits")
323 substances_sorption.push_back(
substances_[i].name());
356 std::stringstream ss;
425 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
442 int reg_idx = elem->region().bulk_idx();
443 unsigned int i_subst, subst_id;
450 if (isotherms_vec[0].is_precomputed())
478 return concentrations;
491 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.
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.
void output(TimeStep step)
SubstanceList substances_
Names belonging to substances.
void zero_time_step() override
RegionSet get_region_set(const string &set_name) const
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
static const Input::Type::Selection & get_sorption_type_selection()
const RegionDB & region_db() const
IdxInt * el_4_loc_
Indices of elements belonging to local dofs.
ElementAccessor< 3 > element_accessor(unsigned int idx, bool boundary=false)
const TimeStep & step(int index=-1) const
std::vector< double > table_limit_
static Input::Type::Abstract & it_abstract_reaction()
#define ADD_FIELD(name,...)
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
Vec * vconc_solid
PETSC sorbed concentration vector (parallel).
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_solid
Initial sorbed concentrations.
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)
IdxInt * row_4_el_
Indices of rows belonging to elements.
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.
void update_solution(void) override
Updates the solution.
double ** compute_reaction(double **concentrations, int loc_el) override
Support classes for parallel programing.
Class SorptionBase is abstract class representing model of sorption in transport. ...
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
Input::Record input_record_
void set_components(const std::vector< string > &names)
void set_initial_condition()
Reads and sets initial condition for concentration in solid.
bool set_time(const TimeStep &time, LimitSide limit_side)
bool is_constant(Region reg) const
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
#define WarningOut()
Macro defining 'warning' record of log.
#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.
bool is_field_output_time(const FieldCommon &field, TimeStep step) const
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.
static bool print_message_table(ostream &stream, std::string equation_name)
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.