43 using namespace
Input::Type;
48 return Record(
"DualPorosity",
49 "Dual porosity model in transport problems.\n" 50 "Provides computing the concentration of substances in mobile and immobile zone.\n" 54 "Containes region specific data necessary to construct dual porosity model.")
56 "Tolerance according to which the explicit Euler scheme is used or not." 57 "Set 0.0 to use analytic formula only (can be slower).")
62 EqData().output_fields.make_output_type(
"DualPorosity",
""),
63 IT::Default(
"{ \"fields\": [ \"conc_immobile\" ] }"),
64 "Setting of the fields output.")
69 Input::register_class< DualPorosity, Mesh &, Input::Record >(
"DualPorosity") +
75 .
name(
"diffusion_rate_immobile")
76 .
description(
"Diffusion coefficient of non-equilibrium linear exchange between mobile and immobile zone.")
81 .
name(
"porosity_immobile")
88 .
name(
"init_conc_immobile")
89 .
description(
"Initial concentration of substances in the immobile zone.")
100 .
name(
"conc_immobile")
190 .set_time_governor(*
time_);
199 .set_time_governor(*
time_);
254 std::stringstream ss;
310 conc_mob, conc_immob,
311 previous_conc_mob, previous_conc_immob,
328 temp_exponent = (por_mob + por_immob) / (por_mob * por_immob) *
time_->
dt();
332 exponent = diff_vec[sbi] * temp_exponent;
338 conc_average = ((por_mob * previous_conc_mob) + (por_immob * previous_conc_immob))
339 / (por_mob + por_immob);
341 conc_max = std::max(previous_conc_mob-conc_average, previous_conc_immob-conc_average);
346 if(
time_->
dt() <= por_mob*por_immob/(max(diff_vec)*(por_mob+por_immob)) &&
349 double temp = diff_vec[sbi]*(previous_conc_immob - previous_conc_mob) *
time_->
dt();
351 conc_mob = temp / por_mob + previous_conc_mob;
354 conc_immob = -temp / por_immob + previous_conc_immob;
358 double temp = exp(-exponent);
360 conc_mob = (previous_conc_mob - conc_average) * temp + conc_average;
363 conc_immob = (previous_conc_immob - conc_average) * temp + conc_average;
382 for (sbi = 0; sbi < n_subst; sbi++) {
434 bool cfl_changed =
false;
445 time_constraint = std::min(time_constraint, cfl_immobile);
void output_type(OutputTime::DiscreteSpace rt)
unsigned int size() const
get global size
Sorption model in immobile zone in case dual porosity is considered.
void set_initial_condition()
Sets initial condition from input.
VecScatter vconc_out_scatter
Output vector scatter.
std::shared_ptr< ReactionTerm > reaction_mobile
Reaction running in mobile zone.
void output_data(void) override
Main output routine.
double ** concentration_matrix_
const std::vector< std::string > & names()
MultiField< 3, FieldValue< 3 >::Scalar > conc_immobile
Calculated concentrations in the immobile zone.
void output(TimeStep step)
SubstanceList substances_
Names belonging to substances.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
void zero_time_step() override
Field< 3, FieldValue< 3 >::Scalar > porosity_immobile
Immobile porosity field.
~DualPorosity(void)
Destructor.
std::vector< VectorSeqDouble > conc_immobile_out
concentration array output for immobile phase (gathered - sequential)
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
void allocate_output_mpi(void)
Allocates petsc vectors, prepares them for output and creates output vector scatter.
const TimeStep & step(int index=-1) const
static Input::Type::Abstract & it_abstract_mobile_term()
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
unsigned int size() const
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
std::shared_ptr< OutputTime > output_stream_
Pointer to a transport output stream.
void update_solution(void) override
ReactionTerm(Mesh &init_mesh, Input::Record in_rec)
Constructor.
Class ReactionTerm is an abstract class representing reaction term in transport.
Class Dual_por_exchange implements the model of dual porosity.
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
double scheme_tolerance_
Dual porosity computational scheme tolerance.
std::shared_ptr< ReactionTerm > reaction_immobile
Reaction running in immobile zone.
void make_reactions()
Resolves construction of following reactions.
void initialize() override
Prepares the object to usage.
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.
static constexpr Mask input_copy
FieldCommon & input_default(const string &input_default)
#define START_TIMER(tag)
Starts a timer with specified tag.
#define OLD_ASSERT_LESS(a, b)
bool evaluate_time_constraint(double &time_constraint) override
Computes a constraint for time step.
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > output_field_ptr
Fields correspond with conc_immobile_out.
void initialize_fields()
Initializes field sets.
static Input::Type::Abstract & it_abstract_immobile_term()
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
EqData()
Collect all fields.
Class representing dual porosity model in transport.
static Input::Type::Abstract & it_abstract_term()
Support classes for parallel programing.
Sorption model in mobile zone in case dual porosity is considered.
void output_vector_gather(void) override
Gathers all the parallel vectors to enable them to be output.
FieldCommon & description(const string &description)
void set_input_list(Input::Array input_list, const TimeGovernor &tg)
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
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)
LongIdx * row_4_el_
Indices of rows belonging to elements.
double ** compute_reaction(double **concentrations, int loc_el) override
bool set_time(const TimeStep &time, LimitSide limit_side)
#define WarningOut()
Macro defining 'warning' record of log.
FieldCommon & name(const string &name)
#define END_TIMER(tag)
Ends a timer with specified tag.
MultiField< 3, FieldValue< 3 >::Scalar > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
static const int registrar
Registrar of class to factory.
void set_mesh(const Mesh &mesh)
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_immobile
Initial concentrations in the immobile zone.
bool is_field_output_time(const FieldCommon &field, TimeStep step) const
FieldCommon & set_limits(double min, double max=std::numeric_limits< double >::max())
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
LongIdx * el_4_loc_
Indices of elements belonging to local dofs.
Class for representation SI units of Fields.
static const Input::Type::Record & get_input_type()
static UnitSI & dimensionless()
Returns dimensionless unit.
static bool print_message_table(ostream &stream, std::string equation_name)
Vec * vconc_immobile
PETSC concentration vector for immobile phase (parallel).
This file contains classes representing sorption model. Sorption model can be computed both in case t...
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
unsigned int lsize(int proc) const
get local size