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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::heThermo
29
30Description
31 Enthalpy/Internal energy for a mixture
32
33SourceFiles
34 heThermo.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef heThermo_H
39#define heThermo_H
40
41#include "basicMixture.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class heThermo Declaration
50\*---------------------------------------------------------------------------*/
51
52template<class BasicThermo, class MixtureType>
53class heThermo
54:
55 public BasicThermo,
56 public MixtureType
57{
58protected:
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
74private:
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
91public:
92
93 // Constructors
94
95 //- Construct from mesh
97 (
98 const fvMesh&,
99 const word& phaseName
100 );
101
102 //- Construct from mesh and dictionary
104 (
105 const fvMesh&,
106 const dictionary&,
107 const word& phaseName
108 );
109
110 //- Construct from mesh,dictionary,phase name with a single temperature
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&
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
160 // Access to thermodynamic state variables
161
162 //- Enthalpy/Internal energy [J/kg]
163 // Non-const access allowed for transport equations
164 virtual volScalarField& he()
165 {
166 return he_;
167 }
168
169 //- Enthalpy/Internal energy [J/kg]
170 virtual const volScalarField& he() const
171 {
172 return he_;
173 }
174
175
176 // Fields derived from thermodynamic state variables
177
178 //- Enthalpy/Internal energy
179 // for given pressure and temperature [J/kg]
180 virtual tmp<volScalarField> he
181 (
182 const volScalarField& p,
183 const volScalarField& T
184 ) const;
185
186 //- Enthalpy/Internal energy for cell-set [J/kg]
187 virtual tmp<scalarField> he
188 (
189 const scalarField& p,
190 const scalarField& T,
191 const labelList& cells
192 ) const;
193
194 //- Enthalpy/Internal energy for patch [J/kg]
195 virtual tmp<scalarField> he
196 (
197 const scalarField& p,
198 const scalarField& T,
199 const label patchi
200 ) const;
201
202 //- Chemical enthalpy [J/kg]
203 virtual tmp<volScalarField> hc() const;
204
205 //- Temperature from enthalpy/internal energy for cell-set
206 virtual tmp<scalarField> THE
207 (
208 const scalarField& he,
209 const scalarField& p,
210 const scalarField& T0, // starting temperature
211 const labelList& cells
212 ) const;
213
214 //- Temperature from enthalpy/internal energy for patch
215 virtual tmp<scalarField> THE
216 (
217 const scalarField& he,
218 const scalarField& p,
219 const scalarField& T0, // starting temperature
220 const label patchi
221 ) const;
222
223 //- Heat capacity at constant pressure for patch [J/kg/K]
224 virtual tmp<scalarField> Cp
225 (
226 const scalarField& p,
227 const scalarField& T,
228 const label patchi
229 ) const;
230
231 //- Heat capacity using pressure and temperature
232 virtual tmp<scalarField> Cp
233 (
234 const scalarField& p,
235 const scalarField& T,
236 const labelList& cells
237 ) const;
238
239 //- Heat capacity at constant pressure [J/kg/K]
240 virtual tmp<volScalarField> Cp() const;
241
242 //- Heat capacity at constant volume for patch [J/kg/K]
243 virtual tmp<scalarField> Cv
244 (
245 const scalarField& p,
246 const scalarField& T,
247 const label patchi
248 ) const;
249
250 //- Density from pressure and temperature
252 (
253 const scalarField& p,
254 const scalarField& T,
255 const labelList& cells
256 ) const;
257
258 //- Heat capacity at constant volume [J/kg/K]
259 virtual tmp<volScalarField> Cv() const;
260
261 //- Gamma = Cp/Cv []
262 virtual tmp<volScalarField> gamma() const;
263
264 //- Gamma = Cp/Cv for patch []
265 virtual tmp<scalarField> gamma
266 (
267 const scalarField& p,
268 const scalarField& T,
269 const label patchi
270 ) const;
271
272 //- Heat capacity at constant pressure/volume for patch [J/kg/K]
273 virtual tmp<scalarField> Cpv
274 (
275 const scalarField& p,
276 const scalarField& T,
277 const label patchi
278 ) const;
279
280 //- Heat capacity at constant pressure/volume [J/kg/K]
281 virtual tmp<volScalarField> Cpv() const;
282
283 //- Heat capacity ratio []
284 virtual tmp<volScalarField> CpByCpv() const;
285
286 //- Heat capacity ratio for patch []
288 (
289 const scalarField& p,
290 const scalarField& T,
291 const label patchi
292 ) const;
293
294 //- Molecular weight [kg/kmol]
295 virtual tmp<volScalarField> W() const;
296
297
298 // Fields derived from transport state variables
299
300 //- Thermal diffusivity for temperature of mixture [J/m/s/K]
301 virtual tmp<volScalarField> kappa() const;
302
303 //- Thermal diffusivity for temperature
304 // of mixture for patch [J/m/s/K]
305 virtual tmp<scalarField> kappa
306 (
307 const label patchi
308 ) const;
309
310 //- Thermal diffusivity for energy of mixture [kg/m/s]
311 virtual tmp<volScalarField> alphahe() const;
312
313 //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
314 virtual tmp<scalarField> alphahe(const label patchi) const;
315
316 //- Effective thermal diffusivity for temperature
317 // of mixture [J/m/s/K]
318 virtual tmp<volScalarField> kappaEff(const volScalarField&) const;
319
320 //- Effective thermal diffusivity for temperature
321 // of mixture for patch [J/m/s/K]
323 (
324 const scalarField& alphat,
325 const label patchi
326 ) const;
327
328 //- Effective thermal diffusivity of mixture [kg/m/s]
330 (
331 const volScalarField& alphat
332 ) const;
333
334 //- Effective thermal diffusivity of mixture for patch [kg/m/s]
336 (
337 const scalarField& alphat,
338 const label patchi
339 ) const;
340
341
342 //- Read thermophysical properties dictionary
343 virtual bool read();
344};
345
346
347// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
348
349} // End namespace Foam
350
351// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
352
353#ifdef NoRepository
354 #include "heThermo.C"
355#endif
356
357// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358
359#endif
360
361// ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:56
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: heThermo.C:819
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.C:403
virtual word thermoName() const
Return the name of the thermo physics.
Definition: heThermo.H:139
virtual bool incompressible() const
Return true if the equation of state is incompressible.
Definition: heThermo.H:146
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:772
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: heThermo.C:893
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
Definition: heThermo.C:954
volScalarField he_
Energy field.
Definition: heThermo.H:62
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: heThermo.C:714
virtual ~heThermo()
Destructor.
Definition: heThermo.C:206
virtual const MixtureType::basicMixtureType & composition() const
Return the composition of the mixture.
Definition: heThermo.H:133
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
Definition: heThermo.C:312
void heBoundaryCorrection(volScalarField &he)
Correct the enthalpy/internal energy field boundaries.
Definition: heThermo.C:37
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Definition: heThermo.C:567
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:163
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: heThermo.C:867
virtual MixtureType::basicMixtureType & composition()
Return the composition of the mixture.
Definition: heThermo.H:126
virtual tmp< scalarField > rhoEoS(const scalarField &p, const scalarField &T, const labelList &cells) const
Density from pressure and temperature.
Definition: heThermo.C:477
virtual const volScalarField & he() const
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:169
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.C:498
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:987
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:642
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:153
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & T
const cellShapeList & cells
kappaEff
Definition: TEqn.H:10
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
scalar T0
Definition: createFields.H:22