thermophysicalModels/specie: Added entropy function to equations of state

Added the pressure dependent part of the entropy from the equation of
state to that returned by the thermo entropy function.

TODO: Add entropy defect to the PengRobinsonGas::s(p, T) function.

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1411
This commit is contained in:
Henry
2015-03-07 21:47:04 +00:00
parent ed9f9e04d4
commit 72f5598049
36 changed files with 639 additions and 567 deletions

View File

@ -39,7 +39,7 @@ defineTemplateTypeNameAndDebugWithName
defineTemplateTypeNameAndDebugWithName
(
Foam::compressible::expoSolid_thermalBaffle1DFvPatchScalarField,
"compressible::thermalBaffle1D<hExponentialSolidThermoPhysics>",
"compressible::thermalBaffle1D<hPowerSolidThermoPhysics>",
0
);

View File

@ -45,7 +45,7 @@ namespace compressible
typedef thermalBaffle1DFvPatchScalarField
<
hExponentialSolidThermoPhysics
hPowerSolidThermoPhysics
>expoSolid_thermalBaffle1DFvPatchScalarField;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,11 +79,11 @@ makeChemistryReaderType(foamChemistryReader, icoPoly8EThermoPhysics);
// Solid chemistry readers for solids based on sensibleInternalEnergy
makeChemistryReader(hConstSolidThermoPhysics);
makeChemistryReader(hExponentialSolidThermoPhysics);
makeChemistryReader(hPowerSolidThermoPhysics);
makeChemistryReader(hExpKappaConstSolidThermoPhysics);
makeChemistryReaderType(foamChemistryReader, hConstSolidThermoPhysics);
makeChemistryReaderType(foamChemistryReader, hExponentialSolidThermoPhysics);
makeChemistryReaderType(foamChemistryReader, hPowerSolidThermoPhysics);
makeChemistryReaderType(foamChemistryReader, hExpKappaConstSolidThermoPhysics);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -54,7 +54,7 @@ makeSolidChemistryModel
solidChemistryModel,
pyrolysisChemistryModel,
basicSolidChemistryModel,
hExponentialSolidThermoPhysics,
hPowerSolidThermoPhysics,
gasHThermoPhysics
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ namespace Foam
(
pyrolysisChemistryModel,
basicSolidChemistryModel,
hExponentialSolidThermoPhysics,
hPowerSolidThermoPhysics,
gasHThermoPhysics
)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ Description
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hPolynomialThermo.H"
#include "hExponentialThermo.H"
#include "hPowerThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
@ -68,13 +68,13 @@ namespace Foam
<
species::thermo
<
hExponentialThermo
hPowerThermo
<
rhoConst<specie>
>,
sensibleEnthalpy
>
> hExponentialSolidThermoPhysics;
> hPowerSolidThermoPhysics;
typedef
polynomialSolidTransport
@ -96,7 +96,7 @@ namespace Foam
<
species::thermo
<
hExponentialThermo
hPowerThermo
<
rhoConst<specie>
>,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ makeSolidIRReactions(hConstSolidThermoPhysics, solidArrheniusReactionRate)
makeSolidIRReactions
(
hExponentialSolidThermoPhysics,
hPowerSolidThermoPhysics,
solidArrheniusReactionRate
)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
#include "specie.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
#include "hPowerThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
@ -69,7 +69,7 @@ makeReactingSolidThermo
reactingMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hExponentialThermo,
hPowerThermo,
rhoConst,
specie
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
#include "specie.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
#include "hPowerThermo.H"
#include "hPolynomialThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
@ -81,7 +81,7 @@ makeSolidThermo
pureMixture,
exponentialSolidTransport,
sensibleEnthalpy,
hExponentialThermo,
hPowerThermo,
rhoConst,
specie
);

View File

@ -168,6 +168,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -116,6 +116,19 @@ inline Foam::scalar Foam::PengRobinsonGas<Specie>::rho
}
template<class Specie>
inline Foam::scalar Foam::PengRobinsonGas<Specie>::s
(
scalar p,
scalar T
) const
{
//***HGW This is the expression for a perfect gas
// Need to add the entropy defect for Peng-Robinson
return -RR*log(p/Pstd);
}
template<class Specie>
inline Foam::scalar Foam::PengRobinsonGas<Specie>::psi
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -167,6 +167,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -104,18 +104,32 @@ template<class Specie>
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::rho
(
scalar p,
scalar
scalar T
) const
{
return rho0_*pow((p + B_)/(p0_ + B_), 1.0/gamma_);
}
template<class Specie>
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::s
(
scalar p,
scalar T
) const
{
scalar n = 1 - 1.0/gamma_;
return
-pow(p0_ + B_, 1.0/gamma_)*(pow((p + B_), n) - pow((Pstd + B_), n))
/(rho0_*T*n);
}
template<class Specie>
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::psi
(
scalar p,
scalar
scalar T
) const
{
return
@ -127,15 +141,15 @@ inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::psi
template<class Specie>
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::Z(scalar, scalar) const
{
return 1.0;
return 1;
}
template<class Specie>
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::cpMcv
(
scalar,
scalar
scalar p,
scalar T
) const
{
return 0;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -155,6 +155,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -102,7 +102,7 @@ Foam::icoPolynomial<Specie, PolySize>::New(const dictionary& dict)
template<class Specie, int PolySize>
inline Foam::scalar Foam::icoPolynomial<Specie, PolySize>::rho
(
scalar,
scalar p,
scalar T
) const
{
@ -111,24 +111,35 @@ inline Foam::scalar Foam::icoPolynomial<Specie, PolySize>::rho
template<class Specie, int PolySize>
inline Foam::scalar Foam::icoPolynomial<Specie, PolySize>::psi
inline Foam::scalar Foam::icoPolynomial<Specie, PolySize>::s
(
scalar,
scalar
scalar p,
scalar T
) const
{
return 0.0;
return 0;
}
template<class Specie, int PolySize>
inline Foam::scalar Foam::icoPolynomial<Specie, PolySize>::psi
(
scalar p,
scalar T
) const
{
return 0;
}
template<class Specie, int PolySize>
inline Foam::scalar Foam::icoPolynomial<Specie, PolySize>::Z
(
scalar,
scalar
scalar p,
scalar T
) const
{
return 0.0;
return 0;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -158,6 +158,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -115,39 +115,49 @@ inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::rho
template<class Specie>
inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::psi
inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::s
(
scalar,
scalar p,
scalar T
) const
{
return 0.0;
return 0;
}
template<class Specie>
inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::psi
(
scalar p,
scalar T
) const
{
return 0;
}
template<class Specie>
inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::Z
(
scalar,
scalar
scalar p,
scalar T
) const
{
return 0.0;
return 0;
}
template<class Specie>
inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::cpMcv
(
scalar,
scalar
scalar p,
scalar T
) const
{
return RR;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Specie>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -156,6 +156,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -93,21 +93,28 @@ inline Foam::scalar Foam::linear<Specie>::rho(scalar p, scalar T) const
template<class Specie>
inline Foam::scalar Foam::linear<Specie>::psi(scalar, scalar T) const
inline Foam::scalar Foam::linear<Specie>::s(scalar p, scalar T) const
{
return -log((rho0_ + psi_*p)/(rho0_ + psi_*Pstd))/(T*psi_);
}
template<class Specie>
inline Foam::scalar Foam::linear<Specie>::psi(scalar p, scalar T) const
{
return psi_;
}
template<class Specie>
inline Foam::scalar Foam::linear<Specie>::Z(scalar, scalar) const
inline Foam::scalar Foam::linear<Specie>::Z(scalar p, scalar T) const
{
return 1.0;
return 1;
}
template<class Specie>
inline Foam::scalar Foam::linear<Specie>::cpMcv(scalar, scalar) const
inline Foam::scalar Foam::linear<Specie>::cpMcv(scalar p, scalar T) const
{
return 0;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -155,6 +155,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -100,21 +100,28 @@ inline Foam::scalar Foam::perfectFluid<Specie>::rho(scalar p, scalar T) const
template<class Specie>
inline Foam::scalar Foam::perfectFluid<Specie>::psi(scalar, scalar T) const
inline Foam::scalar Foam::perfectFluid<Specie>::s(scalar p, scalar T) const
{
return -RR*log(p/Pstd);
}
template<class Specie>
inline Foam::scalar Foam::perfectFluid<Specie>::psi(scalar p, scalar T) const
{
return 1.0/(this->R()*T);
}
template<class Specie>
inline Foam::scalar Foam::perfectFluid<Specie>::Z(scalar, scalar) const
inline Foam::scalar Foam::perfectFluid<Specie>::Z(scalar p, scalar T) const
{
return 1.0;
return 1;
}
template<class Specie>
inline Foam::scalar Foam::perfectFluid<Specie>::cpMcv(scalar, scalar) const
inline Foam::scalar Foam::perfectFluid<Specie>::cpMcv(scalar p, scalar T) const
{
return 0;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,6 +139,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -83,21 +83,28 @@ inline Foam::scalar Foam::perfectGas<Specie>::rho(scalar p, scalar T) const
template<class Specie>
inline Foam::scalar Foam::perfectGas<Specie>::psi(scalar, scalar T) const
inline Foam::scalar Foam::perfectGas<Specie>::s(scalar p, scalar T) const
{
return -RR*log(p/Pstd);
}
template<class Specie>
inline Foam::scalar Foam::perfectGas<Specie>::psi(scalar p, scalar T) const
{
return 1.0/(this->R()*T);
}
template<class Specie>
inline Foam::scalar Foam::perfectGas<Specie>::Z(scalar, scalar) const
inline Foam::scalar Foam::perfectGas<Specie>::Z(scalar p, scalar T) const
{
return 1.0;
return 1;
}
template<class Specie>
inline Foam::scalar Foam::perfectGas<Specie>::cpMcv(scalar, scalar) const
inline Foam::scalar Foam::perfectGas<Specie>::cpMcv(scalar p, scalar T) const
{
return RR;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -141,6 +141,9 @@ public:
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return entropy [J/(kmol K)]
inline scalar s(const scalar p, const scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,23 +79,30 @@ inline Foam::scalar Foam::rhoConst<Specie>::rho(scalar p, scalar T) const
template<class Specie>
inline Foam::scalar Foam::rhoConst<Specie>::psi(scalar, scalar T) const
inline Foam::scalar Foam::rhoConst<Specie>::s(scalar p, scalar T) const
{
return 0.0;
return 0;
}
template<class Specie>
inline Foam::scalar Foam::rhoConst<Specie>::Z(scalar, scalar) const
inline Foam::scalar Foam::rhoConst<Specie>::psi(scalar p, scalar T) const
{
return 0.0;
return 0;
}
template<class Specie>
inline Foam::scalar Foam::rhoConst<Specie>::cpMcv(scalar, scalar) const
inline Foam::scalar Foam::rhoConst<Specie>::Z(scalar p, scalar T) const
{
return 0.0;
return 0;
}
template<class Specie>
inline Foam::scalar Foam::rhoConst<Specie>::cpMcv(scalar p, scalar T) const
{
return 0;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -146,12 +146,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::s
const scalar T
) const
{
notImplemented
(
"scalar eConstThermo<EquationOfState>::"
"s(const scalar p, const scalar) const"
);
return T;
return cp()*log(T/Tstd) + EquationOfState::s(p, T);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,10 +28,10 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class equationOfState>
Foam::hConstThermo<equationOfState>::hConstThermo(Istream& is)
template<class EquationOfState>
Foam::hConstThermo<EquationOfState>::hConstThermo(Istream& is)
:
equationOfState(is),
EquationOfState(is),
Cp_(readScalar(is)),
Hf_(readScalar(is))
{
@ -42,10 +42,10 @@ Foam::hConstThermo<equationOfState>::hConstThermo(Istream& is)
}
template<class equationOfState>
Foam::hConstThermo<equationOfState>::hConstThermo(const dictionary& dict)
template<class EquationOfState>
Foam::hConstThermo<EquationOfState>::hConstThermo(const dictionary& dict)
:
equationOfState(dict),
EquationOfState(dict),
Cp_(readScalar(dict.subDict("thermodynamics").lookup("Cp"))),
Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf")))
{
@ -56,10 +56,10 @@ Foam::hConstThermo<equationOfState>::hConstThermo(const dictionary& dict)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class equationOfState>
void Foam::hConstThermo<equationOfState>::write(Ostream& os) const
template<class EquationOfState>
void Foam::hConstThermo<EquationOfState>::write(Ostream& os) const
{
equationOfState::write(os);
EquationOfState::write(os);
dictionary dict("thermodynamics");
dict.add("Cp", Cp_/this->W());
@ -70,14 +70,14 @@ void Foam::hConstThermo<equationOfState>::write(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class equationOfState>
template<class EquationOfState>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const hConstThermo<equationOfState>& ct
const hConstThermo<EquationOfState>& ct
)
{
os << static_cast<const equationOfState&>(ct) << tab
os << static_cast<const EquationOfState&>(ct) << tab
<< ct.Cp_/ct.W() << tab << ct.Hf_/ct.W();
os.check("Ostream& operator<<(Ostream& os, const hConstThermo& ct)");

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,7 @@ Class
Description
Constant properties thermodynamics package
templated into the equationOfState.
templated into the EquationOfState.
SourceFiles
hConstThermoI.H

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,15 +25,15 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class equationOfState>
inline Foam::hConstThermo<equationOfState>::hConstThermo
template<class EquationOfState>
inline Foam::hConstThermo<EquationOfState>::hConstThermo
(
const equationOfState& st,
const EquationOfState& st,
const scalar cp,
const scalar hf
)
:
equationOfState(st),
EquationOfState(st),
Cp_(cp),
Hf_(hf)
{}
@ -41,48 +41,48 @@ inline Foam::hConstThermo<equationOfState>::hConstThermo
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class equationOfState>
inline Foam::hConstThermo<equationOfState>::hConstThermo
template<class EquationOfState>
inline Foam::hConstThermo<EquationOfState>::hConstThermo
(
const word& name,
const hConstThermo& ct
)
:
equationOfState(name, ct),
EquationOfState(name, ct),
Cp_(ct.Cp_),
Hf_(ct.Hf_)
{}
template<class equationOfState>
inline Foam::autoPtr<Foam::hConstThermo<equationOfState> >
Foam::hConstThermo<equationOfState>::clone() const
template<class EquationOfState>
inline Foam::autoPtr<Foam::hConstThermo<EquationOfState> >
Foam::hConstThermo<EquationOfState>::clone() const
{
return autoPtr<hConstThermo<equationOfState> >
return autoPtr<hConstThermo<EquationOfState> >
(
new hConstThermo<equationOfState>(*this)
new hConstThermo<EquationOfState>(*this)
);
}
template<class equationOfState>
inline Foam::autoPtr<Foam::hConstThermo<equationOfState> >
Foam::hConstThermo<equationOfState>::New(Istream& is)
template<class EquationOfState>
inline Foam::autoPtr<Foam::hConstThermo<EquationOfState> >
Foam::hConstThermo<EquationOfState>::New(Istream& is)
{
return autoPtr<hConstThermo<equationOfState> >
return autoPtr<hConstThermo<EquationOfState> >
(
new hConstThermo<equationOfState>(is)
new hConstThermo<EquationOfState>(is)
);
}
template<class equationOfState>
inline Foam::autoPtr<Foam::hConstThermo<equationOfState> >
Foam::hConstThermo<equationOfState>::New(const dictionary& dict)
template<class EquationOfState>
inline Foam::autoPtr<Foam::hConstThermo<EquationOfState> >
Foam::hConstThermo<EquationOfState>::New(const dictionary& dict)
{
return autoPtr<hConstThermo<equationOfState> >
return autoPtr<hConstThermo<EquationOfState> >
(
new hConstThermo<equationOfState>(dict)
new hConstThermo<EquationOfState>(dict)
);
}
@ -99,8 +99,8 @@ inline Foam::scalar Foam::hConstThermo<EquationOfState>::limit
}
template<class equationOfState>
inline Foam::scalar Foam::hConstThermo<equationOfState>::cp
template<class EquationOfState>
inline Foam::scalar Foam::hConstThermo<EquationOfState>::cp
(
const scalar p,
const scalar T
@ -110,8 +110,8 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::cp
}
template<class equationOfState>
inline Foam::scalar Foam::hConstThermo<equationOfState>::ha
template<class EquationOfState>
inline Foam::scalar Foam::hConstThermo<EquationOfState>::ha
(
const scalar p, const scalar T
) const
@ -120,8 +120,8 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::ha
}
template<class equationOfState>
inline Foam::scalar Foam::hConstThermo<equationOfState>::hs
template<class EquationOfState>
inline Foam::scalar Foam::hConstThermo<EquationOfState>::hs
(
const scalar p, const scalar T
) const
@ -130,39 +130,34 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::hs
}
template<class equationOfState>
inline Foam::scalar Foam::hConstThermo<equationOfState>::hc() const
template<class EquationOfState>
inline Foam::scalar Foam::hConstThermo<EquationOfState>::hc() const
{
return Hf_;
}
template<class equationOfState>
inline Foam::scalar Foam::hConstThermo<equationOfState>::s
template<class EquationOfState>
inline Foam::scalar Foam::hConstThermo<EquationOfState>::s
(
const scalar p, const scalar T
) const
{
notImplemented
(
"scalar hConstThermo<equationOfState>::"
"s(const scalar p, const scalar T) const"
);
return T;
return Cp_*log(T/Tstd) + EquationOfState::s(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class equationOfState>
inline void Foam::hConstThermo<equationOfState>::operator+=
template<class EquationOfState>
inline void Foam::hConstThermo<EquationOfState>::operator+=
(
const hConstThermo<equationOfState>& ct
const hConstThermo<EquationOfState>& ct
)
{
scalar molr1 = this->nMoles();
equationOfState::operator+=(ct);
EquationOfState::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
@ -172,15 +167,15 @@ inline void Foam::hConstThermo<equationOfState>::operator+=
}
template<class equationOfState>
inline void Foam::hConstThermo<equationOfState>::operator-=
template<class EquationOfState>
inline void Foam::hConstThermo<EquationOfState>::operator-=
(
const hConstThermo<equationOfState>& ct
const hConstThermo<EquationOfState>& ct
)
{
scalar molr1 = this->nMoles();
equationOfState::operator-=(ct);
EquationOfState::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
@ -192,20 +187,20 @@ inline void Foam::hConstThermo<equationOfState>::operator-=
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class equationOfState>
inline Foam::hConstThermo<equationOfState> Foam::operator+
template<class EquationOfState>
inline Foam::hConstThermo<EquationOfState> Foam::operator+
(
const hConstThermo<equationOfState>& ct1,
const hConstThermo<equationOfState>& ct2
const hConstThermo<EquationOfState>& ct1,
const hConstThermo<EquationOfState>& ct2
)
{
equationOfState eofs
EquationOfState eofs
(
static_cast<const equationOfState&>(ct1)
+ static_cast<const equationOfState&>(ct2)
static_cast<const EquationOfState&>(ct1)
+ static_cast<const EquationOfState&>(ct2)
);
return hConstThermo<equationOfState>
return hConstThermo<EquationOfState>
(
eofs,
ct1.nMoles()/eofs.nMoles()*ct1.Cp_
@ -216,20 +211,20 @@ inline Foam::hConstThermo<equationOfState> Foam::operator+
}
template<class equationOfState>
inline Foam::hConstThermo<equationOfState> Foam::operator-
template<class EquationOfState>
inline Foam::hConstThermo<EquationOfState> Foam::operator-
(
const hConstThermo<equationOfState>& ct1,
const hConstThermo<equationOfState>& ct2
const hConstThermo<EquationOfState>& ct1,
const hConstThermo<EquationOfState>& ct2
)
{
equationOfState eofs
EquationOfState eofs
(
static_cast<const equationOfState&>(ct1)
- static_cast<const equationOfState&>(ct2)
static_cast<const EquationOfState&>(ct1)
- static_cast<const EquationOfState&>(ct2)
);
return hConstThermo<equationOfState>
return hConstThermo<EquationOfState>
(
eofs,
ct1.nMoles()/eofs.nMoles()*ct1.Cp_
@ -240,27 +235,27 @@ inline Foam::hConstThermo<equationOfState> Foam::operator-
}
template<class equationOfState>
inline Foam::hConstThermo<equationOfState> Foam::operator*
template<class EquationOfState>
inline Foam::hConstThermo<EquationOfState> Foam::operator*
(
const scalar s,
const hConstThermo<equationOfState>& ct
const hConstThermo<EquationOfState>& ct
)
{
return hConstThermo<equationOfState>
return hConstThermo<EquationOfState>
(
s*static_cast<const equationOfState&>(ct),
s*static_cast<const EquationOfState&>(ct),
ct.Cp_,
ct.Hf_
);
}
template<class equationOfState>
inline Foam::hConstThermo<equationOfState> Foam::operator==
template<class EquationOfState>
inline Foam::hConstThermo<EquationOfState> Foam::operator==
(
const hConstThermo<equationOfState>& ct1,
const hConstThermo<equationOfState>& ct2
const hConstThermo<EquationOfState>& ct1,
const hConstThermo<EquationOfState>& ct2
)
{
return ct2 - ct1;

View File

@ -1,328 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "hExponentialThermo.H"
#include "specie.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class equationOfState>
inline void Foam::hExponentialThermo<equationOfState>::checkT
(
const scalar T
) const
{
if (T < 0.0)
{
FatalErrorIn
(
"hExponentialThermo<equationOfState>::checkT(const scalar T) const"
) << "attempt to use hExponentialThermo<equationOfState>"
" out of temperature range "
<< T
<< abort(FatalError);
}
}
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::integrateCp
(
const scalar T
) const
{
return
(
c0_*pow(T, n0_ + 1.0)/(pow(Tref_, n0_)*(n0_ + 1.0))
);
}
template<class equationOfState>
inline Foam::hExponentialThermo<equationOfState>::hExponentialThermo
(
const word& name,
const hExponentialThermo& jt
)
:
equationOfState(name, jt),
c0_(jt.c0_),
n0_(jt.n0_),
Tref_(jt.Tref_),
Hf_(jt.Hf_)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class equationOfState>
inline Foam::hExponentialThermo<equationOfState>::hExponentialThermo
(
const equationOfState& st,
const scalar c0,
const scalar n0,
const scalar Tref,
const scalar Hf
)
:
equationOfState(st),
c0_(c0),
n0_(n0),
Tref_(Tref),
Hf_(Hf)
{}
template<class equationOfState>
inline Foam::autoPtr<Foam::hExponentialThermo<equationOfState> >
Foam::hExponentialThermo<equationOfState>::clone() const
{
return autoPtr<hExponentialThermo<equationOfState> >
(
new hExponentialThermo<equationOfState>(*this)
);
}
template<class equationOfState>
inline Foam::autoPtr<Foam::hExponentialThermo<equationOfState> >
Foam::hExponentialThermo<equationOfState>::New(Istream& is)
{
return autoPtr<hExponentialThermo<equationOfState> >
(
new hExponentialThermo<equationOfState>(is)
);
}
template<class equationOfState>
inline Foam::autoPtr<Foam::hExponentialThermo<equationOfState> >
Foam::hExponentialThermo<equationOfState>::New(const dictionary& dict)
{
return autoPtr<hExponentialThermo<equationOfState> >
(
new hExponentialThermo<equationOfState>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::limit
(
const scalar T
) const
{
return T;
}
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::cp
(
const scalar p, const scalar T
) const
{
return c0_*pow(T/Tref_, n0_);
}
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::ha
(
const scalar p, const scalar T
) const
{
scalar hOffset = integrateCp(Tstd);
return
(
(integrateCp(T) + Hf_ - hOffset)
);
}
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::hs
(
const scalar p, const scalar T
) const
{
scalar hOffset = integrateCp(Tstd);
return (integrateCp(T) - hOffset);
}
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::hc() const
{
return Hf_;
}
template<class equationOfState>
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::s
(
const scalar p, const scalar T
) const
{
notImplemented
(
"scalar hExponentialThermo<equationOfState>::"
"s(const scalar p, const scalar T) const"
);
return T;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class equationOfState>
inline void Foam::hExponentialThermo<equationOfState>::operator+=
(
const hExponentialThermo<equationOfState>& ct
)
{
scalar molr1 = this->nMoles();
equationOfState::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
c0_ = molr1*c0_ + molr2*ct.c0_;
n0_ = molr1*n0_ + molr2*ct.n0_;
Tref_ = molr1*Tref_ + molr2*ct.Tref_;
}
template<class equationOfState>
inline void Foam::hExponentialThermo<equationOfState>::operator-=
(
const hExponentialThermo<equationOfState>& ct
)
{
scalar molr1 = this->nMoles();
equationOfState::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ - molr2*ct.Hf_;
c0_ = (molr1*c0_ - molr2*ct.c0_);
n0_ = (molr1*n0_ - molr2*ct.n0_);
Tref_ = (molr1*Tref_ - molr2*ct.Tref_);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class equationOfState>
inline Foam::hExponentialThermo<equationOfState> Foam::operator+
(
const hExponentialThermo<equationOfState>& ct1,
const hExponentialThermo<equationOfState>& ct2
)
{
equationOfState eofs
(
static_cast<const equationOfState&>(ct1)
+ static_cast<const equationOfState&>(ct2)
);
return hExponentialThermo<equationOfState>
(
eofs,
ct1.nMoles()/eofs.nMoles()*ct1.c0_
+ ct2.nMoles()/eofs.nMoles()*ct2.c0_,
ct1.nMoles()/eofs.nMoles()*ct1.n0_
+ ct2.nMoles()/eofs.nMoles()*ct2.n0_,
ct1.nMoles()/eofs.nMoles()*ct1.Tref_
+ ct2.nMoles()/eofs.nMoles()*ct2.Tref_,
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
+ ct2.nMoles()/eofs.nMoles()*ct2.Hf_
);
}
template<class equationOfState>
inline Foam::hExponentialThermo<equationOfState> Foam::operator-
(
const hExponentialThermo<equationOfState>& ct1,
const hExponentialThermo<equationOfState>& ct2
)
{
equationOfState eofs
(
static_cast<const equationOfState&>(ct1)
+ static_cast<const equationOfState&>(ct2)
);
return hExponentialThermo<equationOfState>
(
eofs,
ct1.nMoles()/eofs.nMoles()*ct1.c0_
- ct2.nMoles()/eofs.nMoles()*ct2.c0_,
ct1.nMoles()/eofs.nMoles()*ct1.n0_
- ct2.nMoles()/eofs.nMoles()*ct2.n0_,
ct1.nMoles()/eofs.nMoles()*ct1.Tref_
- ct2.nMoles()/eofs.nMoles()*ct2.Tref_,
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
- ct2.nMoles()/eofs.nMoles()*ct2.Hf_
);
}
template<class equationOfState>
inline Foam::hExponentialThermo<equationOfState> Foam::operator*
(
const scalar s,
const hExponentialThermo<equationOfState>& ct
)
{
return hExponentialThermo<equationOfState>
(
s*static_cast<const equationOfState&>(ct),
ct.c0_,
ct.n0_,
ct.Tref_,
ct.Hf_
);
}
template<class equationOfState>
inline Foam::hExponentialThermo<equationOfState> Foam::operator==
(
const hExponentialThermo<equationOfState>& ct1,
const hExponentialThermo<equationOfState>& ct2
)
{
return ct2 - ct1;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -137,7 +137,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s
const scalar T
) const
{
return sCoeffs_.value(T);
return sCoeffs_.value(T) + EquationOfState::s(p, T);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,33 +23,33 @@ License
\*---------------------------------------------------------------------------*/
#include "hExponentialThermo.H"
#include "hPowerThermo.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class equationOfState>
Foam::hExponentialThermo<equationOfState>::hExponentialThermo(Istream& is)
template<class EquationOfState>
Foam::hPowerThermo<EquationOfState>::hPowerThermo(Istream& is)
:
equationOfState(is),
EquationOfState(is),
n0_(readScalar(is)),
Tref_(readScalar(is)),
Hf_(readScalar(is))
{
is.check("hExponentialThermo::hExponentialThermo(Istream& is)");
is.check("hPowerThermo::hPowerThermo(Istream& is)");
c0_ *= this->W();
Hf_ *= this->W();
}
template<class equationOfState>
Foam::hExponentialThermo<equationOfState>::hExponentialThermo
template<class EquationOfState>
Foam::hPowerThermo<EquationOfState>::hPowerThermo
(
const dictionary& dict
)
:
equationOfState(dict),
EquationOfState(dict),
c0_(readScalar(dict.subDict("thermodynamics").lookup("C0"))),
n0_(readScalar(dict.subDict("thermodynamics").lookup("n0"))),
Tref_(readScalar(dict.subDict("thermodynamics").lookup("Tref"))),
@ -62,14 +62,14 @@ Foam::hExponentialThermo<equationOfState>::hExponentialThermo
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class equationOfState>
template<class EquationOfState>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const hExponentialThermo<equationOfState>& et
const hPowerThermo<EquationOfState>& et
)
{
os << static_cast<const equationOfState&>(et) << nl
os << static_cast<const EquationOfState&>(et) << nl
<< " " << et.c0_
<< tab << et.n0_
<< tab << et.Tref_
@ -81,7 +81,7 @@ Foam::Ostream& Foam::operator<<
os.check
(
"operator<<(Ostream& os, const hExponentialThermo<equationOfState>& et)"
"operator<<(Ostream& os, const hPowerThermo<EquationOfState>& et)"
);
return os;

View File

@ -22,59 +22,65 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::hExponentialThermo
Foam::hPowerThermo
Description
Exponential properties thermodynamics package
templated into the equationOfState.
Power-function based thermodynamics package templated on EquationOfState.
In this thermodynamics package the heat capacity is a simple power of
temperature:
Cp(T) = c0*(T/Tref)^n0;
which is particularly suitable for solids.
SourceFiles
hExponentialThermoI.H
hExponentialThermo.C
hPowerThermoI.H
hPowerThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hExponentialThermo_H
#define hExponentialThermo_H
#ifndef hPowerThermo_H
#define hPowerThermo_H
#include "scalar.H"
#include "dictionary.H"
#include "specie.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class EquationOfState> class hExponentialThermo;
// Forward declaration of friend functions and operators
template<class EquationOfState> class hPowerThermo;
template<class EquationOfState>
inline hExponentialThermo<EquationOfState> operator+
inline hPowerThermo<EquationOfState> operator+
(
const hExponentialThermo<EquationOfState>&,
const hExponentialThermo<EquationOfState>&
const hPowerThermo<EquationOfState>&,
const hPowerThermo<EquationOfState>&
);
template<class EquationOfState>
inline hExponentialThermo<EquationOfState> operator-
inline hPowerThermo<EquationOfState> operator-
(
const hExponentialThermo<EquationOfState>&,
const hExponentialThermo<EquationOfState>&
const hPowerThermo<EquationOfState>&,
const hPowerThermo<EquationOfState>&
);
template<class EquationOfState>
inline hExponentialThermo<EquationOfState> operator*
inline hPowerThermo<EquationOfState> operator*
(
const scalar,
const hExponentialThermo<EquationOfState>&
const hPowerThermo<EquationOfState>&
);
template<class EquationOfState>
inline hExponentialThermo<EquationOfState> operator==
inline hPowerThermo<EquationOfState> operator==
(
const hExponentialThermo<EquationOfState>&,
const hExponentialThermo<EquationOfState>&
const hPowerThermo<EquationOfState>&,
const hPowerThermo<EquationOfState>&
);
@ -82,20 +88,19 @@ template<class EquationOfState>
Ostream& operator<<
(
Ostream&,
const hExponentialThermo<EquationOfState>&
const hPowerThermo<EquationOfState>&
);
/*---------------------------------------------------------------------------*\
Class hExponentialThermo Declaration
Class hPowerThermo Declaration
\*---------------------------------------------------------------------------*/
template<class EquationOfState>
class hExponentialThermo
class hPowerThermo
:
public EquationOfState
{
// Private data
scalar c0_;
@ -109,11 +114,8 @@ class hExponentialThermo
//- Check given temperature is within the range of the fitted coeffs
inline void checkT(const scalar T) const;
//- Integrate Cp expression
inline scalar integrateCp(const scalar T) const;
//- Construct from components
inline hExponentialThermo
inline hPowerThermo
(
const EquationOfState& st,
const scalar c0,
@ -122,31 +124,32 @@ class hExponentialThermo
const scalar Hf
);
public:
// Constructors
//- Construct from Istream
hExponentialThermo(Istream&);
hPowerThermo(Istream&);
//- Construct from dictionary
hExponentialThermo(const dictionary&);
hPowerThermo(const dictionary&);
//- Construct as a named copy
inline hExponentialThermo
inline hPowerThermo
(
const word&,
const hExponentialThermo&
const hPowerThermo&
);
//- Construct and return a clone
inline autoPtr<hExponentialThermo> clone() const;
inline autoPtr<hPowerThermo> clone() const;
//- Selector from Istream
inline static autoPtr<hExponentialThermo> New(Istream& is);
inline static autoPtr<hPowerThermo> New(Istream& is);
//- Selector from dictionary
inline static autoPtr<hExponentialThermo> New(const dictionary& dict);
inline static autoPtr<hPowerThermo> New(const dictionary& dict);
// Member Functions
@ -154,7 +157,7 @@ public:
//- Return the instantiated type name
static word typeName()
{
return "hExponential<" + EquationOfState::typeName() + '>';
return "hPower<" + EquationOfState::typeName() + '>';
}
//- Limit the temperature to be in the range Tlow_ to Thigh_
@ -181,35 +184,35 @@ public:
// Member operators
inline void operator+=(const hExponentialThermo&);
inline void operator-=(const hExponentialThermo&);
inline void operator+=(const hPowerThermo&);
inline void operator-=(const hPowerThermo&);
// Friend operators
friend hExponentialThermo operator+ <EquationOfState>
friend hPowerThermo operator+ <EquationOfState>
(
const hExponentialThermo&,
const hExponentialThermo&
const hPowerThermo&,
const hPowerThermo&
);
friend hExponentialThermo operator- <EquationOfState>
friend hPowerThermo operator- <EquationOfState>
(
const hExponentialThermo&,
const hExponentialThermo&
const hPowerThermo&,
const hPowerThermo&
);
friend hExponentialThermo operator* <EquationOfState>
friend hPowerThermo operator* <EquationOfState>
(
const scalar,
const hExponentialThermo&
const hPowerThermo&
);
friend hExponentialThermo operator== <EquationOfState>
friend hPowerThermo operator== <EquationOfState>
(
const hExponentialThermo&,
const hExponentialThermo&
const hPowerThermo&,
const hPowerThermo&
);
@ -218,7 +221,7 @@ public:
friend Ostream& operator<< <EquationOfState>
(
Ostream&,
const hExponentialThermo&
const hPowerThermo&
);
};
@ -229,10 +232,9 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "hExponentialThermoI.H"
# include "hExponentialThermo.C"
# include "hPowerThermoI.H"
# include "hPowerThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,307 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "hPowerThermo.H"
#include "specie.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class EquationOfState>
inline void Foam::hPowerThermo<EquationOfState>::checkT
(
const scalar T
) const
{
if (T < 0)
{
FatalErrorIn
(
"hPowerThermo<EquationOfState>::checkT(const scalar T) const"
) << "attempt to evaluate hPowerThermo<EquationOfState>"
" for negative temperature " << T
<< abort(FatalError);
}
}
template<class EquationOfState>
inline Foam::hPowerThermo<EquationOfState>::hPowerThermo
(
const word& name,
const hPowerThermo& jt
)
:
EquationOfState(name, jt),
c0_(jt.c0_),
n0_(jt.n0_),
Tref_(jt.Tref_),
Hf_(jt.Hf_)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class EquationOfState>
inline Foam::hPowerThermo<EquationOfState>::hPowerThermo
(
const EquationOfState& st,
const scalar c0,
const scalar n0,
const scalar Tref,
const scalar Hf
)
:
EquationOfState(st),
c0_(c0),
n0_(n0),
Tref_(Tref),
Hf_(Hf)
{}
template<class EquationOfState>
inline Foam::autoPtr<Foam::hPowerThermo<EquationOfState> >
Foam::hPowerThermo<EquationOfState>::clone() const
{
return autoPtr<hPowerThermo<EquationOfState> >
(
new hPowerThermo<EquationOfState>(*this)
);
}
template<class EquationOfState>
inline Foam::autoPtr<Foam::hPowerThermo<EquationOfState> >
Foam::hPowerThermo<EquationOfState>::New(Istream& is)
{
return autoPtr<hPowerThermo<EquationOfState> >
(
new hPowerThermo<EquationOfState>(is)
);
}
template<class EquationOfState>
inline Foam::autoPtr<Foam::hPowerThermo<EquationOfState> >
Foam::hPowerThermo<EquationOfState>::New(const dictionary& dict)
{
return autoPtr<hPowerThermo<EquationOfState> >
(
new hPowerThermo<EquationOfState>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class EquationOfState>
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::limit
(
const scalar T
) const
{
return T;
}
template<class EquationOfState>
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::cp
(
const scalar p, const scalar T
) const
{
return c0_*pow(T/Tref_, n0_);
}
template<class EquationOfState>
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::ha
(
const scalar p, const scalar T
) const
{
return hs(p, T) + hc();
}
template<class EquationOfState>
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::hs
(
const scalar p, const scalar T
) const
{
return
c0_*(pow(T, n0_ + 1) - pow(Tstd, n0_ + 1))/(pow(Tref_, n0_)*(n0_ + 1));
}
template<class EquationOfState>
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::hc() const
{
return Hf_;
}
template<class EquationOfState>
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::s
(
const scalar p, const scalar T
) const
{
return
c0_*(pow(T, n0_) - pow(Tstd, n0_))/(pow(Tref_, n0_)*n0_)
+ EquationOfState::s(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class EquationOfState>
inline void Foam::hPowerThermo<EquationOfState>::operator+=
(
const hPowerThermo<EquationOfState>& ct
)
{
scalar molr1 = this->nMoles();
EquationOfState::operator+=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
c0_ = molr1*c0_ + molr2*ct.c0_;
n0_ = molr1*n0_ + molr2*ct.n0_;
Tref_ = molr1*Tref_ + molr2*ct.Tref_;
}
template<class EquationOfState>
inline void Foam::hPowerThermo<EquationOfState>::operator-=
(
const hPowerThermo<EquationOfState>& ct
)
{
scalar molr1 = this->nMoles();
EquationOfState::operator-=(ct);
molr1 /= this->nMoles();
scalar molr2 = ct.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ - molr2*ct.Hf_;
c0_ = (molr1*c0_ - molr2*ct.c0_);
n0_ = (molr1*n0_ - molr2*ct.n0_);
Tref_ = (molr1*Tref_ - molr2*ct.Tref_);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class EquationOfState>
inline Foam::hPowerThermo<EquationOfState> Foam::operator+
(
const hPowerThermo<EquationOfState>& ct1,
const hPowerThermo<EquationOfState>& ct2
)
{
EquationOfState eofs
(
static_cast<const EquationOfState&>(ct1)
+ static_cast<const EquationOfState&>(ct2)
);
return hPowerThermo<EquationOfState>
(
eofs,
ct1.nMoles()/eofs.nMoles()*ct1.c0_
+ ct2.nMoles()/eofs.nMoles()*ct2.c0_,
ct1.nMoles()/eofs.nMoles()*ct1.n0_
+ ct2.nMoles()/eofs.nMoles()*ct2.n0_,
ct1.nMoles()/eofs.nMoles()*ct1.Tref_
+ ct2.nMoles()/eofs.nMoles()*ct2.Tref_,
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
+ ct2.nMoles()/eofs.nMoles()*ct2.Hf_
);
}
template<class EquationOfState>
inline Foam::hPowerThermo<EquationOfState> Foam::operator-
(
const hPowerThermo<EquationOfState>& ct1,
const hPowerThermo<EquationOfState>& ct2
)
{
EquationOfState eofs
(
static_cast<const EquationOfState&>(ct1)
+ static_cast<const EquationOfState&>(ct2)
);
return hPowerThermo<EquationOfState>
(
eofs,
ct1.nMoles()/eofs.nMoles()*ct1.c0_
- ct2.nMoles()/eofs.nMoles()*ct2.c0_,
ct1.nMoles()/eofs.nMoles()*ct1.n0_
- ct2.nMoles()/eofs.nMoles()*ct2.n0_,
ct1.nMoles()/eofs.nMoles()*ct1.Tref_
- ct2.nMoles()/eofs.nMoles()*ct2.Tref_,
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
- ct2.nMoles()/eofs.nMoles()*ct2.Hf_
);
}
template<class EquationOfState>
inline Foam::hPowerThermo<EquationOfState> Foam::operator*
(
const scalar s,
const hPowerThermo<EquationOfState>& ct
)
{
return hPowerThermo<EquationOfState>
(
s*static_cast<const EquationOfState&>(ct),
ct.c0_,
ct.n0_,
ct.Tref_,
ct.Hf_
);
}
template<class EquationOfState>
inline Foam::hPowerThermo<EquationOfState> Foam::operator==
(
const hPowerThermo<EquationOfState>& ct1,
const hPowerThermo<EquationOfState>& ct2
)
{
return ct2 - ct1;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -220,9 +220,10 @@ inline Foam::scalar Foam::janafThermo<EquationOfState>::s
return
RR*
(
(((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*::log(T)
(((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*log(T)
+ a[6]
);
)
+ EquationOfState::s(p, T);
}