Flow123d  release_3.0.0-968-gc87a28e79
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 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 
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 
168 
170  };
171 
173 
174 
175  HeatTransferModel(Mesh &mesh, const Input::Record in_rec);
176 
177  void init_from_input(const Input::Record &in_rec) override {};
178 
180  const ElementAccessor<3> &ele_acc,
181  std::vector<double> &mm_coef) override;
182 
184  const ElementAccessor<3> &ele_acc,
185  std::vector<std::vector<double> > &ret_coef) override {};
186 
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 
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_ */
bc_field.hh
HeatTransferModel::ModelEqData::ModelEqData
ModelEqData()
Definition: heat_model.cc:66
HeatTransferModel::ModelEqData::water_content
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content passed from Darcy flow model.
Definition: heat_model.hh:123
HeatTransferModel::subst_idx
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
Definition: heat_model.hh:280
HeatTransferModel::ModelEqData::fluid_ref_temperature
Field< 3, FieldValue< 3 >::Scalar > fluid_ref_temperature
Reference temperature in fluid.
Definition: heat_model.hh:149
Input
Abstract linear system class.
Definition: balance.hh:37
HeatTransferModel::ModelEqData::bc_dirichlet_value
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Dirichlet boundary condition for temperature.
Definition: heat_model.hh:113
SubstanceList
Definition: substance.hh:70
HeatTransferModel::substances
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: heat_model.hh:242
HeatTransferModel::calculate_cumulative_balance
virtual void calculate_cumulative_balance()=0
advection_process_base.hh
HeatTransferModel::ModelEqData::disp_t
Field< 3, FieldValue< 3 >::Scalar > disp_t
Transversal heat dispersivity.
Definition: heat_model.hh:139
HeatTransferModel::ModelEqData::porosity
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity of solid.
Definition: heat_model.hh:121
field_set.hh
substance.hh
Classes for storing substance data.
AdvectionDiffusionModel
Definition: advection_diffusion_model.hh:35
HeatTransferModel::ModelEqData::solid_density
Field< 3, FieldValue< 3 >::Scalar > solid_density
Density of solid.
Definition: heat_model.hh:131
std::vector< arma::vec3 >
ElementAccessor
Definition: fe_value_handler.hh:29
HeatTransferModel
Definition: heat_model.hh:97
HeatTransferModel::ModelEqData::get_bc_type_selection
static const Input::Type::Selection & get_bc_type_selection()
Definition: heat_model.cc:40
advection_diffusion_model.hh
Discontinuous Galerkin method for equation of transport with dispersion.
HeatTransferModel::ModelEqData::bc_flux
BCField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Definition: heat_model.hh:115
type_base.hh
type_selection.hh
HeatTransferModel::ModelEqData::fluid_thermal_source
Field< 3, FieldValue< 3 >::Scalar > fluid_thermal_source
Thermal source in fluid.
Definition: heat_model.hh:141
type_record.hh
EquationBase::mesh
Mesh & mesh()
Definition: equation.hh:174
HeatTransferModel::output_stream
std::shared_ptr< OutputTime > & output_stream()
Definition: heat_model.hh:261
HeatTransferModel::ModelEqData::disp_l
Field< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal heat dispersivity.
Definition: heat_model.hh:137
HeatTransferModel::ModelEqData::init_temperature
Field< 3, FieldValue< 3 >::Scalar > init_temperature
Initial temperature.
Definition: heat_model.hh:119
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
HeatTransferModel::ModelEqData::bc_inflow
@ bc_inflow
Definition: heat_model.hh:104
AdvectionProcessBase
Definition: advection_process_base.hh:23
HeatTransferModel::get_flux_bc_sigma
void get_flux_bc_sigma(unsigned int index, const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< double > &bc_sigma) override
Return transition coefficient for flux b.c.
Definition: heat_model.cc:372
type_generic.hh
HeatTransferModel::ModelEqData::fluid_heat_capacity
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_capacity
Heat capacity of fluid.
Definition: heat_model.hh:127
HeatTransferModel::ModelEqData::output_field
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: heat_model.hh:157
HeatTransferModel::ModelEqData::fluid_density
Field< 3, FieldValue< 3 >::Scalar > fluid_density
Density of fluid.
Definition: heat_model.hh:125
bc_multi_field.hh
HeatTransferModel::get_flux_bc_data
void get_flux_bc_data(unsigned int index, const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< double > &bc_flux, std::vector< double > &bc_sigma, std::vector< double > &bc_ref_value) override
Return data for diffusive or total flux b.c.
Definition: heat_model.cc:357
field_values.hh
HeatTransferModel::mh_dh
const MH_DofHandler * mh_dh
Definition: heat_model.hh:277
OutputTime
The class for outputting data during time.
Definition: output_time.hh:50
HeatTransferModel::get_bc_type
void get_bc_type(const ElementAccessor< 3 > &ele_acc, arma::uvec &bc_types) override
Definition: heat_model.cc:348
HeatTransferModel::ModelEqData::solid_heat_capacity
Field< 3, FieldValue< 3 >::Scalar > solid_heat_capacity
Heat capacity of solid.
Definition: heat_model.hh:133
AdvectionProcessBase::get_input_type
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
Definition: advection_process_base.hh:40
FieldSet
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:71
Input::Type::Selection
Template for classes storing finite set of named values.
Definition: type_selection.hh:65
HeatTransferModel::compute_init_cond
void compute_init_cond(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &init_values) override
Definition: heat_model.cc:340
HeatTransferModel::ModelEqData
Definition: heat_model.hh:100
HeatTransferModel::ModelEqData::bc_total_flux
@ bc_total_flux
Definition: heat_model.hh:106
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
HeatTransferModel::ModelEqData::name
static constexpr const char * name()
Definition: heat_model.hh:163
BCMultiField
Definition: bc_multi_field.hh:29
HeatTransferModel::compute_mass_matrix_coefficient
void compute_mass_matrix_coefficient(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< double > &mm_coef) override
Definition: heat_model.cc:277
Mesh
Definition: mesh.h:80
HeatTransferModel::flux_changed
bool flux_changed
Indicator of change in advection vector field.
Definition: heat_model.hh:267
multi_field.hh
HeatTransferModel::set_velocity_field
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
HeatTransferModel::ModelEqData::bc_diffusive_flux
@ bc_diffusive_flux
Definition: heat_model.hh:107
HeatTransferModel::ModelEqData::bc_robin_sigma
BCField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
Definition: heat_model.hh:117
HeatTransferModel::ModelEqData::solid_thermal_source
Field< 3, FieldValue< 3 >::Scalar > solid_thermal_source
Thermal source in solid.
Definition: heat_model.hh:143
HeatTransferModel::n_substances
unsigned int n_substances()
Returns number of transported substances.
Definition: heat_model.hh:238
MultiField
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:85
HeatTransferModel::compute_retardation_coefficient
void compute_retardation_coefficient(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &ret_coef) override
Definition: heat_model.hh:183
HeatTransferModel::ModelEqData::cross_section
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: heat_model.hh:154
HeatTransferModel::ModelEqData::solid_heat_exchange_rate
Field< 3, FieldValue< 3 >::Scalar > solid_heat_exchange_rate
Heat exchange rate in solid.
Definition: heat_model.hh:147
HeatTransferModel::compute_advection_diffusion_coefficients
void compute_advection_diffusion_coefficients(const std::vector< arma::vec3 > &point_list, const std::vector< arma::vec3 > &velocity, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< arma::vec3 > > &ad_coef, std::vector< std::vector< arma::mat33 > > &dif_coef) override
Definition: heat_model.cc:300
HeatTransferModel::compute_sources_sigma
void compute_sources_sigma(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &sources_sigma) override
Definition: heat_model.cc:419
HeatTransferModel::substances_
SubstanceList substances_
Transported substances.
Definition: heat_model.hh:270
HeatTransferModel::ModelEqData::solid_ref_temperature
Field< 3, FieldValue< 3 >::Scalar > solid_ref_temperature
Reference temperature in solid.
Definition: heat_model.hh:151
HeatTransferModel::ModelEqData::get_output_selection
static IT::Selection get_output_selection()
Definition: heat_model.cc:242
HeatTransferModel::compute_source_coefficients
void compute_source_coefficients(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< std::vector< double > > &sources_conc, std::vector< std::vector< double > > &sources_density, std::vector< std::vector< double > > &sources_sigma) override
Definition: heat_model.cc:381
HeatTransferModel::ModelEqData::default_output_field
static string default_output_field()
Definition: heat_model.hh:165
HeatTransferModel::data
virtual ModelEqData & data()=0
Derived class should implement getter for ModelEqData instance.
HeatTransferModel::ModelEqData::bc_dirichlet
@ bc_dirichlet
Definition: heat_model.hh:105
HeatTransferModel::output_data
void output_data() override
Write computed fields.
Definition: heat_model.cc:271
HeatTransferModel::FactoryBaseType
AdvectionProcessBase FactoryBaseType
Definition: heat_model.hh:172
BCField
Definition: bc_field.hh:32
Field
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:83
HeatTransferModel::ModelEqData::fluid_heat_exchange_rate
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_exchange_rate
Heat exchange rate in fluid.
Definition: heat_model.hh:145
HeatTransferModel::ModelEqData::Heat_bc_types
Heat_bc_types
Definition: heat_model.hh:103
HeatTransferModel::~HeatTransferModel
~HeatTransferModel() override
Definition: heat_model.cc:442
HeatTransferModel::output_stream_
std::shared_ptr< OutputTime > output_stream_
Definition: heat_model.hh:282
HeatTransferModel::ModelEqData::bc_type
BCField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
Definition: heat_model.hh:111
MH_DofHandler
Definition: mh_dofhandler.hh:43
HeatTransferModel::ModelEqData::fluid_heat_conductivity
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_conductivity
Heat conductivity of fluid.
Definition: heat_model.hh:129
field.hh
HeatTransferModel::ModelEqData::solid_heat_conductivity
Field< 3, FieldValue< 3 >::Scalar > solid_heat_conductivity
Heat conductivity of solid.
Definition: heat_model.hh:135
HeatTransferModel::HeatTransferModel
HeatTransferModel(Mesh &mesh, const Input::Record in_rec)
Definition: heat_model.cc:252
HeatTransferModel::init_from_input
void init_from_input(const Input::Record &in_rec) override
Read necessary data from input record.
Definition: heat_model.hh:177