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-2022 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 #include "volFields.H"
40 #include "uniformGeometricFields.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class heThermo Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class BasicThermo, class MixtureType>
52 class heThermo
53 :
54  public BasicThermo,
55  public MixtureType
56 {
57 protected:
58 
59  // Protected data
60 
61  //- Energy field
63 
64  //- Heat capacity at constant pressure field [J/kg/K]
66 
67  // Heat capacity at constant volume field [J/kg/K]
69 
70 
71  // Protected Member Functions
72 
73  //- Return a volScalarField of the given property
74  template
75  <
76  class CellMixture,
77  class PatchFaceMixture,
78  class Method,
79  class ... Args
80  >
82  (
83  const word& psiName,
84  const dimensionSet& psiDim,
85  CellMixture cellMixture,
86  PatchFaceMixture patchFaceMixture,
87  Method psiMethod,
88  const Args& ... args
89  ) const;
90 
91  //- Return a scalarField of the given property on a cell set
92  template<class CellMixture, class Method, class ... Args>
94  (
95  CellMixture cellMixture,
96  Method psiMethod,
97  const labelList& cells,
98  const Args& ... args
99  ) const;
100 
101  //- Return a scalarField of the given property on a patch
102  template<class PatchFaceMixture, class Method, class ... Args>
104  (
105  PatchFaceMixture patchFaceMixture,
106  Method psiMethod,
107  const label patchi,
108  const Args& ... args
109  ) const;
110 
111  //- Return an indirect list of a field for the given set of cells
113  (
114  const volScalarField& psi,
115  const labelList& cells
116  );
117 
118  //- Return an indirect list of a field for the given set of cells
120  (
122  const labelList&
123  );
124 
125  //- Correct the enthalpy/internal energy field boundaries
127 
128 
129 public:
130 
131  // Constructors
132 
133  //- Construct from mesh
134  heThermo
135  (
136  const fvMesh&,
137  const word& phaseName
138  );
139 
140  //- Disallow default bitwise copy construction
142 
143 
144  //- Destructor
145  virtual ~heThermo();
146 
147 
148  // Member Functions
149 
150  //- Return the composition of the mixture
151  virtual typename MixtureType::basicMixtureType&
152  composition()
153  {
154  return *this;
155  }
156 
157  //- Return the composition of the mixture
158  virtual const typename MixtureType::basicMixtureType&
159  composition() const
160  {
161  return *this;
162  }
163 
164  //- Return the name of the thermo physics
165  virtual word thermoName() const
166  {
167  return MixtureType::thermoType::typeName();
168  }
169 
170  //- Return true if the equation of state is incompressible
171  // i.e. rho != f(p)
172  virtual bool incompressible() const
173  {
174  return MixtureType::thermoType::incompressible;
175  }
176 
177  //- Return true if the equation of state is isochoric
178  // i.e. rho = const
179  virtual bool isochoric() const
180  {
181  return MixtureType::thermoType::isochoric;
182  }
183 
184 
185  // Access to thermodynamic state variables
186 
187  //- Enthalpy/Internal energy [J/kg]
188  // Non-const access allowed for transport equations
189  virtual volScalarField& he()
190  {
191  return he_;
192  }
193 
194  //- Enthalpy/Internal energy [J/kg]
195  virtual const volScalarField& he() const
196  {
197  return he_;
198  }
199 
200  //- Heat capacity at constant pressure [J/kg/K]
201  virtual const volScalarField& Cp() const
202  {
203  return Cp_;
204  }
205 
206  //- Heat capacity at constant volume [J/kg/K]
207  virtual const volScalarField& Cv() const
208  {
209  return Cv_;
210  }
211 
212 
213  // Fields derived from thermodynamic state variables
214 
215  //- Enthalpy/Internal energy
216  // for given pressure and temperature [J/kg]
217  virtual tmp<volScalarField> he
218  (
219  const volScalarField& p,
220  const volScalarField& T
221  ) const;
222 
223  //- Enthalpy/Internal energy for cell-set [J/kg]
224  virtual tmp<scalarField> he
225  (
226  const scalarField& T,
227  const labelList& cells
228  ) const;
229 
230  //- Enthalpy/Internal energy for patch [J/kg]
231  virtual tmp<scalarField> he
232  (
233  const scalarField& T,
234  const label patchi
235  ) const;
236 
237  //- Sensible enthalpy [J/kg/K]
238  virtual tmp<volScalarField> hs() const;
239 
240  //- Sensible enthalpy
241  // for given pressure and temperature [J/kg]
242  virtual tmp<volScalarField> hs
243  (
244  const volScalarField& p,
245  const volScalarField& T
246  ) const;
247 
248  //- Sensible enthalpy for patch [J/kg/K]
249  virtual tmp<scalarField> hs
250  (
251  const scalarField& T,
252  const label patchi
253  ) const;
254 
255  //- Sensible enthalpy for cell-set [J/kg]
256  virtual tmp<scalarField> hs
257  (
258  const scalarField& T,
259  const labelList& cells
260  ) const;
261 
262  //- Absolute enthalpy [J/kg/K]
263  virtual tmp<volScalarField> ha() const;
264 
265  //- Absolute enthalpy
266  // for given pressure and temperature [J/kg]
267  virtual tmp<volScalarField> ha
268  (
269  const volScalarField& p,
270  const volScalarField& T
271  ) const;
272 
273  //- Absolute enthalpy for patch [J/kg/K]
274  virtual tmp<scalarField> ha
275  (
276  const scalarField& T,
277  const label patchi
278  ) const;
279 
280  //- Absolute enthalpy for cell-set [J/kg]
281  virtual tmp<scalarField> ha
282  (
283  const scalarField& T,
284  const labelList& cells
285  ) const;
286 
287  //- Enthalpy of formation [J/kg]
288  virtual tmp<volScalarField> hc() const;
289 
290  //- Temperature from enthalpy/internal energy
291  virtual tmp<volScalarField> THE
292  (
293  const volScalarField& h,
294  const volScalarField& p,
295  const volScalarField& T0 // starting temperature
296  ) const;
297 
298  //- Temperature from enthalpy/internal energy for cell-set
299  virtual tmp<scalarField> THE
300  (
301  const scalarField& he,
302  const scalarField& T0, // starting temperature
303  const labelList& cells
304  ) const;
305 
306  //- Temperature from enthalpy/internal energy for patch
307  virtual tmp<scalarField> THE
308  (
309  const scalarField& he,
310  const scalarField& T0, // starting temperature
311  const label patchi
312  ) const;
313 
314  //- Heat capacity at constant pressure for patch [J/kg/K]
315  virtual tmp<scalarField> Cp
316  (
317  const scalarField& T,
318  const label patchi
319  ) const;
320 
321  //- Heat capacity at constant volume for patch [J/kg/K]
322  virtual tmp<scalarField> Cv
323  (
324  const scalarField& T,
325  const label patchi
326  ) const;
327 
328  //- Gamma = Cp/Cv []
329  virtual tmp<volScalarField> gamma() const;
330 
331  //- Gamma = Cp/Cv for patch []
332  virtual tmp<scalarField> gamma
333  (
334  const scalarField& T,
335  const label patchi
336  ) const;
337 
338  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
339  virtual tmp<scalarField> Cpv
340  (
341  const scalarField& T,
342  const label patchi
343  ) const;
344 
345  //- Heat capacity at constant pressure/volume [J/kg/K]
346  virtual tmp<volScalarField> Cpv() const;
347 
348  //- Molecular weight [kg/kmol]
349  virtual tmp<volScalarField> W() const;
350 
351  //- Molecular weight for patch [kg/kmol]
352  virtual tmp<scalarField> W(const label patchi) const;
353 
354 
355  // Fields derived from transport state variables
356 
357  //- Thermal diffusivity of energy of mixture [kg/m/s]
358  virtual tmp<volScalarField> alphahe() const;
359 
360  //- Thermal diffusivity of energy of mixture for patch [kg/m/s]
361  virtual tmp<scalarField> alphahe(const label patchi) const;
362 
363  //- Effective thermal turbulent conductivity of mixture [W/m/K]
365  (
366  const volScalarField&
367  ) const;
368 
369  //- Effective thermal turbulent conductivity of mixture
370  // for patch [W/m/K]
371  virtual tmp<scalarField> kappaEff
372  (
373  const scalarField& alphat,
374  const label patchi
375  ) const;
376 
377  //- Effective turbulent thermal diffusivity of energy
378  // of mixture [kg/m/s]
380  (
381  const volScalarField& alphat
382  ) const;
383 
384  //- Effective turbulent thermal diffusivity of energy
385  // of mixture for patch [kg/m/s]
386  virtual tmp<scalarField> alphaEff
387  (
388  const scalarField& alphat,
389  const label patchi
390  ) const;
391 
392 
393  //- Read thermophysical properties dictionary
394  virtual bool read();
395 };
396 
397 
398 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
399 
400 } // End namespace Foam
401 
402 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
403 
404 #ifdef NoRepository
405  #include "heThermo.C"
406 #endif
407 
408 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
409 
410 #endif
411 
412 // ************************************************************************* //
A class representing the concept of a uniform field which stores only the single value and providing ...
Definition: UniformField.H:47
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Definition: heThermo.C:542
volScalarField he_
Energy field.
Definition: heThermo.H:61
virtual ~heThermo()
Destructor.
Definition: heThermo.C:262
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:568
virtual word thermoName() const
Return the name of the thermo physics.
Definition: heThermo.H:164
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:188
const dimensionedScalar h
Planck constant.
virtual tmp< volScalarField > hc() const
Enthalpy of formation [J/kg].
Definition: heThermo.C:472
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:178
tmp< scalarField > patchFieldProperty(PatchFaceMixture patchFaceMixture, Method psiMethod, const label patchi, const Args &... args) const
Return a scalarField of the given property on a patch.
Dimension set for the base types.
Definition: dimensionSet.H:121
const cellShapeList & cells
A class for handling words, derived from string.
Definition: word.H:59
static UIndirectList< scalar > cellSetScalarList(const volScalarField &psi, const labelList &cells)
Return an indirect list of a field for the given set of cells.
Definition: heThermo.C:148
const volScalarField & psi
virtual tmp< volScalarField > THE(const volScalarField &h, const volScalarField &p, const volScalarField &T0) const
Temperature from enthalpy/internal energy.
Definition: heThermo.C:583
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity of energy of mixture [kg/m/s].
Definition: heThermo.C:675
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg/K].
Definition: heThermo.C:326
virtual tmp< volScalarField > ha() const
Absolute enthalpy [J/kg/K].
Definition: heThermo.C:399
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective turbulent thermal diffusivity of energy.
Definition: heThermo.C:731
volScalarField Cv_
Definition: heThermo.H:67
virtual const volScalarField & Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.H:206
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:151
heThermo(const fvMesh &, const word &phaseName)
Construct from mesh.
Definition: heThermo.C:195
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:776
label patchi
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal turbulent conductivity of mixture [W/m/K].
Definition: heThermo.C:706
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:51
virtual const volScalarField & Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.H:200
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
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:171
volScalarField Cp_
Heat capacity at constant pressure field [J/kg/K].
Definition: heThermo.H:64
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:171
Namespace for OpenFOAM.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: heThermo.C:645
scalar T0
Definition: createFields.H:22