Flow123d  JS_before_hm-913-g695b665
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 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_field(const MH_DofHandler &dh) = 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_field(std::shared_ptr<FieldFE<3, FieldValue<3>::VectorFixed>> flux_field) 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  /// Density of fluid.
125  /// Heat capacity of fluid.
127  /// Heat conductivity of fluid.
129  /// Density of solid.
131  /// Heat capacity of solid.
133  /// Heat conductivity of solid.
135  /// Longitudal heat dispersivity.
137  /// Transversal heat dispersivity.
139  /// Thermal source in fluid.
141  /// Thermal source in solid.
143  /// Heat exchange rate in fluid.
145  /// Heat exchange rate in solid.
147  /// Reference temperature in fluid.
149  /// Reference temperature in solid.
151 
152  /// Pointer to DarcyFlow field cross_section
154 
155 
157 
158 
159 
160  ModelEqData();
161 
162  static constexpr const char * name() { return "Heat_AdvectionDiffusion"; }
163 
164  static string default_output_field() { return "\"temperature\""; }
165 
166  static const Input::Type::Selection & get_bc_type_selection();
167 
168  static IT::Selection get_output_selection();
169  };
170 
172 
173 
174  HeatTransferModel(Mesh &mesh, const Input::Record in_rec);
175 
176  void init_from_input(const Input::Record &) override {};
177 
178  void compute_mass_matrix_coefficient(const Armor::array &point_list,
179  const ElementAccessor<3> &ele_acc,
180  std::vector<double> &mm_coef) override;
181 
183  const ElementAccessor<3> &,
184  std::vector<std::vector<double> > &) override {};
185 
186  void compute_advection_diffusion_coefficients(const Armor::array &point_list,
187  const std::vector<arma::vec3> &velocity,
188  const ElementAccessor<3> &ele_acc,
190  std::vector<std::vector<arma::mat33> > &dif_coef) override;
191 
192  void compute_init_cond(const Armor::array &point_list,
193  const ElementAccessor<3> &ele_acc,
194  std::vector<std::vector<double> > &init_values) override;
195 
196  void get_bc_type(const ElementAccessor<3> &ele_acc,
197  arma::uvec &bc_types) override;
198 
199  void get_flux_bc_data(unsigned int index,
200  const Armor::array &point_list,
201  const ElementAccessor<3> &ele_acc,
202  std::vector< double > &bc_flux,
203  std::vector< double > &bc_sigma,
204  std::vector< double > &bc_ref_value) override;
205 
206  void get_flux_bc_sigma(unsigned int index,
207  const Armor::array &point_list,
208  const ElementAccessor<3> &ele_acc,
209  std::vector< double > &bc_sigma) override;
210 
211  void compute_source_coefficients(const Armor::array &point_list,
212  const ElementAccessor<3> &ele_acc,
213  std::vector<std::vector<double> > &sources_conc,
214  std::vector<std::vector<double> > &sources_density,
215  std::vector<std::vector<double> > &sources_sigma) override;
216 
217  void compute_sources_sigma(const Armor::array &point_list,
218  const ElementAccessor<3> &ele_acc,
219  std::vector<std::vector<double> > &sources_sigma) override;
220 
221  ~HeatTransferModel() override;
222 
223  /**
224  * @brief Updates the velocity field which determines some coefficients of the transport equation.
225  *
226  * @param dh mixed hybrid dof handler
227  *
228  * (So far it does not work since the flow module returns a vector of zeros.)
229  */
230  inline void set_velocity_field(std::shared_ptr<FieldFE<3, FieldValue<3>::VectorFixed>> flux_field) override
231  {
232  velocity_field_ptr_ = flux_field;
233  flux_changed = true;
234  }
235 
236  /// Returns number of transported substances.
237  inline unsigned int n_substances()
238  { return 1; }
239 
240  /// Returns reference to the vector of substance names.
242  { return substances_; }
243 
245  { return subst_idx; }
246 
247  std::shared_ptr<FieldFE<3, FieldValue<3>::VectorFixed>> velocity_field_ptr() const {
248  return this->velocity_field_ptr_;
249  }
250 
251 
252 protected:
253 
254  /// Derived class should implement getter for ModelEqData instance.
255  virtual ModelEqData &data() = 0;
256 
257  /**
258  * Create input type that can be passed to the derived class.
259  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
260  * @param description Comment used to describe the record key.
261  * @return
262  */
263  static IT::Record get_input_type(const string &implementation, const string &description);
264 
265  void output_data() override;
266 
267  std::shared_ptr<OutputTime> &output_stream()
268  { return output_stream_; }
269 
270  virtual void calculate_cumulative_balance() = 0;
271 
272  /// Indicator of change in advection vector field.
274 
275  /// Transported substances.
277 
278  /// List of indices used to call balance methods for a set of quantities.
280 
281  std::shared_ptr<OutputTime> output_stream_;
282 
283  /// Pointer to velocity field given from Flow equation.
284  std::shared_ptr<FieldFE<3, FieldValue<3>::VectorFixed>> velocity_field_ptr_;
285 
286 
287 };
288 
289 
290 
291 
292 
293 #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:279
Field< 3, FieldValue< 3 >::Scalar > solid_heat_capacity
Heat capacity of solid.
Definition: heat_model.hh:132
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:124
void compute_retardation_coefficient(const Armor::array &, const ElementAccessor< 3 > &, std::vector< std::vector< double > > &) override
Definition: heat_model.hh:182
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:138
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: heat_model.hh:153
Abstract linear system class.
Definition: balance.hh:40
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::VectorFixed > > velocity_field_ptr() const
Definition: heat_model.hh:247
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:144
Field< 3, FieldValue< 3 >::Scalar > solid_heat_exchange_rate
Heat exchange rate in solid.
Definition: heat_model.hh:146
Definition: mesh.h:78
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: heat_model.hh:241
void init_from_input(const Input::Record &) override
Read necessary data from input record.
Definition: heat_model.hh:176
std::shared_ptr< OutputTime > & output_stream()
Definition: heat_model.hh:267
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:126
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::VectorFixed > > velocity_field_ptr_
Pointer to velocity field given from Flow equation.
Definition: heat_model.hh:284
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:140
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_conductivity
Heat conductivity of fluid.
Definition: heat_model.hh:128
Field< 3, FieldValue< 3 >::Scalar > fluid_ref_temperature
Reference temperature in fluid.
Definition: heat_model.hh:148
Field< 3, FieldValue< 3 >::Scalar > init_temperature
Initial temperature.
Definition: heat_model.hh:118
static constexpr const char * name()
Definition: heat_model.hh:162
Field< 3, FieldValue< 3 >::Scalar > solid_thermal_source
Thermal source in solid.
Definition: heat_model.hh:142
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:134
SubstanceList substances_
Transported substances.
Definition: heat_model.hh:276
The class for outputting data during time.
Definition: output_time.hh:50
const vector< unsigned int > & get_subst_idx()
Definition: heat_model.hh:244
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: heat_model.hh:156
Field< 3, FieldValue< 3 >::Scalar > solid_ref_temperature
Reference temperature in solid.
Definition: heat_model.hh:150
Discontinuous Galerkin method for equation of transport with dispersion.
AdvectionProcessBase FactoryBaseType
Definition: heat_model.hh:171
bool flux_changed
Indicator of change in advection vector field.
Definition: heat_model.hh:273
void set_velocity_field(std::shared_ptr< FieldFE< 3, FieldValue< 3 >::VectorFixed >> flux_field) override
Updates the velocity field which determines some coefficients of the transport equation.
Definition: heat_model.hh:230
Classes for storing substance data.
Field< 3, FieldValue< 3 >::Scalar > solid_density
Density of solid.
Definition: heat_model.hh:130
unsigned int n_substances()
Returns number of transported substances.
Definition: heat_model.hh:237
Record type proxy class.
Definition: type_record.hh:182
static string default_output_field()
Definition: heat_model.hh:164
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:89
std::shared_ptr< OutputTime > output_stream_
Definition: heat_model.hh:281
Template for classes storing finite set of named values.
Field< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal heat dispersivity.
Definition: heat_model.hh:136
Definition: field.hh:60