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/>.
25 JANAF tables based thermodynamics package templated ito the equationOfState.
27 \*---------------------------------------------------------------------------*/
29 #include "janafThermo.H"
30 #include "IOstreams.H"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 template<class equationOfState>
35 Foam::janafThermo<equationOfState>::janafThermo(Istream& is)
38 Tlow_(readScalar(is)),
39 Thigh_(readScalar(is)),
40 Tcommon_(readScalar(is))
46 "janafThermo<equationOfState>::janafThermo(Istream& is)",
48 ) << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')'
49 << exit(FatalIOError);
52 if (Tcommon_ <= Tlow_)
56 "janafThermo<equationOfState>::janafThermo(Istream& is)",
58 ) << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')'
59 << exit(FatalIOError);
62 if (Tcommon_ > Thigh_)
66 "janafThermo<equationOfState>::janafThermo(Istream& is)",
68 ) << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')'
69 << exit(FatalIOError);
74 register label coefLabel=0;
75 coefLabel<janafThermo<equationOfState>::nCoeffs_;
79 is >> highCpCoeffs_[coefLabel];
84 register label coefLabel=0;
85 coefLabel<janafThermo<equationOfState>::nCoeffs_;
89 is >> lowCpCoeffs_[coefLabel];
92 // Check state of Istream
93 is.check("janafThermo::janafThermo(Istream& is)");
97 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
99 template<class equationOfState>
100 Foam::Ostream& Foam::operator<<
103 const janafThermo<equationOfState>& jt
106 os << static_cast<const equationOfState&>(jt) << nl
109 << tab << jt.Tcommon_;
115 register label coefLabel=0;
116 coefLabel<janafThermo<equationOfState>::nCoeffs_;
120 os << jt.highCpCoeffs_[coefLabel] << ' ';
127 register label coefLabel=0;
128 coefLabel<janafThermo<equationOfState>::nCoeffs_;
132 os << jt.lowCpCoeffs_[coefLabel] << ' ';
139 "operator<<(Ostream& os, const janafThermo<equationOfState>& jt)"
146 // ************************************************************************* //