Flow123d
dual_por_exchange.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
10 #define DUAL_POROSITY
11 
12 #include <vector>
13 #include <input/input_type.hh>
14 
15 #include "fields/field_base.hh"
16 #include "fields/field_set.hh"
17 #include "./reaction/reaction.hh"
18 
19 class Mesh;
20 class Distribution;
21 class SorptionBase;
22 
24 {
25 public:
26  /**
27  * Static variable for new input data types input
28  */
30 
31  class EqData : public FieldSet // should be written in class Sorption
32  {
33  public:
34 
35  /// Collect all fields
36  EqData();
37 
38  Field<3, FieldValue<3>::Vector > diffusion_rate_immobile; ///< Mass transfer coefficients between mobile and immobile pores.
39  Field<3, FieldValue<3>::Scalar > porosity_immobile; ///< Immobile porosity field.
40 
41  Field<3, FieldValue<3>::Vector> init_conc_immobile; ///< Initial concentrations in the immobile zone.
42 
43  Field<3, FieldValue<3>::Scalar > porosity; ///< Porosity field.
44 
45  MultiField<3, FieldValue<3>::Scalar> conc_immobile; ///< Calculated concentrations in the immobile zone.
46 
47  /// Fields indended for output, i.e. all input fields plus those representing solution.
49 
51  };
52 
53  DualPorosity(Mesh &init_mesh, Input::Record in_rec);
54  /**
55  * Destructor.
56  */
57  ~DualPorosity(void);
58 
59  void make_reactions();
60 
61  /**
62  * Updates the solution according to the dual porosity model.
63  */
64  void update_solution(void) override;
65 
66  /**
67  * Initialization routines after all necessary members have been set.
68  * It also sets and initializes possible following reaction models.
69  */
70  void zero_time_step() override;
71 
72  void output_data(void) override;
73  void output_vector_gather(void) override;
74 
75  /**
76  * Set the porosity field which is passed from transport.
77  */
78  void set_porosity(Field<3, FieldValue<3>::Scalar > &por_m);
79 
80  double **compute_reaction(double **concentrations, int loc_el) override;
81 
82 protected:
83  /**
84  * This method disables to use constructor without parameters.
85  */
86  DualPorosity();
87 
88  void allocate_output_mpi(void);
89 
90  /**
91  * Pointer to thwodimensional array[species][elements] containing concentrations either in immobile.
92  */
93  double **conc_immobile;
94 
95  /**
96  * Equation data - all data field are in this set.
97  */
99 
101 
102  /**
103  * Input data set - fields in this set are read from the input file.
104  */
106 
107  ReactionTerm *reaction_mobile; ///< Reaction running in mobile zone
108  ReactionTerm *reaction_immobile; ///< Reaction running in immobile zone
109 
110  /** Minimal time for which the analytical solution of dual porosity concentrations are evaluated.
111  * Else it is replaced with simple forward difference approximation.
112  */
113  static const double min_dt;
114 
115  ///@name members used in output routines
116  //@{
117  Vec *vconc_immobile; ///< PETSC concentration vector for immobile phase (parallel).
118  Vec *vconc_immobile_out; ///< PETSC concentration vector output for immobile phase (gathered - sequential)
119  double **conc_immobile_out; ///< concentration array output for immobile phase (gathered - sequential)
120  //@}
121 
122 };
123 
124 #endif //DUAL_POROSITY