31 template<
class equationOfState>
34 const equationOfState& st,
38 const typename janafThermo<equationOfState>::coeffArray& highCpCoeffs,
39 const typename janafThermo<equationOfState>::coeffArray& lowCpCoeffs
47 for (
register label coefLabel=0; coefLabel<
nCoeffs_; coefLabel++)
49 highCpCoeffs_[coefLabel] = highCpCoeffs[coefLabel];
50 lowCpCoeffs_[coefLabel] = lowCpCoeffs[coefLabel];
55 template<
class equationOfState>
58 if (T < Tlow_ || T > Thigh_)
62 "janafThermo<equationOfState>::checkT(const scalar T) const"
63 ) <<
"attempt to use janafThermo<equationOfState>"
64 " out of temperature range "
65 << Tlow_ <<
" -> " << Thigh_ <<
"; T = " << T
71 template<
class equationOfState>
93 template<
class equationOfState>
100 equationOfState(name, jt),
103 Tcommon_(jt.Tcommon_)
105 for (
register label coefLabel=0; coefLabel<nCoeffs_; coefLabel++)
107 highCpCoeffs_[coefLabel] = jt.highCpCoeffs_[coefLabel];
108 lowCpCoeffs_[coefLabel] = jt.lowCpCoeffs_[coefLabel];
115 template<
class equationOfState>
121 const coeffArray& a = coeffs(T);
122 return this->RR*((((a[4]*T + a[3])*T + a[2])*T + a[1])*T + a[0]);
126 template<
class equationOfState>
132 const coeffArray& a = coeffs(T);
135 ((((a[4]/5.0*T + a[3]/4.0)*T + a[2]/3.0)*T + a[1]/2.0)*T + a[0])*T
141 template<
class equationOfState>
151 template<
class equationOfState>
154 const coeffArray& a = lowCpCoeffs_;
159 (((a[4]/5.0*Tstd + a[3]/4.0)*Tstd + a[2]/3.0)*Tstd + a[1]/2.0)*Tstd
166 template<
class equationOfState>
172 const coeffArray& a = coeffs(T);
176 (((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*::
log(T)
184 template<
class equationOfState>
190 scalar molr1 = this->nMoles();
192 equationOfState::operator+=(jt);
194 molr1 /= this->nMoles();
195 scalar molr2 = jt.nMoles()/this->nMoles();
197 Tlow_ =
max(Tlow_, jt.Tlow_);
198 Thigh_ =
min(Thigh_, jt.Thigh_);
199 Tcommon_ = molr1*Tcommon_ + molr2*jt.Tcommon_;
203 register label coefLabel=0;
204 coefLabel<janafThermo<equationOfState>::nCoeffs_;
208 highCpCoeffs_[coefLabel] =
209 molr1*highCpCoeffs_[coefLabel]
210 + molr2*jt.highCpCoeffs_[coefLabel];
212 lowCpCoeffs_[coefLabel] =
213 molr1*lowCpCoeffs_[coefLabel]
214 + molr2*jt.lowCpCoeffs_[coefLabel];
219 template<
class equationOfState>
220 inline void Foam::janafThermo<equationOfState>::operator-=
225 scalar molr1 = this->nMoles();
227 equationOfState::operator-=(jt);
229 molr1 /= this->nMoles();
230 scalar molr2 = jt.nMoles()/this->nMoles();
232 Tlow_ =
max(Tlow_, jt.Tlow_);
233 Thigh_ =
min(Thigh_, jt.Thigh_);
234 Tcommon_ = molr1*Tcommon_ - molr2*jt.Tcommon_;
238 register label coefLabel=0;
239 coefLabel<janafThermo<equationOfState>::nCoeffs_;
243 highCpCoeffs_[coefLabel] =
244 molr1*highCpCoeffs_[coefLabel]
245 - molr2*jt.highCpCoeffs_[coefLabel];
247 lowCpCoeffs_[coefLabel] =
248 molr1*lowCpCoeffs_[coefLabel]
249 - molr2*jt.lowCpCoeffs_[coefLabel];
256 template<
class equationOfState>
263 equationOfState eofs = jt1;
266 scalar molr1 = jt1.nMoles()/eofs.nMoles();
267 scalar molr2 = jt2.nMoles()/eofs.nMoles();
274 register label coefLabel=0;
275 coefLabel<janafThermo<equationOfState>::nCoeffs_;
279 highCpCoeffs[coefLabel] =
280 molr1*jt1.highCpCoeffs_[coefLabel]
281 + molr2*jt2.highCpCoeffs_[coefLabel];
283 lowCpCoeffs[coefLabel] =
284 molr1*jt1.lowCpCoeffs_[coefLabel]
285 + molr2*jt2.lowCpCoeffs_[coefLabel];
291 max(jt1.Tlow_, jt2.Tlow_),
292 min(jt1.Thigh_, jt2.Thigh_),
293 molr1*jt1.Tcommon_ + molr2*jt2.Tcommon_,
300 template<
class equationOfState>
307 equationOfState eofs = jt1;
310 scalar molr1 = jt1.nMoles()/eofs.nMoles();
311 scalar molr2 = jt2.nMoles()/eofs.nMoles();
318 register label coefLabel=0;
319 coefLabel<janafThermo<equationOfState>::nCoeffs_;
323 highCpCoeffs[coefLabel] =
324 molr1*jt1.highCpCoeffs_[coefLabel]
325 - molr2*jt2.highCpCoeffs_[coefLabel];
327 lowCpCoeffs[coefLabel] =
328 molr1*jt1.lowCpCoeffs_[coefLabel]
329 - molr2*jt2.lowCpCoeffs_[coefLabel];
335 max(jt1.Tlow_, jt2.Tlow_),
336 min(jt1.Thigh_, jt2.Thigh_),
337 molr1*jt1.Tcommon_ - molr2*jt2.Tcommon_,
344 template<
class equationOfState>
353 s*
static_cast<const equationOfState&
>(jt),
363 template<
class equationOfState>