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 "perfectGas.H"
|
||||||
|
|
||||||
|
#include "eConstThermo.H"
|
||||||
|
|
||||||
#include "hConstThermo.H"
|
#include "hConstThermo.H"
|
||||||
#include "janafThermo.H"
|
#include "janafThermo.H"
|
||||||
#include "specieThermo.H"
|
#include "specieThermo.H"
|
||||||
@ -68,6 +70,22 @@ makeBasicMixture
|
|||||||
perfectGas
|
perfectGas
|
||||||
);
|
);
|
||||||
|
|
||||||
|
makeBasicMixture
|
||||||
|
(
|
||||||
|
pureMixture,
|
||||||
|
constTransport,
|
||||||
|
eConstThermo,
|
||||||
|
perfectGas
|
||||||
|
);
|
||||||
|
|
||||||
|
makeBasicMixture
|
||||||
|
(
|
||||||
|
pureMixture,
|
||||||
|
sutherlandTransport,
|
||||||
|
eConstThermo,
|
||||||
|
perfectGas
|
||||||
|
);
|
||||||
|
|
||||||
makeBasicMixture
|
makeBasicMixture
|
||||||
(
|
(
|
||||||
pureMixture,
|
pureMixture,
|
||||||
|
|||||||
@ -28,7 +28,7 @@ License
|
|||||||
|
|
||||||
#include "perfectGas.H"
|
#include "perfectGas.H"
|
||||||
|
|
||||||
#include "hConstThermo.H"
|
#include "eConstThermo.H"
|
||||||
#include "janafThermo.H"
|
#include "janafThermo.H"
|
||||||
#include "specieThermo.H"
|
#include "specieThermo.H"
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ makeBasicPsiThermo
|
|||||||
ePsiThermo,
|
ePsiThermo,
|
||||||
pureMixture,
|
pureMixture,
|
||||||
constTransport,
|
constTransport,
|
||||||
hConstThermo,
|
eConstThermo,
|
||||||
perfectGas
|
perfectGas
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ makeBasicPsiThermo
|
|||||||
ePsiThermo,
|
ePsiThermo,
|
||||||
pureMixture,
|
pureMixture,
|
||||||
sutherlandTransport,
|
sutherlandTransport,
|
||||||
hConstThermo,
|
eConstThermo,
|
||||||
perfectGas
|
perfectGas
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -29,9 +29,10 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::eConstThermo::eConstThermo(Istream& is)
|
template<class equationOfState>
|
||||||
|
Foam::eConstThermo<equationOfState>::eConstThermo(Istream& is)
|
||||||
:
|
:
|
||||||
specieThermo(is),
|
equationOfState(is),
|
||||||
Cv_(readScalar(is)),
|
Cv_(readScalar(is)),
|
||||||
Hf_(readScalar(is))
|
Hf_(readScalar(is))
|
||||||
{
|
{
|
||||||
@ -41,9 +42,15 @@ Foam::eConstThermo::eConstThermo(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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)");
|
os.check("Ostream& operator<<(Ostream& os, const eConstThermo& ct)");
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
@ -26,8 +26,8 @@ Class
|
|||||||
Foam::eConstThermo
|
Foam::eConstThermo
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Constant properties thermodynamics package derived from the basic
|
Constant properties thermodynamics package templated on an equation of
|
||||||
thermo package data type specieThermo.
|
state
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
eConstThermoI.H
|
eConstThermoI.H
|
||||||
@ -89,9 +89,10 @@ Ostream& operator<<
|
|||||||
Class eConstThermo Declaration
|
Class eConstThermo Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class equationOfState>
|
||||||
class eConstThermo
|
class eConstThermo
|
||||||
:
|
:
|
||||||
public specieThermo
|
public equationOfState
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ class eConstThermo
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline eConstThermo
|
inline eConstThermo
|
||||||
(
|
(
|
||||||
const specieThermo& st,
|
const equationOfState& st,
|
||||||
const scalar cv,
|
const scalar cv,
|
||||||
const scalar hf
|
const scalar hf
|
||||||
);
|
);
|
||||||
@ -147,20 +148,10 @@ public:
|
|||||||
inline scalar s(const scalar T) const;
|
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
|
// Member operators
|
||||||
|
|
||||||
inline void operator+=(const hConstThermo&);
|
inline void operator+=(const eConstThermo&);
|
||||||
inline void operator-=(const hConstThermo&);
|
inline void operator-=(const eConstThermo&);
|
||||||
|
|
||||||
|
|
||||||
// Friend operators
|
// Friend operators
|
||||||
@ -194,7 +185,8 @@ public:
|
|||||||
|
|
||||||
friend Ostream& operator<< <equationOfState>
|
friend Ostream& operator<< <equationOfState>
|
||||||
(
|
(
|
||||||
Ostream&, const eConstThermo&
|
Ostream&,
|
||||||
|
const eConstThermo&
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -207,6 +199,10 @@ public:
|
|||||||
|
|
||||||
#include "eConstThermoI.H"
|
#include "eConstThermoI.H"
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "eConstThermo.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -26,14 +26,15 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * 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 cv,
|
||||||
const scalar hf
|
const scalar hf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
specieThermo(st),
|
equationOfState(st),
|
||||||
Cv_(cv),
|
Cv_(cv),
|
||||||
Hf_(hf)
|
Hf_(hf)
|
||||||
{}
|
{}
|
||||||
@ -41,20 +42,21 @@ inline Foam::eConstThermo::eConstThermo
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::eConstThermo::eConstThermo
|
template<class equationOfState>
|
||||||
|
inline Foam::eConstThermo<equationOfState>::eConstThermo
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const eConstThermo& ct
|
const eConstThermo<equationOfState>& ct
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
specieThermo(name, ct),
|
equationOfState(name, ct),
|
||||||
Cv_(ct.Cv_),
|
Cv_(ct.Cv_),
|
||||||
Hf_(ct.Hf_)
|
Hf_(ct.Hf_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class equationOfState>
|
template<class equationOfState>
|
||||||
inline Foam::autoPtr<eConstThermo<equationOfState> >
|
inline Foam::autoPtr<Foam::eConstThermo<equationOfState> >
|
||||||
Foam::eConstThermo<equationOfState>::clone() const
|
Foam::eConstThermo<equationOfState>::clone() const
|
||||||
{
|
{
|
||||||
return autoPtr<eConstThermo<equationOfState> >
|
return autoPtr<eConstThermo<equationOfState> >
|
||||||
@ -65,7 +67,7 @@ Foam::eConstThermo<equationOfState>::clone() const
|
|||||||
|
|
||||||
|
|
||||||
template<class equationOfState>
|
template<class equationOfState>
|
||||||
inline autoPtr<eConstThermo<equationOfState> >
|
inline Foam::autoPtr<Foam::eConstThermo<equationOfState> >
|
||||||
Foam::eConstThermo<equationOfState>::New(Istream& is)
|
Foam::eConstThermo<equationOfState>::New(Istream& is)
|
||||||
{
|
{
|
||||||
return autoPtr<eConstThermo<equationOfState> >
|
return autoPtr<eConstThermo<equationOfState> >
|
||||||
@ -77,19 +79,31 @@ Foam::eConstThermo<equationOfState>::New(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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;
|
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");
|
notImplemented("scalar eConstThermo::s(const scalar T) const");
|
||||||
return T;
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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_;
|
equationOfState::operator+=(ct);
|
||||||
Hf_ = ct.Hf_;
|
|
||||||
|
|
||||||
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::eConstThermo Foam::operator+
|
template<class equationOfState>
|
||||||
|
inline Foam::eConstThermo<equationOfState> Foam::operator+
|
||||||
(
|
(
|
||||||
const eConstThermo& ct1,
|
const eConstThermo<equationOfState>& ct1,
|
||||||
const eConstThermo& ct2
|
const eConstThermo<equationOfState>& ct2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
specieThermo st(((const specieThermo&)ct1) + ((const specieThermo&)ct2));
|
equationOfState eofs
|
||||||
|
|
||||||
return eConstThermo
|
|
||||||
(
|
(
|
||||||
st,
|
static_cast<const equationOfState&>(ct1)
|
||||||
ct1.nMoles()/st.nMoles()*ct1.Cv_ + ct2.nMoles()/st.nMoles()*ct2.Cv_,
|
+ static_cast<const equationOfState&>(ct2)
|
||||||
ct1.nMoles()/st.nMoles()*ct1.Hf_ + ct2.nMoles()/st.nMoles()*ct2.Hf_
|
);
|
||||||
|
|
||||||
|
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<equationOfState>& ct1,
|
||||||
const eConstThermo& ct2
|
const eConstThermo<equationOfState>& ct2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
specieThermo st(((const specieThermo&)ct1) - ((const specieThermo&)ct2));
|
equationOfState eofs
|
||||||
|
|
||||||
return eConstThermo
|
|
||||||
(
|
(
|
||||||
st,
|
static_cast<const equationOfState&>(ct1)
|
||||||
ct1.nMoles()/st.nMoles()*ct1.Cv_ - ct2.nMoles()/st.nMoles()*ct2.Cv_,
|
- static_cast<const equationOfState&>(ct2)
|
||||||
ct1.nMoles()/st.nMoles()*ct1.Hf_ - ct2.nMoles()/st.nMoles()*ct2.Hf_
|
);
|
||||||
|
|
||||||
|
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 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.Cv_,
|
||||||
ct.Hf_
|
ct.Hf_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::eConstThermo Foam::operator==
|
template<class equationOfState>
|
||||||
|
inline Foam::eConstThermo<equationOfState> Foam::operator==
|
||||||
(
|
(
|
||||||
const eConstThermo& ct1,
|
const eConstThermo<equationOfState>& ct1,
|
||||||
const eConstThermo& ct2
|
const eConstThermo<equationOfState>& ct2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ct2 - ct1;
|
return ct2 - ct1;
|
||||||
|
|||||||
Reference in New Issue
Block a user