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-2017 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 
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 at constant pressure [J/kg/K]
232  virtual tmp<volScalarField> Cp() const;
233 
234  //- Heat capacity at constant volume for patch [J/kg/K]
235  virtual tmp<scalarField> Cv
236  (
237  const scalarField& p,
238  const scalarField& T,
239  const label patchi
240  ) const;
241 
242  //- Heat capacity at constant volume [J/kg/K]
243  virtual tmp<volScalarField> Cv() const;
244 
245  //- Gamma = Cp/Cv []
246  virtual tmp<volScalarField> gamma() const;
247 
248  //- Gamma = Cp/Cv for patch []
249  virtual tmp<scalarField> gamma
250  (
251  const scalarField& p,
252  const scalarField& T,
253  const label patchi
254  ) const;
255 
256  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
257  virtual tmp<scalarField> Cpv
258  (
259  const scalarField& p,
260  const scalarField& T,
261  const label patchi
262  ) const;
263 
264  //- Heat capacity at constant pressure/volume [J/kg/K]
265  virtual tmp<volScalarField> Cpv() const;
266 
267  //- Heat capacity ratio []
268  virtual tmp<volScalarField> CpByCpv() const;
269 
270  //- Heat capacity ratio for patch []
271  virtual tmp<scalarField> CpByCpv
272  (
273  const scalarField& p,
274  const scalarField& T,
275  const label patchi
276  ) const;
277 
278  //- Molecular weight [kg/kmol]
279  virtual tmp<volScalarField> W() const;
280 
281 
282  // Fields derived from transport state variables
283 
284  //- Thermal diffusivity for temperature of mixture [J/m/s/K]
285  virtual tmp<volScalarField> kappa() const;
286 
287  //- Thermal diffusivity for temperature
288  // of mixture for patch [J/m/s/K]
289  virtual tmp<scalarField> kappa
290  (
291  const label patchi
292  ) const;
293 
294  //- Thermal diffusivity for energy of mixture [kg/m/s]
295  virtual tmp<volScalarField> alphahe() const;
296 
297  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
298  virtual tmp<scalarField> alphahe(const label patchi) const;
299 
300  //- Effective thermal diffusivity for temperature
301  // of mixture [J/m/s/K]
302  virtual tmp<volScalarField> kappaEff(const volScalarField&) const;
303 
304  //- Effective thermal diffusivity for temperature
305  // of mixture for patch [J/m/s/K]
306  virtual tmp<scalarField> kappaEff
307  (
308  const scalarField& alphat,
309  const label patchi
310  ) const;
311 
312  //- Effective thermal diffusivity of mixture [kg/m/s]
314  (
315  const volScalarField& alphat
316  ) const;
317 
318  //- Effective thermal diffusivity of mixture for patch [kg/m/s]
319  virtual tmp<scalarField> alphaEff
320  (
321  const scalarField& alphat,
322  const label patchi
323  ) const;
324 
325 
326  //- Read thermophysical properties dictionary
327  virtual bool read();
328 };
329 
330 
331 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
332 
333 } // End namespace Foam
334 
335 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
336 
337 #ifdef NoRepository
338  #include "heThermo.C"
339 #endif
340 
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
342 
343 #endif
344 
345 // ************************************************************************* //
Foam::heThermo::incompressible
virtual bool incompressible() const
Return true if the equation of state is incompressible.
Definition: heThermo.H:146
Foam::heThermo
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:52
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::heThermo::gamma
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Definition: heThermo.C:521
Foam::heThermo::W
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: heThermo.C:773
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::heThermo::he
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:163
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::heThermo::hc
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
Definition: heThermo.C:310
Foam::heThermo::kappa
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: heThermo.C:821
Foam::heThermo::CpByCpv
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: heThermo.C:668
Foam::heThermo::Cp
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.C:379
Foam::heThermo::~heThermo
virtual ~heThermo()
Destructor.
Definition: heThermo.C:204
Foam::heThermo::Cpv
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:596
Foam::heThermo::thermoName
virtual word thermoName() const
Return the name of the thermo physics.
Definition: heThermo.H:139
Foam::Field< scalar >
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::heThermo::isochoric
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:153
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
heThermo.C
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::heThermo::composition
virtual MixtureType::basicMixtureType & composition()
Return the composition of the mixture.
Definition: heThermo.H:126
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::heThermo::read
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:941
Foam::heThermo::Cv
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.C:452
Foam::heThermo::alphahe
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: heThermo.C:847
Foam::heThermo::he
virtual const volScalarField & he() const
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:169
Foam::List< label >
Foam::heThermo::alphaEff
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
Definition: heThermo.C:908
basicMixture.H
Foam::heThermo::THE
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:726
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::heThermo::kappaEff
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal diffusivity for temperature.
Definition: heThermo.C:873
T0
scalar T0
Definition: createFields.H:22
Foam::heThermo::composition
virtual const MixtureType::basicMixtureType & composition() const
Return the composition of the mixture.
Definition: heThermo.H:133
Foam::heThermo::heBoundaryCorrection
void heBoundaryCorrection(volScalarField &he)
Correct the enthalpy/internal energy field boundaries.
Definition: heThermo.C:37
Foam::heThermo::he_
volScalarField he_
Energy field.
Definition: heThermo.H:62