Flow123d  JS_before_hm-1602-g5680f2c
heat_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 heat_model.hh
15  * @brief Discontinuous Galerkin method for equation of transport with dispersion.
16  * @author Jan Stebel
17  */
18 
19 #ifndef HEAT_MODEL_HH_
20 #define HEAT_MODEL_HH_
21 
22 
23 #include <memory> // for shared_ptr
24 #include <string> // for string
25 #include <vector> // for vector
26 #include <armadillo>
29 #include "transport/substance.hh"
30 #include "fields/field_values.hh" // for FieldValue<>::Scalar
31 #include "fields/bc_field.hh"
32 #include "fields/bc_multi_field.hh"
33 #include "fields/field.hh"
34 #include "fields/multi_field.hh"
35 #include "fields/field_set.hh"
36 #include "input/type_base.hh" // for Array
37 #include "input/type_generic.hh" // for Instance
38 #include "input/type_record.hh" // for Record
39 #include "input/type_selection.hh" // for Selection
40 
41 class Mesh;
42 class OutputTime;
43 namespace Input { class Record; }
44 template <int spacedim> class ElementAccessor;
45 
46 
47 // class HeatProcessBase : public EquationBase
48 // {
49 // public:
50 // typedef HeatProcessBase FactoryBaseType;
51 
52 
53 // HeatProcessBase(Mesh &mesh, const Input::Record in_rec)
54 // : EquationBase(mesh, in_rec)
55 // {};
56 
57 // /**
58 // * This method takes sequential PETSc vector of side velocities and update
59 // * transport matrix. The ordering is same as ordering of sides in the mesh.
60 // * We just keep the pointer, but do not destroy the object.
61 // *
62 // * TODO: We should pass whole velocity field object (description of base functions and dof numbering) and vector.
63 // */
64 // virtual void set_velocity_changed() = 0;
65 
66 // /// Common specification of the input record for secondary equations.
67 // static Input::Type::Abstract & get_input_type() {
68 // return Input::Type::Abstract("Heat",
69 // "Equation for heat transfer.")
70 // .close();
71 // }
72 // };
73 
74 /*
75 class HeatNothing : public HeatProcessBase {
76 public:
77  inline HeatNothing(Mesh &mesh_in)
78  : HeatProcessBase(mesh_in, Input::Record() )
79 
80  {
81  // make module solved for ever
82  time_=new TimeGovernor();
83  time_->next_time();
84  };
85 
86  inline virtual ~HeatNothing()
87  {}
88 
89  inline void set_velocity_changed() override {};
90 
91  inline virtual void output_data() override {};
92 
93 };
94 */
95 
97 public:
98 
99  class ModelEqFields : public FieldSet {
100  public:
101 
102  /// Type of boundary condition (see also BC_Type)
104  /// Dirichlet boundary condition for temperature.
106  /// Flux value in total/diffusive flux b.c.
108  /// Transition coefficient in total/diffusive flux b.c.
110  /// Initial temperature.
112  /// Porosity of solid.
114  /// Water content passed from Darcy flow model
116  /// Flow flux, can be result of water flow model.
118  /// Density of fluid.
120  /// Heat capacity of fluid.
122  /// Heat conductivity of fluid.
124  /// Density of solid.
126  /// Heat capacity of solid.
128  /// Heat conductivity of solid.
130  /// Longitudal heat dispersivity.
132  /// Transversal heat dispersivity.
134  /// Thermal source in fluid.
136  /// Thermal source in solid.
138  /// Heat exchange rate in fluid.
140  /// Heat exchange rate in solid.
142  /// Reference temperature in fluid.
144  /// Reference temperature in solid.
146 
147  /// Pointer to DarcyFlow field cross_section
149 
150 
152 
153 
154  /// @name Instances of FieldModel used in assembly methods
155  // @{
156 
157  /// Velocity norm field.
159  /// Field represents coefficients of mass matrix.
161  /// Field represents retardation coefficients due to sorption.
163  /// Concentration sources - density output
165  /// Concentration sources - sigma output
167  /// Concentration sources - concentration output
169  /// Advection coefficients.
171  /// Diffusion coefficients.
173 
174  // @}
175 
180  bc_diffusive_flux
181  };
182 
183  ModelEqFields();
184 
185  static const Input::Type::Selection & get_bc_type_selection();
186 
187  /**
188  * Initialize FieldModel instances.
189  */
190  void initialize();
191 
192  };
193 
194 
195  class ModelEqData {
196  public:
197 
199  substances_.initialize({""});
200  }
201 
202  static constexpr const char * name() { return "Heat_AdvectionDiffusion"; }
203 
204  static string default_output_field() { return "\"temperature\""; }
205 
206  static IT::Selection get_output_selection();
207 
208  /// Returns number of transported substances.
209  inline unsigned int n_substances()
210  { return 1; }
211 
212  /// Returns reference to the vector of substance indices.
214  { return subst_idx_; }
215 
216  /// Returns reference to the vector of substance names.
218  { return substances_; }
219 
220 
221  /// @name Data of substances
222  // @{
223 
224  /// Transported substances.
226 
227  /// List of indices used to call balance methods for a set of quantities.
229 
230  // @}
231  };
232 
234 
235 
236  HeatTransferModel(Mesh &mesh, const Input::Record in_rec);
237 
238  void init_from_input(const Input::Record &) override {};
239 
240  ~HeatTransferModel() override;
241 
242  /// Derived class should implement getter for ModelEqFields instance.
243  virtual ModelEqFields &eq_fields() = 0;
244 
245  /// Derived class should implement getter for ModelEqData instance.
246  virtual ModelEqData &eq_data() = 0;
247 
248 protected:
249 
250  /**
251  * Create input type that can be passed to the derived class.
252  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
253  * @param description Comment used to describe the record key.
254  * @return
255  */
256  static IT::Record get_input_type(const string &implementation, const string &description);
257 
258  virtual void calculate_cumulative_balance() = 0;
259 
260  /**
261  * Temporary method, sets balance object after construction of EqData object.
262  */
263  void init_balance(const Input::Record &in_rec);
264 
265  std::shared_ptr<OutputTime> output_stream_;
266 };
267 
268 
269 
270 
271 
272 #endif /* HEAT_MODEL_HH_ */
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
Definition: heat_model.hh:109
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
MultiField< 3, FieldValue< 3 >::Scalar > retardation_coef
Field represents retardation coefficients due to sorption.
Definition: heat_model.hh:162
Field< 3, FieldValue< 3 >::Scalar > fluid_density
Density of fluid.
Definition: heat_model.hh:119
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma_out
Concentration sources - sigma output.
Definition: heat_model.hh:166
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_exchange_rate
Heat exchange rate in fluid.
Definition: heat_model.hh:139
Field< 3, FieldValue< 3 >::Scalar > solid_heat_exchange_rate
Heat exchange rate in solid.
Definition: heat_model.hh:141
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity of solid.
Definition: heat_model.hh:113
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_conductivity
Heat conductivity of fluid.
Definition: heat_model.hh:123
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Dirichlet boundary condition for temperature.
Definition: heat_model.hh:105
Abstract linear system class.
Definition: balance.hh:40
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:94
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Definition: heat_model.hh:107
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content passed from Darcy flow model.
Definition: heat_model.hh:115
Definition: mesh.h:77
void init_from_input(const Input::Record &) override
Read necessary data from input record.
Definition: heat_model.hh:238
Field< 3, FieldValue< 3 >::Scalar > solid_thermal_source
Thermal source in solid.
Definition: heat_model.hh:137
MultiField< 3, FieldValue< 3 >::Scalar > init_condition
Initial temperature.
Definition: heat_model.hh:111
MultiField< 3, FieldValue< 3 >::VectorFixed > advection_coef
Advection coefficients.
Definition: heat_model.hh:170
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc_out
Concentration sources - concentration output.
Definition: heat_model.hh:168
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: heat_model.hh:148
const vector< unsigned int > & subst_idx()
Returns reference to the vector of substance indices.
Definition: heat_model.hh:213
Field< 3, FieldValue< 3 >::Scalar > fluid_ref_temperature
Reference temperature in fluid.
Definition: heat_model.hh:143
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_capacity
Heat capacity of fluid.
Definition: heat_model.hh:121
Field< 3, FieldValue< 3 >::Scalar > solid_density
Density of solid.
Definition: heat_model.hh:125
unsigned int n_substances()
Returns number of transported substances.
Definition: heat_model.hh:209
Field< 3, FieldValue< 3 >::Scalar > disp_t
Transversal heat dispersivity.
Definition: heat_model.hh:133
static constexpr const char * name()
Definition: heat_model.hh:202
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
BCMultiField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
Definition: heat_model.hh:103
The class for outputting data during time.
Definition: output_time.hh:51
SubstanceList substances_
Transported substances.
Definition: heat_model.hh:225
vector< unsigned int > subst_idx_
List of indices used to call balance methods for a set of quantities.
Definition: heat_model.hh:228
Field< 3, FieldValue< 3 >::Scalar > fluid_thermal_source
Thermal source in fluid.
Definition: heat_model.hh:135
Field< 3, FieldValue< 3 >::Scalar > solid_heat_capacity
Heat capacity of solid.
Definition: heat_model.hh:127
Discontinuous Galerkin method for equation of transport with dispersion.
MultiField< 3, FieldValue< 3 >::TensorFixed > diffusion_coef
Diffusion coefficients.
Definition: heat_model.hh:172
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: heat_model.hh:151
AdvectionProcessBase FactoryBaseType
Definition: heat_model.hh:233
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: heat_model.hh:217
Classes for storing substance data.
Field< 3, FieldValue< 3 >::Scalar > mass_matrix_coef
Field represents coefficients of mass matrix.
Definition: heat_model.hh:160
Field< 3, FieldValue< 3 >::Scalar > solid_heat_conductivity
Heat conductivity of solid.
Definition: heat_model.hh:129
Record type proxy class.
Definition: type_record.hh:182
Field< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal heat dispersivity.
Definition: heat_model.hh:131
static string default_output_field()
Definition: heat_model.hh:204
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:87
std::shared_ptr< OutputTime > output_stream_
Definition: heat_model.hh:265
Field< 3, FieldValue< 3 >::Scalar > v_norm
Velocity norm field.
Definition: heat_model.hh:158
Field< 3, FieldValue< 3 >::Scalar > solid_ref_temperature
Reference temperature in solid.
Definition: heat_model.hh:145
Template for classes storing finite set of named values.
MultiField< 3, FieldValue< 3 >::Scalar > sources_density_out
Concentration sources - density output.
Definition: heat_model.hh:164
Field< 3, FieldValue< 3 >::VectorFixed > flow_flux
Flow flux, can be result of water flow model.
Definition: heat_model.hh:117