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