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 | Copyright (C) 2011-2016 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 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class heThermo Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class BasicThermo, class MixtureType>
50 class heThermo
51 :
52  public BasicThermo,
53  public MixtureType
54 {
55 protected:
56 
57  // Protected data
58 
59  //- Energy field
61 
62 
63  // Protected Member Functions
64 
65  // Enthalpy/Internal energy
66 
67  //- Correct the enthalpy/internal energy field boundaries
69 
70 
71 private:
72 
73  // Private Member Functions
74 
75  //- Construct as copy (not implemented)
77 
78 
79  //- Initialize heThermo
80  void init();
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Construct from mesh
88  heThermo
89  (
90  const fvMesh&,
91  const word& phaseName
92  );
93 
94  //- Construct from mesh and dictionary
95  heThermo
96  (
97  const fvMesh&,
98  const dictionary&,
99  const word& phaseName
100  );
101 
102 
103  //- Destructor
104  virtual ~heThermo();
105 
106 
107  // Member functions
108 
109  //- Return the compostion of the mixture
110  virtual typename MixtureType::basicMixtureType&
111  composition()
112  {
113  return *this;
114  }
115 
116  //- Return the compostion of the mixture
117  virtual const typename MixtureType::basicMixtureType&
118  composition() const
119  {
120  return *this;
121  }
122 
123  //- Return true if the equation of state is incompressible
124  // i.e. rho != f(p)
125  virtual bool incompressible() const
126  {
127  return MixtureType::thermoType::incompressible;
128  }
129 
130  //- Return true if the equation of state is isochoric
131  // i.e. rho = const
132  virtual bool isochoric() const
133  {
134  return MixtureType::thermoType::isochoric;
135  }
136 
137 
138  // Access to thermodynamic state variables
139 
140  //- Enthalpy/Internal energy [J/kg]
141  // Non-const access allowed for transport equations
142  virtual volScalarField& he()
143  {
144  return he_;
145  }
146 
147  //- Enthalpy/Internal energy [J/kg]
148  virtual const volScalarField& he() const
149  {
150  return he_;
151  }
152 
153 
154  // Fields derived from thermodynamic state variables
155 
156  //- Enthalpy/Internal energy
157  // for given pressure and temperature [J/kg]
158  virtual tmp<volScalarField> he
159  (
160  const volScalarField& p,
161  const volScalarField& T
162  ) const;
163 
164  //- Enthalpy/Internal energy for cell-set [J/kg]
165  virtual tmp<scalarField> he
166  (
167  const scalarField& p,
168  const scalarField& T,
169  const labelList& cells
170  ) const;
171 
172  //- Enthalpy/Internal energy for patch [J/kg]
173  virtual tmp<scalarField> he
174  (
175  const scalarField& p,
176  const scalarField& T,
177  const label patchi
178  ) const;
179 
180  //- Chemical enthalpy [J/kg]
181  virtual tmp<volScalarField> hc() const;
182 
183  //- Temperature from enthalpy/internal energy for cell-set
184  virtual tmp<scalarField> THE
185  (
186  const scalarField& he,
187  const scalarField& p,
188  const scalarField& T0, // starting temperature
189  const labelList& cells
190  ) const;
191 
192  //- Temperature from enthalpy/internal energy for patch
193  virtual tmp<scalarField> THE
194  (
195  const scalarField& he,
196  const scalarField& p,
197  const scalarField& T0, // starting temperature
198  const label patchi
199  ) const;
200 
201  //- Heat capacity at constant pressure for patch [J/kg/K]
202  virtual tmp<scalarField> Cp
203  (
204  const scalarField& p,
205  const scalarField& T,
206  const label patchi
207  ) const;
208 
209  //- Heat capacity at constant pressure [J/kg/K]
210  virtual tmp<volScalarField> Cp() const;
211 
212  //- Heat capacity at constant volume for patch [J/kg/K]
213  virtual tmp<scalarField> Cv
214  (
215  const scalarField& p,
216  const scalarField& T,
217  const label patchi
218  ) const;
219 
220  //- Heat capacity at constant volume [J/kg/K]
221  virtual tmp<volScalarField> Cv() const;
222 
223  //- Gamma = Cp/Cv []
224  virtual tmp<volScalarField> gamma() const;
225 
226  //- Gamma = Cp/Cv for patch []
227  virtual tmp<scalarField> gamma
228  (
229  const scalarField& p,
230  const scalarField& T,
231  const label patchi
232  ) const;
233 
234  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
235  virtual tmp<scalarField> Cpv
236  (
237  const scalarField& p,
238  const scalarField& T,
239  const label patchi
240  ) const;
241 
242  //- Heat capacity at constant pressure/volume [J/kg/K]
243  virtual tmp<volScalarField> Cpv() const;
244 
245  //- Heat capacity ratio []
246  virtual tmp<volScalarField> CpByCpv() const;
247 
248  //- Heat capacity ratio for patch []
249  virtual tmp<scalarField> CpByCpv
250  (
251  const scalarField& p,
252  const scalarField& T,
253  const label patchi
254  ) const;
255 
256 
257  // Fields derived from transport state variables
258 
259  //- Thermal diffusivity for temperature of mixture [J/m/s/K]
260  virtual tmp<volScalarField> kappa() const;
261 
262  //- Thermal diffusivity for temperature
263  // of mixture for patch [J/m/s/K]
264  virtual tmp<scalarField> kappa
265  (
266  const label patchi
267  ) const;
268 
269  //- Effective thermal diffusivity for temperature
270  // of mixture [J/m/s/K]
271  virtual tmp<volScalarField> kappaEff(const volScalarField&) const;
272 
273  //- Effective thermal diffusivity for temperature
274  // of mixture for patch [J/m/s/K]
275  virtual tmp<scalarField> kappaEff
276  (
277  const scalarField& alphat,
278  const label patchi
279  ) const;
280 
281  //- Effective thermal diffusivity of mixture [kg/m/s]
283  (
284  const volScalarField& alphat
285  ) const;
286 
287  //- Effective thermal diffusivity of mixture for patch [kg/m/s]
288  virtual tmp<scalarField> alphaEff
289  (
290  const scalarField& alphat,
291  const label patchi
292  ) const;
293 
294 
295  //- Read thermophysical properties dictionary
296  virtual bool read();
297 };
298 
299 
300 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 
302 } // End namespace Foam
303 
304 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
305 
306 #ifdef NoRepository
307  #include "heThermo.C"
308 #endif
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #endif
313 
314 // ************************************************************************* //
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: heThermo.C:725
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:678
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:473
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: heThermo.C:620
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
volScalarField he_
Energy field.
Definition: heThermo.H:59
virtual ~heThermo()
Destructor.
Definition: heThermo.C:156
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: heThermo.C:548
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: heThermo.H:141
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
Definition: heThermo.C:262
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: heThermo.H:131
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: heThermo.C:331
const cellShapeList & cells
A class for handling words, derived from string.
Definition: word.H:59
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
Definition: heThermo.C:787
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual MixtureType::basicMixtureType & composition()
Return the compostion of the mixture.
Definition: heThermo.H:110
virtual bool read()
Read thermophysical properties dictionary.
Definition: heThermo.C:820
label patchi
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal diffusivity for temperature.
Definition: heThermo.C:752
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: heThermo.C:404
Enthalpy/Internal energy for a mixture.
Definition: heThermo.H:49
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
void heBoundaryCorrection(volScalarField &he)
Correct the enthalpy/internal energy field boundaries.
Definition: heThermo.C:34
virtual bool incompressible() const
Return true if the equation of state is incompressible.
Definition: heThermo.H:124
Namespace for OpenFOAM.