Flow123d  jenkins-Flow123d-windows-release-multijob-285
transport_operator_splitting.hh
Go to the documentation of this file.
1 #ifndef TRANSPORT_OPERATOR_SPLITTING_HH_
2 #define TRANSPORT_OPERATOR_SPLITTING_HH_
3 
4 #include "coupling/equation.hh"
5 
6 #include <limits>
7 
8 #include "io/output_time.hh"
9 #include "flow/darcy_flow_mh.hh"
10 #include "flow/mh_dofhandler.hh"
12 #include "fields/field_values.hh"
14 #include "transport/substance.hh"
15 
16 
17 /// external types:
18 class Mesh;
19 class ReactionTerm;
21 class Semchem_interface;
22 
23 
24 
25 
26 
27 
28 
30 
31 public:
32 
33  AdvectionProcessBase(Mesh &mesh, const Input::Record in_rec) : EquationBase(mesh, in_rec) {};
34 
35  /**
36  * This method takes sequential PETSc vector of side velocities and update
37  * transport matrix. The ordering is same as ordering of sides in the mesh.
38  * We just keep the pointer, but do not destroy the object.
39  *
40  * TODO: We should pass whole velocity field object (description of base functions and dof numbering) and vector.
41  */
42  virtual void set_velocity_field(const MH_DofHandler &dh) = 0;
43 
44  virtual unsigned int n_substances() = 0;
45 
46  virtual SubstanceList &substances() = 0;
47 
48 
49  /// Common specification of the input record for secondary equations.
51 
52 
53 };
54 
55 
56 
57 /**
58  * @brief Specification of transport model interface.
59  *
60  * Here one has to specify methods for setting or getting data particular to
61  * transport equations.
62  */
64 public:
65 
66  /**
67  * Class with fields that are common to all transport models.
68  */
69  class TransportEqData : public FieldSet {
70  public:
71 
73  inline virtual ~TransportEqData() {};
74 
75  /// Mobile porosity
77 
78  /// Pointer to DarcyFlow field cross_section
80 
81  /// Concentration sources - density of substance source, only positive part is used.
83  /// Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc)
86 
87  };
88 
89  /**
90  * Specification of the output record. Need not to be used by all transport models, but they should
91  * allow output of similar fields.
92  */
94 
95  TransportBase(Mesh &mesh, const Input::Record in_rec);
96  virtual ~TransportBase();
97 
98  virtual void set_velocity_field(const MH_DofHandler &dh) override {
99  mh_dh=&dh;
100  }
101 
102 
103  /// Returns number of trnasported substances.
104  inline unsigned int n_substances() override { return n_subst_; }
105 
106  /// Returns reference to the vector of substnace names.
107  inline SubstanceList &substances() override { return substances_; }
108 
109  virtual void set_concentration_vector(Vec &vec){};
110 
111 
112 protected:
113 
114  /// Returns the region database.
115  const RegionDB *region_db() { return &mesh_->region_db(); }
116 
117  /// Number of transported substances.
118  unsigned int n_subst_;
119 
120  /// Transported substances.
122 
123  /**
124  * Temporary solution how to pass velocity field form the flow model.
125  * TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other
126  * data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.
127  */
129 
130  /// (new) object for calculation and writing the mass balance to file.
131  boost::shared_ptr<Balance> balance_;
132 };
133 
134 
135 
136 /**
137  * @brief Empty transport class.
138  */
140 public:
141  inline TransportNothing(Mesh &mesh_in)
142  : TransportBase(mesh_in, Input::Record() )
143  {
144  // make module solved for ever
145  time_=new TimeGovernor();
146  time_->next_time();
147  };
148 
149  inline virtual ~TransportNothing()
150  {}
151 
152  inline virtual void output_data() override {};
153 
154 
155 };
156 
157 
158 
159 /**
160  * @brief Coupling of a transport model with a reaction model by operator splitting.
161  *
162  * Outline:
163  * Transport model is any descendant of TransportBase (even TransportOperatorSplitting itself). This
164  * should perform the transport possibly with diffusion and usually without coupling between substances and phases.
165  *
166  * Reaction is any descendant of the ReactionBase class. This represents reactions in general way of any coupling that
167  * happens between substances and phases on one element or more generally on one DoF.
168  */
169 
171 public:
172 
173  /**
174  * @brief Declare input record type for the equation TransportOperatorSplittiong.
175  *
176  * TODO: The question is if this should be a general coupling class
177  * (e.g. allow coupling TranportDG with reactions even if it is not good idea for numerical reasons.)
178  * To make this a coupling class we should modify all main input files for transport problems.
179  */
181 
182  /// Constructor.
183  TransportOperatorSplitting(Mesh &init_mesh, const Input::Record &in_rec);
184  /// Destructor.
185  virtual ~TransportOperatorSplitting();
186 
187  virtual void set_velocity_field(const MH_DofHandler &dh) override;
188 
189  void zero_time_step() override;
190  void update_solution() override;
191 
193  void compute_internal_step();
194  void output_data() override ;
195 
196 
197 
198 private:
199 
202 
203  double *** semchem_conc_ptr; //dumb 3-dim array (for phases, which are not supported any more)
205 
206 };
207 
208 
209 
210 
211 
212 #endif // TRANSPORT_OPERATOR_SPLITTING_HH_
virtual unsigned int n_substances()=0
Abstract base class for equation clasess.
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:51
static Input::Type::AbstractRecord input_type
Common specification of the input record for secondary equations.
const RegionDB * region_db()
Returns the region database.
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
virtual void set_velocity_field(const MH_DofHandler &dh) override
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:52
void next_time()
Proceed to the next time according to current estimated time step.
const MH_DofHandler * mh_dh
Coupling of a transport model with a reaction model by operator splitting.
Definition: mesh.h:109
Field< 3, FieldValue< 3 >::Vector > sources_conc
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity.
const RegionDB & region_db() const
Definition: mesh.h:155
virtual void set_velocity_field(const MH_DofHandler &dh) override
Basic time management functionality for unsteady (and steady) solvers (class Equation).
Specification of transport model interface.
Mesh & mesh()
Definition: equation.hh:171
Accessor to the data with type Type::Record.
Definition: accessors.hh:327
Class for declaration of polymorphic Record.
Definition: type_record.hh:487
Mesh * mesh_
Definition: equation.hh:218
virtual void output_data() override
Write computed fields.
boost::shared_ptr< Balance > balance_
(new) object for calculation and writing the mass balance to file.
unsigned int n_subst_
Number of transported substances.
static Input::Type::Record input_type_output_record
virtual void set_concentration_vector(Vec &vec)
Empty transport class.
Field< 3, FieldValue< 3 >::Vector > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc) ...
void output_data() override
Write computed fields.
SubstanceList substances_
Transported substances.
Field< 3, FieldValue< 3 >::Vector > sources_density
Concentration sources - density of substance source, only positive part is used.
Classes for storing substance data.
AdvectionProcessBase(Mesh &mesh, const Input::Record in_rec)
virtual void set_velocity_field(const MH_DofHandler &dh)=0
SubstanceList & substances() override
Returns reference to the vector of substnace names.
mixed-hybrid model of linear Darcy flow, possibly unsteady.
TransportBase(Mesh &mesh, const Input::Record in_rec)
unsigned int n_substances() override
Returns number of trnasported substances.
Record type proxy class.
Definition: type_record.hh:169
static Input::Type::Record input_type
Declare input record type for the equation TransportOperatorSplittiong.
virtual SubstanceList & substances()=0
TransportOperatorSplitting(Mesh &init_mesh, const Input::Record &in_rec)
Constructor.
TimeGovernor * time_
Definition: equation.hh:219
virtual ~TransportOperatorSplitting()
Destructor.