21 using namespace Input::Type;
25 = EqData().output_fields.make_output_field_selection(
"DualPorosity_Output")
30 "Dual porosity model in transport problems.\n"
31 "Provides computing the concentration of substances in mobile and immobile zone.\n"
35 "Containes region specific data necessary to construct dual porosity model.")
37 "Tolerance according to which the explicit Euler scheme is used or not."
38 "Set 0.0 to use analytic formula only (can be slower).")
44 Default(
"conc_immobile"),
"List of fields to write to output stream.");
48 *
this += diffusion_rate_immobile
49 .name(
"diffusion_rate_immobile")
50 .description(
"Diffusion coefficient of non-equilibrium linear exchange between mobile and immobile zone.")
54 *
this += porosity_immobile
55 .name(
"porosity_immobile")
56 .description(
"Porosity of the immobile zone.")
60 *
this += init_conc_immobile
61 .name(
"init_conc_immobile")
62 .description(
"Initial concentration of substances in the immobile zone.")
63 .units(
UnitSI().kg().m(-3) );
71 output_fields += *
this;
72 output_fields += conc_immobile.name(
"conc_immobile").units(
UnitSI().kg().m(-3) );
120 THROW( ReactionTerm::ExcWrongDescendantModel()
121 << ReactionTerm::EI_Model((*reactions_it).type().type_name())
122 << (*reactions_it).ei_address());
125 {
THROW( ReactionTerm::ExcWrongDescendantModel()
126 << ReactionTerm::EI_Model((*reactions_it).type().type_name())
127 << EI_Message(
"This model is not currently supported!")
128 << (*reactions_it).ei_address());
132 << EI_Message(
"Descending model type selection failed (SHOULD NEVER HAPPEN).")
133 << (*reactions_it).ei_address());
154 THROW( ReactionTerm::ExcWrongDescendantModel()
155 << ReactionTerm::EI_Model((*reactions_it).type().type_name())
156 << (*reactions_it).ei_address());
159 {
THROW( ReactionTerm::ExcWrongDescendantModel()
160 << ReactionTerm::EI_Model((*reactions_it).type().type_name())
161 << EI_Message(
"This model is not currently supported!")
162 << (*reactions_it).ei_address());
166 << EI_Message(
"Descending model type selection failed (SHOULD NEVER HAPPEN).")
167 << (*reactions_it).ei_address());
179 ASSERT(
time_ !=
nullptr,
"Time governor has not been set yet.\n");
247 ASSERT(
time_ !=
nullptr,
"Time governor has not been set yet.\n");
316 conc_mob, conc_immob,
317 previous_conc_mob, previous_conc_immob,
332 temp_exponent = (por_mob + por_immob) / (por_mob * por_immob) *
time_->
dt();
336 exponent = diff_vec[sbi] * temp_exponent;
342 conc_average = ((por_mob * previous_conc_mob) + (por_immob * previous_conc_immob))
343 / (por_mob + por_immob);
345 conc_max = std::max(previous_conc_mob-conc_average, previous_conc_immob-conc_average);
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++) {
void output_type(OutputTime::DiscreteSpace rt)
unsigned int size() const
get global size
void set_input_list(Input::Array input_list)
static Input::Type::Record input_type
Sorption model in immobile zone in case dual porosity is considered.
virtual void zero_time_step()
ReactionTerm & output_stream(OutputTime &ostream)
Sets the output stream which is given from transport class.
void set_limit_side(LimitSide side)
OutputTime * output_stream_
Pointer to a transport output stream.
void set_initial_condition()
Sets initial condition from input.
VecScatter vconc_out_scatter
Output vector scatter.
virtual void output_data(void)
Output method.
void output_data(void) override
Main output routine.
double ** concentration_matrix_
const std::vector< std::string > & names()
virtual void initialize()
Initialize fields.
void add_admissible_field_names(const Input::Array &in_array)
Registers names of output fields that can be written using this stream.
MultiField< 3, FieldValue< 3 >::Scalar > conc_immobile
Calculated concentrations in the immobile zone.
FieldSet output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
SubstanceList substances_
Names belonging to substances.
static Input::Type::Record input_type
void set_time(const TimeStep &time)
RegionSet get_region_set(const string &set_name) const
void zero_time_step() override
Field< 3, FieldValue< 3 >::Scalar > porosity_immobile
Immobile porosity field.
int * row_4_el_
Indices of rows belonging to elements.
~DualPorosity(void)
Destructor.
std::vector< VectorSeqDouble > conc_immobile_out
concentration array output for immobile phase (gathered - sequential)
Field< 3, FieldValue< 3 >::Vector > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
const RegionDB & region_db() const
static Input::Type::Record input_type
Input record for class FirstOrderReaction.
ElementAccessor< 3 > element_accessor(unsigned int idx, bool boundary=false)
void allocate_output_mpi(void)
Allocates petsc vectors, prepares them for output and creates output vector scatter.
const TimeStep & step(int index=-1) const
unsigned int size() const
void update_solution(void) override
Input::Array output_array
static Input::Type::AbstractRecord input_type
double scheme_tolerance_
Dual porosity computational scheme tolerance.
static Input::Type::Record input_type
void make_reactions()
Resolves construction of following reactions.
unsigned int n_elements() const
void initialize() override
Prepares the object to usage.
Distribution * distribution_
Pointer to reference to distribution of elements between processors.
static constexpr Mask input_copy
A field that is input of its equation and can not read from input, thus must be set by copy...
static Input::Type::Selection output_selection
Class implements the radioactive decay chain.
#define ASSERT_LESS(a, b)
#define START_TIMER(tag)
Starts a timer with specified tag.
void initialize_fields()
Initializes field sets.
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
void set_field(const std::string &dest_field_name, FieldCommon &source)
EqData()
Collect all fields.
static Input::Type::Record input_type
void * xmalloc(size_t size)
Memory allocation with checking.
virtual void set_time_governor(TimeGovernor &time)
Support classes for parallel programing.
ReactionTerm * reaction_immobile
Reaction running in immobile zone.
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.
Field< 3, FieldValue< 3 >::Vector > init_conc_immobile
Initial concentrations in the immobile zone.
virtual void update_solution()
void output(OutputTime *stream)
Input::Record input_record_
void set_components(const std::vector< string > &names)
int * el_4_loc_
Indices of elements belonging to local dofs.
double ** compute_reaction(double **concentrations, int loc_el) override
#define END_TIMER(tag)
Ends a timer with specified tag.
static Input::Type::Record input_type
Input record for class RadioactiveDecay.
arma::vec::fixed< spacedim > centre() const
void set_mesh(const Mesh &mesh)
ReactionTerm * reaction_mobile
Reaction running in mobile zone.
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field.
Class implements the linear reactions.
Class for representation SI units of Fields.
static UnitSI & dimensionless()
Returns dimensionless unit.
Vec * vconc_immobile
PETSC concentration vector for immobile phase (parallel).
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
ReactionTerm & concentration_matrix(double **concentration, Distribution *conc_distr, int *el_4_loc, int *row_4_el)
ReactionTerm & substances(SubstanceList &substances)
Sets the names of substances considered in transport.
ElementVector element
Vector of elements of the mesh.
unsigned int lsize(int proc) const
get local size