Flow123d  build_with_4.0.3-c0baa07
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 template<unsigned int dim> class InitConditionAssemblyDp;
48 template<unsigned int dim> class ReactionAssemblyDp;
49 template< template<IntDim...> class DimAssembly> class GenericAssembly;
50 
51 
52 /// Class representing dual porosity model in transport.
54 {
55 public:
57 
58  /**
59  * Static variable for new input data types input
60  */
61  static const Input::Type::Record & get_input_type();
62 
63  /// DualPorosity fields
65  {
66  public:
67 
68  /// Collect all fields
69  EqFields();
70 
71  MultiField<3, FieldValue<3>::Scalar > diffusion_rate_immobile; ///< Mass transfer coefficients between mobile and immobile pores.
72  Field<3, FieldValue<3>::Scalar > porosity_immobile; ///< Immobile porosity field.
73 
74  MultiField<3, FieldValue<3>::Scalar> init_conc_immobile; ///< Initial concentrations in the immobile zone.
75 
76  Field<3, FieldValue<3>::Scalar > porosity; ///< Porosity field.
77 
78  MultiField<3, FieldValue<3>::Scalar> conc_immobile; ///< Calculated concentrations in the immobile zone.
79  FieldFEScalarVec conc_immobile_fe; ///< Underlaying FieldFE for each substance of conc_immobile.
80 
81  /// Fields indended for output, i.e. all input fields plus those representing solution.
83 
84  };
85 
86  /// DualPorosity data
88  {
89  public:
90 
91  /// Constructor
92  EqData();
93 
94  /// Dual porosity computational scheme tolerance.
95  /** According to this tolerance the analytical solution of dual porosity concentrations or
96  * simple forward difference approximation of concentrations is chosen for computation.
97  */
99 
100  /// TimeGovernor object shared with assembly classes.
102 
103  };
104 
105  /// Constructor.
106  DualPorosity(Mesh &init_mesh, Input::Record in_rec);
107 
108  ///Destructor.
109  ~DualPorosity(void);
110 
111  /// Prepares the object to usage.
112  /**
113  * Allocating memory, reading input, initialization of fields.
114  */
115  void initialize() override;
116 
117  /**
118  * Does first computation after initialization process.
119  * The time is set and initial condition is set and output.
120  */
121  void zero_time_step() override;
122 
123  /**
124  * Updates the solution according to the dual porosity model.
125  */
126  void update_solution(void) override;
127 
128  /// Main output routine.
129  void output_data(void) override;
130 
131 protected:
132  /**
133  * This method disables to use constructor without parameters.
134  */
136 
137  /// Resolves construction of following reactions.
138  void make_reactions();
139 
140  /// Initializes field sets.
141  void initialize_fields();
142 
143  /// Compute reaction on a single element.
144  void compute_reaction(const DHCellAccessor& dh_cell) override;
145 
146  std::shared_ptr<EqFields> eq_fields_; ///< Equation fields - all fields are in this set.
147  std::shared_ptr<EqData> eq_data_; ///< Equation data
148 
149  /**
150  * Input data set - fields in this set are read from the input file.
151  */
153 
154  std::shared_ptr<ReactionTerm> reaction_mobile; ///< Reaction running in mobile zone
155  std::shared_ptr<ReactionTerm> reaction_immobile; ///< Reaction running in immobile zone
156 
157  /// general assembly objects, hold assembly objects of appropriate dimension
160 
161 private:
162  /// Registrar of class to factory
163  static const int registrar;
164 
165 };
166 
167 #endif //DUAL_POROSITY_H_
Cell accessor allow iterate over DOF handler cells.
DualPorosity data.
TimeGovernor * time_
TimeGovernor object shared with assembly classes.
double scheme_tolerance_
Dual porosity computational scheme tolerance.
EqData()
Constructor.
DualPorosity fields.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
FieldFEScalarVec conc_immobile_fe
Underlaying FieldFE for each substance of conc_immobile.
MultiField< 3, FieldValue< 3 >::Scalar > conc_immobile
Calculated concentrations in the immobile zone.
EqFields()
Collect all fields.
MultiField< 3, FieldValue< 3 >::Scalar > init_conc_immobile
Initial concentrations in the immobile zone.
MultiField< 3, FieldValue< 3 >::Scalar > diffusion_rate_immobile
Mass transfer coefficients between mobile and immobile pores.
Field< 3, FieldValue< 3 >::Scalar > porosity_immobile
Immobile porosity field.
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity field.
Class representing dual porosity model in transport.
GenericAssembly< InitConditionAssemblyDp > * init_condition_assembly_
general assembly objects, hold assembly objects of appropriate dimension
void update_solution(void) override
GenericAssembly< ReactionAssemblyDp > * reaction_assembly_
~DualPorosity(void)
Destructor.
std::shared_ptr< ReactionTerm > reaction_mobile
Reaction running in mobile zone.
void zero_time_step() override
static const Input::Type::Record & get_input_type()
void compute_reaction(const DHCellAccessor &dh_cell) override
Compute reaction on a single element.
void initialize_fields()
Initializes field sets.
std::shared_ptr< EqData > eq_data_
Equation data.
void initialize() override
Prepares the object to usage.
static const int registrar
Registrar of class to factory.
std::shared_ptr< EqFields > eq_fields_
Equation fields - all fields are in this set.
ReactionTerm FactoryBaseType
void output_data(void) override
Main output routine.
std::shared_ptr< ReactionTerm > reaction_immobile
Reaction running in immobile zone.
void make_reactions()
Resolves construction of following reactions.
FieldSet input_field_set_
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:92
Generic class of assemblation.
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Record type proxy class.
Definition: type_record.hh:182
Definition: mesh.h:362
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:87
Reaction data.
Basic time management functionality for unsteady (and steady) solvers (class Equation).
unsigned int IntDim
A dimension index type.
Definition: mixed.hh:19
Abstract linear system class.
Definition: balance.hh:40
Class ReactionTerm is an abstract class representing reaction term in transport.