Flow123d
JS_before_hm-2115-gf629a871a
|
Go to the documentation of this file.
44 "Linear isotherm runs the concentration exchange between liquid and solid.")
46 "Langmuir isotherm runs the concentration exchange between liquid and solid.")
48 "Freundlich isotherm runs the concentration exchange between liquid and solid.")
55 return Record(
"SorptionAux",
"AUXILIARY RECORD. Should not be directly part of the input tree.")
57 "Names of the substances that take part in the sorption model.")
59 "Density of the solvent.")
61 "Number of equidistant substeps, molar mass and isotherm intersections")
63 "Specifies solubility limits of all the sorbing species.")
65 "Specifies the highest aqueous concentration in the isotherm function interpolation table. "
66 "Use any negative value for an automatic choice according to current maximal concentration (default and recommended). "
67 "Use '0' to always evaluate isotherm function directly (can be very slow). "
68 "Use a positive value to set the interpolation table limit manually "
69 "(if aqueous concentration is higher, then the isotherm function is evaluated directly).")
71 "Containes region specific data necessary to construct isotherms.")
87 .
description(
"Considered sorption is described by selected isotherm.\n"
88 "If porosity on an element is equal to 1.0 (or even higher), meaning no sorbing surface, then type 'none' will be selected automatically.")
93 .
description(
"Distribution coefficient (( $k_l, k_F, k_L $)) of linear, Freundlich or Langmuir isotherm respectively.")
98 .
description(
"Additional parameter (($ \\alpha $)) of nonlinear isotherms.")
103 .
description(
"Initial solid concentration of substances. It is a vector: one value for every substance.")
179 for(
unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
183 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
194 .concentration_fields(
eq_fields_->conc_mobile_fe)
195 .set_time_governor(*
time_);
201 .concentration_fields(
eq_fields_->conc_solid_fe)
202 .set_time_governor(*
time_);
211 unsigned int k, global_idx, i_subst = 0;
215 for(; spec_iter != substances_array.
end(); ++spec_iter, i_subst++)
219 for(k = 0; k <
eq_data_->substances_.size(); k++)
221 if (*spec_iter ==
eq_data_->substances_[k].name())
230 THROW(ReactionTerm::ExcUnknownSubstance()
231 << ReactionTerm::EI_Substance(*spec_iter)
268 THROW(SorptionBase::ExcSubstanceCountMatch()
269 << SorptionBase::EI_ArrayName(
"solubility")
284 if( interp_table_limits )
288 THROW(SorptionBase::ExcSubstanceCountMatch()
289 << SorptionBase::EI_ArrayName(
"table_limits")
311 substances_sorption.push_back(
eq_data_->substances_[i].name());
312 eq_fields_->set_components(substances_sorption);
328 for (
unsigned int sbi = 0; sbi <
eq_data_->substances_.size(); sbi++)
331 eq_fields_->conc_solid_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(
eq_data_->dof_handler_);
346 std::stringstream ss;
368 IntIdx dof_p0 = dh_cell.get_loc_dof_indices()[0];
405 double mult_coef =
eq_fields_->distribution_coefficient[i_subst].value(elem.
centre(),elem);
406 double second_coef =
eq_fields_->isotherm_other[i_subst].value(elem.
centre(),elem);
423 THROW( ExcNotPositiveScaling() << EI_Subst(i_subst) );
433 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++)
441 unsigned int reg_idx, i_subst;
445 for(reg_idx = 0; reg_idx < nr_of_regions; reg_idx++)
452 unsigned int reg_idx, i_subst, subst_id;
457 IntIdx dof_p0 = dh_cell.get_loc_dof_indices()[0];
458 reg_idx = dh_cell.elm().region().bulk_idx();
474 int reg_idx = reg_iter.bulk_idx();
487 for(
unsigned int i_subst = 0; i_subst <
n_substances_; i_subst++){
491 isotherms[reg_idx][i_subst].clear_table();
497 bool call_make_table = call_reinit;
499 double subst_table_limit =
isotherms[reg_idx][i_subst].table_limit();
504 if(subst_table_limit <
max_conc[reg_idx][i_subst])
506 call_make_table =
true;
507 subst_table_limit = 2*
max_conc[reg_idx][i_subst];
536 unsigned int i_subst, subst_id;
538 bool is_common_ele_data_valid =
false;
547 double c_aqua =
eq_fields_->conc_mobile_fe[subst_id]->vec().get(dof_p0);
548 double c_sorbed =
eq_fields_->conc_solid_fe[subst_id]->vec().get(dof_p0);
550 eq_fields_->conc_mobile_fe[subst_id]->vec().set(dof_p0, c_aqua);
551 eq_fields_->conc_solid_fe[subst_id]->vec().set(dof_p0, c_sorbed);
555 if(! is_common_ele_data_valid){
557 is_common_ele_data_valid =
true;
561 double c_aqua =
eq_fields_->conc_mobile_fe[subst_id]->vec().get(dof_p0);
562 double c_sorbed =
eq_fields_->conc_solid_fe[subst_id]->vec().get(dof_p0);
563 isotherm.
compute(c_aqua, c_sorbed);
564 eq_fields_->conc_mobile_fe[subst_id]->vec().set(dof_p0, c_aqua);
565 eq_fields_->conc_solid_fe[subst_id]->vec().set(dof_p0, c_sorbed);
571 eq_fields_->conc_mobile_fe[subst_id]->vec().get(dof_p0));
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
std::vector< double > table_limit_
std::shared_ptr< OutputTime > output_stream_
Pointer to a transport output stream.
MultiField< 3, FieldValue< 3 >::Enum > sorption_type
Discrete need Selection for initialization.
static const Input::Type::Record & get_input_type()
#define ASSERT_GT(a, b)
Definition of comparative assert macro (Greater Than)
static UnitSI & dimensionless()
Returns dimensionless unit.
std::shared_ptr< ReactionTerm > reaction_liquid
void initialize_substance_ids()
Reads names of substances from input and creates indexing to global vector of substance.
std::shared_ptr< ReactionTerm > reaction_solid
ReactionTerm(Mesh &init_mesh, Input::Record in_rec)
MultiField< 3, FieldValue< 3 >::Scalar > distribution_coefficient
Multiplication coefficients (k, omega) for all types of isotherms.
Base of exceptions used in Flow123d.
const RegionDB & region_db() const
void clear_max_conc()
Sets max conc to zeros on all regins.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
void initialize_from_input()
Initializes private members of sorption from the input record.
Support classes for parallel programing.
std::shared_ptr< EqFields > eq_fields_
Pointer to equation fields. The object is constructed in descendants.
void initialize_fields()
Initializes field sets.
unsigned int n_interpolation_steps_
void update_max_conc()
Computes maximal aqueous concentration at the current step.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
std::vector< double > solubility_vec_
FieldCommon & set_limits(double min, double max=std::numeric_limits< double >::max())
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Class SorptionBase is abstract class representing model of sorption in transport.
double no_sorbing_surface_cond
void isotherm_reinit(unsigned int i_subst, const ElementAccessor< 3 > &elm)
Reinitializes the isotherm.
void interpolate(double &c_aqua, double &c_sorbed)
void compute_reaction(const DHCellAccessor &dh_cell) override
Compute reaction on a single element.
void output_data(void) override
Output method.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than)
virtual void compute_common_ele_data(const ElementAccessor< 3 > &elem)=0
static const Input::Type::Selection & get_sorption_type_selection()
void compute(double &c_aqua, double &c_sorbed)
MultiField< 3, FieldValue< 3 >::Scalar > isotherm_other
Langmuir sorption coeficients alpha (in fraction c_s = omega * (alpha*c_a)/(1- alpha*c_a)).
SorptionType
Type of adsorption isotherm.
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_solid
Initial sorbed concentrations.
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
static Input::Type::Abstract & it_abstract_reaction()
void set_initial_condition()
Reads and sets initial condition for concentration in solid.
unsigned int bulk_size() const
void zero_time_step() override
const TimeStep & step(int index=-1) const
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
static bool print_message_table(ostream &stream, std::string equation_name)
Class for representation SI units of Fields.
Input::Record input_record_
RegionSet get_region_set(const std::string &set_name) const
virtual ~SorptionBase(void)
MultiField< 3, FieldValue< 3 >::Scalar > conc_solid
Calculated sorbed concentrations, for output only.
bool is_precomputed(void)
static constexpr Mask input_copy
std::vector< std::vector< Isotherm > > isotherms
void update_solution(void) override
Updates the solution.
Field< 3, FieldValue< 3 >::Scalar > rock_density
Rock matrix density.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
std::vector< unsigned int > substance_global_idx_
Mapping from local indexing of substances to global.
FieldCommon & input_default(const string &input_default)
Class Dual_por_exchange implements the model of dual porosity.
Cell accessor allow iterate over DOF handler cells.
#define WarningOut()
Macro defining 'warning' record of log.
unsigned int n_substances_
void isotherm_reinit_all(const ElementAccessor< 3 > &elm)
Calls isotherm_reinit for all isotherms.
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
std::vector< std::vector< double > > max_conc
void initialize() override
Prepares the object to usage.
FieldCommon & input_selection(Input::Type::Selection element_selection)
FieldCommon & description(const string &description)
Class ReactionTerm is an abstract class representing reaction term in transport.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field copied from transport.
FieldSet input_field_set_
Input data set - fields in this set are read from the input file.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
#define START_TIMER(tag)
Starts a timer with specified tag.
std::shared_ptr< EqData > eq_data_
Equation data - all data needs in assembly class.
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
void reinit(enum SorptionType sorption_type, bool limited_solubility_on, double aqua_density, double scale_aqua, double scale_sorbed, double c_aqua_limit, double mult_coef, double second_coef)
#define END_TIMER(tag)
Ends a timer with specified tag.
FieldCommon & name(const string &name)
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
struct SorptionBase::CommonElementData common_ele_data