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