Flow123d  master-f44eb46
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_ */
Discontinuous Galerkin method for equation of transport with dispersion.
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
static constexpr const char * name()
unsigned int n_substances()
Returns number of transported substances.
vector< unsigned int > subst_idx_
List of indices used to call balance methods for a set of quantities.
const vector< unsigned int > & subst_idx()
Returns reference to the vector of substance indices.
SubstanceList substances_
Transported substances.
SubstanceList & substances()
Returns reference to the vector of substance names.
Field< 3, FieldValue< 3 >::Scalar > rock_density
Rock matrix density.
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc_out
Concentration sources - concentration output.
BCMultiField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
MultiField< 3, FieldValue< 3 >::Scalar > init_condition
Initial concentrations.
Field< 3, FieldValue< 3 >::Scalar > mass_matrix_coef
Field represents coefficients of mass matrix.
MultiField< 3, FieldValue< 3 >::Scalar > sorption_coefficient
Coefficient of linear sorption.
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma_out
Concentration sources - sigma output.
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Field< 3, FieldValue< 3 >::Scalar > v_norm
Velocity norm field.
MultiField< 3, FieldValue< 3 >::TensorFixed > diff_m
Molecular diffusivity (for each substance).
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Prescribed concentration for Dirichlet/reference concentration for flux b.c.
MultiField< 3, FieldValue< 3 >::Scalar > output_field
MultiField< 3, FieldValue< 3 >::Scalar > retardation_coef
Field represents retardation coefficients due to sorption.
MultiField< 3, FieldValue< 3 >::Scalar > disp_t
Transversal dispersivity (for each substance).
MultiField< 3, FieldValue< 3 >::TensorFixed > diffusion_coef
Diffusion coefficients.
static const Input::Type::Selection & get_bc_type_selection()
MultiField< 3, FieldValue< 3 >::VectorFixed > advection_coef
Advection coefficients.
MultiField< 3, FieldValue< 3 >::Scalar > sources_density_out
Concentration sources - density output.
MultiField< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal dispersivity (for each substance).
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
SubstanceList & substances() override
Returns reference to the vector of substance names.
virtual ModelEqData & eq_data()=0
Derived class should implement getter for ModelEqData instance.
void init_from_input(const Input::Record &in_rec) override
Read necessary data from input record.
void set_balance_object(std::shared_ptr< Balance > balance) override
unsigned int n_substances() override
Returns number of transported substances.
ConcentrationTransportBase FactoryBaseType
void set_target_time(double) override
void init_balance(const Input::Record &in_rec)
const vector< unsigned int > & get_subst_idx() override
Return substance indices used in balance.
virtual ModelEqFields & eq_fields()=0
Derived class should implement getter for ModelEqFields instance.
std::shared_ptr< OutputTime > output_stream_
double solvent_density_
Density of liquid (a global constant).
void set_output_stream(std::shared_ptr< OutputTime > stream)
Setter for output stream.
ConcentrationTransportModel(Mesh &mesh, const Input::Record &in_rec)
std::shared_ptr< Balance > balance() const
Definition: equation.hh:189
Mesh & mesh()
Definition: equation.hh:181
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:92
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Record type proxy class.
Definition: type_record.hh:182
Template for classes storing finite set of named values.
Definition: mesh.h:362
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:87
The class for outputting data during time.
Definition: output_time.hh:51
unsigned int size() const
Definition: substance.hh:87
Abstract linear system class.
Definition: balance.hh:40
Classes for storing substance data.