janafThermo.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) 2020 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::janafThermo
29
30Group
31 grpSpecieThermo
32
33Description
34 JANAF tables based thermodynamics package templated
35 into the equation of state.
36
37SourceFiles
38 janafThermoI.H
39 janafThermo.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef janafThermo_H
44#define janafThermo_H
45
46#include "scalar.H"
47#include "FixedList.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55
56template<class EquationOfState> class janafThermo;
57
58template<class EquationOfState>
59inline janafThermo<EquationOfState> operator+
60(
63);
64
65template<class EquationOfState>
66inline janafThermo<EquationOfState> operator*
67(
68 const scalar,
70);
71
72template<class EquationOfState>
73inline janafThermo<EquationOfState> operator==
74(
77);
78
79template<class EquationOfState>
80Ostream& operator<<
81(
82 Ostream&,
84);
85
86
87/*---------------------------------------------------------------------------*\
88 Class janafThermo Declaration
89\*---------------------------------------------------------------------------*/
90
91template<class EquationOfState>
92class janafThermo
93:
94 public EquationOfState
95{
96public:
97
98 // Public Data
100 static constexpr int nCoeffs_ = 7;
102
103
104private:
105
106 // Private Data
107
108 // Temperature limits of applicability of functions
109 scalar Tlow_, Thigh_, Tcommon_;
110
111 coeffArray highCpCoeffs_;
112 coeffArray lowCpCoeffs_;
113
114
115 // Private Member Functions
116
117 //- Check that input data is valid
118 void checkInputData() const;
119
120 //- Return the coefficients corresponding to the given temperature
121 inline const coeffArray& coeffs(const scalar T) const;
122
123
124public:
125
126 // Constructors
127
128 //- Construct from components
129 inline janafThermo
130 (
131 const EquationOfState& st,
132 const scalar Tlow,
133 const scalar Thigh,
134 const scalar Tcommon,
136 const coeffArray& lowCpCoeffs,
137 const bool convertCoeffs = false
138 );
139
140 //- Construct from dictionary
142
143 //- Construct as a named copy
144 inline janafThermo(const word&, const janafThermo&);
145
146
147 // Member Functions
148
149 //- Return the instantiated type name
150 static word typeName()
151 {
152 return "janaf<" + EquationOfState::typeName() + '>';
153 }
154
155 //- Limit the temperature to be in the range Tlow_ to Thigh_
156 inline scalar limit(const scalar T) const;
157
158
159 // Access
160
161 //- Return const access to the low temperature limit
162 inline scalar Tlow() const;
163
164 //- Return const access to the high temperature limit
165 inline scalar Thigh() const;
166
167 //- Return const access to the common temperature
168 inline scalar Tcommon() const;
169
170 //- Return const access to the high temperature poly coefficients
171 inline const coeffArray& highCpCoeffs() const;
172
173 //- Return const access to the low temperature poly coefficients
174 inline const coeffArray& lowCpCoeffs() const;
175
176
177 // Fundamental properties
178
179 //- Heat capacity at constant pressure [J/(kg K)]
180 inline scalar Cp(const scalar p, const scalar T) const;
181
182 //- Absolute Enthalpy [J/kg]
183 inline scalar Ha(const scalar p, const scalar T) const;
184
185 //- Sensible enthalpy [J/kg]
186 inline scalar Hs(const scalar p, const scalar T) const;
187
188 //- Chemical enthalpy [J/kg]
189 inline scalar Hc() const;
190
191 //- Entropy [J/(kg K)]
192 inline scalar S(const scalar p, const scalar T) const;
193
194 //- Gibbs free energy of the mixture in the standard state [J/kg]
195 inline scalar Gstd(const scalar T) const;
196
197 #include "HtoEthermo.H"
198
199
200 // Derivative term used for Jacobian
201
202
203 //- Temperature derivative of heat capacity at constant pressure
204 inline scalar dCpdT(const scalar p, const scalar T) const;
205
206
207 // I-O
208
209 //- Write to Ostream
210 void write(Ostream& os) const;
211
212
213 // Member operators
214
215 inline void operator+=(const janafThermo&);
216
217
218 // Friend operators
220 friend janafThermo operator+ <EquationOfState>
221 (
222 const janafThermo&,
223 const janafThermo&
224 );
226 friend janafThermo operator* <EquationOfState>
227 (
228 const scalar,
229 const janafThermo&
230 );
232 friend janafThermo operator== <EquationOfState>
233 (
234 const janafThermo&,
235 const janafThermo&
236 );
237
238
239 // Ostream Operator
241 friend Ostream& operator<< <EquationOfState>
242 (
243 Ostream&,
244 const janafThermo&
245 );
246};
247
248
249// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251} // End namespace Foam
252
253// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254
255#include "janafThermoI.H"
256
257#ifdef NoRepository
258 #include "janafThermo.C"
259#endif
260
261// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262
263#endif
264
265// ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: FixedList.H:81
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
JANAF tables based thermodynamics package templated into the equation of state.
Definition: janafThermo.H:94
static constexpr int nCoeffs_
Definition: janafThermo.H:99
janafThermo(const EquationOfState &st, const scalar Tlow, const scalar Thigh, const scalar Tcommon, const coeffArray &highCpCoeffs, const coeffArray &lowCpCoeffs, const bool convertCoeffs=false)
Construct from components.
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: janafThermoI.H:114
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: janafThermoI.H:204
static word typeName()
Return the instantiated type name.
Definition: janafThermo.H:149
scalar Tlow() const
Return const access to the low temperature limit.
Definition: janafThermoI.H:136
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: janafThermoI.H:264
FixedList< scalar, nCoeffs_ > coeffArray
Definition: janafThermo.H:100
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: janafThermoI.H:214
scalar Tcommon() const
Return const access to the common temperature.
Definition: janafThermoI.H:150
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: janafThermoI.H:229
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: janafThermoI.H:188
scalar Thigh() const
Return const access to the high temperature limit.
Definition: janafThermoI.H:143
const coeffArray & highCpCoeffs() const
Return const access to the high temperature poly coefficients.
Definition: janafThermoI.H:158
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
Definition: janafThermoI.H:245
const coeffArray & lowCpCoeffs() const
Return const access to the low temperature poly coefficients.
Definition: janafThermoI.H:166
void operator+=(const janafThermo &)
Definition: janafThermoI.H:278
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & Cp
Definition: EEqn.H:7
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
dictionary dict