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 -------------------------------------------------------------------------------
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::janafThermo
29 
30 Group
31  grpSpecieThermo
32 
33 Description
34  JANAF tables based thermodynamics package templated
35  into the equation of state.
36 
37 SourceFiles
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 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 
56 template<class EquationOfState> class janafThermo;
57 
58 template<class EquationOfState>
59 inline janafThermo<EquationOfState> operator+
60 (
63 );
64 
65 template<class EquationOfState>
66 inline janafThermo<EquationOfState> operator*
67 (
68  const scalar,
70 );
71 
72 template<class EquationOfState>
73 inline janafThermo<EquationOfState> operator==
74 (
77 );
78 
79 template<class EquationOfState>
80 Ostream& operator<<
81 (
82  Ostream&,
84 );
85 
86 
87 /*---------------------------------------------------------------------------*\
88  Class janafThermo Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 template<class EquationOfState>
92 class janafThermo
93 :
94  public EquationOfState
95 {
96 public:
97 
98  // Public Data
99 
100  static constexpr int nCoeffs_ = 7;
102 
103 
104 private:
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 
124 public:
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,
135  const coeffArray& highCpCoeffs,
136  const coeffArray& lowCpCoeffs,
137  const bool convertCoeffs = false
138  );
139 
140  //- Construct from dictionary
141  janafThermo(const dictionary& dict);
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
219 
220  friend janafThermo operator+ <EquationOfState>
221  (
222  const janafThermo&,
223  const janafThermo&
224  );
225 
226  friend janafThermo operator* <EquationOfState>
227  (
228  const scalar,
229  const janafThermo&
230  );
231 
232  friend janafThermo operator== <EquationOfState>
233  (
234  const janafThermo&,
235  const janafThermo&
236  );
237 
238 
239  // Ostream Operator
240 
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 // ************************************************************************* //
HtoEthermo.H
Foam::janafThermo::highCpCoeffs
const coeffArray & highCpCoeffs() const
Return const access to the high temperature poly coefficients.
Definition: janafThermoI.H:158
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::janafThermo::Tlow
scalar Tlow() const
Return const access to the low temperature limit.
Definition: janafThermoI.H:136
Foam::janafThermo
JANAF tables based thermodynamics package templated into the equation of state.
Definition: janafThermo.H:55
Foam::janafThermo::typeName
static word typeName()
Return the instantiated type name.
Definition: janafThermo.H:149
Foam::janafThermo::lowCpCoeffs
const coeffArray & lowCpCoeffs() const
Return const access to the low temperature poly coefficients.
Definition: janafThermoI.H:166
Foam::janafThermo::Cp
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: janafThermoI.H:174
Foam::janafThermo::nCoeffs_
static constexpr int nCoeffs_
Definition: janafThermo.H:99
Foam::janafThermo::coeffArray
FixedList< scalar, nCoeffs_ > coeffArray
Definition: janafThermo.H:100
Foam::janafThermo::Ha
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: janafThermoI.H:188
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::janafThermo::operator+=
void operator+=(const janafThermo &)
Definition: janafThermoI.H:278
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
scalar.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::janafThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: janafThermoI.H:114
Foam::janafThermo::Tcommon
scalar Tcommon() const
Return const access to the common temperature.
Definition: janafThermoI.H:150
Foam::FixedList< scalar, nCoeffs_ >
janafThermoI.H
janafThermo.C
Foam::janafThermo::janafThermo
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.
Foam::janafThermo::Hs
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: janafThermoI.H:204
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
FixedList.H
Foam::janafThermo::write
void write(Ostream &os) const
Write to Ostream.
Definition: janafThermo.C:85
Foam::janafThermo::Thigh
scalar Thigh() const
Return const access to the high temperature limit.
Definition: janafThermoI.H:143
Foam::janafThermo::dCpdT
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: janafThermoI.H:264
Foam::janafThermo::Gstd
scalar Gstd(const scalar T) const
Gibbs free energy of the mixture in the standard state [J/kg].
Definition: janafThermoI.H:245
Foam::janafThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: janafThermoI.H:214
Foam::janafThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: janafThermoI.H:229