1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 JANAF tables based thermodynamics package templated
30 into the equationOfState.
36 \*---------------------------------------------------------------------------*/
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
100 static const int nCoeffs_ = 7;
101 typedef scalar coeffArray[7];
107 // Temperature limits of applicability of functions
108 scalar Tlow_, Thigh_, Tcommon_;
110 coeffArray highCpCoeffs_;
111 coeffArray lowCpCoeffs_;
114 // Private member functions
116 //- Check given temperature is within the range of the fitted coeffs
117 inline void checkT(const scalar T) const;
119 //- Return the coefficients corresponding to the given temperature
120 inline const coeffArray& coeffs(const scalar T) const;
127 //- Construct from components
130 const equationOfState& st,
133 const scalar Tcommon,
134 const coeffArray& highCpCoeffs,
135 const coeffArray& lowCpCoeffs
138 //- Construct from Istream
139 janafThermo(Istream&);
141 //- Construct as a named copy
142 inline janafThermo(const word&, const janafThermo&);
147 //- Heat capacity at constant pressure [J/(kmol K)]
148 inline scalar cp(const scalar T) const;
150 //- Enthalpy [J/kmol]
151 inline scalar h(const scalar T) const;
153 //- Sensible enthalpy [J/kmol]
154 inline scalar hs(const scalar T) const;
156 //- Chemical enthalpy [J/kmol]
157 inline scalar hc() const;
159 //- Entropy [J/(kmol K)]
160 inline scalar s(const scalar T) const;
165 inline void operator+=(const janafThermo&);
166 inline void operator-=(const janafThermo&);
171 friend janafThermo operator+ <equationOfState>
177 friend janafThermo operator- <equationOfState>
183 friend janafThermo operator* <equationOfState>
189 friend janafThermo operator== <equationOfState>
198 friend Ostream& operator<< <equationOfState>
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 #include "janafThermoI.H"
215 # include "janafThermo.C"
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 // ************************************************************************* //