1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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
26 JANAF tables based thermodynamics package templated ito the equationOfState.
28 \*---------------------------------------------------------------------------*/
30 #include "janafThermo.H"
31 #include "IOstreams.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 template<class equationOfState>
41 janafThermo<equationOfState>::janafThermo(Istream& is)
44 Tlow_(readScalar(is)),
45 Thigh_(readScalar(is)),
46 Tcommon_(readScalar(is))
52 "janafThermo<equationOfState>::janafThermo(Istream& is)",
54 ) << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')'
55 << exit(FatalIOError);
58 if (Tcommon_ <= Tlow_)
62 "janafThermo<equationOfState>::janafThermo(Istream& is)",
64 ) << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')'
65 << exit(FatalIOError);
68 if (Tcommon_ > Thigh_)
72 "janafThermo<equationOfState>::janafThermo(Istream& is)",
74 ) << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')'
75 << exit(FatalIOError);
80 register label coefLabel=0;
81 coefLabel<janafThermo<equationOfState>::nCoeffs_;
85 is >> highCpCoeffs_[coefLabel];
90 register label coefLabel=0;
91 coefLabel<janafThermo<equationOfState>::nCoeffs_;
95 is >> lowCpCoeffs_[coefLabel];
98 // Check state of Istream
99 is.check("janafThermo::janafThermo(Istream& is)");
103 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
105 template<class equationOfState>
106 Ostream& operator<<(Ostream& os, const janafThermo<equationOfState>& jt)
108 os << static_cast<const equationOfState&>(jt) << nl
111 << tab << jt.Tcommon_;
117 register label coefLabel=0;
118 coefLabel<janafThermo<equationOfState>::nCoeffs_;
122 os << jt.highCpCoeffs_[coefLabel] << ' ';
129 register label coefLabel=0;
130 coefLabel<janafThermo<equationOfState>::nCoeffs_;
134 os << jt.lowCpCoeffs_[coefLabel] << ' ';
141 "operator<<(Ostream& os, const janafThermo<equationOfState>& jt)"
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 } // End namespace Foam
152 // ************************************************************************* //