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-2020 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  //- Return a volScalarField of the given property
66  template
67  <
68  class CellMixture,
69  class PatchFaceMixture,
70  class Method,
71  class ... Args
72  >
74  (
75  const word& psiName,
76  const dimensionSet& psiDim,
77  CellMixture cellMixture,
78  PatchFaceMixture patchFaceMixture,
79  Method psiMethod,
80  const Args& ... args
81  ) const;
82 
83  //- Return a scalarField of the given property on a cell set
84  template<class CellMixture, class Method, class ... Args>
86  (
87  CellMixture cellMixture,
88  Method psiMethod,
89  const labelList& cells,
90  const Args& ... args
91  ) const;
92 
93  //- Return a scalarField of the given property on a patch
94  template<class PatchFaceMixture, class Method, class ... Args>
96  (
97  PatchFaceMixture patchFaceMixture,
98  Method psiMethod,
99  const label patchi,
100  const Args& ... args
101  ) const;
102 
103  //- Correct the enthalpy/internal energy field boundaries
105 
106 
107 public:
108 
109  // Constructors
110 
111  //- Construct from mesh
112  heThermo
113  (
114  const fvMesh&,
115  const word& phaseName
116  );
117 
118  //- Construct from mesh and dictionary
119  heThermo
120  (
121  const fvMesh&,
122  const dictionary&,
123  const word& phaseName
124  );
125 
126  //- Disallow default bitwise copy construction
128 
129 
130  //- Destructor
131  virtual ~heThermo();
132 
133 
134  // Member Functions
135 
136  //- Return the composition of the mixture
137  virtual typename MixtureType::basicMixtureType&
138  composition()
139  {
140  return *this;
141  }
142 
143  //- Return the composition of the mixture
144  virtual const typename MixtureType::basicMixtureType&
145  composition() const
146  {
147  return *this;
148  }
149 
150  //- Return the name of the thermo physics
151  virtual word thermoName() const
152  {
153  return MixtureType::thermoType::typeName();
154  }
155 
156  //- Return true if the equation of state is incompressible
157  // i.e. rho != f(p)
158  virtual bool incompressible() const
159  {
160  return MixtureType::thermoType::incompressible;
161  }
162 
163  //- Return true if the equation of state is isochoric
164  // i.e. rho = const
165  virtual bool isochoric() const
166  {
167  return MixtureType::thermoType::isochoric;
168  }
169 
170 
171  // Access to thermodynamic state variables
172 
173  //- Enthalpy/Internal energy [J/kg]
174  // Non-const access allowed for transport equations
175  virtual volScalarField& he()
176  {
177  return he_;
178  }
179 
180  //- Enthalpy/Internal energy [J/kg]
181  virtual const volScalarField& he() const
182  {
183  return he_;
184  }
185 
186 
187  // Fields derived from thermodynamic state variables
188 
189  //- Enthalpy/Internal energy
190  // for given pressure and temperature [J/kg]
191  virtual tmp<volScalarField> he
192  (
193  const volScalarField& p,
194  const volScalarField& T
195  ) const;
196 
197  //- Enthalpy/Internal energy for cell-set [J/kg]
198  virtual tmp<scalarField> he
199  (
200  const scalarField& T,
201  const labelList& cells
202  ) const;
203 
204  //- Enthalpy/Internal energy for patch [J/kg]
205  virtual tmp<scalarField> he
206  (
207  const scalarField& T,
208  const label patchi
209  ) const;
210 
211  //- Sensible enthalpy [J/kg/K]
212  virtual tmp<volScalarField> hs() const;
213 
214  //- Sensible enthalpy
215  // for given pressure and temperature [J/kg]
216  virtual tmp<volScalarField> hs
217  (
218  const volScalarField& p,
219  const volScalarField& T
220  ) const;
221 
222  //- Sensible enthalpy for patch [J/kg/K]
223  virtual tmp<scalarField> hs
224  (
225  const scalarField& T,
226  const label patchi
227  ) const;
228 
229  //- Sensible enthalpy for cell-set [J/kg]
230  virtual tmp<scalarField> hs
231  (
232  const scalarField& T,
233  const labelList& cells
234  ) const;
235 
236  //- Absolute enthalpy [J/kg/K]
237  virtual tmp<volScalarField> ha() const;
238 
239  //- Absolute enthalpy
240  // for given pressure and temperature [J/kg]
241  virtual tmp<volScalarField> ha
242  (
243  const volScalarField& p,
244  const volScalarField& T
245  ) const;
246 
247  //- Absolute enthalpy for patch [J/kg/K]
248  virtual tmp<scalarField> ha
249  (
250  const scalarField& T,
251  const label patchi
252  ) const;
253 
254  //- Absolute enthalpy for cell-set [J/kg]
255  virtual tmp<scalarField> ha
256  (
257  const scalarField& T,
258  const labelList& cells
259  ) const;
260 
261  //- Enthalpy of formation [J/kg]
262  virtual tmp<volScalarField> hc() const;
263 
264  //- Temperature from enthalpy/internal energy for cell-set
265  virtual tmp<scalarField> THE
266  (
267  const scalarField& he,
268  const scalarField& T0, // starting temperature
269  const labelList& cells
270  ) const;
271 
272  //- Temperature from enthalpy/internal energy for patch
273  virtual tmp<scalarField> THE
274  (
275  const scalarField& he,
276  const scalarField& T0, // starting temperature
277  const label patchi
278  ) const;
279 
280  //- Heat capacity at constant pressure for patch [J/kg/K]
281  virtual tmp<scalarField> Cp
282  (
283  const scalarField& T,
284  const label patchi
285  ) const;
286 
287  //- Heat capacity at constant pressure [J/kg/K]
288  virtual tmp<volScalarField> Cp() const;
289 
290  //- Heat capacity at constant volume for patch [J/kg/K]
291  virtual tmp<scalarField> Cv
292  (
293  const scalarField& T,
294  const label patchi
295  ) const;
296 
297  //- Heat capacity at constant volume [J/kg/K]
298  virtual tmp<volScalarField> Cv() const;
299 
300  //- Gamma = Cp/Cv []
301  virtual tmp<volScalarField> gamma() const;
302 
303  //- Gamma = Cp/Cv for patch []
304  virtual tmp<scalarField> gamma
305  (
306  const scalarField& T,
307  const label patchi
308  ) const;
309 
310  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
311  virtual tmp<scalarField> Cpv
312  (
313  const scalarField& T,
314  const label patchi
315  ) const;
316 
317  //- Heat capacity at constant pressure/volume [J/kg/K]
318  virtual tmp<volScalarField> Cpv() const;
319 
320  //- Heat capacity ratio []
321  virtual tmp<volScalarField> CpByCpv() const;
322 
323  //- Heat capacity ratio for patch []
324  virtual tmp<scalarField> CpByCpv
325  (
326  const scalarField& T,
327  const label patchi
328  ) const;
329 
330  //- Molecular weight [kg/kmol]
331  virtual tmp<volScalarField> W() const;
332 
333  //- Molecular weight for patch [kg/kmol]
334  virtual tmp<scalarField> W(const label patchi) const;
335 
336 
337  // Fields derived from transport state variables
338 
339  //- Thermal diffusivity for temperature of mixture [W/m/K]
340  virtual tmp<volScalarField> kappa() const;
341 
342  //- Thermal diffusivity for temperature of mixture for patch [W/m/K]
343  virtual tmp<scalarField> kappa(const label patchi) const;
344 
345  //- Thermal diffusivity for energy of mixture [kg/m/s]
346  virtual tmp<volScalarField> alphahe() const;
347 
348  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
349  virtual tmp<scalarField> alphahe(const label patchi) const;
350 
351  //- Effective thermal turbulent diffusivity for temperature
352  // of mixture [W/m/K]
354  (
355  const volScalarField&
356  ) const;
357 
358  //- Effective thermal turbulent diffusivity for temperature
359  // of mixture for patch [W/m/K]
360  virtual tmp<scalarField> kappaEff
361  (
362  const scalarField& alphat,
363  const label patchi
364  ) const;
365 
366  //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
368  (
369  const volScalarField& alphat
370  ) const;
371 
372  //- Effective thermal turbulent diffusivity of mixture
373  // for patch [kg/m/s]
374  virtual tmp<scalarField> alphaEff
375  (
376  const scalarField& alphat,
377  const label patchi
378  ) const;
379 
380 
381  //- Read thermophysical properties dictionary
382  virtual bool read();
383 };
384 
385 
386 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
387 
388 } // End namespace Foam
389 
390 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
391 
392 #ifdef NoRepository
393  #include "heThermo.C"
394 #endif
395 
396 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
397 
398 #endif
399 
400 // ************************************************************************* //
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [W/m/K].
Definition: heThermo.C:708
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:551
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: heThermo.C:621
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
volScalarField he_
Energy field.
Definition: heThermo.H:59
virtual ~heThermo()
Destructor.
Definition: heThermo.C:237
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:586
virtual word thermoName() const
Return the name of the thermo physics.
Definition: heThermo.H:150
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:174
virtual tmp< volScalarField > hc() const
Enthalpy of formation [J/kg].
Definition: heThermo.C:447
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:164
tmp< scalarField > patchFieldProperty(PatchFaceMixture patchFaceMixture, Method psiMethod, const label patchi, const Args &... args) const
Return a scalarField of the given property on a patch.
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.C:480
Dimension set for the base types.
Definition: dimensionSet.H:120
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:735
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg/K].
Definition: heThermo.C:301
virtual tmp< volScalarField > ha() const
Absolute enthalpy [J/kg/K].
Definition: heThermo.C:374
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Definition: heThermo.C:795
tmp< scalarField > cellSetProperty(CellMixture cellMixture, Method psiMethod, const labelList &cells, const Args &... args) const
Return a scalarField of the given property on a cell set.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual MixtureType::basicMixtureType & composition()
Return the composition of the mixture.
Definition: heThermo.H:137
heThermo(const fvMesh &, const word &phaseName)
Construct from mesh.
Definition: heThermo.C:171
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:826
label patchi
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal turbulent diffusivity for temperature.
Definition: heThermo.C:762
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.C:516
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:49
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual tmp< scalarField > THE(const scalarField &he, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.
Definition: heThermo.C:638
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
Foam::argList args(argc, argv)
void heBoundaryCorrection(volScalarField &he)
Correct the enthalpy/internal energy field boundaries.
Definition: heThermo.C:147
tmp< volScalarField > volScalarFieldProperty(const word &psiName, const dimensionSet &psiDim, CellMixture cellMixture, PatchFaceMixture patchFaceMixture, Method psiMethod, const Args &... args) const
Return a volScalarField of the given property.
virtual bool incompressible() const
Return true if the equation of state is incompressible.
Definition: heThermo.H:157
Namespace for OpenFOAM.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: heThermo.C:678
scalar T0
Definition: createFields.H:22