22 using namespace Input::Type;
27 = EqData().output_fields.make_output_field_selection(
"DualPorosity_Output")
32 "Dual porosity model in transport problems.\n"
33 "Provides computing the concentration of substances in mobile and immobile zone.\n"
37 "Containes region specific data necessary to construct dual porosity model.")
39 "Tolerance according to which the explicit Euler scheme is used or not."
40 "Set 0.0 to use analytic formula only (can be slower).")
46 Default(
"conc_immobile"),
"List of fields to write to output stream.");
50 *
this += diffusion_rate_immobile
51 .name(
"diffusion_rate_immobile")
52 .description(
"Diffusion coefficient of non-equilibrium linear exchange between mobile and immobile zone.")
56 *
this += porosity_immobile
57 .name(
"porosity_immobile")
58 .description(
"Porosity of the immobile zone.")
62 *
this += init_conc_immobile
63 .name(
"init_conc_immobile")
64 .description(
"Initial concentration of substances in the immobile zone.")
65 .units(
UnitSI().kg().m(-3) );
73 output_fields += *
this;
74 output_fields += conc_immobile.name(
"conc_immobile").units(
UnitSI().kg().m(-3) );
98 for (
unsigned int sbi = 0; sbi <
names_.size(); sbi++)
125 xprintf(
UsrErr,
"Dual porosity model cannot have another descendant dual porosity model.\n");
129 xprintf(
UsrErr,
"Semchem chemistry model is not supported at current time.\n");
132 xprintf(
UsrErr,
"Wrong reaction type in DualPorosity model.\n");
153 xprintf(
UsrErr,
"Dual porosity model cannot have another descendant dual porosity model.\n");
157 xprintf(
UsrErr,
"Semchem chemistry model is not supported at current time.\n");
160 xprintf(
UsrErr,
"Unknown reactions type in DualPorosity model.\n");
172 ASSERT(
time_ !=
nullptr,
"Time governor has not been set yet.\n");
179 for (
unsigned int sbi = 0; sbi <
names_.size(); sbi++)
228 for (
unsigned int sbi=0; sbi<
names_.size(); sbi++)
231 std::shared_ptr<FieldElementwise<3, FieldValue<3>::Scalar> > output_field_ptr(
243 ASSERT(
time_ !=
nullptr,
"Time governor has not been set yet.\n");
285 for (
unsigned int sbi=0; sbi <
names_.size(); sbi++)
312 conc_mob, conc_immob,
313 previous_conc_mob, previous_conc_immob,
328 temp_exponent = (por_mob + por_immob) / (por_mob * por_immob) *
time_->
dt();
330 for (sbi = 0; sbi <
names_.size(); sbi++)
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);
345 double temp = diff_vec[sbi]*(previous_conc_immob - previous_conc_mob) *
time_->
dt();
347 conc_mob = temp / por_mob + previous_conc_mob;
350 conc_immob = -temp / por_immob + previous_conc_immob;
354 double temp = exp(-exponent);
356 conc_mob = (previous_conc_mob - conc_average) * temp + conc_average;
359 conc_immob = (previous_conc_immob - conc_average) * temp + conc_average;
379 for (sbi = 0; sbi < n_subst; sbi++) {
401 for (sbi = 0; sbi <
names_.size(); 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.
void init(const vector< string > &names)
virtual void output_data(void)
Output method.
void output_data(void) override
Main output routine.
double ** concentration_matrix_
virtual void initialize()
Initialize fields.
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.
vector< string > names_
Names belonging to substances.
static Input::Type::Record input_type
RegionSet get_region_set(const string &set_name) const
void zero_time_step() override
static Input::Type::Record input_type
Field< 3, FieldValue< 3 >::Scalar > porosity_immobile
Immobile porosity field.
int * row_4_el_
Indices of rows belonging to elements.
~DualPorosity(void)
Destructor.
Field< 3, FieldValue< 3 >::Vector > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
const RegionDB & region_db() const
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.
void update_solution(void) override
Input::Array output_array
static Input::Type::AbstractRecord input_type
double scheme_tolerance_
Dual porosity computational scheme tolerance.
void make_reactions()
Resolves construction of following reactions.
unsigned int n_elements() const
void initialize() override
Prepares the object to usage.
static Input::Type::Record input_type
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 cna not read from input, thus muzt be set by copy...
static Input::Type::Selection output_selection
#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
static Input::Type::AbstractRecord input_type
void * xmalloc(size_t size)
Memory allocation with checking.
void set_time(const TimeGovernor &time)
virtual void set_time_governor(TimeGovernor &time)
Support classes for parallel programing.
void set_n_components(unsigned int n_comp)
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.
double ** conc_immobile_out
concentration array output for immobile phase (gathered - sequential)
virtual void update_solution()
void output(OutputTime *stream)
Input::Record input_record_
int * el_4_loc_
Indices of elements belonging to local dofs.
void add_admissible_field_names(const Input::Array &in_array, const Input::Type::Selection &in_sel)
Registers names of output fields that can be written using this stream.
double ** compute_reaction(double **concentrations, int loc_el) override
ReactionTerm & names(const std::vector< string > &names)
Sets the names of substances considered in transport.
#define END_TIMER(tag)
Ends a timer with specified tag.
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 for representation SI units of Fields.
static UnitSI & dimensionless()
Returns dimensionless unit.
Vec * vconc_immobile
PETSC concentration vector for immobile phase (parallel).
Vec * vconc_immobile_out
PETSC concentration vector output for immobile phase (gathered - sequential)
ReactionTerm & concentration_matrix(double **concentration, Distribution *conc_distr, int *el_4_loc, int *row_4_el)
void set_mesh(const Mesh &mesh) override
ElementVector element
Vector of elements of the mesh.
unsigned int lsize(int proc) const
get local size