Flow123d
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
flow123d
src
transport
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
"
10
#include "
fields/field_base.hh
"
11
#include "
fields/field_values.hh
"
12
#include "
transport/mass_balance.hh
"
13
14
15
/// external types:
16
//class LinSys;
17
//struct Solver;
18
class
Mesh
;
19
//class SchurComplement;
20
//class Distribution;
21
//class SparseGraph;
22
23
class
ReactionTerm
;
24
class
ConvectionTransport
;
25
26
class
Semchem_interface
;
27
28
29
30
31
32
class
AdvectionProcessBase
:
public
EquationBase
,
public
EquationForMassBalance
{
33
34
public
:
35
36
AdvectionProcessBase
(
Mesh
&
mesh
,
const
Input::Record
in_rec) :
EquationBase
(mesh, in_rec) {};
37
38
/**
39
* This method takes sequential PETSc vector of side velocities and update
40
* transport matrix. The ordering is same as ordering of sides in the mesh.
41
* We just keep the pointer, but do not destroy the object.
42
*
43
* TODO: We should pass whole velocity field object (description of base functions and dof numbering) and vector.
44
*/
45
virtual
void
set_velocity_field
(
const
MH_DofHandler
&dh) = 0;
46
47
48
49
//virtual void set_cross_section_field(const Field< 3, FieldValue<3>::Scalar > &cross_section) = 0;
50
51
virtual
unsigned
int
n_substances
() = 0;
52
53
virtual
vector<string>
&
substance_names
() = 0;
54
55
56
/// Common specification of the input record for secondary equations.
57
static
Input::Type::AbstractRecord
input_type
;
58
59
60
};
61
62
63
64
/**
65
* @brief Specification of transport model interface.
66
*
67
* Here one has to specify methods for setting or getting data particular to
68
* transport equations.
69
*/
70
class
TransportBase
:
public
AdvectionProcessBase
{
71
public
:
72
73
/**
74
* Class with fields that are common to all transport models.
75
*/
76
class
TransportEqData
:
public
FieldSet
{
77
public
:
78
79
TransportEqData
();
80
inline
virtual
~TransportEqData
() {};
81
/*
82
Input::Type::Record boundary_input_type() {
83
return EqDataBase::boundary_input_type()
84
.declare_key(OldBcdInput::transport_old_bcd_file_key(), IT::FileName::input(), "Input file with boundary conditions (obsolete).");
85
}
86
*/
87
/// Mobile porosity
88
Field<3, FieldValue<3>::Scalar
>
porosity
;
89
90
/// Pointer to DarcyFlow field cross_section
91
Field<3, FieldValue<3>::Scalar
>
cross_section
;
92
93
/// Concentration sources - density of substance source, only positive part is used.
94
Field<3, FieldValue<3>::Vector
>
sources_density
;
95
/// Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc)
96
Field<3, FieldValue<3>::Vector
>
sources_sigma
;
97
Field<3, FieldValue<3>::Vector
>
sources_conc
;
98
99
};
100
101
/**
102
* Specification of the output record. Need not to be used by all transport models, but they should
103
* allow output of similar fields.
104
*/
105
static
Input::Type::Record
input_type_output_record
;
106
107
TransportBase
(
Mesh
&
mesh
,
const
Input::Record
in_rec);
108
virtual
~TransportBase
();
109
110
virtual
void
set_velocity_field
(
const
MH_DofHandler
&dh) {
111
mh_dh
=&dh;
112
}
113
114
115
116
/**
117
* @brief Sets pointer to data of other equations.
118
* TODO: there should be also passed the sigma parameter between dimensions
119
* @param cross_section is pointer to cross_section data of Darcy flow equation
120
*/
121
//virtual void set_cross_section_field(Field<3, FieldValue<3>::Scalar > *cross_section) =0;
122
123
/**
124
* Getter for mass balance class
125
*/
126
MassBalance
*
mass_balance
() {
return
mass_balance_
; }
127
128
/// Returns number of trnasported substances.
129
inline
unsigned
int
n_substances
() {
return
n_subst_
; }
130
131
/// Returns reference to the vector of substnace names.
132
inline
vector<string>
&
substance_names
() {
return
subst_names_
; }
133
134
virtual
void
set_concentration_vector
(Vec &vec){};
135
136
137
protected
:
138
139
/// Returns the region database.
140
const
RegionDB
*
region_db
() {
return
&
mesh_
->
region_db
(); }
141
142
/// Number of transported substances.
143
unsigned
int
n_subst_
;
144
145
/// Names of transported substances.
146
std::vector<string>
subst_names_
;
147
148
/**
149
* Temporary solution how to pass velocity field form the flow model.
150
* TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other
151
* data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.
152
*/
153
const
MH_DofHandler
*
mh_dh
;
154
155
/**
156
* Mark type mask that is true for time marks of output points of the transport model.
157
* E.g. for TransportOperatorSplitting this is same as the output points of its transport sub-model.
158
*/
159
//TimeMark::Type output_mark_type;
160
161
/// object for calculation and writing the mass balance to file.
162
MassBalance
*
mass_balance_
;
163
};
164
165
166
167
/**
168
* @brief Empty transport class.
169
*/
170
class
TransportNothing
:
public
TransportBase
{
171
public
:
172
inline
TransportNothing
(
Mesh
&mesh_in)
173
:
TransportBase
(mesh_in, Input::Record() )
174
{
175
// make module solved for ever
176
time_
=
new
TimeGovernor
();
177
time_
->
next_time
();
178
};
179
180
inline
virtual
~TransportNothing
()
181
{}
182
183
inline
virtual
void
output_data
() {};
184
185
void
set_cross_section_field
(
const
Field
< 3,
FieldValue<3>::Scalar
> &cross_section) {};
186
187
TimeIntegrationScheme
time_scheme
() {
return
none
; }
188
189
private
:
190
191
inline
void
calc_fluxes
(
vector
<
vector<double>
> &bcd_balance,
vector
<
vector<double>
> &bcd_plus_balance,
vector
<
vector<double>
> &bcd_minus_balance) {};
192
inline
void
calc_elem_sources
(
vector
<
vector<double>
> &mass,
vector
<
vector<double>
> &src_balance) {};
193
194
};
195
196
197
198
/**
199
* @brief Coupling of a transport model with a reaction model by operator splitting.
200
*
201
* Outline:
202
* Transport model is any descendant of TransportBase (even TransportOperatorSplitting itself). This
203
* should perform the transport possibly with diffusion and usually without coupling between substances and phases.
204
*
205
* Reaction is any descendant of the ReactionBase class. This represents reactions in general way of any coupling that
206
* happens between substances and phases on one element or more generally on one DoF.
207
*/
208
209
class
TransportOperatorSplitting
:
public
TransportBase
{
210
public
:
211
212
/**
213
* @brief Declare input record type for the equation TransportOperatorSplittiong.
214
*
215
* TODO: The question is if this should be a general coupling class
216
* (e.g. allow coupling TranportDG with reactions even if it is not good idea for numerical reasons.)
217
* To make this a coupling class we should modify all main input files for transport problems.
218
*/
219
static
Input::Type::Record
input_type
;
220
221
/// Constructor.
222
TransportOperatorSplitting
(
Mesh
&init_mesh,
const
Input::Record
&in_rec);
223
/// Destructor.
224
virtual
~TransportOperatorSplitting
();
225
226
227
virtual
void
set_velocity_field
(
const
MH_DofHandler
&dh);
228
229
void
zero_time_step
()
override
;
230
void
update_solution
()
override
;
231
//virtual void compute_one_step();
232
//virtual void compute_until();
233
234
// DELETE
235
// virtual void get_parallel_solution_vector(Vec &vc);
236
// virtual void get_solution_vector(double* &vector, unsigned int &size);
237
238
void
compute_until_save_time
();
239
void
compute_internal_step
();
240
void
output_data
();
241
242
243
/**
244
* @brief Sets pointer to data of other equations.
245
* TODO: there should be also passed the sigma parameter between dimensions
246
* @param cross_section is pointer to cross_section data of Darcy flow equation
247
*/
248
//void set_cross_section_field(const Field< 3, FieldValue<3>::Scalar > &cross_section);
249
250
TimeIntegrationScheme
time_scheme
() {
return
none
; }
251
252
253
private
:
254
/**
255
* Implements the virtual method EquationForMassBalance::calc_fluxes().
256
*/
257
void
calc_fluxes
(
vector
<
vector<double>
> &bcd_balance,
vector
<
vector<double>
> &bcd_plus_balance,
vector
<
vector<double>
> &bcd_minus_balance);
258
/**
259
* Implements the virtual method EquationForMassBalance::calc_elem_sources().
260
*/
261
void
calc_elem_sources
(
vector
<
vector<double>
> &mass,
vector
<
vector<double>
> &src_balance);
262
263
ConvectionTransport
*
convection
;
264
ReactionTerm
*
reaction
;
265
266
Semchem_interface
*
Semchem_reactions
;
267
//int steps;
268
269
270
};
271
272
273
274
275
276
#endif // TRANSPORT_OPERATOR_SPLITTING_HH_
Generated on Thu May 29 2014 23:14:49 for Flow123d by
1.8.4