1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 JANAF tables based thermodynamics package templated
29 into the equation of state.
35 \*---------------------------------------------------------------------------*/
41 #include "FixedList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of friend functions and operators
50 template<class EquationOfState> class janafThermo;
52 template<class EquationOfState>
53 inline janafThermo<EquationOfState> operator+
55 const janafThermo<EquationOfState>&,
56 const janafThermo<EquationOfState>&
59 template<class EquationOfState>
60 inline janafThermo<EquationOfState> operator-
62 const janafThermo<EquationOfState>&,
63 const janafThermo<EquationOfState>&
66 template<class EquationOfState>
67 inline janafThermo<EquationOfState> operator*
70 const janafThermo<EquationOfState>&
73 template<class EquationOfState>
74 inline janafThermo<EquationOfState> operator==
76 const janafThermo<EquationOfState>&,
77 const janafThermo<EquationOfState>&
80 template<class EquationOfState>
84 const janafThermo<EquationOfState>&
88 /*---------------------------------------------------------------------------*\
89 Class janafThermo Declaration
90 \*---------------------------------------------------------------------------*/
92 template<class EquationOfState>
95 public EquationOfState
102 static const int nCoeffs_ = 7;
103 typedef FixedList<scalar, nCoeffs_> coeffArray;
110 // Temperature limits of applicability of functions
111 scalar Tlow_, Thigh_, Tcommon_;
113 coeffArray highCpCoeffs_;
114 coeffArray lowCpCoeffs_;
117 // Private Member Functions
119 //- Check that input data is valid
120 void checkInputData() const;
122 //- Return the coefficients corresponding to the given temperature
123 inline const coeffArray& coeffs(const scalar T) const;
130 //- Construct from components
133 const EquationOfState& st,
136 const scalar Tcommon,
137 const coeffArray& highCpCoeffs,
138 const coeffArray& lowCpCoeffs
141 //- Construct from Istream
142 janafThermo(Istream&);
144 //- Construct from dictionary
145 janafThermo(const dictionary& dict);
147 //- Construct as a named copy
148 inline janafThermo(const word&, const janafThermo&);
153 //- Limit the temperature to be in the range Tlow_ to Thigh_
154 inline scalar limit(const scalar T) const;
156 // Fundamental properties
158 //- Heat capacity at constant pressure [J/(kmol K)]
159 inline scalar cp(const scalar T) const;
161 //- Enthalpy [J/kmol]
162 inline scalar h(const scalar T) const;
164 //- Sensible enthalpy [J/kmol]
165 inline scalar hs(const scalar T) const;
167 //- Chemical enthalpy [J/kmol]
168 inline scalar hc() const;
170 //- Entropy [J/(kmol K)]
171 inline scalar s(const scalar T) const;
177 void write(Ostream& os) const;
182 inline void operator+=(const janafThermo&);
183 inline void operator-=(const janafThermo&);
188 friend janafThermo operator+ <EquationOfState>
194 friend janafThermo operator- <EquationOfState>
200 friend janafThermo operator* <EquationOfState>
206 friend janafThermo operator== <EquationOfState>
215 friend Ostream& operator<< <EquationOfState>
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 } // End namespace Foam
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 #include "janafThermoI.H"
232 # include "janafThermo.C"
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 // ************************************************************************* //