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/>.
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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 template<class equationOfState>
82 inline Foam::scalar Foam::eConstThermo<equationOfState>::cp
87 return Cv_*this->W() + specie::RR();
91 template<class equationOfState>
92 inline Foam::scalar Foam::eConstThermo<equationOfState>::h
97 return cp(T)*T + Hf_*this->W();
101 template<class equationOfState>
102 inline Foam::scalar Foam::eConstThermo<equationOfState>::hs
111 template<class equationOfState>
112 inline Foam::scalar Foam::eConstThermo<equationOfState>::hc() const
114 return Hf_*this->W();
118 template<class equationOfState>
119 inline Foam::scalar Foam::eConstThermo<equationOfState>::s
124 notImplemented("scalar eConstThermo::s(const scalar T) const");
129 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
131 template<class equationOfState>
132 inline void Foam::eConstThermo<equationOfState>::operator+=
134 const eConstThermo<equationOfState>& ct
137 scalar molr1 = this->nMoles();
139 equationOfState::operator+=(ct);
141 molr1 /= this->nMoles();
142 scalar molr2 = ct.nMoles()/this->nMoles();
144 Cv_ = molr1*Cv_ + molr2*ct.Cv_;
145 Hf_ = molr1*Hf_ + molr2*ct.Hf_;
149 template<class equationOfState>
150 inline void Foam::eConstThermo<equationOfState>::operator-=
152 const eConstThermo<equationOfState>& ct
155 scalar molr1 = this->nMoles();
157 equationOfState::operator-=(ct);
159 molr1 /= this->nMoles();
160 scalar molr2 = ct.nMoles()/this->nMoles();
162 Cv_ = molr1*Cv_ - molr2*ct.Cv_;
163 Hf_ = molr1*Hf_ - molr2*ct.Hf_;
167 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
169 template<class equationOfState>
170 inline Foam::eConstThermo<equationOfState> Foam::operator+
172 const eConstThermo<equationOfState>& ct1,
173 const eConstThermo<equationOfState>& ct2
178 static_cast<const equationOfState&>(ct1)
179 + static_cast<const equationOfState&>(ct2)
182 return eConstThermo<equationOfState>
185 ct1.nMoles()/eofs.nMoles()*ct1.Cv_
186 + ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
187 ct1.nMoles()/eofs.nMoles()*ct1.Hf_
188 + ct2.nMoles()/eofs.nMoles()*ct2.Hf_
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*
221 const eConstThermo<equationOfState>& ct
224 return eConstThermo<equationOfState>
226 s*static_cast<const equationOfState&>(ct),
233 template<class equationOfState>
234 inline Foam::eConstThermo<equationOfState> Foam::operator==
236 const eConstThermo<equationOfState>& ct1,
237 const eConstThermo<equationOfState>& ct2
244 // ************************************************************************* //