Flow123d  JS_before_hm-2115-gf629a871a
dual_porosity.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file dual_porosity.hh
15  * @brief Class Dual_por_exchange implements the model of dual porosity.
16  *
17  * It can be part of the transport model and it computes the concentrations of substances both in
18  * mobile and immobile zone. This model can also work above the sorption model - the sorbed concentration
19  * is then computed both from mobile and immobile concentrations. Linear reactions can be define
20  * also in both zones.
21  */
22 
23 #ifndef DUAL_POROSITY_H_
24 #define DUAL_POROSITY_H_
25 
26 
27 #include <memory> // for shared_ptr
28 #include <vector>
29 #include "fields/field.hh" // for Field
30 #include "fields/field_values.hh" // for FieldValue<>::Scalar, FieldValue
31 #include "fields/field_set.hh"
32 #include "fields/multi_field.hh"
33 #include "la/vector_mpi.hh"
35 #include "input/type_base.hh" // for Array
36 #include "input/type_generic.hh" // for Instance
37 #include "petscvec.h" // for Vec, VecScatter, _p_VecScatter
38 #include "reaction/reaction_term.hh" // for ReactionTerm
39 
40 class Mesh;
41 namespace Input {
42  class Record;
43  namespace Type {
44  class Record;
45  }
46 }
47 
48 
49 /// Class representing dual porosity model in transport.
51 {
52 public:
54 
55  /**
56  * Static variable for new input data types input
57  */
58  static const Input::Type::Record & get_input_type();
59 
60  /// DualPorosity fields
62  {
63  public:
64 
65  /// Collect all fields
66  EqFields();
67 
68  MultiField<3, FieldValue<3>::Scalar > diffusion_rate_immobile; ///< Mass transfer coefficients between mobile and immobile pores.
69  Field<3, FieldValue<3>::Scalar > porosity_immobile; ///< Immobile porosity field.
70 
71  MultiField<3, FieldValue<3>::Scalar> init_conc_immobile; ///< Initial concentrations in the immobile zone.
72 
73  Field<3, FieldValue<3>::Scalar > porosity; ///< Porosity field.
74 
75  MultiField<3, FieldValue<3>::Scalar> conc_immobile; ///< Calculated concentrations in the immobile zone.
76  FieldFEScalarVec conc_immobile_fe; ///< Underlaying FieldFE for each substance of conc_immobile.
77 
78  /// Fields indended for output, i.e. all input fields plus those representing solution.
80 
81  };
82 
83  /// Constructor.
84  DualPorosity(Mesh &init_mesh, Input::Record in_rec);
85 
86  ///Destructor.
87  ~DualPorosity(void);
88 
89  /// Prepares the object to usage.
90  /**
91  * Allocating memory, reading input, initialization of fields.
92  */
93  void initialize() override;
94 
95  /**
96  * Does first computation after initialization process.
97  * The time is set and initial condition is set and output.
98  */
99  void zero_time_step() override;
100 
101  /**
102  * Updates the solution according to the dual porosity model.
103  */
104  void update_solution(void) override;
105 
106  /// Main output routine.
107  void output_data(void) override;
108 
109 protected:
110  /**
111  * This method disables to use constructor without parameters.
112  */
113  DualPorosity();
114 
115  /// Resolves construction of following reactions.
116  void make_reactions();
117 
118  /// Sets initial condition from input.
119  void set_initial_condition();
120  /// Initializes field sets.
121  void initialize_fields();
122 
123  /// Compute reaction on a single element.
124  void compute_reaction(const DHCellAccessor& dh_cell) override;
125 
126  std::shared_ptr<EqFields> eq_fields_; ///< Equation fields - all fields are in this set.
127 
128  /**
129  * Input data set - fields in this set are read from the input file.
130  */
132 
133  std::shared_ptr<ReactionTerm> reaction_mobile; ///< Reaction running in mobile zone
134  std::shared_ptr<ReactionTerm> reaction_immobile; ///< Reaction running in immobile zone
135 
136  /// Dual porosity computational scheme tolerance.
137  /** According to this tolerance the analytical solution of dual porosity concentrations or
138  * simple forward difference approximation of concentrations is chosen for computation.
139  */
141 
142 private:
143  /// Registrar of class to factory
144  static const int registrar;
145 
146 };
147 
148 #endif //DUAL_POROSITY_H_
DualPorosity::EqFields::EqFields
EqFields()
Collect all fields.
Definition: dual_porosity.cc:72
DualPorosity::registrar
static const int registrar
Registrar of class to factory.
Definition: dual_porosity.hh:144
DualPorosity::EqFields::diffusion_rate_immobile
MultiField< 3, FieldValue< 3 >::Scalar > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
Definition: dual_porosity.hh:68
DualPorosity::initialize
void initialize() override
Prepares the object to usage.
Definition: dual_porosity.cc:158
vector_mpi.hh
DualPorosity::scheme_tolerance_
double scheme_tolerance_
Dual porosity computational scheme tolerance.
Definition: dual_porosity.hh:140
Input
Abstract linear system class.
Definition: balance.hh:40
DualPorosity::eq_fields_
std::shared_ptr< EqFields > eq_fields_
Equation fields - all fields are in this set.
Definition: dual_porosity.hh:126
field_set.hh
DualPorosity::compute_reaction
void compute_reaction(const DHCellAccessor &dh_cell) override
Compute reaction on a single element.
Definition: dual_porosity.cc:283
DualPorosity::update_solution
void update_solution(void) override
Definition: dual_porosity.cc:267
DualPorosity::DualPorosity
DualPorosity()
DualPorosity::EqFields::init_conc_immobile
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_immobile
Initial concentrations in the immobile zone.
Definition: dual_porosity.hh:71
DualPorosity::EqFields::conc_immobile_fe
FieldFEScalarVec conc_immobile_fe
Underlaying FieldFE for each substance of conc_immobile.
Definition: dual_porosity.hh:76
ReactionTerm::EqFields
Reaction data.
Definition: reaction_term.hh:65
DualPorosity
Class representing dual porosity model in transport.
Definition: dual_porosity.hh:50
type_base.hh
DualPorosity::make_reactions
void make_reactions()
Resolves construction of following reactions.
Definition: dual_porosity.cc:133
equation_output.hh
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
DualPorosity::input_field_set_
FieldSet input_field_set_
Definition: dual_porosity.hh:131
type_generic.hh
EquationOutput
Definition: equation_output.hh:44
DualPorosity::reaction_mobile
std::shared_ptr< ReactionTerm > reaction_mobile
Reaction running in mobile zone.
Definition: dual_porosity.hh:133
field_values.hh
DualPorosity::EqFields::porosity_immobile
Field< 3, FieldValue< 3 >::Scalar > porosity_immobile
Immobile porosity field.
Definition: dual_porosity.hh:69
DualPorosity::~DualPorosity
~DualPorosity(void)
Destructor.
Definition: dual_porosity.cc:128
FieldSet
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
DualPorosity::EqFields::porosity
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field.
Definition: dual_porosity.hh:73
DualPorosity::set_initial_condition
void set_initial_condition()
Sets initial condition from input.
Definition: dual_porosity.cc:253
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
DualPorosity::reaction_immobile
std::shared_ptr< ReactionTerm > reaction_immobile
Reaction running in immobile zone.
Definition: dual_porosity.hh:134
DualPorosity::output_data
void output_data(void) override
Main output routine.
Definition: dual_porosity.cc:350
Mesh
Definition: mesh.h:355
DualPorosity::EqFields
DualPorosity fields.
Definition: dual_porosity.hh:61
multi_field.hh
DualPorosity::zero_time_step
void zero_time_step() override
Definition: dual_porosity.cc:216
DHCellAccessor
Cell accessor allow iterate over DOF handler cells.
Definition: dh_cell_accessor.hh:43
DualPorosity::get_input_type
static const Input::Type::Record & get_input_type()
Definition: dual_porosity.cc:47
MultiField
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:87
DualPorosity::EqFields::output_fields
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
Definition: dual_porosity.hh:79
DualPorosity::initialize_fields
void initialize_fields()
Initializes field sets.
Definition: dual_porosity.cc:186
Field
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:93
ReactionTerm::FieldFEScalarVec
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > FieldFEScalarVec
Definition: reaction_term.hh:54
reaction_term.hh
Class ReactionTerm is an abstract class representing reaction term in transport.
ReactionTerm
Definition: reaction_term.hh:46
field.hh
DualPorosity::FactoryBaseType
ReactionTerm FactoryBaseType
Definition: dual_porosity.hh:53
DualPorosity::EqFields::conc_immobile
MultiField< 3, FieldValue< 3 >::Scalar > conc_immobile
Calculated concentrations in the immobile zone.
Definition: dual_porosity.hh:75