Skip to content
Snippets Groups Projects
Commit e0216666 authored by Andrew Heather's avatar Andrew Heather
Browse files

added offset to enthalpy poly (ref h at Tstd) and renamed s poly to ds

parent 3ac2b938
Branches
Tags
No related merge requests found
...@@ -40,8 +40,11 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo ...@@ -40,8 +40,11 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Sf_(readScalar(is)), Sf_(readScalar(is)),
cpPolynomial_("cpPolynomial", is), cpPolynomial_("cpPolynomial", is),
dhPolynomial_(cpPolynomial_.integrate()), dhPolynomial_(cpPolynomial_.integrate()),
sPolynomial_(cpPolynomial_.integrateMinus1()) dsPolynomial_(cpPolynomial_.integrateMinus1())
{} {
// Offset dh poly so that it is relative to the enthalpy at Tstd
dhPolynomial_[0] -= dhPolynomial_.evaluate(specie::Tstd);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
...@@ -58,7 +61,7 @@ Foam::Ostream& Foam::operator<< ...@@ -58,7 +61,7 @@ Foam::Ostream& Foam::operator<<
<< pt.Sf_ << tab << pt.Sf_ << tab
<< pt.cpPolynomial_ << tab << pt.cpPolynomial_ << tab
<< pt.dhPolynomial_ << tab << pt.dhPolynomial_ << tab
<< pt.sPolynomial; << pt.dsPolynomial;
os.check os.check
( (
......
...@@ -106,14 +106,14 @@ class hPolynomialThermo ...@@ -106,14 +106,14 @@ class hPolynomialThermo
//- Standard entropy [J/(kg.K)] //- Standard entropy [J/(kg.K)]
scalar Sf_; scalar Sf_;
//- Specific heat at constant pressure //- Specific heat at constant pressure [J/(kg.K)]
Polynomial<PolySize> cpPolynomial_; Polynomial<PolySize> cpPolynomial_;
//- Enthalpy - derived from cp //- Enthalpy - derived from cp [J/kg] - relative to Tstd
typename Polynomial<PolySize>::intPolyType dhPolynomial_; typename Polynomial<PolySize>::intPolyType dhPolynomial_;
//- Entropy - derived from cp //- Entropy - derived from cp [J/(kg.K)]
Polynomial<PolySize> sPolynomial_; Polynomial<PolySize> dsPolynomial_;
// Private member functions // Private member functions
...@@ -125,8 +125,8 @@ class hPolynomialThermo ...@@ -125,8 +125,8 @@ class hPolynomialThermo
const scalar Hf, const scalar Hf,
const scalar Sf, const scalar Sf,
const Polynomial<PolySize>& cpPoly, const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& hPoly, const typename Polynomial<PolySize>::intPolyType& dhPoly,
const Polynomial<PolySize>& sPoly const Polynomial<PolySize>& dsPoly
); );
......
...@@ -36,7 +36,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo ...@@ -36,7 +36,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
const scalar Sf, const scalar Sf,
const Polynomial<PolySize>& cpPoly, const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& dhPoly, const typename Polynomial<PolySize>::intPolyType& dhPoly,
const Polynomial<PolySize>& sPoly const Polynomial<PolySize>& dsPoly
) )
: :
EquationOfState(pt), EquationOfState(pt),
...@@ -44,7 +44,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo ...@@ -44,7 +44,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Sf_(Sf), Sf_(Sf),
cpPolynomial_(cpPoly), cpPolynomial_(cpPoly),
dhPolynomial_(dhPoly), dhPolynomial_(dhPoly),
sPolynomial_(sPoly) dsPolynomial_(dsPoly)
{} {}
...@@ -62,8 +62,11 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo ...@@ -62,8 +62,11 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Sf_(pt.Sf_), Sf_(pt.Sf_),
cpPolynomial_(pt.cpPolynomial_), cpPolynomial_(pt.cpPolynomial_),
dhPolynomial_(pt.dhPolynomial_), dhPolynomial_(pt.dhPolynomial_),
sPolynomial_(pt.sPolynomial_) dsPolynomial_(pt.dsPolynomial_)
{} {
// Offset dh poly so that it is relative to the enthalpy at Tstd
dhPolynomial_[0] -= dhPolynomial_.evaluate(specie::Tstd);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
...@@ -112,7 +115,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s ...@@ -112,7 +115,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s
const scalar T const scalar T
) const ) const
{ {
return (sPolynomial_.evaluate(T) + Sf_)*this->W(); return (dsPolynomial_.evaluate(T) + Sf_)*this->W();
} }
...@@ -135,7 +138,7 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator+= ...@@ -135,7 +138,7 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator+=
Sf_ = molr1*Sf_ + molr2*pt.Sf_; Sf_ = molr1*Sf_ + molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_; cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_;
dhPolynomial_ = molr1*dhPolynomial_ + molr2*pt.dhPolynomial_; dhPolynomial_ = molr1*dhPolynomial_ + molr2*pt.dhPolynomial_;
sPolynomial_ = molr1*sPolynomial_ + molr2*pt.sPolynomial_; dsPolynomial_ = molr1*dsPolynomial_ + molr2*pt.dsPolynomial_;
} }
...@@ -153,10 +156,10 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator-= ...@@ -153,10 +156,10 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator-=
scalar molr2 = pt.nMoles()/this->nMoles(); scalar molr2 = pt.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ - molr2*pt.Hf_; Hf_ = molr1*Hf_ - molr2*pt.Hf_;
Sf_ = molr1*Hf_ - molr2*pt.Sf_; Sf_ = molr1*Sf_ - molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_; cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_;
dhPolynomial_ = molr1*dhPolynomial_ - molr2*pt.dhPolynomial_; dhPolynomial_ = molr1*dhPolynomial_ - molr2*pt.dhPolynomial_;
sPolynomial_ = molr1*sPolynomial_ - molr2*pt.sPolynomial_; dsPolynomial_ = molr1*dsPolynomial_ - molr2*pt.dsPolynomial_;
} }
...@@ -184,7 +187,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator+ ...@@ -184,7 +187,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator+
molr1*pt1.Sf_ + molr2*pt2.Sf_, molr1*pt1.Sf_ + molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_, molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_,
molr1*pt1.dhPolynomial_ + molr2*pt2.dhPolynomial_, molr1*pt1.dhPolynomial_ + molr2*pt2.dhPolynomial_,
molr1*pt1.sPolynomial_ + molr2*pt2.sPolynomial_ molr1*pt1.dsPolynomial_ + molr2*pt2.dsPolynomial_
); );
} }
...@@ -211,7 +214,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator- ...@@ -211,7 +214,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator-
molr1*pt1.Sf_ - molr2*pt2.Sf_, molr1*pt1.Sf_ - molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_, molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_,
molr1*pt1.dhPolynomial_ - molr2*pt2.dhPolynomial_, molr1*pt1.dhPolynomial_ - molr2*pt2.dhPolynomial_,
molr1*pt1.sPolynomial_ - molr2*pt2.sPolynomial_ molr1*pt1.dsPolynomial_ - molr2*pt2.dsPolynomial_
); );
} }
...@@ -230,7 +233,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator* ...@@ -230,7 +233,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator*
pt.Sf_, pt.Sf_,
pt.cpPolynomial_, pt.cpPolynomial_,
pt.dhPolynomial_, pt.dhPolynomial_,
pt.sPolynomial_ pt.dsPolynomial_
); );
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment