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 *
this += rock_density.name(
"rock_density")
78 .description(
"Rock matrix density.")
80 .units(
UnitSI().kg().m(-3) );
82 *
this += sorption_type.name(
"sorption_type")
83 .description(
"Considered sorption is described by selected isotherm.\n" 84 "If porosity on an element is equal to 1.0 (or even higher), meaning no sorbing surface, then type 'none' will be selected automatically.")
85 .input_selection(get_sorption_type_selection())
88 *
this += distribution_coefficient.name(
"distribution_coefficient")
89 .description(
"Distribution coefficient (( $k_l, k_F, k_L $)) of linear, Freundlich or Langmuir isotherm respectively.")
91 .units(
UnitSI().m(3).kg(-1) );
93 *
this += isotherm_other.name(
"isotherm_other")
94 .description(
"Additional parameter (($ \\alpha $)) of nonlinear isotherms.")
98 *
this += init_conc_solid.name(
"init_conc_solid")
99 .description(
"Initial solid concentration of substances. It is a vector: one value for every substance.")
101 .units(
UnitSI().dimensionless() );
103 input_data_set_ += *
this;
113 output_fields += *
this;
114 output_fields += conc_solid.name(output_field_name)
115 .description(output_field_desc)
116 .units(
UnitSI().dimensionless() )
189 for(
unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
192 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
219 .set_time_governor(*
time_);
226 .set_time_governor(*
time_);
235 unsigned int k, global_idx, i_subst = 0;
239 for(; spec_iter != substances_array.
end(); ++spec_iter, i_subst++)
254 THROW(ReactionTerm::ExcUnknownSubstance()
255 << ReactionTerm::EI_Substance(*spec_iter)
292 THROW(SorptionBase::ExcSubstanceCountMatch()
293 << SorptionBase::EI_ArrayName(
"solubility")
308 if( interp_table_limits )
312 THROW(SorptionBase::ExcSubstanceCountMatch()
313 << SorptionBase::EI_ArrayName(
"table_limits")
335 substances_sorption.push_back(
substances_[i].name());
368 std::stringstream ss;
437 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
454 int reg_idx = elem->region().bulk_idx();
455 unsigned int i_subst, subst_id;
462 if (isotherms_vec[0].is_precomputed())
490 return concentrations;
503 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()
void output(TimeStep step)
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.
void initialize(std::shared_ptr< OutputTime > stream, Input::Record in_rec, const TimeGovernor &tg)
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
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()
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)
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. ...
Input::Record input_record_
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.
EqData(const string &output_field_name, const string &output_field_desc)
Collect all fields.
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.