1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
28 template<class equationOfState>
29 inline Foam::hConstThermo<equationOfState>::hConstThermo
31 const equationOfState& st,
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 template<class equationOfState>
45 inline Foam::hConstThermo<equationOfState>::hConstThermo
48 const hConstThermo& ct
51 equationOfState(name, ct),
57 template<class equationOfState>
58 inline Foam::autoPtr<Foam::hConstThermo<equationOfState> >
59 Foam::hConstThermo<equationOfState>::clone() const
61 return autoPtr<hConstThermo<equationOfState> >
63 new hConstThermo<equationOfState>(*this)
68 template<class equationOfState>
69 inline Foam::autoPtr<Foam::hConstThermo<equationOfState> >
70 Foam::hConstThermo<equationOfState>::New(Istream& is)
72 return autoPtr<hConstThermo<equationOfState> >
74 new hConstThermo<equationOfState>(is)
79 template<class equationOfState>
80 inline Foam::autoPtr<Foam::hConstThermo<equationOfState> >
81 Foam::hConstThermo<equationOfState>::New(const dictionary& dict)
83 return autoPtr<hConstThermo<equationOfState> >
85 new hConstThermo<equationOfState>(dict)
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 template<class EquationOfState>
93 inline Foam::scalar Foam::hConstThermo<EquationOfState>::limit
102 template<class equationOfState>
103 inline Foam::scalar Foam::hConstThermo<equationOfState>::cp
108 return Cp_*this->W();
112 template<class equationOfState>
113 inline Foam::scalar Foam::hConstThermo<equationOfState>::h
118 return (Cp_*T + Hf_)*this->W();
122 template<class equationOfState>
123 inline Foam::scalar Foam::hConstThermo<equationOfState>::hs
128 return Cp_*T*this->W();
132 template<class equationOfState>
133 inline Foam::scalar Foam::hConstThermo<equationOfState>::hc() const
135 return Hf_*this->W();
139 template<class equationOfState>
140 inline Foam::scalar Foam::hConstThermo<equationOfState>::s
147 "scalar hConstThermo<equationOfState>::s(const scalar T) const"
153 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
155 template<class equationOfState>
156 inline void Foam::hConstThermo<equationOfState>::operator+=
158 const hConstThermo<equationOfState>& ct
161 scalar molr1 = this->nMoles();
163 equationOfState::operator+=(ct);
165 molr1 /= this->nMoles();
166 scalar molr2 = ct.nMoles()/this->nMoles();
168 Cp_ = molr1*Cp_ + molr2*ct.Cp_;
169 Hf_ = molr1*Hf_ + molr2*ct.Hf_;
173 template<class equationOfState>
174 inline void Foam::hConstThermo<equationOfState>::operator-=
176 const hConstThermo<equationOfState>& ct
179 scalar molr1 = this->nMoles();
181 equationOfState::operator-=(ct);
183 molr1 /= this->nMoles();
184 scalar molr2 = ct.nMoles()/this->nMoles();
186 Cp_ = molr1*Cp_ - molr2*ct.Cp_;
187 Hf_ = molr1*Hf_ - molr2*ct.Hf_;
191 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
193 template<class equationOfState>
194 inline Foam::hConstThermo<equationOfState> Foam::operator+
196 const hConstThermo<equationOfState>& ct1,
197 const hConstThermo<equationOfState>& ct2
202 static_cast<const equationOfState&>(ct1)
203 + static_cast<const equationOfState&>(ct2)
206 return hConstThermo<equationOfState>
209 ct1.nMoles()/eofs.nMoles()*ct1.Cp_
210 + ct2.nMoles()/eofs.nMoles()*ct2.Cp_,
211 ct1.nMoles()/eofs.nMoles()*ct1.Hf_
212 + ct2.nMoles()/eofs.nMoles()*ct2.Hf_
217 template<class equationOfState>
218 inline Foam::hConstThermo<equationOfState> Foam::operator-
220 const hConstThermo<equationOfState>& ct1,
221 const hConstThermo<equationOfState>& ct2
226 static_cast<const equationOfState&>(ct1)
227 - static_cast<const equationOfState&>(ct2)
230 return hConstThermo<equationOfState>
233 ct1.nMoles()/eofs.nMoles()*ct1.Cp_
234 - ct2.nMoles()/eofs.nMoles()*ct2.Cp_,
235 ct1.nMoles()/eofs.nMoles()*ct1.Hf_
236 - ct2.nMoles()/eofs.nMoles()*ct2.Hf_
241 template<class equationOfState>
242 inline Foam::hConstThermo<equationOfState> Foam::operator*
245 const hConstThermo<equationOfState>& ct
248 return hConstThermo<equationOfState>
250 s*static_cast<const equationOfState&>(ct),
257 template<class equationOfState>
258 inline Foam::hConstThermo<equationOfState> Foam::operator==
260 const hConstThermo<equationOfState>& ct1,
261 const hConstThermo<equationOfState>& ct2
268 // ************************************************************************* //