Flow123d  JS_before_hm-937-g93502c2
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 #include <boost/exception/info.hpp> // for operator<<, error_info::error_i...
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 data
61  class EqData : public FieldSet
62  {
63  public:
64 
65  /// Collect all fields
66  EqData();
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 
77  /// Fields indended for output, i.e. all input fields plus those representing solution.
79 
80  };
81 
82  /// Constructor.
83  DualPorosity(Mesh &init_mesh, Input::Record in_rec);
84 
85  ///Destructor.
86  ~DualPorosity(void);
87 
88  /// Prepares the object to usage.
89  /**
90  * Allocating memory, reading input, initialization of fields.
91  */
92  void initialize() override;
93 
94  /**
95  * Does first computation after initialization process.
96  * The time is set and initial condition is set and output.
97  */
98  void zero_time_step() override;
99 
100  /**
101  * Updates the solution according to the dual porosity model.
102  */
103  void update_solution(void) override;
104 
105  /// Main output routine.
106  void output_data(void) override;
107 
108  bool evaluate_time_constraint(double &time_constraint) override;
109 
110 protected:
111  /**
112  * This method disables to use constructor without parameters.
113  */
114  DualPorosity();
115 
116  /// Resolves construction of following reactions.
117  void make_reactions();
118 
119  /// Sets initial condition from input.
120  void set_initial_condition();
121  /// Initializes field sets.
122  void initialize_fields();
123 
124  double **compute_reaction(double **concentrations, int loc_el) override;
125 
126  /**
127  * Pointer to twodimensional array[substance][elements] containing concentrations either in immobile.
128  */
129  double **conc_immobile;
130 
131  /**
132  * Equation data - all data fields are in this set.
133  */
135 
136  /**
137  * Input data set - fields in this set are read from the input file.
138  */
140 
141  std::shared_ptr<ReactionTerm> reaction_mobile; ///< Reaction running in mobile zone
142  std::shared_ptr<ReactionTerm> reaction_immobile; ///< Reaction running in immobile zone
143 
144  /// Dual porosity computational scheme tolerance.
145  /** According to this tolerance the analytical solution of dual porosity concentrations or
146  * simple forward difference approximation of concentrations is chosen for computation.
147  */
149 
150  ///@name members used in output routines
151  //@{
152  std::vector<VectorMPI> conc_immobile_out; ///< concentration array output for immobile phase (parallel, shared with FieldFE)
153  //@}
154 
155 private:
156  /// Registrar of class to factory
157  static const int registrar;
158 
159 };
160 
161 #endif //DUAL_POROSITY_H_
ReactionTerm FactoryBaseType
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:74
std::shared_ptr< ReactionTerm > reaction_mobile
Reaction running in mobile zone.
std::vector< VectorMPI > conc_immobile_out
concentration array output for immobile phase (parallel, shared with FieldFE)
MultiField< 3, FieldValue< 3 >::Scalar > conc_immobile
Calculated concentrations in the immobile zone.
Abstract linear system class.
Definition: balance.hh:40
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:92
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
Definition: mesh.h:78
Field< 3, FieldValue< 3 >::Scalar > porosity_immobile
Immobile porosity field.
Class ReactionTerm is an abstract class representing reaction term in transport.
double scheme_tolerance_
Dual porosity computational scheme tolerance.
std::shared_ptr< ReactionTerm > reaction_immobile
Reaction running in immobile zone.
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
Class representing dual porosity model in transport.
double ** conc_immobile
MultiField< 3, FieldValue< 3 >::Scalar > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
static const int registrar
Registrar of class to factory.
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_immobile
Initial concentrations in the immobile zone.
Record type proxy class.
Definition: type_record.hh:182
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:89
DualPorosity data.
FieldSet input_data_set_