1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 JANAF tables based thermodynamics package templated
29 into the equationOfState.
35 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of friend functions and operators
49 template<class equationOfState> class janafThermo;
51 template<class equationOfState>
52 inline janafThermo<equationOfState> operator+
54 const janafThermo<equationOfState>&,
55 const janafThermo<equationOfState>&
58 template<class equationOfState>
59 inline janafThermo<equationOfState> operator-
61 const janafThermo<equationOfState>&,
62 const janafThermo<equationOfState>&
65 template<class equationOfState>
66 inline janafThermo<equationOfState> operator*
69 const janafThermo<equationOfState>&
72 template<class equationOfState>
73 inline janafThermo<equationOfState> operator==
75 const janafThermo<equationOfState>&,
76 const janafThermo<equationOfState>&
79 template<class equationOfState>
83 const janafThermo<equationOfState>&
87 /*---------------------------------------------------------------------------*\
88 Class janafThermo Declaration
89 \*---------------------------------------------------------------------------*/
91 template<class equationOfState>
94 public equationOfState
99 static const int nCoeffs_ = 7;
100 typedef FixedList<scalar, nCoeffs_> coeffArray;
106 // Temperature limits of applicability of functions
107 scalar Tlow_, Thigh_, Tcommon_;
109 coeffArray highCpCoeffs_;
110 coeffArray lowCpCoeffs_;
113 // Private member functions
115 //- Check given temperature is within the range of the fitted coeffs
116 // Note: bounding T within range. HJ, 12/Oct/2010
117 inline void checkT(scalar& T) const;
119 //- Return the coefficients corresponding to the given temperature
120 // Note: bounding T within range. HJ, 12/Oct/2010
121 inline const coeffArray& coeffs(scalar& T) const;
128 //- Construct from components
131 const equationOfState& st,
134 const scalar Tcommon,
135 const coeffArray& highCpCoeffs,
136 const coeffArray& lowCpCoeffs
139 //- Construct from Istream
140 janafThermo(Istream&);
142 //- Construct as a named copy
143 inline janafThermo(const word&, const janafThermo&);
148 //- Heat capacity at constant pressure [J/(kmol K)]
149 // Note: bounding T within range. HJ, 12/Oct/2010
150 inline scalar cp(scalar T) const;
152 //- Enthalpy [J/kmol]
153 // Note: bounding T within range. HJ, 12/Oct/2010
154 inline scalar h(scalar T) const;
156 //- Sensible enthalpy [J/kmol]
157 // Note: bounding T within range. HJ, 12/Oct/2010
158 inline scalar hs(scalar T) const;
160 //- Chemical enthalpy [J/kmol]
161 inline scalar hc() const;
163 //- Entropy [J/(kmol K)]
164 // Note: bounding T within range. HJ, 12/Oct/2010
165 inline scalar s(scalar T) const;
170 inline void operator+=(const janafThermo&);
171 inline void operator-=(const janafThermo&);
176 friend janafThermo operator+ <equationOfState>
182 friend janafThermo operator- <equationOfState>
188 friend janafThermo operator* <equationOfState>
194 friend janafThermo operator== <equationOfState>
203 friend Ostream& operator<< <equationOfState>
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #include "janafThermoI.H"
220 # include "janafThermo.C"
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 // ************************************************************************* //