Flow123d  jenkins-Flow123d-linux-release-multijob-198
dual_porosity.hh
Go to the documentation of this file.
1 /** @brief Class Dual_por_exchange implements the model of dual porosity.
2  *
3  * It can be part of the transport model and it computes the concentrations of substances both in
4  * mobile and immobile zone. This model can also work above the sorption model - the sorbed concentration
5  * is then computed both from mobile and immobile concentrations. Linear reactions can be define
6  * also in both zones.
7  *
8  */
9 #ifndef DUAL_POROSITY_H_
10 #define DUAL_POROSITY_H_
11 
12 #include <vector>
13 #include "input/accessors.hh"
14 
16 #include "fields/field_set.hh"
17 #include "fields/multi_field.hh"
18 #include "fields/vec_seq_double.hh"
20 
21 class Mesh;
22 
23 /// Class representing dual porosity model in transport.
25 {
26 public:
27  /**
28  * Static variable for new input data types input
29  */
31 
32  /// DualPorosity data
33  class EqData : public FieldSet
34  {
35  public:
36 
37  /// Collect all fields
38  EqData();
39 
40  Field<3, FieldValue<3>::Vector > diffusion_rate_immobile; ///< Mass transfer coefficients between mobile and immobile pores.
41  Field<3, FieldValue<3>::Scalar > porosity_immobile; ///< Immobile porosity field.
42 
43  Field<3, FieldValue<3>::Vector> init_conc_immobile; ///< Initial concentrations in the immobile zone.
44 
45  Field<3, FieldValue<3>::Scalar > porosity; ///< Porosity field.
46 
47  MultiField<3, FieldValue<3>::Scalar> conc_immobile; ///< Calculated concentrations in the immobile zone.
48 
49  /// Fields indended for output, i.e. all input fields plus those representing solution.
51 
53  };
54 
55  /// Constructor.
56  DualPorosity(Mesh &init_mesh, Input::Record in_rec);
57 
58  ///Destructor.
59  ~DualPorosity(void);
60 
61  /// Prepares the object to usage.
62  /**
63  * Allocating memory, reading input, initialization of fields.
64  */
65  void initialize() override;
66 
67  /**
68  * Does first computation after initialization process.
69  * The time is set and initial condition is set and output.
70  */
71  void zero_time_step() override;
72 
73  /**
74  * Updates the solution according to the dual porosity model.
75  */
76  void update_solution(void) override;
77 
78  /// Main output routine.
79  void output_data(void) override;
80 
81 protected:
82  /**
83  * This method disables to use constructor without parameters.
84  */
85  DualPorosity();
86 
87  /// Resolves construction of following reactions.
88  void make_reactions();
89 
90  /// Sets initial condition from input.
91  void set_initial_condition();
92  /// Initializes field sets.
93  void initialize_fields();
94  /// Allocates petsc vectors, prepares them for output and creates output vector scatter.
95  void allocate_output_mpi(void);
96 
97  double **compute_reaction(double **concentrations, int loc_el) override;
98 
99  /// Gathers all the parallel vectors to enable them to be output.
100  void output_vector_gather(void) override;
101 
102  /**
103  * Pointer to twodimensional array[substance][elements] containing concentrations either in immobile.
104  */
105  double **conc_immobile;
106 
107  /**
108  * Equation data - all data fields are in this set.
109  */
111 
113 
114  /**
115  * Input data set - fields in this set are read from the input file.
116  */
118 
119  ReactionTerm *reaction_mobile; ///< Reaction running in mobile zone
120  ReactionTerm *reaction_immobile; ///< Reaction running in immobile zone
121 
122  /// Dual porosity computational scheme tolerance.
123  /** According to this tolerance the analytical solution of dual porosity concentrations or
124  * simple forward difference approximation of concentrations is chosen for computation.
125  */
127 
128  ///@name members used in output routines
129  //@{
130  VecScatter vconc_out_scatter; ///< Output vector scatter.
131  Vec *vconc_immobile; ///< PETSC concentration vector for immobile phase (parallel).
132  std::vector<VectorSeqDouble> conc_immobile_out; ///< concentration array output for immobile phase (gathered - sequential)
133  //@}
134 
135 };
136 
137 #endif //DUAL_POROSITY_H_
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:51
void set_initial_condition()
Sets initial condition from input.
VecScatter vconc_out_scatter
Output vector scatter.
Accessor to input data conforming to declared Array.
Definition: accessors.hh:558
void output_data(void) override
Main output routine.
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.
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:52
void zero_time_step() override
Definition: mesh.h:109
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)
Field< 3, FieldValue< 3 >::Vector > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
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
double scheme_tolerance_
Dual porosity computational scheme tolerance.
void make_reactions()
Resolves construction of following reactions.
void initialize() override
Prepares the object to usage.
static Input::Type::Selection output_selection
Accessor to the data with type Type::Record.
Definition: accessors.hh:327
void initialize_fields()
Initializes field sets.
EqData()
Collect all fields.
static Input::Type::Record input_type
Class representing dual porosity model in transport.
double ** conc_immobile
ReactionTerm * reaction_immobile
Reaction running in immobile zone.
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 ** compute_reaction(double **concentrations, int loc_el) override
ReactionTerm * reaction_mobile
Reaction running in mobile zone.
Record type proxy class.
Definition: type_record.hh:169
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field.
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:45
DualPorosity data.
Vec * vconc_immobile
PETSC concentration vector for immobile phase (parallel).
Template for classes storing finite set of named values.
FieldSet input_data_set_