Flow123d  release_1.8.2-1603-g0109a2b
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 
23 #include "fields/bc_field.hh"
24 #include "fields/bc_multi_field.hh"
25 #include "fields/field.hh"
26 #include "fields/multi_field.hh"
27 
28 
29 
31 public:
32 
33  class ModelEqData : public FieldSet {
34  public:
35 
41  };
42 
43  /// Type of boundary condition (see also BC_Type)
45  /// Dirichlet boundary condition for temperature.
47  /// Flux value in total/diffusive flux b.c.
49  /// Transition coefficient in total/diffusive flux b.c.
51  /// Initial temperature.
53  /// Porosity of solid.
55  /// Density of fluid.
57  /// Heat capacity of fluid.
59  /// Heat conductivity of fluid.
61  /// Density of solid.
63  /// Heat capacity of solid.
65  /// Heat conductivity of solid.
67  /// Longitudal heat dispersivity.
69  /// Transversal heat dispersivity.
71  /// Thermal source in fluid.
73  /// Thermal source in solid.
75  /// Heat exchange rate in fluid.
77  /// Heat exchange rate in solid.
79  /// Reference temperature in fluid.
81  /// Reference temperature in solid.
83 
84  /// Pointer to DarcyFlow field cross_section
86 
87 
89 
90 
91 
92  ModelEqData();
93 
94  static constexpr const char * name() { return "HeatTransfer"; }
95 
96  static string default_output_field() { return "\"temperature\""; }
97 
99 
101  };
102 
103 
104 
106 
107 
108  HeatTransferModel(Mesh &mesh, const Input::Record in_rec);
109 
110  void set_components(SubstanceList &substances, const Input::Record &in_rec) override;
111 
113  const ElementAccessor<3> &ele_acc,
114  std::vector<double> &mm_coef) override;
115 
117  const std::vector<arma::vec3> &velocity,
118  const ElementAccessor<3> &ele_acc,
120  std::vector<std::vector<arma::mat33> > &dif_coef) override;
121 
122  void compute_init_cond(const std::vector<arma::vec3> &point_list,
123  const ElementAccessor<3> &ele_acc,
124  std::vector< arma::vec > &init_values) override;
125 
126  void get_bc_type(const ElementAccessor<3> &ele_acc,
127  arma::uvec &bc_types) override;
128 
129  void get_flux_bc_data(unsigned int index,
130  const std::vector<arma::vec3> &point_list,
131  const ElementAccessor<3> &ele_acc,
133  std::vector< double > &bc_sigma,
134  std::vector< double > &bc_ref_value) override;
135 
136  void get_flux_bc_sigma(unsigned int index,
137  const std::vector<arma::vec3> &point_list,
138  const ElementAccessor<3> &ele_acc,
139  std::vector< double > &bc_sigma) override;
140 
142  const ElementAccessor<3> &ele_acc,
143  std::vector<arma::vec> &sources_conc,
144  std::vector<arma::vec> &sources_density,
145  std::vector<arma::vec> &sources_sigma) override;
146 
147  void compute_sources_sigma(const std::vector<arma::vec3> &point_list,
148  const ElementAccessor<3> &ele_acc,
149  std::vector<arma::vec> &sources_sigma) override;
150 
151  ~HeatTransferModel() override;
152 
153  /**
154  * @brief Updates the velocity field which determines some coefficients of the transport equation.
155  *
156  * @param dh mixed hybrid dof handler
157  *
158  * (So far it does not work since the flow module returns a vector of zeros.)
159  */
160  inline void set_velocity_field(const MH_DofHandler &dh) override
161  {
162  mh_dh = &dh;
163  flux_changed = true;
164  }
165 
166  /// Returns number of transported substances.
167  inline unsigned int n_substances()
168  { return 1; }
169 
170  /// Returns reference to the vector of substance names.
172  { return substances_; }
173 
174 
175 protected:
176 
177  /// Derived class should implement getter for ModelEqData instance.
178  virtual ModelEqData &data() = 0;
179 
180  /**
181  * Create input type that can be passed to the derived class.
182  * @param implementation String characterizing the numerical method, e.g. DG, FEM, FVM.
183  * @param description Comment used to describe the record key.
184  * @return
185  */
186  static IT::Record get_input_type(const string &implementation, const string &description);
187 
188  void output_data() override;
189 
190  std::shared_ptr<OutputTime> &output_stream()
191  { return output_stream_; }
192 
193  virtual void calculate_cumulative_balance() = 0;
194 
195  virtual void calculate_instant_balance() = 0;
196 
197  /// Indicator of change in advection vector field.
199 
200  /// Transported substances.
202 
203  /**
204  * Temporary solution how to pass velocity field form the flow model.
205  * TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other
206  * data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.
207  */
209 
210  /// List of indices used to call balance methods for a set of quantities.
212 
213  std::shared_ptr<OutputTime> output_stream_;
214 
215 
216 };
217 
218 
219 
220 
221 
222 #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:211
Field< 3, FieldValue< 3 >::Scalar > solid_heat_capacity
Heat capacity of solid.
Definition: heat_model.hh:64
void compute_sources_sigma(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< arma::vec > &sources_sigma) override
Definition: heat_model.cc:424
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:61
Field< 3, FieldValue< 3 >::Scalar > fluid_density
Density of fluid.
Definition: heat_model.hh:56
Field< 3, FieldValue< 3 >::Scalar > disp_t
Transversal heat dispersivity.
Definition: heat_model.hh:70
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: heat_model.hh:85
static IT::Selection get_output_selection()
Definition: heat_model.cc:230
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:62
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_exchange_rate
Heat exchange rate in fluid.
Definition: heat_model.hh:76
Field< 3, FieldValue< 3 >::Scalar > solid_heat_exchange_rate
Heat exchange rate in solid.
Definition: heat_model.hh:78
Definition: mesh.h:99
SubstanceList & substances()
Returns reference to the vector of substance names.
Definition: heat_model.hh:171
std::shared_ptr< OutputTime > & output_stream()
Definition: heat_model.hh:190
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_dirichlet_value
Dirichlet boundary condition for temperature.
Definition: heat_model.hh:46
void compute_init_cond(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< arma::vec > &init_values) override
Definition: heat_model.cc:341
BCField< 3, FieldValue< 3 >::Enum > bc_type
Type of boundary condition (see also BC_Type)
Definition: heat_model.hh:44
static const Input::Type::Selection & get_bc_type_selection()
Definition: heat_model.cc:39
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_capacity
Heat capacity of fluid.
Definition: heat_model.hh:58
virtual void calculate_instant_balance()=0
BCField< 3, FieldValue< 3 >::Scalar > bc_flux
Flux value in total/diffusive flux b.c.
Definition: heat_model.hh:48
void get_bc_type(const ElementAccessor< 3 > &ele_acc, arma::uvec &bc_types) override
Definition: heat_model.cc:352
Field< 3, FieldValue< 3 >::Scalar > porosity
Porosity of solid.
Definition: heat_model.hh:54
virtual void calculate_cumulative_balance()=0
Field< 3, FieldValue< 3 >::Scalar > fluid_thermal_source
Thermal source in fluid.
Definition: heat_model.hh:72
Field< 3, FieldValue< 3 >::Scalar > fluid_heat_conductivity
Heat conductivity of fluid.
Definition: heat_model.hh:60
const MH_DofHandler * mh_dh
Definition: heat_model.hh:208
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:376
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
Field< 3, FieldValue< 3 >::Scalar > fluid_ref_temperature
Reference temperature in fluid.
Definition: heat_model.hh:80
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:361
Mesh & mesh()
Definition: equation.hh:174
Field< 3, FieldValue< 3 >::Scalar > init_temperature
Initial temperature.
Definition: heat_model.hh:52
static constexpr const char * name()
Definition: heat_model.hh:94
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:278
Field< 3, FieldValue< 3 >::Scalar > solid_thermal_source
Thermal source in solid.
Definition: heat_model.hh:74
Accessor to the data with type Type::Record.
Definition: accessors.hh:277
Field< 3, FieldValue< 3 >::Scalar > solid_heat_conductivity
Heat conductivity of solid.
Definition: heat_model.hh:66
SubstanceList substances_
Transported substances.
Definition: heat_model.hh:201
MultiField< 3, FieldValue< 3 >::Scalar > output_field
Definition: heat_model.hh:88
Field< 3, FieldValue< 3 >::Scalar > solid_ref_temperature
Reference temperature in solid.
Definition: heat_model.hh:82
Discontinuous Galerkin method for equation of transport with dispersion.
void set_components(const std::vector< string > &names)
Definition: field_set.hh:167
virtual ModelEqData & data()=0
Derived class should implement getter for ModelEqData instance.
AdvectionProcessBase FactoryBaseType
Definition: heat_model.hh:105
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:301
bool flux_changed
Indicator of change in advection vector field.
Definition: heat_model.hh:198
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:160
~HeatTransferModel() override
Definition: heat_model.cc:447
Field< 3, FieldValue< 3 >::Scalar > solid_density
Density of solid.
Definition: heat_model.hh:62
HeatTransferModel(Mesh &mesh, const Input::Record in_rec)
Definition: heat_model.cc:240
unsigned int n_substances()
Returns number of transported substances.
Definition: heat_model.hh:167
Record type proxy class.
Definition: type_record.hh:171
void compute_source_coefficients(const std::vector< arma::vec3 > &point_list, const ElementAccessor< 3 > &ele_acc, std::vector< arma::vec > &sources_conc, std::vector< arma::vec > &sources_density, std::vector< arma::vec > &sources_sigma) override
Definition: heat_model.cc:385
static string default_output_field()
Definition: heat_model.hh:96
BCField< 3, FieldValue< 3 >::Scalar > bc_robin_sigma
Transition coefficient in total/diffusive flux b.c.
Definition: heat_model.hh:50
Class for representation of a vector of fields of the same physical quantity.
Definition: multi_field.hh:55
std::shared_ptr< OutputTime > output_stream_
Definition: heat_model.hh:213
Template for classes storing finite set of named values.
void output_data() override
Write computed fields.
Definition: heat_model.cc:267
Field< 3, FieldValue< 3 >::Scalar > disp_l
Longitudal heat dispersivity.
Definition: heat_model.hh:68