Flow123d  release_3.0.0-1264-g45bfb2a
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 #include <boost/exception/info.hpp> // for operator<<, error_inf...
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 MH_DofHandler;
42 class Mesh;
43 class OutputTime;
44 namespace Input { class Record; }
45 template <int spacedim> class ElementAccessor;
46 
47 
48 // class HeatProcessBase : public EquationBase
49 // {
50 // public:
51 // typedef HeatProcessBase FactoryBaseType;
52 
53 
54 // HeatProcessBase(Mesh &mesh, const Input::Record in_rec)
55 // : EquationBase(mesh, in_rec)
56 // {};
57 
58 // /**
59 // * This method takes sequential PETSc vector of side velocities and update
60 // * transport matrix. The ordering is same as ordering of sides in the mesh.
61 // * We just keep the pointer, but do not destroy the object.
62 // *
63 // * TODO: We should pass whole velocity field object (description of base functions and dof numbering) and vector.
64 // */
65 // virtual void set_velocity_field(const MH_DofHandler &dh) = 0;
66 
67 // /// Common specification of the input record for secondary equations.
68 // static Input::Type::Abstract & get_input_type() {
69 // return Input::Type::Abstract("Heat",
70 // "Equation for heat transfer.")
71 // .close();
72 // }
73 // };
74 
75 /*
76 class HeatNothing : public HeatProcessBase {
77 public:
78  inline HeatNothing(Mesh &mesh_in)
79  : HeatProcessBase(mesh_in, Input::Record() )
80 
81  {
82  // make module solved for ever
83  time_=new TimeGovernor();
84  time_->next_time();
85  };
86 
87  inline virtual ~HeatNothing()
88  {}
89 
90  inline void set_velocity_field(const MH_DofHandler &dh) override {};
91 
92  inline virtual void output_data() override {};
93 
94 };
95 */
96 
98 public:
99 
100  class ModelEqData : public FieldSet {
101  public:
102 
107  bc_diffusive_flux
108  };
109 
110  /// Type of boundary condition (see also BC_Type)
112  /// Dirichlet boundary condition for temperature.
114  /// Flux value in total/diffusive flux b.c.
116  /// Transition coefficient in total/diffusive flux b.c.
118  /// Initial temperature.
120  /// Porosity of solid.
122  /// Water content passed from Darcy flow model
124  /// Density of fluid.
126  /// Heat capacity of fluid.
128  /// Heat conductivity of fluid.
130  /// Density of solid.
132  /// Heat capacity of solid.
134  /// Heat conductivity of solid.
136  /// Longitudal heat dispersivity.
138  /// Transversal heat dispersivity.
140  /// Thermal source in fluid.
142  /// Thermal source in solid.
144  /// Heat exchange rate in fluid.
146  /// Heat exchange rate in solid.
148  /// Reference temperature in fluid.
150  /// Reference temperature in solid.
152 
153  /// Pointer to DarcyFlow field cross_section
155 
156 
158 
159 
160 
161  ModelEqData();
162 
163  static constexpr const char * name() { return "Heat_AdvectionDiffusion"; }
164 
165  static string default_output_field() { return "\"temperature\""; }
166 
167  static const Input::Type::Selection & get_bc_type_selection();
168 
169  static IT::Selection get_output_selection();
170  };
171 
173 
174 
175  HeatTransferModel(Mesh &mesh, const Input::Record in_rec);
176 
177  void init_from_input(const Input::Record &) override {};
178 
179  void compute_mass_matrix_coefficient(const std::vector<arma::vec3 > &point_list,
180  const ElementAccessor<3> &ele_acc,
181  std::vector<double> &mm_coef) override;
182 
184  const ElementAccessor<3> &,
185  std::vector<std::vector<double> > &) override {};
186 
187  void compute_advection_diffusion_coefficients(const std::vector<arma::vec3 > &point_list,
188  const std::vector<arma::vec3> &velocity,
189  const ElementAccessor<3> &ele_acc,
191  std::vector<std::vector<arma::mat33> > &dif_coef) override;
192 
193  void compute_init_cond(const std::vector<arma::vec3> &point_list,
194  const ElementAccessor<3> &ele_acc,
195  std::vector<std::vector<double> > &init_values) override;
196 
197  void get_bc_type(const ElementAccessor<3> &ele_acc,
198  arma::uvec &bc_types) override;
199 
200  void get_flux_bc_data(unsigned int index,
201  const std::vector<arma::vec3> &point_list,
202  const ElementAccessor<3> &ele_acc,
203  std::vector< double > &bc_flux,
204  std::vector< double > &bc_sigma,
205  std::vector< double > &bc_ref_value) override;
206 
207  void get_flux_bc_sigma(unsigned int index,
208  const std::vector<arma::vec3> &point_list,
209  const ElementAccessor<3> &ele_acc,
210  std::vector< double > &bc_sigma) override;
211 
212  void compute_source_coefficients(const std::vector<arma::vec3> &point_list,
213  const ElementAccessor<3> &ele_acc,
214  std::vector<std::vector<double> > &sources_conc,
215  std::vector<std::vector<double> > &sources_density,
216  std::vector<std::vector<double> > &sources_sigma) override;
217 
218  void compute_sources_sigma(const std::vector<arma::vec3> &point_list,
219  const ElementAccessor<3> &ele_acc,
220  std::vector<std::vector<double> > &sources_sigma) override;
221 
222  ~HeatTransferModel() override;
223 
224  /**
225  * @brief Updates the velocity field which determines some coefficients of the transport equation.
226  *
227  * @param dh mixed hybrid dof handler
228  *
229  * (So far it does not work since the flow module returns a vector of zeros.)
230  */
231  inline void set_velocity_field(const MH_DofHandler &dh) override
232  {
233  mh_dh = &dh;
234  flux_changed = true;
235  }
236 
237  /// Returns number of transported substances.
238  inline unsigned int n_substances()
239  { return 1; }
240 
241  /// Returns reference to the vector of substance names.
243  { return substances_; }
244 
245 
246 protected:
247 
248  /// Derived class should implement getter for ModelEqData instance.
249  virtual ModelEqData &data() = 0;
250 
251  /**
252  * Create input type that can be passed to the derived class.
253  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
254  * @param description Comment used to describe the record key.
255  * @return
256  */
257  static IT::Record get_input_type(const string &implementation, const string &description);
258 
259  void output_data() override;
260 
261  std::shared_ptr<OutputTime> &output_stream()
262  { return output_stream_; }
263 
264  virtual void calculate_cumulative_balance() = 0;
265 
266  /// Indicator of change in advection vector field.
268 
269  /// Transported substances.
271 
272  /**
273  * Temporary solution how to pass velocity field form the flow model.
274  * TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other
275  * data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.
276  */
278 
279  /// List of indices used to call balance methods for a set of quantities.
281 
282  std::shared_ptr<OutputTime> output_stream_;
283 
284 
285 };
286 
287 
288 
289 
290 
291 #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:280
Field< 3, FieldValue< 3 >::Scalar > solid_heat_capacity
Heat capacity of solid.
Definition: heat_model.hh:133
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:71
Field< 3, FieldValue< 3 >::Scalar > fluid_density
Density of fluid.
Definition: heat_model.hh:125
void compute_retardation_coefficient(const std::vector< arma::vec3 > &, const ElementAccessor< 3 > &, std::vector< std::vector< double > > &) override
Definition: heat_model.hh:183
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content passed from Darcy flow model.
Definition: heat_model.hh:123
Field< 3, FieldValue< 3 >::Scalar > disp_t
Transversal heat dispersivity.
Definition: heat_model.hh:139
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: heat_model.hh:154
Abstract linear system class.
Definition: balance.hh:37
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:83
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_exchange_rate
Heat exchange rate in fluid.
Definition: heat_model.hh:145
Field< 3, FieldValue< 3 >::Scalar > solid_heat_exchange_rate
Heat exchange rate in solid.
Definition: heat_model.hh:147
Definition: mesh.h:76
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: heat_model.hh:242
void init_from_input(const Input::Record &) override
Read necessary data from input record.
Definition: heat_model.hh:177
std::shared_ptr< OutputTime > & output_stream()
Definition: heat_model.hh:261
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Dirichlet boundary condition for temperature.
Definition: heat_model.hh:113
BCField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
Definition: heat_model.hh:111
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_capacity
Heat capacity of fluid.
Definition: heat_model.hh:127
BCField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Definition: heat_model.hh:115
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity of solid.
Definition: heat_model.hh:121
Field< 3, FieldValue< 3 >::Scalar > fluid_thermal_source
Thermal source in fluid.
Definition: heat_model.hh:141
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_conductivity
Heat conductivity of fluid.
Definition: heat_model.hh:129
const MH_DofHandler * mh_dh
Definition: heat_model.hh:277
Field< 3, FieldValue< 3 >::Scalar > fluid_ref_temperature
Reference temperature in fluid.
Definition: heat_model.hh:149
Field< 3, FieldValue< 3 >::Scalar > init_temperature
Initial temperature.
Definition: heat_model.hh:119
static constexpr const char * name()
Definition: heat_model.hh:163
Field< 3, FieldValue< 3 >::Scalar > solid_thermal_source
Thermal source in solid.
Definition: heat_model.hh:143
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
Field< 3, FieldValue< 3 >::Scalar > solid_heat_conductivity
Heat conductivity of solid.
Definition: heat_model.hh:135
SubstanceList substances_
Transported substances.
Definition: heat_model.hh:270
The class for outputting data during time.
Definition: output_time.hh:50
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: heat_model.hh:157
Field< 3, FieldValue< 3 >::Scalar > solid_ref_temperature
Reference temperature in solid.
Definition: heat_model.hh:151
Discontinuous Galerkin method for equation of transport with dispersion.
AdvectionProcessBase FactoryBaseType
Definition: heat_model.hh:172
bool flux_changed
Indicator of change in advection vector field.
Definition: heat_model.hh:267
void set_velocity_field(const MH_DofHandler &dh) override
Updates the velocity field which determines some coefficients of the transport equation.
Definition: heat_model.hh:231
Classes for storing substance data.
Field< 3, FieldValue< 3 >::Scalar > solid_density
Density of solid.
Definition: heat_model.hh:131
unsigned int n_substances()
Returns number of transported substances.
Definition: heat_model.hh:238
Record type proxy class.
Definition: type_record.hh:182
static string default_output_field()
Definition: heat_model.hh:165
BCField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
Definition: heat_model.hh:117
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:282
Template for classes storing finite set of named values.
Field< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal heat dispersivity.
Definition: heat_model.hh:137