1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2011 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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "hPolynomialThermo.H"
27 #include "IOstreams.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class EquationOfState, int PolySize>
32 Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
40 CpCoeffs_("CpCoeffs<" + Foam::name(PolySize) + '>', is),
46 CpCoeffs_ *= this->W();
48 hCoeffs_ = CpCoeffs_.integral();
49 sCoeffs_ = CpCoeffs_.integralMinus1();
51 // Offset h poly so that it is relative to the enthalpy at Tstd
52 hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd);
54 // Offset s poly so that it is relative to the entropy at Tstd
55 sCoeffs_[0] += Sf_ - sCoeffs_.value(specie::Tstd);
59 template<class EquationOfState, int PolySize>
60 Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
62 const dictionary& dict
65 EquationOfState(dict),
66 Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf"))),
67 Sf_(readScalar(dict.subDict("thermodynamics").lookup("Sf"))),
70 dict.subDict("thermodynamics").lookup
72 "CpCoeffs<" + Foam::name(PolySize) + '>'
80 CpCoeffs_ *= this->W();
82 hCoeffs_ = CpCoeffs_.integral();
83 sCoeffs_ = CpCoeffs_.integralMinus1();
85 // Offset h poly so that it is relative to the enthalpy at Tstd
86 hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd);
88 // Offset s poly so that it is relative to the entropy at Tstd
89 sCoeffs_[0] += Sf_ - sCoeffs_.value(specie::Tstd);
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 template<class EquationOfState, int PolySize>
96 void Foam::hPolynomialThermo<EquationOfState, PolySize>::write
101 EquationOfState::write(os);
103 dictionary dict("thermodynamics");
108 word("CpCoeffs<" + Foam::name(PolySize) + '>'),
115 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
117 template<class EquationOfState, int PolySize>
118 Foam::Ostream& Foam::operator<<
121 const hPolynomialThermo<EquationOfState, PolySize>& pt
124 os << static_cast<const EquationOfState&>(pt) << tab
125 << pt.Hf_/pt.W() << tab
126 << pt.Sf_/pt.W() << tab
127 << "CpCoeffs<" << Foam::name(PolySize) << '>' << tab
128 << pt.CpCoeffs_/pt.W();
135 "const hPolynomialThermo<EquationOfState, PolySize>&"
143 // ************************************************************************* //