eTabulatedThermo.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-2023 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::eTabulatedThermo
26 
27 Description
28  Internal energy based thermodynamics package using uniform tabulated
29  data for internal energy 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  Es | Sensible internal energy vs pressure and temperature table
38  Cv | 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  Es
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  Cv
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  eTabulatedThermoI.H
90  eTabulatedThermo.C
91 
92 See also
93  Foam::Function2s::uniformTable
94 
95 \*---------------------------------------------------------------------------*/
96 
97 #ifndef eTabulatedThermo_H
98 #define eTabulatedThermo_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 eTabulatedThermo;
111 
112 template<class EquationOfState>
113 Ostream& operator<<
114 (
115  Ostream&,
116  const eTabulatedThermo<EquationOfState>&
117 );
118 
119 
120 /*---------------------------------------------------------------------------*\
121  Class eTabulatedThermo Declaration
122 \*---------------------------------------------------------------------------*/
123 
124 template<class EquationOfState>
125 class eTabulatedThermo
126 :
127  public EquationOfState
128 {
129  // Private Typedefs
130 
131  //- Table type
132  typedef Function2s::UniformTable<scalar> table2D;
133 
134 
135  // Private Data
136 
137  //- Heat of formation
138  scalar Hf_;
139 
140  //- Standard entropy
141  scalar Sf_;
142 
143  //- Sensible internal energy table [J/kg]
144  table2D Es_;
145 
146  //- Specific heat at constant pressure table [J/kg/K]
147  table2D Cp_;
148 
149  //- Specific heat at constant volume table [J/kg/K]
150  table2D Cv_;
151 
152 
153 public:
154 
155  // Constructors
156 
157  //- Construct from name and dictionary
158  eTabulatedThermo(const word& name, const dictionary& dict);
159 
160  //- Construct as a named copy
161  inline eTabulatedThermo(const word&, const eTabulatedThermo&);
162 
163 
164  // Member Functions
165 
166  //- Return the instantiated type name
167  static word typeName()
168  {
169  return "eTabulated<" + EquationOfState::typeName() + '>';
170  }
171 
172  //- Limit the temperature to be in the range Tlow_ to Thigh_
173  inline scalar limit(const scalar) const;
174 
175 
176  // Fundamental properties
177 
178  //- Heat capacity at constant pressure [J/kg/K]
179  inline scalar Cp(const scalar p, const scalar T) const;
180 
181  //- Heat capacity at constant pressure [J/kg/K]
182  inline scalar Cv(const scalar p, const scalar T) const;
183 
184  //- Sensible internal energy [J/kg]
185  inline scalar Es(const scalar p, const scalar T) const;
186 
187  //- Absolute internal energy [J/kg]
188  inline scalar Ea(const scalar p, const scalar T) const;
189 
190  //- Sensible enthalpy [J/kg]
191  inline scalar Hs(const scalar p, const scalar T) const;
192 
193  //- Absolute enthalpy [J/kg]
194  inline scalar Ha(const scalar p, const scalar T) const;
195 
196  //- Enthalpy of formation [J/kg]
197  inline scalar Hf() const;
198 
199  //- Entropy [J/kg/K]
200  inline scalar S(const scalar p, const scalar T) const;
201 
202  //- Gibbs free energy of the mixture in the standard state [J/kg]
203  inline scalar Gstd(const scalar T) const;
204 
205 
206  // Derivative term used for Jacobian
207 
208  //- Temperature derivative of heat capacity at constant pressure
209  inline scalar dCpdT(const scalar p, const scalar T) const;
210 
211 
212  // I-O
213 
214  //- Write to Ostream
215  void write(Ostream& os) const;
216 
217 
218  // Ostream Operator
219 
220  friend Ostream& operator<< <EquationOfState>
221  (
222  Ostream&,
223  const eTabulatedThermo&
224  );
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
235 
236 #ifdef NoRepository
237  #include "eTabulatedThermo.C"
238 #endif
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #endif
243 
244 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Internal energy based thermodynamics package using uniform tabulated data for internal energy and hea...
scalar Hf() const
Enthalpy of formation [J/kg].
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
static word typeName()
Return the instantiated type name.
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].
eTabulatedThermo(const word &name, const dictionary &dict)
Construct from name and dictionary.
void write(Ostream &os) const
Write to Ostream.
scalar S(const scalar p, const scalar T) const
Entropy [J/kg/K].
scalar Ha(const scalar p, const scalar T) const
Absolute enthalpy [J/kg].
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/kg/K].
scalar limit(const scalar) const
Limit the temperature to be in the range Tlow_ to Thigh_.
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [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:62
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p