Flow123d  JS_before_hm-989-g79825ac
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 ModelEqData : public FieldSet {
100  public:
101 
106  bc_diffusive_flux
107  };
108 
109  /// Type of boundary condition (see also BC_Type)
111  /// Dirichlet boundary condition for temperature.
113  /// Flux value in total/diffusive flux b.c.
115  /// Transition coefficient in total/diffusive flux b.c.
117  /// Initial temperature.
119  /// Porosity of solid.
121  /// Water content passed from Darcy flow model
123  /// Flow flux, can be result of water flow model.
125  /// Density of fluid.
127  /// Heat capacity of fluid.
129  /// Heat conductivity of fluid.
131  /// Density of solid.
133  /// Heat capacity of solid.
135  /// Heat conductivity of solid.
137  /// Longitudal heat dispersivity.
139  /// Transversal heat dispersivity.
141  /// Thermal source in fluid.
143  /// Thermal source in solid.
145  /// Heat exchange rate in fluid.
147  /// Heat exchange rate in solid.
149  /// Reference temperature in fluid.
151  /// Reference temperature in solid.
153 
154  /// Pointer to DarcyFlow field cross_section
156 
157 
159 
160 
161 
162  ModelEqData();
163 
164  static constexpr const char * name() { return "Heat_AdvectionDiffusion"; }
165 
166  static string default_output_field() { return "\"temperature\""; }
167 
168  static const Input::Type::Selection & get_bc_type_selection();
169 
170  static IT::Selection get_output_selection();
171  };
172 
174 
175 
176  HeatTransferModel(Mesh &mesh, const Input::Record in_rec);
177 
178  void init_from_input(const Input::Record &) override {};
179 
180  void compute_mass_matrix_coefficient(const Armor::array &point_list,
181  const ElementAccessor<3> &ele_acc,
182  std::vector<double> &mm_coef) override;
183 
185  const ElementAccessor<3> &,
186  std::vector<std::vector<double> > &) override {};
187 
188  void compute_advection_diffusion_coefficients(const Armor::array &point_list,
189  const std::vector<arma::vec3> &velocity,
190  const ElementAccessor<3> &ele_acc,
192  std::vector<std::vector<arma::mat33> > &dif_coef) override;
193 
194  void compute_init_cond(const Armor::array &point_list,
195  const ElementAccessor<3> &ele_acc,
196  std::vector<std::vector<double> > &init_values) override;
197 
198  void get_bc_type(const ElementAccessor<3> &ele_acc,
199  arma::uvec &bc_types) override;
200 
201  void get_flux_bc_data(unsigned int index,
202  const Armor::array &point_list,
203  const ElementAccessor<3> &ele_acc,
204  std::vector< double > &bc_flux,
205  std::vector< double > &bc_sigma,
206  std::vector< double > &bc_ref_value) override;
207 
208  void get_flux_bc_sigma(unsigned int index,
209  const Armor::array &point_list,
210  const ElementAccessor<3> &ele_acc,
211  std::vector< double > &bc_sigma) override;
212 
213  void compute_source_coefficients(const Armor::array &point_list,
214  const ElementAccessor<3> &ele_acc,
215  std::vector<std::vector<double> > &sources_conc,
216  std::vector<std::vector<double> > &sources_density,
217  std::vector<std::vector<double> > &sources_sigma) override;
218 
219  void compute_sources_sigma(const Armor::array &point_list,
220  const ElementAccessor<3> &ele_acc,
221  std::vector<std::vector<double> > &sources_sigma) override;
222 
223  ~HeatTransferModel() override;
224 
225  /// Returns number of transported substances.
226  inline unsigned int n_substances()
227  { return 1; }
228 
229  /// Returns reference to the vector of substance names.
231  { return substances_; }
232 
234  { return subst_idx; }
235 
236 
237  /// Derived class should implement getter for ModelEqData instance.
238  virtual ModelEqData &data() = 0;
239 
240 protected:
241 
242  /**
243  * Create input type that can be passed to the derived class.
244  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
245  * @param description Comment used to describe the record key.
246  * @return
247  */
248  static IT::Record get_input_type(const string &implementation, const string &description);
249 
250  void output_data() override;
251 
252  std::shared_ptr<OutputTime> &output_stream()
253  { return output_stream_; }
254 
255  virtual void calculate_cumulative_balance() = 0;
256 
257  /// Transported substances.
259 
260  /// List of indices used to call balance methods for a set of quantities.
262 
263  std::shared_ptr<OutputTime> output_stream_;
264 };
265 
266 
267 
268 
269 
270 #endif /* HEAT_MODEL_HH_ */
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
Definition: heat_model.hh:261
Field< 3, FieldValue< 3 >::Scalar > solid_heat_capacity
Heat capacity of solid.
Definition: heat_model.hh:134
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:74
Field< 3, FieldValue< 3 >::Scalar > fluid_density
Density of fluid.
Definition: heat_model.hh:126
void compute_retardation_coefficient(const Armor::array &, const ElementAccessor< 3 > &, std::vector< std::vector< double > > &) override
Definition: heat_model.hh:184
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content passed from Darcy flow model.
Definition: heat_model.hh:122
Field< 3, FieldValue< 3 >::Scalar > disp_t
Transversal heat dispersivity.
Definition: heat_model.hh:140
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: heat_model.hh:155
Abstract linear system class.
Definition: balance.hh:40
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:92
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_exchange_rate
Heat exchange rate in fluid.
Definition: heat_model.hh:146
Field< 3, FieldValue< 3 >::Scalar > solid_heat_exchange_rate
Heat exchange rate in solid.
Definition: heat_model.hh:148
Field< 3, FieldValue< 3 >::VectorFixed > flow_flux
Flow flux, can be result of water flow model.
Definition: heat_model.hh:124
Definition: mesh.h:78
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: heat_model.hh:230
void init_from_input(const Input::Record &) override
Read necessary data from input record.
Definition: heat_model.hh:178
std::shared_ptr< OutputTime > & output_stream()
Definition: heat_model.hh:252
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Dirichlet boundary condition for temperature.
Definition: heat_model.hh:112
BCField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
Definition: heat_model.hh:110
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_capacity
Heat capacity of fluid.
Definition: heat_model.hh:128
BCField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Definition: heat_model.hh:114
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity of solid.
Definition: heat_model.hh:120
Field< 3, FieldValue< 3 >::Scalar > fluid_thermal_source
Thermal source in fluid.
Definition: heat_model.hh:142
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_conductivity
Heat conductivity of fluid.
Definition: heat_model.hh:130
Field< 3, FieldValue< 3 >::Scalar > fluid_ref_temperature
Reference temperature in fluid.
Definition: heat_model.hh:150
Field< 3, FieldValue< 3 >::Scalar > init_temperature
Initial temperature.
Definition: heat_model.hh:118
static constexpr const char * name()
Definition: heat_model.hh:164
Field< 3, FieldValue< 3 >::Scalar > solid_thermal_source
Thermal source in solid.
Definition: heat_model.hh:144
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Field< 3, FieldValue< 3 >::Scalar > solid_heat_conductivity
Heat conductivity of solid.
Definition: heat_model.hh:136
SubstanceList substances_
Transported substances.
Definition: heat_model.hh:258
The class for outputting data during time.
Definition: output_time.hh:50
const vector< unsigned int > & get_subst_idx()
Definition: heat_model.hh:233
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: heat_model.hh:158
Field< 3, FieldValue< 3 >::Scalar > solid_ref_temperature
Reference temperature in solid.
Definition: heat_model.hh:152
Discontinuous Galerkin method for equation of transport with dispersion.
AdvectionProcessBase FactoryBaseType
Definition: heat_model.hh:173
Classes for storing substance data.
Field< 3, FieldValue< 3 >::Scalar > solid_density
Density of solid.
Definition: heat_model.hh:132
unsigned int n_substances()
Returns number of transported substances.
Definition: heat_model.hh:226
Record type proxy class.
Definition: type_record.hh:182
static string default_output_field()
Definition: heat_model.hh:166
BCField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
Definition: heat_model.hh:116
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:263
Template for classes storing finite set of named values.
Field< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal heat dispersivity.
Definition: heat_model.hh:138