From e0216666c3cc6be1365bdff4a38334b57e073ac4 Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Wed, 21 Oct 2009 17:52:27 +0100 Subject: [PATCH] added offset to enthalpy poly (ref h at Tstd) and renamed s poly to ds --- .../thermo/hPolynomial/hPolynomialThermo.C | 9 ++++--- .../thermo/hPolynomial/hPolynomialThermo.H | 12 ++++----- .../thermo/hPolynomial/hPolynomialThermoI.H | 25 +++++++++++-------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 7264041083d..497dc7c757b 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -40,8 +40,11 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo Sf_(readScalar(is)), cpPolynomial_("cpPolynomial", is), 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 * * * * * * * * * * * * * // @@ -58,7 +61,7 @@ Foam::Ostream& Foam::operator<< << pt.Sf_ << tab << pt.cpPolynomial_ << tab << pt.dhPolynomial_ << tab - << pt.sPolynomial; + << pt.dsPolynomial; os.check ( diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H index ec3c752f24b..a15d05adfe1 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H @@ -106,14 +106,14 @@ class hPolynomialThermo //- Standard entropy [J/(kg.K)] scalar Sf_; - //- Specific heat at constant pressure + //- Specific heat at constant pressure [J/(kg.K)] Polynomial<PolySize> cpPolynomial_; - //- Enthalpy - derived from cp + //- Enthalpy - derived from cp [J/kg] - relative to Tstd typename Polynomial<PolySize>::intPolyType dhPolynomial_; - //- Entropy - derived from cp - Polynomial<PolySize> sPolynomial_; + //- Entropy - derived from cp [J/(kg.K)] + Polynomial<PolySize> dsPolynomial_; // Private member functions @@ -125,8 +125,8 @@ class hPolynomialThermo const scalar Hf, const scalar Sf, const Polynomial<PolySize>& cpPoly, - const typename Polynomial<PolySize>::intPolyType& hPoly, - const Polynomial<PolySize>& sPoly + const typename Polynomial<PolySize>::intPolyType& dhPoly, + const Polynomial<PolySize>& dsPoly ); diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H index 1382c6f3ece..f575e970b4a 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H @@ -36,7 +36,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo const scalar Sf, const Polynomial<PolySize>& cpPoly, const typename Polynomial<PolySize>::intPolyType& dhPoly, - const Polynomial<PolySize>& sPoly + const Polynomial<PolySize>& dsPoly ) : EquationOfState(pt), @@ -44,7 +44,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo Sf_(Sf), cpPolynomial_(cpPoly), dhPolynomial_(dhPoly), - sPolynomial_(sPoly) + dsPolynomial_(dsPoly) {} @@ -62,8 +62,11 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo Sf_(pt.Sf_), cpPolynomial_(pt.cpPolynomial_), 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 * * * * * * * * * * * * * // @@ -112,7 +115,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s const scalar T ) 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+= Sf_ = molr1*Sf_ + molr2*pt.Sf_; cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_; 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-= scalar molr2 = pt.nMoles()/this->nMoles(); Hf_ = molr1*Hf_ - molr2*pt.Hf_; - Sf_ = molr1*Hf_ - molr2*pt.Sf_; + Sf_ = molr1*Sf_ - molr2*pt.Sf_; cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_; 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+ molr1*pt1.Sf_ + molr2*pt2.Sf_, molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_, 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- molr1*pt1.Sf_ - molr2*pt2.Sf_, molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_, 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* pt.Sf_, pt.cpPolynomial_, pt.dhPolynomial_, - pt.sPolynomial_ + pt.dsPolynomial_ ); } -- GitLab