Flow123d  jenkins-Flow123d-windows32-release-multijob-51
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 #include "io/output.h"
8 #include "flow/darcy_flow_mh.hh"
9 #include "flow/mh_dofhandler.hh"
11 #include "fields/field_values.hh"
13 
14 
15 /// external types:
16 class Mesh;
17 class ReactionTerm;
19 class Semchem_interface;
20 
21 
22 
23 
24 
26 
27 public:
28 
29  AdvectionProcessBase(Mesh &mesh, const Input::Record in_rec) : EquationBase(mesh, in_rec) {};
30 
31  /**
32  * This method takes sequential PETSc vector of side velocities and update
33  * transport matrix. The ordering is same as ordering of sides in the mesh.
34  * We just keep the pointer, but do not destroy the object.
35  *
36  * TODO: We should pass whole velocity field object (description of base functions and dof numbering) and vector.
37  */
38  virtual void set_velocity_field(const MH_DofHandler &dh) = 0;
39 
40  virtual unsigned int n_substances() = 0;
41 
42  virtual vector<string> &substance_names() = 0;
43 
44 
45  /// Common specification of the input record for secondary equations.
47 
48 
49 };
50 
51 
52 
53 /**
54  * @brief Specification of transport model interface.
55  *
56  * Here one has to specify methods for setting or getting data particular to
57  * transport equations.
58  */
60 public:
61 
62  /**
63  * Class with fields that are common to all transport models.
64  */
65  class TransportEqData : public FieldSet {
66  public:
67 
69  inline virtual ~TransportEqData() {};
70 
71  /// Mobile porosity
73 
74  /// Pointer to DarcyFlow field cross_section
76 
77  /// Concentration sources - density of substance source, only positive part is used.
79  /// Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc)
82 
83  };
84 
85  /**
86  * Specification of the output record. Need not to be used by all transport models, but they should
87  * allow output of similar fields.
88  */
90 
91  TransportBase(Mesh &mesh, const Input::Record in_rec);
92  virtual ~TransportBase();
93 
94  virtual void set_velocity_field(const MH_DofHandler &dh) override {
95  mh_dh=&dh;
96  }
97 
98  /**
99  * Getter for mass balance class
100  */
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 vector<string> &substance_names() override { return subst_names_; }
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  /// Names of 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  /// object for calculation and writing the mass balance to file.
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  TimeIntegrationScheme time_scheme() override { return none; }
155 
156 private:
157 
158  inline void calc_fluxes(vector<vector<double> > &bcd_balance, vector<vector<double> > &bcd_plus_balance, vector<vector<double> > &bcd_minus_balance) override {};
159  inline void calc_elem_sources(vector<vector<double> > &mass, vector<vector<double> > &src_balance) override {};
160 
161 };
162 
163 
164 
165 /**
166  * @brief Coupling of a transport model with a reaction model by operator splitting.
167  *
168  * Outline:
169  * Transport model is any descendant of TransportBase (even TransportOperatorSplitting itself). This
170  * should perform the transport possibly with diffusion and usually without coupling between substances and phases.
171  *
172  * Reaction is any descendant of the ReactionBase class. This represents reactions in general way of any coupling that
173  * happens between substances and phases on one element or more generally on one DoF.
174  */
175 
177 public:
178 
179  /**
180  * @brief Declare input record type for the equation TransportOperatorSplittiong.
181  *
182  * TODO: The question is if this should be a general coupling class
183  * (e.g. allow coupling TranportDG with reactions even if it is not good idea for numerical reasons.)
184  * To make this a coupling class we should modify all main input files for transport problems.
185  */
187 
188  /// Constructor.
189  TransportOperatorSplitting(Mesh &init_mesh, const Input::Record &in_rec);
190  /// Destructor.
191  virtual ~TransportOperatorSplitting();
192 
193  virtual void set_velocity_field(const MH_DofHandler &dh) override;
194 
195  void zero_time_step() override;
196  void update_solution() override;
197 
199  void compute_internal_step();
200  void output_data() override ;
201 
202 
203  TimeIntegrationScheme time_scheme() override { return none; }
204 
205 
206 private:
207  /**
208  * Implements the virtual method EquationForMassBalance::calc_fluxes().
209  */
210  void calc_fluxes(vector<vector<double> > &bcd_balance, vector<vector<double> > &bcd_plus_balance, vector<vector<double> > &bcd_minus_balance) override;
211  /**
212  * Implements the virtual method EquationForMassBalance::calc_elem_sources().
213  */
214  void calc_elem_sources(vector<vector<double> > &mass, vector<vector<double> > &src_balance) override;
215 
218 
220 
221 };
222 
223 
224 
225 
226 
227 #endif // TRANSPORT_OPERATOR_SPLITTING_HH_
virtual unsigned int n_substances()=0
Returns number of trnasported substances.
Abstract base class for equation clasess.
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:51
void calc_elem_sources(vector< vector< double > > &mass, vector< vector< double > > &src_balance) override
Header: The functions for all outputs.
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.
void calc_fluxes(vector< vector< double > > &bcd_balance, vector< vector< double > > &bcd_plus_balance, vector< vector< double > > &bcd_minus_balance) override
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:48
void next_time()
Proceed to the next time according to current estimated time step.
const MH_DofHandler * mh_dh
MassBalance * mass_balance_
object for calculation and writing the mass balance to file.
Coupling of a transport model with a reaction model by operator splitting.
Definition: mesh.h:108
Field< 3, FieldValue< 3 >::Vector > sources_conc
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity.
const RegionDB & region_db() const
Definition: mesh.h:148
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
Class for calculation and writing the balance of mass, volume sources and fluxes. ...
Definition: mass_balance.hh:82
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
Class for declaration of polymorphic Record.
Definition: type_record.hh:463
Mesh * mesh_
Definition: equation.hh:218
virtual void output_data() override
Write computed fields.
TimeIntegrationScheme time_scheme() override
Returns the time integration scheme of the equation.
unsigned int n_subst_
Number of transported substances.
static Input::Type::Record input_type_output_record
vector< string > & substance_names() override
Returns reference to the vector of substnace names.
void calc_fluxes(vector< vector< double > > &bcd_balance, vector< vector< double > > &bcd_plus_balance, vector< vector< double > > &bcd_minus_balance) override
virtual void set_concentration_vector(Vec &vec)
std::vector< string > subst_names_
Names of transported substances.
Empty transport class.
Field< 3, FieldValue< 3 >::Vector > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc) ...
void calc_elem_sources(vector< vector< double > > &mass, vector< vector< double > > &src_balance) override
void output_data() override
Write computed fields.
Field< 3, FieldValue< 3 >::Vector > sources_density
Concentration sources - density of substance source, only positive part is used.
TimeIntegrationScheme time_scheme() override
Returns the time integration scheme of the equation.
virtual vector< string > & substance_names()=0
Returns reference to the vector of substnace names.
AdvectionProcessBase(Mesh &mesh, const Input::Record in_rec)
virtual void set_velocity_field(const MH_DofHandler &dh)=0
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:161
static Input::Type::Record input_type
Declare input record type for the equation TransportOperatorSplittiong.
TransportOperatorSplitting(Mesh &init_mesh, const Input::Record &in_rec)
Constructor.
TimeGovernor * time_
Definition: equation.hh:219
virtual ~TransportOperatorSplitting()
Destructor.