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 #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  //- Construct from mesh and dictionary
141  heThermo
142  (
143  const fvMesh&,
144  const dictionary&,
145  const word& phaseName
146  );
147 
148  //- Disallow default bitwise copy construction
150 
151 
152  //- Destructor
153  virtual ~heThermo();
154 
155 
156  // Member Functions
157 
158  //- Return the composition of the mixture
159  virtual typename MixtureType::basicMixtureType&
160  composition()
161  {
162  return *this;
163  }
164 
165  //- Return the composition of the mixture
166  virtual const typename MixtureType::basicMixtureType&
167  composition() const
168  {
169  return *this;
170  }
171 
172  //- Return the name of the thermo physics
173  virtual word thermoName() const
174  {
175  return MixtureType::thermoType::typeName();
176  }
177 
178  //- Return true if the equation of state is incompressible
179  // i.e. rho != f(p)
180  virtual bool incompressible() const
181  {
182  return MixtureType::thermoType::incompressible;
183  }
184 
185  //- Return true if the equation of state is isochoric
186  // i.e. rho = const
187  virtual bool isochoric() const
188  {
189  return MixtureType::thermoType::isochoric;
190  }
191 
192 
193  // Access to thermodynamic state variables
194 
195  //- Enthalpy/Internal energy [J/kg]
196  // Non-const access allowed for transport equations
197  virtual volScalarField& he()
198  {
199  return he_;
200  }
201 
202  //- Enthalpy/Internal energy [J/kg]
203  virtual const volScalarField& he() const
204  {
205  return he_;
206  }
207 
208  //- Heat capacity at constant pressure [J/kg/K]
209  virtual tmp<volScalarField> Cp() const
210  {
211  return Cp_;
212  }
213 
214  //- Heat capacity at constant volume [J/kg/K]
215  virtual tmp<volScalarField> Cv() const
216  {
217  return Cv_;
218  }
219 
220 
221  // Fields derived from thermodynamic state variables
222 
223  //- Enthalpy/Internal energy
224  // for given pressure and temperature [J/kg]
225  virtual tmp<volScalarField> he
226  (
227  const volScalarField& p,
228  const volScalarField& T
229  ) const;
230 
231  //- Enthalpy/Internal energy for cell-set [J/kg]
232  virtual tmp<scalarField> he
233  (
234  const scalarField& T,
235  const labelList& cells
236  ) const;
237 
238  //- Enthalpy/Internal energy for patch [J/kg]
239  virtual tmp<scalarField> he
240  (
241  const scalarField& T,
242  const label patchi
243  ) const;
244 
245  //- Sensible enthalpy [J/kg/K]
246  virtual tmp<volScalarField> hs() const;
247 
248  //- Sensible enthalpy
249  // for given pressure and temperature [J/kg]
250  virtual tmp<volScalarField> hs
251  (
252  const volScalarField& p,
253  const volScalarField& T
254  ) const;
255 
256  //- Sensible enthalpy for patch [J/kg/K]
257  virtual tmp<scalarField> hs
258  (
259  const scalarField& T,
260  const label patchi
261  ) const;
262 
263  //- Sensible enthalpy for cell-set [J/kg]
264  virtual tmp<scalarField> hs
265  (
266  const scalarField& T,
267  const labelList& cells
268  ) const;
269 
270  //- Absolute enthalpy [J/kg/K]
271  virtual tmp<volScalarField> ha() const;
272 
273  //- Absolute enthalpy
274  // for given pressure and temperature [J/kg]
275  virtual tmp<volScalarField> ha
276  (
277  const volScalarField& p,
278  const volScalarField& T
279  ) const;
280 
281  //- Absolute enthalpy for patch [J/kg/K]
282  virtual tmp<scalarField> ha
283  (
284  const scalarField& T,
285  const label patchi
286  ) const;
287 
288  //- Absolute enthalpy for cell-set [J/kg]
289  virtual tmp<scalarField> ha
290  (
291  const scalarField& T,
292  const labelList& cells
293  ) const;
294 
295  //- Enthalpy of formation [J/kg]
296  virtual tmp<volScalarField> hc() const;
297 
298  //- Temperature from enthalpy/internal energy
299  virtual tmp<volScalarField> THE
300  (
301  const volScalarField& h,
302  const volScalarField& p,
303  const volScalarField& T0 // starting temperature
304  ) const;
305 
306  //- Temperature from enthalpy/internal energy for cell-set
307  virtual tmp<scalarField> THE
308  (
309  const scalarField& he,
310  const scalarField& T0, // starting temperature
311  const labelList& cells
312  ) const;
313 
314  //- Temperature from enthalpy/internal energy for patch
315  virtual tmp<scalarField> THE
316  (
317  const scalarField& he,
318  const scalarField& T0, // starting temperature
319  const label patchi
320  ) const;
321 
322  //- Heat capacity at constant pressure for patch [J/kg/K]
323  virtual tmp<scalarField> Cp
324  (
325  const scalarField& T,
326  const label patchi
327  ) const;
328 
329  //- Heat capacity at constant volume for patch [J/kg/K]
330  virtual tmp<scalarField> Cv
331  (
332  const scalarField& T,
333  const label patchi
334  ) const;
335 
336  //- Gamma = Cp/Cv []
337  virtual tmp<volScalarField> gamma() const;
338 
339  //- Gamma = Cp/Cv for patch []
340  virtual tmp<scalarField> gamma
341  (
342  const scalarField& T,
343  const label patchi
344  ) const;
345 
346  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
347  virtual tmp<scalarField> Cpv
348  (
349  const scalarField& T,
350  const label patchi
351  ) const;
352 
353  //- Heat capacity at constant pressure/volume [J/kg/K]
354  virtual tmp<volScalarField> Cpv() const;
355 
356  //- Molecular weight [kg/kmol]
357  virtual tmp<volScalarField> W() const;
358 
359  //- Molecular weight for patch [kg/kmol]
360  virtual tmp<scalarField> W(const label patchi) const;
361 
362 
363  // Fields derived from transport state variables
364 
365  //- Thermal diffusivity for temperature of mixture [W/m/K]
366  virtual tmp<volScalarField> kappa() const;
367 
368  //- Thermal diffusivity for temperature of mixture for patch [W/m/K]
369  virtual tmp<scalarField> kappa(const label patchi) const;
370 
371  //- Thermal diffusivity for energy of mixture [kg/m/s]
372  virtual tmp<volScalarField> alphahe() const;
373 
374  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
375  virtual tmp<scalarField> alphahe(const label patchi) const;
376 
377  //- Effective thermal turbulent diffusivity for temperature
378  // of mixture [W/m/K]
380  (
381  const volScalarField&
382  ) const;
383 
384  //- Effective thermal turbulent diffusivity for temperature
385  // of mixture for patch [W/m/K]
386  virtual tmp<scalarField> kappaEff
387  (
388  const scalarField& alphat,
389  const label patchi
390  ) const;
391 
392  //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
394  (
395  const volScalarField& alphat
396  ) const;
397 
398  //- Effective thermal turbulent diffusivity of mixture
399  // for patch [kg/m/s]
400  virtual tmp<scalarField> alphaEff
401  (
402  const scalarField& alphat,
403  const label patchi
404  ) const;
405 
406 
407  //- Read thermophysical properties dictionary
408  virtual bool read();
409 };
410 
411 
412 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
413 
414 } // End namespace Foam
415 
416 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
417 
418 #ifdef NoRepository
419  #include "heThermo.C"
420 #endif
421 
422 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
423 
424 #endif
425 
426 // ************************************************************************* //
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [W/m/K].
Definition: heThermo.C:742
A class representing the concept of a uniform field which stores only the single value and providing ...
Definition: UniformField.H:47
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.H:208
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:609
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
volScalarField he_
Energy field.
Definition: heThermo.H:61
virtual ~heThermo()
Destructor.
Definition: heThermo.C:329
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:635
virtual word thermoName() const
Return the name of the thermo physics.
Definition: heThermo.H:172
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:196
const dimensionedScalar h
Planck constant.
virtual tmp< volScalarField > hc() const
Enthalpy of formation [J/kg].
Definition: heThermo.C:539
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:186
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:120
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
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.H:214
virtual tmp< volScalarField > THE(const volScalarField &h, const volScalarField &p, const volScalarField &T0) const
Temperature from enthalpy/internal energy.
Definition: heThermo.C:650
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: heThermo.C:765
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg/K].
Definition: heThermo.C:393
virtual tmp< volScalarField > ha() const
Absolute enthalpy [J/kg/K].
Definition: heThermo.C:466
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Definition: heThermo.C:834
volScalarField Cv_
Definition: heThermo.H:67
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:159
heThermo(const fvMesh &, const word &phaseName)
Construct from mesh.
Definition: heThermo.C:195
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:878
label patchi
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal turbulent diffusivity for temperature.
Definition: heThermo.C:805
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:51
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const volScalarField & psi
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:179
Namespace for OpenFOAM.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: heThermo.C:712
scalar T0
Definition: createFields.H:22