Flow123d  JS_before_hm-1804-gf2ad740aa
concentration_model.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 concentration_model.hh
15  * @brief Discontinuous Galerkin method for equation of transport with dispersion.
16  * @author Jan Stebel
17  */
18 
19 #ifndef CONC_TRANS_MODEL_HH_
20 #define CONC_TRANS_MODEL_HH_
21 
22 
23 #include <memory> // for shared_ptr
24 #include <string> // for string
25 #include <vector> // for vector
26 #include <armadillo>
28 #include "fields/field_values.hh" // for FieldValue<>::S...
29 #include "fields/bc_multi_field.hh"
30 #include "fields/field.hh"
31 #include "fields/multi_field.hh"
32 #include "input/type_base.hh" // for Array
33 #include "input/type_generic.hh" // for Instance
34 #include "input/type_record.hh" // for Record
35 #include "input/type_selection.hh" // for Selection
36 #include "transport/substance.hh" // for SubstanceList
37 #include "transport/transport_operator_splitting.hh" // for ConcentrationTr...
38 
39 class Balance;
40 class Mesh;
41 class OutputTime;
42 namespace Input { class Record; }
43 template <int spacedim> class ElementAccessor;
44 
45 
46 
47 
49 public:
50 
52  public:
53 
54  /// Type of boundary condition (see also BC_Type)
56  /// Prescribed concentration for Dirichlet/reference concentration for flux b.c.
58  /// Flux value in total/diffusive flux b.c.
60  /// Transition coefficient in total/diffusive flux b.c.
62  /// Initial concentrations.
64  /// Longitudal dispersivity (for each substance).
66  /// Transversal dispersivity (for each substance).
68  /// Molecular diffusivity (for each substance).
70 
71  Field<3, FieldValue<3>::Scalar > rock_density; ///< Rock matrix density.
72  MultiField<3, FieldValue<3>::Scalar > sorption_coefficient; ///< Coefficient of linear sorption.
73 
74 
76 
77 
78  /// @name Instances of FieldModel used in assembly methods
79  // @{
80 
81  /// Field represents coefficients of mass matrix.
83  /// Field represents retardation coefficients due to sorption.
85  /// Concentration sources - density output
87  /// Concentration sources - sigma output
89  /// Concentration sources - concentration output
91  /// Advection coefficients.
93  /// Diffusion coefficients.
95  /// Velocity norm field.
97 
98  // @}
99 
105  };
106 
107  ModelEqFields();
108 
110 
111  /**
112  * Initialize FieldModel instances.
113  */
114  void initialize();
115 
116  };
117 
118  class ModelEqData {
119  public:
120 
122 
123  static constexpr const char * name() { return "Solute_AdvectionDiffusion"; }
124 
125  static string default_output_field() { return "\"conc\""; }
126 
128 
129  /// Returns number of transported substances.
130  inline unsigned int n_substances()
131  { return substances_.size(); }
132 
133  /// Returns reference to the vector of substance indices.
135  { return subst_idx_; }
136 
137  /// Returns reference to the vector of substance names.
139  { return substances_; }
140 
141 
142  /// @name Data of substances
143  // @{
144 
145  /// Transported substances.
147 
148  /// List of indices used to call balance methods for a set of quantities.
150 
151  // @}
152  };
153 
154 
156 
157 
159 
160  void init_from_input(const Input::Record &in_rec) override;
161 
162 
163  ~ConcentrationTransportModel() override;
164 
165  /// Returns number of transported substances.
166  inline unsigned int n_substances() override
167  { return eq_data().n_substances(); }
168 
169  /// Returns reference to the vector of substance names.
170  inline SubstanceList &substances() override
171  { return eq_data().substances(); }
172 
173 
174  // Methods inherited from ConcentrationTransportBase:
175 
176  // Must be implemented in descendants.
177  void set_target_time(double) override {};
178 
179  void set_balance_object(std::shared_ptr<Balance> balance) override;
180 
182  { return eq_data().subst_idx(); }
183 
184  void set_output_stream(std::shared_ptr<OutputTime> stream)
185  { output_stream_ = stream; }
186 
187 
188  /// Derived class should implement getter for ModelEqFields instance.
189  virtual ModelEqFields &eq_fields() = 0;
190 
191  /// Derived class should implement getter for ModelEqData instance.
192  virtual ModelEqData &eq_data() = 0;
193 
194 protected:
195 
196  /**
197  * Create input type that can be passed to the derived class.
198  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
199  * @param description Comment used to describe the record key.
200  * @return
201  */
202  static IT::Record get_input_type(const string &implementation, const string &description);
203 
204  /**
205  * Empty temporary method (must be implemented for continuity with HeatTransferModel)
206  */
207  void init_balance(const Input::Record &in_rec);
208 
209  /// Density of liquid (a global constant).
211 
212  std::shared_ptr<OutputTime> output_stream_;
213 };
214 
215 
216 
217 
218 
219 
220 
221 
222 #endif /* CONC_TRANS_MODEL_HH_ */
ConcentrationTransportModel::ModelEqData::get_output_selection
static IT::Selection get_output_selection()
Definition: concentration_model.cc:314
ConcentrationTransportModel::ModelEqFields::sources_density_out
MultiField< 3, FieldValue< 3 >::Scalar > sources_density_out
Concentration sources - density output.
Definition: concentration_model.hh:86
ConcentrationTransportModel::ModelEqFields::init_condition
MultiField< 3, FieldValue< 3 >::Scalar > init_condition
Initial concentrations.
Definition: concentration_model.hh:63
ConcentrationTransportModel::n_substances
unsigned int n_substances() override
Returns number of transported substances.
Definition: concentration_model.hh:166
ConcentrationTransportModel::set_balance_object
void set_balance_object(std::shared_ptr< Balance > balance) override
Definition: concentration_model.cc:350
ConcentrationTransportModel::ModelEqData::n_substances
unsigned int n_substances()
Returns number of transported substances.
Definition: concentration_model.hh:130
ConcentrationTransportModel::ModelEqFields::advection_coef
MultiField< 3, FieldValue< 3 >::VectorFixed > advection_coef
Advection coefficients.
Definition: concentration_model.hh:92
ConcentrationTransportModel::ModelEqData::substances_
SubstanceList substances_
Transported substances.
Definition: concentration_model.hh:146
ConcentrationTransportModel::ModelEqData::substances
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: concentration_model.hh:138
ConcentrationTransportModel::ModelEqFields::bc_robin_sigma
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
Definition: concentration_model.hh:61
ConcentrationTransportModel::ModelEqData::ModelEqData
ModelEqData()
Definition: concentration_model.hh:121
ConcentrationTransportModel::eq_fields
virtual ModelEqFields & eq_fields()=0
Derived class should implement getter for ModelEqFields instance.
Input
Abstract linear system class.
Definition: balance.hh:40
SubstanceList::size
unsigned int size() const
Definition: substance.hh:87
SubstanceList
Definition: substance.hh:70
Balance
Definition: balance.hh:119
ConcentrationTransportModel::ModelEqData::subst_idx_
vector< unsigned int > subst_idx_
List of indices used to call balance methods for a set of quantities.
Definition: concentration_model.hh:149
ConcentrationTransportModel::eq_data
virtual ModelEqData & eq_data()=0
Derived class should implement getter for ModelEqData instance.
ConcentrationTransportModel::ModelEqFields::initialize
void initialize()
Definition: concentration_model.cc:251
ConcentrationTransportModel::ModelEqFields::disp_t
MultiField< 3, FieldValue< 3 >::Scalar > disp_t
Transversal dispersivity (for each substance).
Definition: concentration_model.hh:67
substance.hh
Classes for storing substance data.
AdvectionDiffusionModel
Definition: advection_diffusion_model.hh:33
ConcentrationTransportModel::set_output_stream
void set_output_stream(std::shared_ptr< OutputTime > stream)
Setter for output stream.
Definition: concentration_model.hh:184
ConcentrationTransportModel::init_from_input
void init_from_input(const Input::Record &in_rec) override
Read necessary data from input record.
Definition: concentration_model.cc:340
std::vector< unsigned int >
ElementAccessor
Definition: dh_cell_accessor.hh:32
ConcentrationTransportModel::FactoryBaseType
ConcentrationTransportBase FactoryBaseType
Definition: concentration_model.hh:155
ConcentrationTransportModel
Definition: concentration_model.hh:48
advection_diffusion_model.hh
Discontinuous Galerkin method for equation of transport with dispersion.
type_base.hh
type_selection.hh
ConcentrationTransportModel::output_stream_
std::shared_ptr< OutputTime > output_stream_
Definition: concentration_model.hh:212
ConcentrationTransportModel::ModelEqFields::sources_conc_out
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc_out
Concentration sources - concentration output.
Definition: concentration_model.hh:90
type_record.hh
ConcentrationTransportModel::ModelEqFields::sources_sigma_out
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma_out
Concentration sources - sigma output.
Definition: concentration_model.hh:88
ConcentrationTransportModel::get_subst_idx
const vector< unsigned int > & get_subst_idx() override
Return substance indices used in balance.
Definition: concentration_model.hh:181
EquationBase::mesh
Mesh & mesh()
Definition: equation.hh:177
ConcentrationTransportModel::init_balance
void init_balance(const Input::Record &in_rec)
Definition: concentration_model.cc:357
EquationBase::balance
std::shared_ptr< Balance > balance() const
Definition: equation.hh:185
ConcentrationTransportModel::ModelEqFields::get_bc_type_selection
static const Input::Type::Selection & get_bc_type_selection()
Definition: concentration_model.cc:286
ConcentrationTransportModel::ModelEqFields::diffusion_coef
MultiField< 3, FieldValue< 3 >::TensorFixed > diffusion_coef
Diffusion coefficients.
Definition: concentration_model.hh:94
ConcentrationTransportModel::set_target_time
void set_target_time(double) override
Definition: concentration_model.hh:177
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
ConcentrationTransportModel::~ConcentrationTransportModel
~ConcentrationTransportModel() override
Definition: concentration_model.cc:346
ConcentrationTransportModel::ModelEqFields::Concentration_bc_types
Concentration_bc_types
Definition: concentration_model.hh:100
type_generic.hh
ConcentrationTransportModel::ModelEqFields::bc_dirichlet
@ bc_dirichlet
Definition: concentration_model.hh:102
bc_multi_field.hh
ConcentrationTransportModel::ModelEqFields::bc_flux
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Definition: concentration_model.hh:59
field_values.hh
ConcentrationTransportModel::ModelEqFields::bc_type
BCMultiField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
Definition: concentration_model.hh:55
OutputTime
The class for outputting data during time.
Definition: output_time.hh:51
ConcentrationTransportModel::ModelEqFields::rock_density
Field< 3, FieldValue< 3 >::Scalar > rock_density
Rock matrix density.
Definition: concentration_model.hh:71
ConcentrationTransportModel::substances
SubstanceList & substances() override
Returns reference to the vector of substance names.
Definition: concentration_model.hh:170
Input::Type::Selection
Template for classes storing finite set of named values.
Definition: type_selection.hh:65
ConcentrationTransportModel::ModelEqFields::retardation_coef
MultiField< 3, FieldValue< 3 >::Scalar > retardation_coef
Field represents retardation coefficients due to sorption.
Definition: concentration_model.hh:84
ConcentrationTransportModel::ModelEqFields::diff_m
MultiField< 3, FieldValue< 3 >::TensorFixed > diff_m
Molecular diffusivity (for each substance).
Definition: concentration_model.hh:69
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
BCMultiField
Definition: bc_multi_field.hh:29
ConcentrationTransportModel::ModelEqFields::disp_l
MultiField< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal dispersivity (for each substance).
Definition: concentration_model.hh:65
ConcentrationTransportBase
Definition: transport_operator_splitting.hh:61
Mesh
Definition: mesh.h:98
multi_field.hh
ConcentrationTransportModel::solvent_density_
double solvent_density_
Density of liquid (a global constant).
Definition: concentration_model.hh:210
ConcentrationTransportModel::ModelEqFields::bc_inflow
@ bc_inflow
Definition: concentration_model.hh:101
ConcentrationTransportModel::ModelEqFields::sorption_coefficient
MultiField< 3, FieldValue< 3 >::Scalar > sorption_coefficient
Coefficient of linear sorption.
Definition: concentration_model.hh:72
ConcentrationTransportModel::ConcentrationTransportModel
ConcentrationTransportModel(Mesh &mesh, const Input::Record &in_rec)
Definition: concentration_model.cc:335
MultiField
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:87
ConcentrationTransportModel::ModelEqFields::bc_dirichlet_value
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Prescribed concentration for Dirichlet/reference concentration for flux b.c.
Definition: concentration_model.hh:57
ConcentrationTransportModel::ModelEqData::name
static constexpr const char * name()
Definition: concentration_model.hh:123
ConcentrationTransportModel::ModelEqData::subst_idx
const vector< unsigned int > & subst_idx()
Returns reference to the vector of substance indices.
Definition: concentration_model.hh:134
ConcentrationTransportBase::get_input_type
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
Definition: transport_operator_splitting.cc:62
ConcentrationTransportModel::ModelEqFields::bc_diffusive_flux
@ bc_diffusive_flux
Definition: concentration_model.hh:104
ConcentrationTransportModel::ModelEqData::default_output_field
static string default_output_field()
Definition: concentration_model.hh:125
ConcentrationTransportModel::ModelEqFields::output_field
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: concentration_model.hh:75
Field
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:95
TransportEqFields
Definition: transport_operator_splitting.hh:143
ConcentrationTransportModel::ModelEqData
Definition: concentration_model.hh:118
ConcentrationTransportModel::ModelEqFields::bc_total_flux
@ bc_total_flux
Definition: concentration_model.hh:103
ConcentrationTransportModel::ModelEqFields::ModelEqFields
ModelEqFields()
Definition: concentration_model.cc:134
transport_operator_splitting.hh
ConcentrationTransportModel::ModelEqFields
Definition: concentration_model.hh:51
field.hh
ConcentrationTransportModel::ModelEqFields::v_norm
Field< 3, FieldValue< 3 >::Scalar > v_norm
Velocity norm field.
Definition: concentration_model.hh:96
ConcentrationTransportModel::ModelEqFields::mass_matrix_coef
Field< 3, FieldValue< 3 >::Scalar > mass_matrix_coef
Field represents coefficients of mass matrix.
Definition: concentration_model.hh:82