31 template<
class Thermo,
template<
class>
class Type>
41 template<
class Thermo,
template<
class>
class Type>
51 const bool diagnostics
57 <<
"Negative initial temperature T0: " << T0
63 scalar Ttol = T0*tol_;
68 const unsigned int width = IOstream::defaultPrecision() + 8;
71 <<
"Energy -> temperature conversion failed to converge:" <<
endl;
73 <<
setw(width) <<
"Test" 74 <<
setw(width) <<
"e/h" 75 <<
setw(width) <<
"Cv/p" 76 <<
setw(width) <<
"Tnew" 85 (Test - ((this->*F)(p, Test) - f)/(this->*dFdT)(p, Test));
89 const unsigned int width = IOstream::defaultPrecision() + 8;
92 <<
setw(width) << Test
93 <<
setw(width) << ((this->*
F)(p, Test))
94 <<
setw(width) << ((this->*dFdT)(p, Test))
95 <<
setw(width) << Tnew
99 if (iter++ > maxIter_)
103 T(f, p, T0, F, dFdT, limit,
true);
107 <<
"Maximum number of iterations exceeded: " << maxIter_
111 }
while (
mag(Tnew - Test) > Ttol);
119 template<
class Thermo,
template<
class>
class Type>
132 template<
class Thermo,
template<
class>
class Type>
136 return Type<thermo<Thermo, Type>>::energyName();
140 template<
class Thermo,
template<
class>
class Type>
144 return Type<thermo<Thermo, Type>>::Cpv(*
this, p, T);
148 template<
class Thermo,
template<
class>
class Type>
152 const scalar
Cp = this->
Cp(p, T);
153 return Cp/(Cp - this->CpMCv(p, T));
157 template<
class Thermo,
template<
class>
class Type>
165 return Type<thermo<Thermo, Type>>::CpByCpv(*
this, p, T);
169 template<
class Thermo,
template<
class>
class Type>
173 return Type<thermo<Thermo, Type>>::HE(*
this, p, T);
177 template<
class Thermo,
template<
class>
class Type>
181 return this->
Ha(p, T) - T*this->S(p, T);
185 template<
class Thermo,
template<
class>
class Type>
189 return this->
Ea(p, T) - T*this->S(p, T);
193 template<
class Thermo,
template<
class>
class Type>
197 return this->
Cp(p, T)*this->
W();
201 template<
class Thermo,
template<
class>
class Type>
205 return this->
Ha(p, T)*this->
W();
209 template<
class Thermo,
template<
class>
class Type>
213 return this->
Hs(p, T)*this->
W();
217 template<
class Thermo,
template<
class>
class Type>
221 return this->Hc()*this->
W();
225 template<
class Thermo,
template<
class>
class Type>
229 return this->S(p, T)*this->
W();
233 template<
class Thermo,
template<
class>
class Type>
237 return this->HE(p, T)*this->
W();
241 template<
class Thermo,
template<
class>
class Type>
245 return this->
Cv(p, T)*this->
W();
249 template<
class Thermo,
template<
class>
class Type>
253 return this->
Es(p, T)*this->
W();
257 template<
class Thermo,
template<
class>
class Type>
261 return this->
Ea(p, T)*this->
W();
265 template<
class Thermo,
template<
class>
class Type>
269 return this->
G(p, T)*this->
W();
273 template<
class Thermo,
template<
class>
class Type>
277 return this->A(p, T)*this->
W();
281 template<
class Thermo,
template<
class>
class Type>
285 scalar arg = -this->
Y()*this->
G(
Pstd, T)/(
RR*
T);
298 template<
class Thermo,
template<
class>
class Type>
306 template<
class Thermo,
template<
class>
class Type>
310 const scalar nm = this->
Y()/this->
W();
312 if (
equal(nm, small))
323 template<
class Thermo,
template<
class>
class Type>
330 const scalar nm = this->
Y()/this->
W();
332 if (
equal(nm, small))
338 return Kp(p, T)*
pow(
Pstd/p, nm);
343 template<
class Thermo,
template<
class>
class Type>
351 const scalar nm = this->
Y()/this->
W();
353 if (
equal(nm, small))
359 return Kp(p, T)*
pow(n*
Pstd/p, nm);
364 template<
class Thermo,
template<
class>
class Type>
372 return Type<thermo<Thermo, Type>>::THE(*
this, he, p, T0);
376 template<
class Thermo,
template<
class>
class Type>
396 template<
class Thermo,
template<
class>
class Type>
416 template<
class Thermo,
template<
class>
class Type>
436 template<
class Thermo,
template<
class>
class Type>
456 template<
class Thermo,
template<
class>
class Type>
464 const scalar nm = this->
Y()/this->
W();
466 if (
equal(nm, small))
468 return -this->dGdT(
Pstd, T)*this->
Y()/
RR;
472 return -(nm/T + this->dGdT(
Pstd, T)*this->
Y()/
RR);
477 template<
class Thermo,
template<
class>
class Type>
481 return this->dCpdT(p, T)*this->
W();;
487 template<
class Thermo,
template<
class>
class Type>
488 inline void Foam::species::thermo<Thermo, Type>::operator+=
493 Thermo::operator+=(st);
497 template<
class Thermo,
template<
class>
class Type>
500 Thermo::operator*=(s);
506 template<
class Thermo,
template<
class>
class Type>
515 static_cast<const Thermo&
>(st1) + static_cast<const Thermo&>(st2)
520 template<
class Thermo,
template<
class>
class Type>
529 s*
static_cast<const Thermo&
>(st)
534 template<
class Thermo,
template<
class>
class Type>
543 static_cast<const Thermo&
>(st1) == static_cast<const Thermo&>(st2)
scalar Cv(const scalar p, const scalar T) const
void limit(const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phi, surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su, const PsiMaxType &psiMax, const PsiMinType &psiMin, const bool returnCorr)
scalar TEs(const scalar E, const scalar p, const scalar T0) const
Temperature from sensible internal energy.
scalar dKcdTbyKc(const scalar p, const scalar T) const
Derivative of B (acooding to Niemeyer et al.) w.r.t. temperature.
scalar G(const scalar p, const scalar T) const
Gibbs free energy [J/kg].
scalar A(const scalar p, const scalar T) const
Helmholtz free energy [J/kg].
scalar Hs(const scalar p, const scalar T) const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kmol].
scalar he(const scalar p, const scalar T) const
Enthalpy/Internal energy [J/kmol].
scalar Es(const scalar p, const scalar T) const
const dimensionedScalar G
Newtonian constant of gravitation.
scalar Kn(const scalar p, const scalar T, const scalar n) const
Equilibrium constant [] i.t.o. number of moles.
scalar dcpdT(const scalar p, const scalar T) const
Derivative of cp w.r.t. temperature.
scalar s(const scalar p, const scalar T) const
Entropy [J/kmol/K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar Kx(const scalar p, const scalar T) const
Equilibrium constant [] i.t.o. mole-fractions.
scalar g(const scalar p, const scalar T) const
Gibbs free energy [J/kmol].
CGAL::Exact_predicates_exact_constructions_kernel K
static word heName()
Name of Enthalpy/Internal energy.
scalar CpByCpv(const scalar p, const scalar T) const
Ratio of heat capacity at constant pressure to that at.
scalar THa(const scalar H, const scalar p, const scalar T0) const
Temperature from absolute enthalpy.
scalar HE(const scalar p, const scalar T) const
Enthalpy/Internal energy [J/kg].
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar exp(const dimensionedScalar &ds)
A class for handling words, derived from string.
scalar hc() const
Chemical enthalpy [J/kmol].
volVectorField F(fluid.F())
scalar Cpv(const scalar p, const scalar T) const
Heat capacity at constant pressure/volume [J/kg/K].
scalar gamma(const scalar p, const scalar T) const
Gamma = Cp/Cv [].
const dimensionedScalar Pstd
Standard pressure.
errorManip< error > abort(error &err)
scalar a(const scalar p, const scalar T) const
Helmholtz free energy [J/kmol].
Istream and Ostream manipulators taking arguments.
scalar cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/kmol/K].
scalar ea(const scalar p, const scalar T) const
Absolute internal energy [J/kmol].
scalar TEa(const scalar E, const scalar p, const scalar T0) const
Temperature from absolute internal energy.
scalar hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kmol].
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
bool equal(const T &s1, const T &s2)
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
prefixOSstream Pout(cout, "Pout")
const scalarList W(::W(thermo))
PtrList< volScalarField > & Y
void operator*=(const scalar)
thermo(const Thermo &sp)
Construct from components.
scalar Cp(const scalar p, const scalar T) const
scalar Kc(const scalar p, const scalar T) const
Equilibrium constant i.t.o. molar concentration.
scalar THs(const scalar Hs, const scalar p, const scalar T0) const
Temperature from sensible enthalpy given an initial T0.
dimensioned< scalar > mag(const dimensioned< Type > &)
scalar Ha(const scalar p, const scalar T) const
const scalar RR
Universal gas constant (default in [J/kmol/K])
Omanip< int > setw(const int i)
scalar cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kmol/K].
scalar es(const scalar p, const scalar T) const
Sensible internal energy [J/kmol].
scalar K(const scalar p, const scalar T) const
Equilibrium constant [] i.t.o fugacities.
scalar Ea(const scalar p, const scalar T) const
scalar THE(const scalar H, const scalar p, const scalar T0) const
Temperature from enthalpy or internal energy.
scalar Kp(const scalar p, const scalar T) const
Equilibrium constant [] i.t.o. partial pressures.
#define InfoInFunction
Report an information message using Foam::Info.