hTabulatedThermo.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) 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::hTabulatedThermo
26 
27 Description
28  Enthalpy based thermodynamics package using uniform tabulated data for
29  enthalpy and heat capacity vs pressure and temperature.
30 
31 Usage
32 
33  \table
34  Property | Description
35  Hf | Heat of formation
36  Sf | Standard entropy
37  Hs | Sensible enthalpy vs pressure and temperature table
38  Cp | Specific heat capacity vs pressure and temperature table
39  \endtable
40 
41  Example of the specification of the thermodynamic properties:
42  \verbatim
43  thermodynamics
44  {
45  Hf 0;
46  Sf 0;
47 
48  Hs
49  {
50  pLow 1e4;
51  pHigh 5e5;
52 
53  Tlow 200;
54  Thigh 1500;
55 
56  values
57  <m> <n>
58  (
59  (..........)
60  .
61  .
62  .
63  (..........)
64  );
65  }
66 
67  Cp
68  {
69  pLow 1e3;
70  pHigh 1e6;
71 
72  Tlow 200;
73  Thigh 1500;
74 
75  values
76  <m> <n>
77  (
78  (..........)
79  .
80  .
81  .
82  (..........)
83  );
84  }
85  }
86  \endverbatim
87 
88 SourceFiles
89  hTabulatedThermoI.H
90  hTabulatedThermo.C
91 
92 See also
93  Foam::Function2s::uniformTable
94 
95 \*---------------------------------------------------------------------------*/
96 
97 #ifndef hTabulatedThermo_H
98 #define hTabulatedThermo_H
99 
100 #include "UniformTable2.H"
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 namespace Foam
105 {
106 
107 // Forward declaration of friend functions and operators
108 
109 template<class EquationOfState>
110 class hTabulatedThermo;
111 
112 template<class EquationOfState>
113 Ostream& operator<<
114 (
115  Ostream&,
116  const hTabulatedThermo<EquationOfState>&
117 );
118 
119 
120 /*---------------------------------------------------------------------------*\
121  Class hTabulatedThermo Declaration
122 \*---------------------------------------------------------------------------*/
123 
124 template<class EquationOfState>
125 class hTabulatedThermo
126 :
127  public EquationOfState
128 {
130 
131 
132  // Private Data
133 
134  //- Heat of formation
135  scalar Hf_;
136 
137  //- Standard entropy
138  scalar Sf_;
139 
140  //- Sensible enthalpy table [J/kg]
141  table2D Hs_;
142 
143  //- Specific heat at constant pressure table [J/kg/K]
144  table2D Cp_;
145 
146  //- Specific heat at constant volume table [J/kg/K]
147  table2D Cv_;
148 
149 
150 public:
151 
152  // Constructors
153 
154  //- Construct from dictionary
156 
157  //- Construct as a named copy
158  inline hTabulatedThermo(const word&, const hTabulatedThermo&);
159 
160 
161  // Member Functions
162 
163  //- Return the instantiated type name
164  static word typeName()
165  {
166  return "hTabulated<" + EquationOfState::typeName() + '>';
167  }
168 
169  //- Limit the temperature to be in the range Tlow_ to Thigh_
170  inline scalar limit(const scalar) const;
171 
172 
173  // Fundamental properties
174 
175  //- Heat capacity at constant pressure [J/kg/K]
176  inline scalar Cp(const scalar p, const scalar T) const;
177 
178  //- Heat capacity at constant volume [J/kg/K]
179  inline scalar Cv(const scalar p, const scalar T) const;
180 
181  //- Sensible enthalpy [J/kg]
182  inline scalar Hs(const scalar p, const scalar T) const;
183 
184  //- Absolute enthalpy [J/kg]
185  inline scalar Ha(const scalar p, const scalar T) const;
186 
187  //- Sensible internal energy [J/kg]
188  inline scalar Es(const scalar p, const scalar T) const;
189 
190  //- Absolute internal energy [J/kg]
191  inline scalar Ea(const scalar p, const scalar T) const;
192 
193  //- Enthalpy of formation [J/kg]
194  inline scalar Hf() const;
195 
196  //- Entropy [J/kg/K]
197  inline scalar S(const scalar p, const scalar T) const;
198 
199  //- Gibbs free energy of the mixture in the standard state [J/kg]
200  inline scalar Gstd(const scalar T) const;
201 
202 
203  // Derivative term used for Jacobian
204 
205  //- Temperature derivative of heat capacity at constant pressure
206  inline scalar dCpdT(const scalar p, const scalar T) const;
207 
208 
209  // I-O
210 
211  //- Write to Ostream
212  void write(Ostream& os) const;
213 
214 
215  // Ostream Operator
216 
217  friend Ostream& operator<< <EquationOfState>
218  (
219  Ostream&,
220  const hTabulatedThermo&
221  );
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #include "hTabulatedThermoI.H"
232 
233 #ifdef NoRepository
234  #include "hTabulatedThermo.C"
235 #endif
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
dictionary dict
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kg/K].
scalar limit(const scalar) const
Limit the temperature to be in the range Tlow_ to Thigh_.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Enthalpy based thermodynamics package using uniform tabulated data for enthalpy and heat capacity vs ...
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/kg/K].
hTabulatedThermo(const dictionary &dict)
Construct from dictionary.
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
scalar Ha(const scalar p, const scalar T) const
Absolute enthalpy [J/kg].
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
A class for handling words, derived from string.
Definition: word.H:59
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
scalar S(const scalar p, const scalar T) const
Entropy [J/kg/K].
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
scalar Hf() const
Enthalpy of formation [J/kg].
void write(Ostream &os) const
Write to Ostream.
volScalarField & p
Namespace for OpenFOAM.
static word typeName()
Return the instantiated type name.