Flow123d
JS_before_hm-2198-g122e1f2e2
|
Go to the documentation of this file.
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 the highest aqueous concentration in the isotherm function interpolation table. "
67 "Use any negative value for an automatic choice according to current maximal concentration (default and recommended). "
68 "Use '0' to always evaluate isotherm function directly (can be very slow). "
69 "Use a positive value to set the interpolation table limit manually "
70 "(if aqueous concentration is higher, then the isotherm function is evaluated directly).")
72 "Containes region specific data necessary to construct isotherms.")
88 .
description(
"Considered sorption is described by selected isotherm.\n"
89 "If porosity on an element is equal to 1.0 (or even higher), meaning no sorbing surface, then type 'none' will be selected automatically.")
94 .
description(
"Distribution coefficient (( $k_l, k_F, k_L $)) of linear, Freundlich or Langmuir isotherm respectively.")
99 .
description(
"Additional parameter (($ \\alpha $)) of nonlinear isotherms.")
104 .
description(
"Initial solid concentration of substances. It is a vector: one value for every substance.")
135 .
description(
"No sorbing surface condition computed by model.")
150 eq_data_ = std::make_shared<EqData>();
203 for(
unsigned int i_reg = 0; i_reg < nr_of_regions; i_reg++)
207 for(
unsigned int i_subst = 0; i_subst <
eq_data_->n_substances_; i_subst++)
219 .concentration_fields(
eq_fields_->conc_mobile_fe)
220 .set_time_governor(*
time_);
226 .concentration_fields(
eq_fields_->conc_solid_fe)
227 .set_time_governor(*
time_);
238 unsigned int k, global_idx, i_subst = 0;
242 for(; spec_iter != substances_array.
end(); ++spec_iter, i_subst++)
246 for(k = 0; k <
eq_data_->substances_.size(); k++)
248 if (*spec_iter ==
eq_data_->substances_[k].name())
257 THROW(ReactionTerm::ExcUnknownSubstance()
258 << ReactionTerm::EI_Substance(*spec_iter)
263 for(k = 0; k <
eq_data_->substance_global_idx_.size(); k++)
265 if(
eq_data_->substance_global_idx_[k] == global_idx)
274 eq_data_->substance_global_idx_.push_back(global_idx);
293 if (solub_iter->Array::size() !=
eq_data_->n_substances_)
295 THROW(SorptionBase::ExcSubstanceCountMatch()
296 << SorptionBase::EI_ArrayName(
"solubility")
311 if( interp_table_limits )
313 if (interp_table_limits->Array::size() !=
eq_data_->n_substances_)
315 THROW(SorptionBase::ExcSubstanceCountMatch()
316 << SorptionBase::EI_ArrayName(
"table_limits")
332 ASSERT_GT(
eq_data_->n_substances_, 0).error(
"Number of substances is wrong, they might have not been set yet.\n");
337 for (
unsigned int i :
eq_data_->substance_global_idx_)
338 substances_sorption.push_back(
eq_data_->substances_[i].name());
339 eq_fields_->set_components(substances_sorption);
355 for (
unsigned int sbi = 0; sbi <
eq_data_->substances_.size(); sbi++)
358 eq_fields_->conc_solid_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(
eq_data_->dof_handler_);
374 std::stringstream ss;
419 double mult_coef =
eq_fields_->distribution_coefficient[i_subst].value(elem.
centre(),elem);
420 double second_coef =
eq_fields_->isotherm_other[i_subst].value(elem.
centre(),elem);
429 double no_sorbing_surface_cond =
eq_fields_->no_sorbing_surface_cond.value(elem.
centre(), elem);
432 if( no_sorbing_surface_cond <= std::numeric_limits<double>::epsilon())
435 scale_aqua, scale_sorbed,
440 if ( scale_sorbed <= 0.0)
441 THROW( ExcNotPositiveScaling() << EI_Subst(i_subst) );
445 scale_aqua, scale_sorbed,
451 for(
unsigned int i_subst = 0; i_subst <
eq_data_->n_substances_; i_subst++)
459 unsigned int reg_idx, i_subst;
463 for(reg_idx = 0; reg_idx < nr_of_regions; reg_idx++)
464 for(i_subst = 0; i_subst <
eq_data_->n_substances_; i_subst++)
470 unsigned int reg_idx, i_subst, subst_id;
475 IntIdx dof_p0 = dh_cell.get_loc_dof_indices()[0];
476 reg_idx = dh_cell.elm().region().bulk_idx();
477 for(i_subst = 0; i_subst <
eq_data_->n_substances_; i_subst++){
478 subst_id =
eq_data_->substance_global_idx_[i_subst];
492 int reg_idx = reg_iter.bulk_idx();
504 for(
unsigned int i_subst = 0; i_subst <
eq_data_->n_substances_; i_subst++){
508 isotherms[reg_idx][i_subst].clear_table();
514 bool call_make_table = call_reinit;
516 double subst_table_limit =
isotherms[reg_idx][i_subst].table_limit();
521 if(subst_table_limit <
max_conc[reg_idx][i_subst])
523 call_make_table =
true;
524 subst_table_limit = 2*
max_conc[reg_idx][i_subst];
553 unsigned int i_subst, subst_id;
557 for(i_subst = 0; i_subst <
eq_data_->n_substances_; i_subst++)
559 subst_id =
eq_data_->substance_global_idx_[i_subst];
563 double c_aqua =
eq_fields_->conc_mobile_fe[subst_id]->vec().get(dof_p0);
564 double c_sorbed =
eq_fields_->conc_solid_fe[subst_id]->vec().get(dof_p0);
566 eq_fields_->conc_mobile_fe[subst_id]->vec().set(dof_p0, c_aqua);
567 eq_fields_->conc_solid_fe[subst_id]->vec().set(dof_p0, c_sorbed);
573 double c_aqua =
eq_fields_->conc_mobile_fe[subst_id]->vec().get(dof_p0);
574 double c_sorbed =
eq_fields_->conc_solid_fe[subst_id]->vec().get(dof_p0);
575 isotherm.
compute(c_aqua, c_sorbed);
576 eq_fields_->conc_mobile_fe[subst_id]->vec().set(dof_p0, c_aqua);
577 eq_fields_->conc_solid_fe[subst_id]->vec().set(dof_p0, c_sorbed);
583 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.
Field< 3, FieldValue< 3 >::Scalar > no_sorbing_surface_cond
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.
virtual void init_field_models()=0
Initialize FieldModels, method is implemented in descendants.
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.
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
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)
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()
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.
std::shared_ptr< EqData > eq_data_
Equation data.
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.
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.
EqData()
Collect all fields.
void isotherm_reinit_all(const ElementAccessor< 3 > &elm)
Calls isotherm_reinit for all isotherms.
Field< 3, FieldValue< 3 >::Scalar > scale_aqua
Instances of FieldModel used in assembly methods.
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
std::shared_ptr< EqData > eq_data_base_
Equation data - all data needs in assembly class.
GenericAssembly< InitConditionAssemblySorp > * init_condition_assembly_
general assembly objects, hold assembly objects of appropriate dimension
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.
Field< 3, FieldValue< 3 >::Scalar > scale_sorbed
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.