heThermo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::heThermo
26 
27 Description
28  Enthalpy/Internal energy for a mixture
29 
30 SourceFiles
31  heThermo.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef heThermo_H
36 #define heThermo_H
37 
38 #include "basicMixture.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class heThermo Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class BasicThermo, class MixtureType>
50 class heThermo
51 :
52  public BasicThermo,
53  public MixtureType
54 {
55 protected:
56 
57  // Protected data
58 
59  //- Energy field
61 
62 
63  // Protected Member Functions
64 
65  // Enthalpy/Internal energy
66 
67  //- Correct the enthalpy/internal energy field boundaries
69 
70 
71 private:
72 
73  // Private Member Functions
74 
75  //- Construct as copy (not implemented)
77 
78 
79  //- Initialize heThermo
80  void init();
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Construct from mesh
88  heThermo
89  (
90  const fvMesh&,
91  const word& phaseName
92  );
93 
94  //- Construct from mesh and dictionary
95  heThermo
96  (
97  const fvMesh&,
98  const dictionary&,
99  const word& phaseName
100  );
101 
102 
103  //- Destructor
104  virtual ~heThermo();
105 
106 
107  // Member functions
108 
109  //- Return the compostion of the mixture
110  virtual typename MixtureType::basicMixtureType&
111  composition()
112  {
113  return *this;
114  }
115 
116  //- Return the compostion of the mixture
117  virtual const typename MixtureType::basicMixtureType&
118  composition() const
119  {
120  return *this;
121  }
122 
123  //- Return the name of the thermo physics
124  virtual word thermoName() const
125  {
126  return MixtureType::thermoType::typeName();
127  }
128 
129  //- Return true if the equation of state is incompressible
130  // i.e. rho != f(p)
131  virtual bool incompressible() const
132  {
133  return MixtureType::thermoType::incompressible;
134  }
135 
136  //- Return true if the equation of state is isochoric
137  // i.e. rho = const
138  virtual bool isochoric() const
139  {
140  return MixtureType::thermoType::isochoric;
141  }
142 
143 
144  // Access to thermodynamic state variables
145 
146  //- Enthalpy/Internal energy [J/kg]
147  // Non-const access allowed for transport equations
148  virtual volScalarField& he()
149  {
150  return he_;
151  }
152 
153  //- Enthalpy/Internal energy [J/kg]
154  virtual const volScalarField& he() const
155  {
156  return he_;
157  }
158 
159 
160  // Fields derived from thermodynamic state variables
161 
162  //- Enthalpy/Internal energy
163  // for given pressure and temperature [J/kg]
164  virtual tmp<volScalarField> he
165  (
166  const volScalarField& p,
167  const volScalarField& T
168  ) const;
169 
170  //- Enthalpy/Internal energy for cell-set [J/kg]
171  virtual tmp<scalarField> he
172  (
173  const scalarField& p,
174  const scalarField& T,
175  const labelList& cells
176  ) const;
177 
178  //- Enthalpy/Internal energy for patch [J/kg]
179  virtual tmp<scalarField> he
180  (
181  const scalarField& p,
182  const scalarField& T,
183  const label patchi
184  ) const;
185 
186  //- Chemical enthalpy [J/kg]
187  virtual tmp<volScalarField> hc() const;
188 
189  //- Temperature from enthalpy/internal energy for cell-set
190  virtual tmp<scalarField> THE
191  (
192  const scalarField& he,
193  const scalarField& p,
194  const scalarField& T0, // starting temperature
195  const labelList& cells
196  ) const;
197 
198  //- Temperature from enthalpy/internal energy for patch
199  virtual tmp<scalarField> THE
200  (
201  const scalarField& he,
202  const scalarField& p,
203  const scalarField& T0, // starting temperature
204  const label patchi
205  ) const;
206 
207  //- Heat capacity at constant pressure for patch [J/kg/K]
208  virtual tmp<scalarField> Cp
209  (
210  const scalarField& p,
211  const scalarField& T,
212  const label patchi
213  ) const;
214 
215  //- Heat capacity at constant pressure [J/kg/K]
216  virtual tmp<volScalarField> Cp() const;
217 
218  //- Heat capacity at constant volume for patch [J/kg/K]
219  virtual tmp<scalarField> Cv
220  (
221  const scalarField& p,
222  const scalarField& T,
223  const label patchi
224  ) const;
225 
226  //- Heat capacity at constant volume [J/kg/K]
227  virtual tmp<volScalarField> Cv() const;
228 
229  //- Gamma = Cp/Cv []
230  virtual tmp<volScalarField> gamma() const;
231 
232  //- Gamma = Cp/Cv for patch []
233  virtual tmp<scalarField> gamma
234  (
235  const scalarField& p,
236  const scalarField& T,
237  const label patchi
238  ) const;
239 
240  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
241  virtual tmp<scalarField> Cpv
242  (
243  const scalarField& p,
244  const scalarField& T,
245  const label patchi
246  ) const;
247 
248  //- Heat capacity at constant pressure/volume [J/kg/K]
249  virtual tmp<volScalarField> Cpv() const;
250 
251  //- Heat capacity ratio []
252  virtual tmp<volScalarField> CpByCpv() const;
253 
254  //- Heat capacity ratio for patch []
255  virtual tmp<scalarField> CpByCpv
256  (
257  const scalarField& p,
258  const scalarField& T,
259  const label patchi
260  ) const;
261 
262  //- Molecular weight [kg/kmol]
263  virtual tmp<volScalarField> W() const;
264 
265 
266  // Fields derived from transport state variables
267 
268  //- Thermal diffusivity for temperature of mixture [J/m/s/K]
269  virtual tmp<volScalarField> kappa() const;
270 
271  //- Thermal diffusivity for temperature of mixture
272  // for patch [J/m/s/K]
273  virtual tmp<scalarField> kappa
274  (
275  const label patchi
276  ) const;
277 
278  //- Thermal diffusivity for energy of mixture [kg/m/s]
279  virtual tmp<volScalarField> alphahe() const;
280 
281  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
282  virtual tmp<scalarField> alphahe(const label patchi) const;
283 
284  //- Effective thermal turbulent diffusivity for temperature
285  // of mixture [J/m/s/K]
287  (
288  const volScalarField&
289  ) const;
290 
291  //- Effective thermal turbulent diffusivity for temperature
292  // of mixture for patch [J/m/s/K]
293  virtual tmp<scalarField> kappaEff
294  (
295  const scalarField& alphat,
296  const label patchi
297  ) const;
298 
299  //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
301  (
302  const volScalarField& alphat
303  ) const;
304 
305  //- Effective thermal turbulent diffusivity of mixture
306  // for patch [kg/m/s]
307  virtual tmp<scalarField> alphaEff
308  (
309  const scalarField& alphat,
310  const label patchi
311  ) const;
312 
313 
314  //- Read thermophysical properties dictionary
315  virtual bool read();
316 };
317 
318 
319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320 
321 } // End namespace Foam
322 
323 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
324 
325 #ifdef NoRepository
326  #include "heThermo.C"
327 #endif
328 
329 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 
331 #endif
332 
333 // ************************************************************************* //
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: heThermo.C:773
virtual tmp< scalarField > THE(const scalarField &he, const scalarField &p, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.
Definition: heThermo.C:678
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Definition: heThermo.C:473
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: heThermo.C:620
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
volScalarField he_
Energy field.
Definition: heThermo.H:59
virtual ~heThermo()
Destructor.
Definition: heThermo.C:156
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:548
virtual word thermoName() const
Return the name of the thermo physics.
Definition: heThermo.H:123
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:147
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
Definition: heThermo.C:262
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:137
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.C:331
const cellShapeList & cells
A class for handling words, derived from string.
Definition: word.H:59
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: heThermo.C:799
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Definition: heThermo.C:860
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual MixtureType::basicMixtureType & composition()
Return the compostion of the mixture.
Definition: heThermo.H:110
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:893
label patchi
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal turbulent diffusivity for temperature.
Definition: heThermo.C:825
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.C:404
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:49
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
void heBoundaryCorrection(volScalarField &he)
Correct the enthalpy/internal energy field boundaries.
Definition: heThermo.C:34
virtual bool incompressible() const
Return true if the equation of state is incompressible.
Definition: heThermo.H:130
Namespace for OpenFOAM.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: heThermo.C:725