mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
updated to current thermo spec
This commit is contained in:
@ -34,6 +34,8 @@ Description
|
||||
|
||||
#include "perfectGas.H"
|
||||
|
||||
#include "eConstThermo.H"
|
||||
|
||||
#include "hConstThermo.H"
|
||||
#include "janafThermo.H"
|
||||
#include "specieThermo.H"
|
||||
@ -68,6 +70,22 @@ makeBasicMixture
|
||||
perfectGas
|
||||
);
|
||||
|
||||
makeBasicMixture
|
||||
(
|
||||
pureMixture,
|
||||
constTransport,
|
||||
eConstThermo,
|
||||
perfectGas
|
||||
);
|
||||
|
||||
makeBasicMixture
|
||||
(
|
||||
pureMixture,
|
||||
sutherlandTransport,
|
||||
eConstThermo,
|
||||
perfectGas
|
||||
);
|
||||
|
||||
makeBasicMixture
|
||||
(
|
||||
pureMixture,
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
|
||||
#include "perfectGas.H"
|
||||
|
||||
#include "hConstThermo.H"
|
||||
#include "eConstThermo.H"
|
||||
#include "janafThermo.H"
|
||||
#include "specieThermo.H"
|
||||
|
||||
@ -50,7 +50,7 @@ makeBasicPsiThermo
|
||||
ePsiThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
hConstThermo,
|
||||
eConstThermo,
|
||||
perfectGas
|
||||
);
|
||||
|
||||
@ -59,7 +59,7 @@ makeBasicPsiThermo
|
||||
ePsiThermo,
|
||||
pureMixture,
|
||||
sutherlandTransport,
|
||||
hConstThermo,
|
||||
eConstThermo,
|
||||
perfectGas
|
||||
);
|
||||
|
||||
|
||||
@ -29,9 +29,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::eConstThermo::eConstThermo(Istream& is)
|
||||
template<class equationOfState>
|
||||
Foam::eConstThermo<equationOfState>::eConstThermo(Istream& is)
|
||||
:
|
||||
specieThermo(is),
|
||||
equationOfState(is),
|
||||
Cv_(readScalar(is)),
|
||||
Hf_(readScalar(is))
|
||||
{
|
||||
@ -41,9 +42,15 @@ Foam::eConstThermo::eConstThermo(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const eConstThermo& ct)
|
||||
template<class equationOfState>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const eConstThermo<equationOfState>& ct
|
||||
)
|
||||
{
|
||||
os << (const specieThermo&)ct << tab << ct.Cv_ << tab << ct.Hf_;
|
||||
os << static_cast<const equationOfState&>(ct) << tab
|
||||
<< ct.Cv_ << tab << ct.Hf_;
|
||||
|
||||
os.check("Ostream& operator<<(Ostream& os, const eConstThermo& ct)");
|
||||
return os;
|
||||
|
||||
@ -26,8 +26,8 @@ Class
|
||||
Foam::eConstThermo
|
||||
|
||||
Description
|
||||
Constant properties thermodynamics package derived from the basic
|
||||
thermo package data type specieThermo.
|
||||
Constant properties thermodynamics package templated on an equation of
|
||||
state
|
||||
|
||||
SourceFiles
|
||||
eConstThermoI.H
|
||||
@ -89,9 +89,10 @@ Ostream& operator<<
|
||||
Class eConstThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class equationOfState>
|
||||
class eConstThermo
|
||||
:
|
||||
public specieThermo
|
||||
public equationOfState
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -104,7 +105,7 @@ class eConstThermo
|
||||
//- Construct from components
|
||||
inline eConstThermo
|
||||
(
|
||||
const specieThermo& st,
|
||||
const equationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf
|
||||
);
|
||||
@ -147,20 +148,10 @@ public:
|
||||
inline scalar s(const scalar T) const;
|
||||
|
||||
|
||||
// Some derived properties
|
||||
// Other derived properties obtained from specieThermo base type
|
||||
|
||||
//- Temperature from Enthalpy given an initial temperature T0
|
||||
inline scalar TH(const scalar h, const scalar T0) const;
|
||||
|
||||
//- Temperature from internal energy given an initial temperature T0
|
||||
inline scalar TE(const scalar e, const scalar T0) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const hConstThermo&);
|
||||
inline void operator-=(const hConstThermo&);
|
||||
inline void operator+=(const eConstThermo&);
|
||||
inline void operator-=(const eConstThermo&);
|
||||
|
||||
|
||||
// Friend operators
|
||||
@ -194,7 +185,8 @@ public:
|
||||
|
||||
friend Ostream& operator<< <equationOfState>
|
||||
(
|
||||
Ostream&, const eConstThermo&
|
||||
Ostream&,
|
||||
const eConstThermo&
|
||||
);
|
||||
};
|
||||
|
||||
@ -207,6 +199,10 @@ public:
|
||||
|
||||
#include "eConstThermoI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "eConstThermo.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,14 +26,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
inline Foam::eConstThermo::eConstThermo
|
||||
template<class equationOfState>
|
||||
inline Foam::eConstThermo<equationOfState>::eConstThermo
|
||||
(
|
||||
const specieThermo& st,
|
||||
const equationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf
|
||||
)
|
||||
:
|
||||
specieThermo(st),
|
||||
equationOfState(st),
|
||||
Cv_(cv),
|
||||
Hf_(hf)
|
||||
{}
|
||||
@ -41,20 +42,21 @@ inline Foam::eConstThermo::eConstThermo
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::eConstThermo::eConstThermo
|
||||
template<class equationOfState>
|
||||
inline Foam::eConstThermo<equationOfState>::eConstThermo
|
||||
(
|
||||
const word& name,
|
||||
const eConstThermo& ct
|
||||
const eConstThermo<equationOfState>& ct
|
||||
)
|
||||
:
|
||||
specieThermo(name, ct),
|
||||
equationOfState(name, ct),
|
||||
Cv_(ct.Cv_),
|
||||
Hf_(ct.Hf_)
|
||||
{}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::autoPtr<eConstThermo<equationOfState> >
|
||||
inline Foam::autoPtr<Foam::eConstThermo<equationOfState> >
|
||||
Foam::eConstThermo<equationOfState>::clone() const
|
||||
{
|
||||
return autoPtr<eConstThermo<equationOfState> >
|
||||
@ -65,7 +67,7 @@ Foam::eConstThermo<equationOfState>::clone() const
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline autoPtr<eConstThermo<equationOfState> >
|
||||
inline Foam::autoPtr<Foam::eConstThermo<equationOfState> >
|
||||
Foam::eConstThermo<equationOfState>::New(Istream& is)
|
||||
{
|
||||
return autoPtr<eConstThermo<equationOfState> >
|
||||
@ -77,19 +79,31 @@ Foam::eConstThermo<equationOfState>::New(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::cp(const scalar) const
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<equationOfState>::cp
|
||||
(
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return Cv_*W() + RR;
|
||||
return Cv_*this->W() + specie::RR;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::h(const scalar T) const
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<equationOfState>::h
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return cp(T)*T + Hf_*W();
|
||||
return cp(T)*T + Hf_*this->W();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::hs(const scalar T) const
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<equationOfState>::hs
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return cp(T)*T;
|
||||
}
|
||||
@ -102,104 +116,126 @@ inline Foam::scalar Foam::eConstThermo<equationOfState>::hc() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::s(const scalar T) const
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<equationOfState>::s
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
notImplemented("scalar eConstThermo::s(const scalar T) const");
|
||||
return T;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::TH
|
||||
(
|
||||
const scalar h,
|
||||
const scalar T0
|
||||
) const
|
||||
{
|
||||
return (h - Hf_)/Cp(T0);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::TE
|
||||
(
|
||||
const scalar e,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return (e - Hf_)/Cv_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::eConstThermo& Foam::eConstThermo::operator=
|
||||
template<class equationOfState>
|
||||
inline void Foam::eConstThermo<equationOfState>::operator+=
|
||||
(
|
||||
const eConstThermo& ct
|
||||
const eConstThermo<equationOfState>& ct
|
||||
)
|
||||
{
|
||||
specieThermo::operator=(ct);
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Cv_ = ct.Cv_;
|
||||
Hf_ = ct.Hf_;
|
||||
equationOfState::operator+=(ct);
|
||||
|
||||
return *this;
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ct.nMoles()/this->nMoles();
|
||||
|
||||
Cv_ = molr1*Cv_ + molr2*ct.Cv_;
|
||||
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline void Foam::eConstThermo<equationOfState>::operator-=
|
||||
(
|
||||
const eConstThermo<equationOfState>& ct
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
equationOfState::operator-=(ct);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ct.nMoles()/this->nMoles();
|
||||
|
||||
Cv_ = molr1*Cv_ - molr2*ct.Cv_;
|
||||
Hf_ = molr1*Hf_ - molr2*ct.Hf_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::eConstThermo Foam::operator+
|
||||
template<class equationOfState>
|
||||
inline Foam::eConstThermo<equationOfState> Foam::operator+
|
||||
(
|
||||
const eConstThermo& ct1,
|
||||
const eConstThermo& ct2
|
||||
const eConstThermo<equationOfState>& ct1,
|
||||
const eConstThermo<equationOfState>& ct2
|
||||
)
|
||||
{
|
||||
specieThermo st(((const specieThermo&)ct1) + ((const specieThermo&)ct2));
|
||||
|
||||
return eConstThermo
|
||||
equationOfState eofs
|
||||
(
|
||||
st,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Cv_ + ct2.nMoles()/st.nMoles()*ct2.Cv_,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Hf_ + ct2.nMoles()/st.nMoles()*ct2.Hf_
|
||||
static_cast<const equationOfState&>(ct1)
|
||||
+ static_cast<const equationOfState&>(ct2)
|
||||
);
|
||||
|
||||
return eConstThermo<equationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Cv_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::eConstThermo Foam::operator-
|
||||
template<class equationOfState>
|
||||
inline Foam::eConstThermo<equationOfState> Foam::operator-
|
||||
(
|
||||
const eConstThermo& ct1,
|
||||
const eConstThermo& ct2
|
||||
const eConstThermo<equationOfState>& ct1,
|
||||
const eConstThermo<equationOfState>& ct2
|
||||
)
|
||||
{
|
||||
specieThermo st(((const specieThermo&)ct1) - ((const specieThermo&)ct2));
|
||||
|
||||
return eConstThermo
|
||||
equationOfState eofs
|
||||
(
|
||||
st,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Cv_ - ct2.nMoles()/st.nMoles()*ct2.Cv_,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Hf_ - ct2.nMoles()/st.nMoles()*ct2.Hf_
|
||||
static_cast<const equationOfState&>(ct1)
|
||||
- static_cast<const equationOfState&>(ct2)
|
||||
);
|
||||
|
||||
return eConstThermo<equationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Cv_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::eConstThermo Foam::operator*
|
||||
template<class equationOfState>
|
||||
inline Foam::eConstThermo<equationOfState> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const eConstThermo& ct
|
||||
const eConstThermo<equationOfState>& ct
|
||||
)
|
||||
{
|
||||
return eConstThermo
|
||||
return eConstThermo<equationOfState>
|
||||
(
|
||||
s*((const specieThermo&)ct),
|
||||
s*static_cast<const equationOfState&>(ct),
|
||||
ct.Cv_,
|
||||
ct.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::eConstThermo Foam::operator==
|
||||
template<class equationOfState>
|
||||
inline Foam::eConstThermo<equationOfState> Foam::operator==
|
||||
(
|
||||
const eConstThermo& ct1,
|
||||
const eConstThermo& ct2
|
||||
const eConstThermo<equationOfState>& ct1,
|
||||
const eConstThermo<equationOfState>& ct2
|
||||
)
|
||||
{
|
||||
return ct2 - ct1;
|
||||
|
||||
Reference in New Issue
Block a user