Thermodynamics: renamed isobaricPerfectGas -> incompressiblePerfectGas and incompressible -> rhoConst

Added isochoric and incompressible identifiers to equations of state to indicate the supported processes
This commit is contained in:
Henry
2012-09-11 14:07:22 +01:00
parent 97acc11a4c
commit dd3ab88f47
36 changed files with 406 additions and 277 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,30 +91,6 @@ Foam::Polynomial<PolySize>::Polynomial(const UList<scalar>& coeffs)
} }
// template<int PolySize>
// Foam::Polynomial<PolySize>::Polynomial(const polynomialFunction& poly)
// :
// VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
// logActive_(poly.logActive()),
// logCoeff_(poly.logCoeff())
// {
// if (poly.size() != PolySize)
// {
// FatalErrorIn
// (
// "Polynomial<PolySize>::Polynomial(const polynomialFunction&)"
// ) << "Size mismatch: Needed " << PolySize
// << " but given " << poly.size()
// << nl << exit(FatalError);
// }
//
// for (int i = 0; i < PolySize; ++i)
// {
// this->v_[i] = poly[i];
// }
// }
template<int PolySize> template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(Istream& is) Foam::Polynomial<PolySize>::Polynomial(Istream& is)
: :
@ -178,11 +154,11 @@ Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const
scalar val = this->v_[0]; scalar val = this->v_[0];
// avoid costly pow() in calculation // avoid costly pow() in calculation
scalar powX = x; scalar powX = 1;
for (label i=1; i<PolySize; ++i) for (label i=1; i<PolySize; ++i)
{ {
val += this->v_[i]*powX;
powX *= x; powX *= x;
val += this->v_[i]*powX;
} }
if (logActive_) if (logActive_)
@ -195,39 +171,57 @@ Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const
template<int PolySize> template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::integrate Foam::scalar Foam::Polynomial<PolySize>::derivative(const scalar x) const
{
scalar deriv = 0;
if (PolySize > 1)
{
// avoid costly pow() in calculation
deriv += this->v_[1];
scalar powX = 1;
for (label i=2; i<PolySize; ++i)
{
powX *= x;
deriv += i*this->v_[i]*powX;
}
}
if (logActive_)
{
deriv += logCoeff_/x;
}
return deriv;
}
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::integral
( (
const scalar x1, const scalar x1,
const scalar x2 const scalar x2
) const ) const
{ {
if (logActive_)
{
FatalErrorIn
(
"scalar Polynomial<PolySize>::integrate"
"("
"const scalar, "
"const scalar"
") const"
) << "Cannot integrate polynomial with logarithmic coefficients"
<< nl << abort(FatalError);
}
// avoid costly pow() in calculation // avoid costly pow() in calculation
scalar powX1 = x1; scalar powX1 = x1;
scalar powX2 = x2; scalar powX2 = x2;
scalar val = this->v_[0]*(powX2 - powX1); scalar integ = this->v_[0]*(powX2 - powX1);
for (label i=1; i<PolySize; ++i) for (label i=1; i<PolySize; ++i)
{ {
val += this->v_[i]/(i + 1) * (powX2 - powX1);
powX1 *= x1; powX1 *= x1;
powX2 *= x2; powX2 *= x2;
integ += this->v_[i]/(i + 1)*(powX2 - powX1);
} }
return val; if (logActive_)
{
integ += logCoeff_*((x2*log(x2) - x2) - (x1*log(x1) - x1));
}
return integ;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,13 +27,14 @@ Class
Description Description
Polynomial templated on size (order): Polynomial templated on size (order):
poly = logCoeff*log(x) + sum(coeff_[i]*x^i) poly = sum(coeff_[i]*x^i) logCoeff*log(x)
where 0 \<= i \<= N where 0 \<= i \<= N
- integer powers, starting at zero - integer powers, starting at zero
- value(x) to evaluate the poly for a given value - value(x) to evaluate the poly for a given value
- integrate(x1, x2) between two scalar values - derivative(x) returns derivative at value
- integral(x1, x2) returns integral between two scalar values
- integral() to return a new, integral coeff polynomial - integral() to return a new, integral coeff polynomial
- increases the size (order) - increases the size (order)
- integralMinus1() to return a new, integral coeff polynomial where - integralMinus1() to return a new, integral coeff polynomial where
@ -136,16 +137,18 @@ public:
//- Return polynomial value //- Return polynomial value
scalar value(const scalar x) const; scalar value(const scalar x) const;
//- Integrate between two values //- Return derivative of the polynomial at the given x
scalar integrate(const scalar x1, const scalar x2) const; scalar derivative(const scalar x) const;
//- Return integral between two values
scalar integral(const scalar x1, const scalar x2) const;
//- Return integral coefficients. //- Return integral coefficients.
// Argument becomes zeroth element (constant of integration) // Argument becomes zero'th element (constant of integration)
intPolyType integral(const scalar intConstant = 0.0) const; intPolyType integral(const scalar intConstant = 0.0) const;
//- Return integral coefficients when lowest order is -1. //- Return integral coefficients when lowest order is -1.
// Argument becomes zeroth element (constant of integration) // Argument becomes zero'th element (constant of integration)
polyType integralMinus1(const scalar intConstant = 0.0) const; polyType integralMinus1(const scalar intConstant = 0.0) const;

View File

@ -32,8 +32,8 @@ Description
#include "makeBasicMixture.H" #include "makeBasicMixture.H"
#include "perfectGas.H" #include "perfectGas.H"
#include "incompressible.H" #include "rhoConst.H"
#include "isobaricPerfectGas.H" #include "incompressiblePerfectGas.H"
#include "eConstThermo.H" #include "eConstThermo.H"
@ -94,7 +94,7 @@ makeBasicMixture
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeBasicPolyMixture makeBasicPolyMixture
@ -118,7 +118,7 @@ makeBasicMixture
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeBasicMixture makeBasicMixture
@ -127,7 +127,7 @@ makeBasicMixture
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeBasicMixture makeBasicMixture
@ -136,7 +136,7 @@ makeBasicMixture
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
@ -175,7 +175,7 @@ makeBasicMixture
constTransport, constTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeBasicPolyMixture makeBasicPolyMixture
@ -199,7 +199,7 @@ makeBasicMixture
constTransport, constTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeBasicMixture makeBasicMixture
@ -208,7 +208,7 @@ makeBasicMixture
sutherlandTransport, sutherlandTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeBasicMixture makeBasicMixture
@ -217,7 +217,7 @@ makeBasicMixture
sutherlandTransport, sutherlandTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );

View File

@ -27,8 +27,8 @@ License
#include "makeThermo.H" #include "makeThermo.H"
#include "perfectGas.H" #include "perfectGas.H"
#include "isobaricPerfectGas.H" #include "incompressiblePerfectGas.H"
#include "incompressible.H" #include "rhoConst.H"
#include "hConstThermo.H" #include "hConstThermo.H"
#include "janafThermo.H" #include "janafThermo.H"
@ -94,7 +94,7 @@ makeThermo
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makePolyThermo makePolyThermo
@ -123,7 +123,7 @@ makeThermo
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeThermo makeThermo
@ -134,7 +134,7 @@ makeThermo
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeThermo makeThermo
@ -145,7 +145,7 @@ makeThermo
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
@ -192,7 +192,7 @@ makeThermo
constTransport, constTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makePolyThermo makePolyThermo
@ -221,7 +221,7 @@ makeThermo
constTransport, constTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeThermo makeThermo
@ -232,7 +232,7 @@ makeThermo
sutherlandTransport, sutherlandTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeThermo makeThermo
@ -243,7 +243,7 @@ makeThermo
sutherlandTransport, sutherlandTransport,
sensibleInternalEnergy, sensibleInternalEnergy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );

View File

@ -57,14 +57,14 @@ namespace Foam
( (
ODEChemistryModel, ODEChemistryModel,
psiChemistryModel, psiChemistryModel,
constIsobaricGasThermoPhysics constIncompressibleGasThermoPhysics
); );
makeChemistryModel makeChemistryModel
( (
ODEChemistryModel, ODEChemistryModel,
psiChemistryModel, psiChemistryModel,
isobaricGasThermoPhysics incompressibleGasThermoPhysics
); );
makeChemistryModel makeChemistryModel

View File

@ -57,14 +57,14 @@ namespace Foam
( (
ODEChemistryModel, ODEChemistryModel,
rhoChemistryModel, rhoChemistryModel,
constIsobaricGasThermoPhysics constIncompressibleGasThermoPhysics
); );
makeChemistryModel makeChemistryModel
( (
ODEChemistryModel, ODEChemistryModel,
rhoChemistryModel, rhoChemistryModel,
isobaricGasThermoPhysics incompressibleGasThermoPhysics
); );
makeChemistryModel makeChemistryModel

View File

@ -35,13 +35,21 @@ namespace Foam
{ {
makeChemistrySolverTypes(psiChemistryModel, constGasThermoPhysics); makeChemistrySolverTypes(psiChemistryModel, constGasThermoPhysics);
makeChemistrySolverTypes(psiChemistryModel, gasThermoPhysics); makeChemistrySolverTypes(psiChemistryModel, gasThermoPhysics);
makeChemistrySolverTypes(psiChemistryModel, constIsobaricGasThermoPhysics); makeChemistrySolverTypes
makeChemistrySolverTypes(psiChemistryModel, isobaricGasThermoPhysics); (
psiChemistryModel,
constIncompressibleGasThermoPhysics
);
makeChemistrySolverTypes(psiChemistryModel, incompressibleGasThermoPhysics);
makeChemistrySolverTypes(psiChemistryModel, icoPoly8ThermoPhysics); makeChemistrySolverTypes(psiChemistryModel, icoPoly8ThermoPhysics);
makeChemistrySolverTypes(rhoChemistryModel, constGasThermoPhysics); makeChemistrySolverTypes(rhoChemistryModel, constGasThermoPhysics);
makeChemistrySolverTypes(rhoChemistryModel, gasThermoPhysics); makeChemistrySolverTypes(rhoChemistryModel, gasThermoPhysics);
makeChemistrySolverTypes(rhoChemistryModel, constIsobaricGasThermoPhysics); makeChemistrySolverTypes
makeChemistrySolverTypes(rhoChemistryModel, isobaricGasThermoPhysics); (
rhoChemistryModel,
constIncompressibleGasThermoPhysics
);
makeChemistrySolverTypes(rhoChemistryModel, incompressibleGasThermoPhysics);
makeChemistrySolverTypes(rhoChemistryModel, icoPoly8ThermoPhysics); makeChemistrySolverTypes(rhoChemistryModel, icoPoly8ThermoPhysics);
} }

View File

@ -38,14 +38,18 @@ namespace Foam
makeChemistryReader(constGasThermoPhysics); makeChemistryReader(constGasThermoPhysics);
makeChemistryReader(gasThermoPhysics); makeChemistryReader(gasThermoPhysics);
makeChemistryReader(constIsobaricGasThermoPhysics); makeChemistryReader(constIncompressibleGasThermoPhysics);
makeChemistryReader(isobaricGasThermoPhysics); makeChemistryReader(incompressibleGasThermoPhysics);
makeChemistryReader(icoPoly8ThermoPhysics); makeChemistryReader(icoPoly8ThermoPhysics);
makeChemistryReaderType(foamChemistryReader, constGasThermoPhysics); makeChemistryReaderType(foamChemistryReader, constGasThermoPhysics);
makeChemistryReaderType(foamChemistryReader, gasThermoPhysics); makeChemistryReaderType(foamChemistryReader, gasThermoPhysics);
makeChemistryReaderType(foamChemistryReader, constIsobaricGasThermoPhysics); makeChemistryReaderType
makeChemistryReaderType(foamChemistryReader, isobaricGasThermoPhysics); (
foamChemistryReader,
constIncompressibleGasThermoPhysics
);
makeChemistryReaderType(foamChemistryReader, incompressibleGasThermoPhysics);
makeChemistryReaderType(foamChemistryReader, icoPoly8ThermoPhysics); makeChemistryReaderType(foamChemistryReader, icoPoly8ThermoPhysics);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,7 +29,7 @@ License
#include "heRhoReactionThermo.H" #include "heRhoReactionThermo.H"
#include "perfectGas.H" #include "perfectGas.H"
#include "isobaricPerfectGas.H" #include "incompressiblePerfectGas.H"
#include "hConstThermo.H" #include "hConstThermo.H"
#include "janafThermo.H" #include "janafThermo.H"
@ -137,7 +137,7 @@ makeReactionThermo
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeReactionThermo makeReactionThermo
@ -149,7 +149,7 @@ makeReactionThermo
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeReactionThermo makeReactionThermo
@ -161,7 +161,7 @@ makeReactionThermo
constTransport, constTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeReactionThermo makeReactionThermo
@ -173,7 +173,7 @@ makeReactionThermo
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeReactionThermo makeReactionThermo
@ -185,7 +185,7 @@ makeReactionThermo
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
makeReactionThermo makeReactionThermo
@ -197,7 +197,7 @@ makeReactionThermo
sutherlandTransport, sutherlandTransport,
sensibleEnthalpy, sensibleEnthalpy,
janafThermo, janafThermo,
isobaricPerfectGas incompressiblePerfectGas
); );
@ -227,7 +227,7 @@ makeReactionMixtureThermo
rhoReactionThermo, rhoReactionThermo,
heRhoReactionThermo, heRhoReactionThermo,
multiComponentMixture, multiComponentMixture,
constIsobaricGasThermoPhysics constIncompressibleGasThermoPhysics
); );
makeReactionMixtureThermo makeReactionMixtureThermo
@ -236,7 +236,7 @@ makeReactionMixtureThermo
rhoReactionThermo, rhoReactionThermo,
heRhoReactionThermo, heRhoReactionThermo,
multiComponentMixture, multiComponentMixture,
isobaricGasThermoPhysics incompressibleGasThermoPhysics
); );
makeReactionMixtureThermo makeReactionMixtureThermo
@ -275,7 +275,7 @@ makeReactionMixtureThermo
rhoReactionThermo, rhoReactionThermo,
heRhoReactionThermo, heRhoReactionThermo,
reactingMixture, reactingMixture,
constIsobaricGasThermoPhysics constIncompressibleGasThermoPhysics
); );
makeReactionMixtureThermo makeReactionMixtureThermo
@ -284,7 +284,7 @@ makeReactionMixtureThermo
rhoReactionThermo, rhoReactionThermo,
heRhoReactionThermo, heRhoReactionThermo,
reactingMixture, reactingMixture,
isobaricGasThermoPhysics incompressibleGasThermoPhysics
); );
makeReactionMixtureThermo makeReactionMixtureThermo

View File

@ -32,7 +32,7 @@ Description
#ifndef solidThermoPhysicsTypes_H #ifndef solidThermoPhysicsTypes_H
#define solidThermoPhysicsTypes_H #define solidThermoPhysicsTypes_H
#include "incompressible.H" #include "rhoConst.H"
#include "hConstThermo.H" #include "hConstThermo.H"
#include "hExponentialThermo.H" #include "hExponentialThermo.H"
@ -59,7 +59,7 @@ namespace Foam
< <
hConstThermo hConstThermo
< <
incompressible rhoConst
>, >,
sensibleEnthalpy sensibleEnthalpy
> >
@ -76,7 +76,7 @@ namespace Foam
< <
hExponentialThermo hExponentialThermo
< <
incompressible rhoConst
>, >,
sensibleEnthalpy sensibleEnthalpy
> >

View File

@ -26,7 +26,7 @@ License
#include "makeSolidThermo.H" #include "makeSolidThermo.H"
#include "incompressible.H" #include "rhoConst.H"
#include "hConstThermo.H" #include "hConstThermo.H"
#include "hExponentialThermo.H" #include "hExponentialThermo.H"
@ -67,7 +67,7 @@ makeSolidThermo
constSolidRad, constSolidRad,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeSolidThermo makeSolidThermo
@ -79,7 +79,7 @@ makeSolidThermo
constSolidRad, constSolidRad,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeSolidThermo makeSolidThermo
@ -91,7 +91,7 @@ makeSolidThermo
constSolidRad, constSolidRad,
sensibleEnthalpy, sensibleEnthalpy,
hExponentialThermo, hExponentialThermo,
incompressible rhoConst
); );
makeSolidThermo makeSolidThermo
@ -103,7 +103,7 @@ makeSolidThermo
constSolidRad, constSolidRad,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeSolidThermo makeSolidThermo
@ -115,7 +115,7 @@ makeSolidThermo
constSolidRad, constSolidRad,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );

View File

@ -30,7 +30,7 @@ Description
#include "makeBasicMixture.H" #include "makeBasicMixture.H"
#include "incompressible.H" #include "rhoConst.H"
#include "hConstThermo.H" #include "hConstThermo.H"
#include "hExponentialThermo.H" #include "hExponentialThermo.H"
@ -64,7 +64,7 @@ makeBasicMixture
constIsoSolidTransport, constIsoSolidTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeBasicMixture makeBasicMixture
@ -73,7 +73,7 @@ makeBasicMixture
constAnIsoSolidTransport, constAnIsoSolidTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeBasicMixture makeBasicMixture
@ -82,7 +82,7 @@ makeBasicMixture
exponentialSolidTransport, exponentialSolidTransport,
sensibleEnthalpy, sensibleEnthalpy,
hExponentialThermo, hExponentialThermo,
incompressible rhoConst
); );
makeBasicMixture makeBasicMixture
@ -91,7 +91,7 @@ makeBasicMixture
constIsoSolidTransport, constIsoSolidTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );
makeBasicMixture makeBasicMixture
@ -100,7 +100,7 @@ makeBasicMixture
constIsoSolidTransport, constIsoSolidTransport,
sensibleEnthalpy, sensibleEnthalpy,
hConstThermo, hConstThermo,
incompressible rhoConst
); );

View File

@ -6,8 +6,8 @@ reactions = reaction/reactions
$(atomicWeights)/atomicWeights.C $(atomicWeights)/atomicWeights.C
$(specie)/specie.C $(specie)/specie.C
$(equationOfState)/perfectGas/perfectGas.C $(equationOfState)/perfectGas/perfectGas.C
$(equationOfState)/incompressible/incompressible.C $(equationOfState)/rhoConst/rhoConst.C
$(equationOfState)/isobaricPerfectGas/isobaricPerfectGas.C $(equationOfState)/incompressiblePerfectGas/incompressiblePerfectGas.C
$(reactions)/makeReactionThermoReactions.C $(reactions)/makeReactionThermoReactions.C
$(reactions)/makeLangmuirHinshelwoodReactions.C $(reactions)/makeLangmuirHinshelwoodReactions.C

View File

@ -140,6 +140,14 @@ public:
// Fundamental properties // Fundamental properties
//- Return true if the equation of state is incompressible
// i.e. rho != f(p)
static const bool incompressible = true;
//- Return true if the equation of state is isochoric
// i.e. rho = const
static const bool isochoric = false;
//- Return density [kg/m^3] //- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const; inline scalar rho(scalar p, scalar T) const;
@ -149,8 +157,11 @@ public:
//- Return compression factor [] //- Return compression factor []
inline scalar Z(scalar p, scalar T) const; inline scalar Z(scalar p, scalar T) const;
//- Return (cp - cv) [J/(kmol K]
inline scalar cpMcv(scalar p, scalar T) const;
// I-O
// IO
//- Write to Ostream //- Write to Ostream
void write(Ostream& os) const; void write(Ostream& os) const;

View File

@ -117,6 +117,17 @@ inline Foam::scalar Foam::icoPolynomial<PolySize>::Z(scalar, scalar) const
} }
template<int PolySize>
inline Foam::scalar Foam::icoPolynomial<PolySize>::cpMcv
(
scalar p,
scalar T
) const
{
return -(p/sqr(rhoCoeffs_.value(T)))*rhoCoeffs_.derivative(T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<int PolySize> template<int PolySize>

View File

@ -23,21 +23,21 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "isobaricPerfectGas.H" #include "incompressiblePerfectGas.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::isobaricPerfectGas::isobaricPerfectGas(Istream& is) Foam::incompressiblePerfectGas::incompressiblePerfectGas(Istream& is)
: :
specie(is), specie(is),
pRef_(readScalar(is)) pRef_(readScalar(is))
{ {
is.check("isobaricPerfectGas::isobaricPerfectGas(Istream& is)"); is.check("incompressiblePerfectGas::incompressiblePerfectGas(Istream& is)");
} }
Foam::isobaricPerfectGas::isobaricPerfectGas(const dictionary& dict) Foam::incompressiblePerfectGas::incompressiblePerfectGas(const dictionary& dict)
: :
specie(dict), specie(dict),
pRef_(readScalar(dict.subDict("equationOfState").lookup("pRef"))) pRef_(readScalar(dict.subDict("equationOfState").lookup("pRef")))
@ -46,7 +46,7 @@ Foam::isobaricPerfectGas::isobaricPerfectGas(const dictionary& dict)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::isobaricPerfectGas::write(Ostream& os) const void Foam::incompressiblePerfectGas::write(Ostream& os) const
{ {
specie::write(os); specie::write(os);
dictionary dict("equationOfState"); dictionary dict("equationOfState");
@ -58,12 +58,15 @@ void Foam::isobaricPerfectGas::write(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const isobaricPerfectGas& pg) Foam::Ostream& Foam::operator<<(Ostream& os, const incompressiblePerfectGas& pg)
{ {
os << static_cast<const specie&>(pg) os << static_cast<const specie&>(pg)
<< token::SPACE << pg.pRef_; << token::SPACE << pg.pRef_;
os.check("Ostream& operator<<(Ostream& os, const isobaricPerfectGas& st)"); os.check
(
"Ostream& operator<<(Ostream& os, const incompressiblePerfectGas& st)"
);
return os; return os;
} }

View File

@ -22,20 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::isobaricPerfectGas Foam::incompressiblePerfectGas
Description Description
Perfect gas equation of state using a reference pressure Incompressible gas equation of state using a constant reference pressure in
rather than the local pressure. the perfect gas equation of state rather than the local pressure so that the
density only varies with temperature and composition.
SourceFiles SourceFiles
isobaricPerfectGasI.H incompressiblePerfectGasI.H
isobaricPerfectGas.C incompressiblePerfectGas.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef isobaricPerfectGas_H #ifndef incompressiblePerfectGas_H
#define isobaricPerfectGas_H #define incompressiblePerfectGas_H
#include "specie.H" #include "specie.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -46,10 +47,10 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class isobaricPerfectGas Declaration Class incompressiblePerfectGas Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class isobaricPerfectGas class incompressiblePerfectGas
: :
public specie public specie
{ {
@ -64,31 +65,46 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
inline isobaricPerfectGas(const specie& sp); inline incompressiblePerfectGas(const specie& sp);
//- Construct from Istream //- Construct from Istream
isobaricPerfectGas(Istream&); incompressiblePerfectGas(Istream&);
//- Construct from dictionary //- Construct from dictionary
isobaricPerfectGas(const dictionary& dict); incompressiblePerfectGas(const dictionary& dict);
//- Construct as named copy //- Construct as named copy
inline isobaricPerfectGas(const word& name, const isobaricPerfectGas&); inline incompressiblePerfectGas
(
const word& name,
const incompressiblePerfectGas&
);
//- Construct and return a clone //- Construct and return a clone
inline autoPtr<isobaricPerfectGas> clone() const; inline autoPtr<incompressiblePerfectGas> clone() const;
// Selector from Istream // Selector from Istream
inline static autoPtr<isobaricPerfectGas> New(Istream& is); inline static autoPtr<incompressiblePerfectGas> New(Istream& is);
// Selector from dictionary // Selector from dictionary
inline static autoPtr<isobaricPerfectGas> New(const dictionary& dict); inline static autoPtr<incompressiblePerfectGas> New
(
const dictionary& dict
);
// Member functions // Member functions
// Fundamental properties // Fundamental properties
//- Return true if the equation of state is incompressible
// i.e. rho != f(p)
static const bool incompressible = true;
//- Return true if the equation of state is isochoric
// i.e. rho = const
static const bool isochoric = false;
//- Return density [kg/m^3] //- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const; inline scalar rho(scalar p, scalar T) const;
@ -98,8 +114,11 @@ public:
//- Return compression factor [] //- Return compression factor []
inline scalar Z(scalar p, scalar T) const; inline scalar Z(scalar p, scalar T) const;
//- Return (cp - cv) [J/(kmol K]
inline scalar cpMcv(scalar p, scalar T) const;
// I-O
// IO
//- Write to Ostream //- Write to Ostream
void write(Ostream& os) const; void write(Ostream& os) const;
@ -107,42 +126,42 @@ public:
// Member operators // Member operators
inline void operator+=(const isobaricPerfectGas&); inline void operator+=(const incompressiblePerfectGas&);
inline void operator-=(const isobaricPerfectGas&); inline void operator-=(const incompressiblePerfectGas&);
inline void operator*=(const scalar); inline void operator*=(const scalar);
// Friend operators // Friend operators
inline friend isobaricPerfectGas operator+ inline friend incompressiblePerfectGas operator+
( (
const isobaricPerfectGas&, const incompressiblePerfectGas&,
const isobaricPerfectGas& const incompressiblePerfectGas&
); );
inline friend isobaricPerfectGas operator- inline friend incompressiblePerfectGas operator-
( (
const isobaricPerfectGas&, const incompressiblePerfectGas&,
const isobaricPerfectGas& const incompressiblePerfectGas&
); );
inline friend isobaricPerfectGas operator* inline friend incompressiblePerfectGas operator*
( (
const scalar s, const scalar s,
const isobaricPerfectGas& const incompressiblePerfectGas&
); );
inline friend isobaricPerfectGas operator== inline friend incompressiblePerfectGas operator==
( (
const isobaricPerfectGas&, const incompressiblePerfectGas&,
const isobaricPerfectGas& const incompressiblePerfectGas&
); );
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream&, const isobaricPerfectGas&); friend Ostream& operator<<(Ostream&, const incompressiblePerfectGas&);
}; };
@ -152,7 +171,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "isobaricPerfectGasI.H" #include "incompressiblePerfectGasI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,11 +23,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "isobaricPerfectGas.H" #include "incompressiblePerfectGas.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::isobaricPerfectGas::isobaricPerfectGas(const specie& sp) inline Foam::incompressiblePerfectGas::incompressiblePerfectGas
(
const specie& sp
)
: :
specie(sp) specie(sp)
{} {}
@ -35,76 +38,101 @@ inline Foam::isobaricPerfectGas::isobaricPerfectGas(const specie& sp)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::isobaricPerfectGas::isobaricPerfectGas inline Foam::incompressiblePerfectGas::incompressiblePerfectGas
( (
const word& name, const word& name,
const isobaricPerfectGas& pg const incompressiblePerfectGas& pg
) )
: :
specie(name, pg) specie(name, pg)
{} {}
inline Foam::autoPtr<Foam::isobaricPerfectGas> Foam::isobaricPerfectGas:: inline Foam::autoPtr<Foam::incompressiblePerfectGas>
clone() const Foam::incompressiblePerfectGas::clone() const
{ {
return autoPtr<isobaricPerfectGas>(new isobaricPerfectGas(*this)); return autoPtr<incompressiblePerfectGas>
(
new incompressiblePerfectGas(*this)
);
} }
inline Foam::autoPtr<Foam::isobaricPerfectGas> Foam::isobaricPerfectGas::New inline Foam::autoPtr<Foam::incompressiblePerfectGas>
Foam::incompressiblePerfectGas::New
( (
Istream& is Istream& is
) )
{ {
return autoPtr<isobaricPerfectGas>(new isobaricPerfectGas(is)); return autoPtr<incompressiblePerfectGas>(new incompressiblePerfectGas(is));
} }
inline Foam::autoPtr<Foam::isobaricPerfectGas> Foam::isobaricPerfectGas::New inline Foam::autoPtr<Foam::incompressiblePerfectGas>
Foam::incompressiblePerfectGas::New
( (
const dictionary& dict const dictionary& dict
) )
{ {
return autoPtr<isobaricPerfectGas>(new isobaricPerfectGas(dict)); return autoPtr<incompressiblePerfectGas>
(
new incompressiblePerfectGas(dict)
);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::isobaricPerfectGas::rho(scalar p, scalar T) const inline Foam::scalar Foam::incompressiblePerfectGas::rho
(
scalar p,
scalar T
) const
{ {
return pRef_/(R()*T); return pRef_/(R()*T);
} }
inline Foam::scalar Foam::isobaricPerfectGas::psi(scalar, scalar T) const inline Foam::scalar Foam::incompressiblePerfectGas::psi(scalar, scalar T) const
{ {
return 0.0; return 0.0;
} }
inline Foam::scalar Foam::isobaricPerfectGas::Z(scalar, scalar) const inline Foam::scalar Foam::incompressiblePerfectGas::Z(scalar, scalar) const
{ {
return 0.0; return 0.0;
} }
inline Foam::scalar Foam::incompressiblePerfectGas::cpMcv(scalar, scalar) const
{
return this->RR;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::isobaricPerfectGas::operator+=(const isobaricPerfectGas& pg) inline void Foam::incompressiblePerfectGas::operator+=
(
const incompressiblePerfectGas& pg
)
{ {
specie::operator+=(pg); specie::operator+=(pg);
} }
inline void Foam::isobaricPerfectGas::operator-=(const isobaricPerfectGas& pg) inline void Foam::incompressiblePerfectGas::operator-=
(
const incompressiblePerfectGas& pg
)
{ {
specie::operator-=(pg); specie::operator-=(pg);
} }
inline void Foam::isobaricPerfectGas::operator*=(const scalar s) inline void Foam::incompressiblePerfectGas::operator*=(const scalar s)
{ {
specie::operator*=(s); specie::operator*=(s);
} }
@ -112,13 +140,13 @@ inline void Foam::isobaricPerfectGas::operator*=(const scalar s)
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline Foam::isobaricPerfectGas Foam::operator+ inline Foam::incompressiblePerfectGas Foam::operator+
( (
const isobaricPerfectGas& pg1, const incompressiblePerfectGas& pg1,
const isobaricPerfectGas& pg2 const incompressiblePerfectGas& pg2
) )
{ {
return isobaricPerfectGas return incompressiblePerfectGas
( (
static_cast<const specie&>(pg1) static_cast<const specie&>(pg1)
+ static_cast<const specie&>(pg2) + static_cast<const specie&>(pg2)
@ -126,13 +154,13 @@ inline Foam::isobaricPerfectGas Foam::operator+
} }
inline Foam::isobaricPerfectGas Foam::operator- inline Foam::incompressiblePerfectGas Foam::operator-
( (
const isobaricPerfectGas& pg1, const incompressiblePerfectGas& pg1,
const isobaricPerfectGas& pg2 const incompressiblePerfectGas& pg2
) )
{ {
return isobaricPerfectGas return incompressiblePerfectGas
( (
static_cast<const specie&>(pg1) static_cast<const specie&>(pg1)
- static_cast<const specie&>(pg2) - static_cast<const specie&>(pg2)
@ -140,20 +168,20 @@ inline Foam::isobaricPerfectGas Foam::operator-
} }
inline Foam::isobaricPerfectGas Foam::operator* inline Foam::incompressiblePerfectGas Foam::operator*
( (
const scalar s, const scalar s,
const isobaricPerfectGas& pg const incompressiblePerfectGas& pg
) )
{ {
return isobaricPerfectGas(s*static_cast<const specie&>(pg)); return incompressiblePerfectGas(s*static_cast<const specie&>(pg));
} }
inline Foam::isobaricPerfectGas Foam::operator== inline Foam::incompressiblePerfectGas Foam::operator==
( (
const isobaricPerfectGas& pg1, const incompressiblePerfectGas& pg1,
const isobaricPerfectGas& pg2 const incompressiblePerfectGas& pg2
) )
{ {
return pg2 - pg1; return pg2 - pg1;

View File

@ -83,6 +83,14 @@ public:
// Fundamental properties // Fundamental properties
//- Return true if the equation of state is incompressible
// i.e. rho != f(p)
static const bool incompressible = false;
//- Return true if the equation of state is isochoric
// i.e. rho = const
static const bool isochoric = false;
//- Return density [kg/m^3] //- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const; inline scalar rho(scalar p, scalar T) const;
@ -92,8 +100,11 @@ public:
//- Return compression factor [] //- Return compression factor []
inline scalar Z(scalar p, scalar T) const; inline scalar Z(scalar p, scalar T) const;
//- Return (cp - cv) [J/(kmol K]
inline scalar cpMcv(scalar p, scalar T) const;
// I-O
// IO
//- Write to Ostream //- Write to Ostream
void write(Ostream& os) const; void write(Ostream& os) const;

View File

@ -82,6 +82,12 @@ inline Foam::scalar Foam::perfectGas::Z(scalar, scalar) const
} }
inline Foam::scalar Foam::perfectGas::cpMcv(scalar, scalar) const
{
return this->RR;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::perfectGas::operator+=(const perfectGas& pg) inline void Foam::perfectGas::operator+=(const perfectGas& pg)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,21 +23,21 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "incompressible.H" #include "rhoConst.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::incompressible::incompressible(Istream& is) Foam::rhoConst::rhoConst(Istream& is)
: :
specie(is), specie(is),
rho_(readScalar(is)) rho_(readScalar(is))
{ {
is.check("incompressible::incompressible(Istream& is)"); is.check("rhoConst::rhoConst(Istream& is)");
} }
Foam::incompressible::incompressible(const dictionary& dict) Foam::rhoConst::rhoConst(const dictionary& dict)
: :
specie(dict), specie(dict),
rho_(readScalar(dict.subDict("equationOfState").lookup("rho"))) rho_(readScalar(dict.subDict("equationOfState").lookup("rho")))
@ -46,7 +46,7 @@ Foam::incompressible::incompressible(const dictionary& dict)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::incompressible::write(Ostream& os) const void Foam::rhoConst::write(Ostream& os) const
{ {
specie::write(os); specie::write(os);
@ -59,12 +59,12 @@ void Foam::incompressible::write(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const incompressible& ico) Foam::Ostream& Foam::operator<<(Ostream& os, const rhoConst& ico)
{ {
os << static_cast<const specie&>(ico) os << static_cast<const specie&>(ico)
<< token::SPACE << ico.rho_; << token::SPACE << ico.rho_;
os.check("Ostream& operator<<(Ostream& os, const incompressible& ico)"); os.check("Ostream& operator<<(Ostream& os, const rhoConst& ico)");
return os; return os;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::incompressible Foam::rhoConst
Description Description
Incompressible gas/liquid equation of state. RhoConst (rho = const) of state.
SourceFiles SourceFiles
incompressibleI.H rhoConstI.H
incompressible.C rhoConst.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef incompressible_H #ifndef rhoConst_H
#define incompressible_H #define rhoConst_H
#include "specie.H" #include "specie.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -45,10 +45,10 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class incompressible Declaration Class rhoConst Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class incompressible class rhoConst
: :
public specie public specie
{ {
@ -63,28 +63,36 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
inline incompressible(const specie& sp, const scalar rho); inline rhoConst(const specie& sp, const scalar rho);
//- Construct from Istream //- Construct from Istream
incompressible(Istream&); rhoConst(Istream&);
//- Construct from dictionary //- Construct from dictionary
incompressible(const dictionary& dict); rhoConst(const dictionary& dict);
//- Construct as named copy //- Construct as named copy
inline incompressible(const word& name, const incompressible&); inline rhoConst(const word& name, const rhoConst&);
//- Construct and return a clone //- Construct and return a clone
inline autoPtr<incompressible> clone() const; inline autoPtr<rhoConst> clone() const;
// Selector from Istream // Selector from Istream
inline static autoPtr<incompressible> New(Istream& is); inline static autoPtr<rhoConst> New(Istream& is);
// Member functions // Member functions
// Fundamental properties // Fundamental properties
//- Return true if the equation of state is rhoConst
// i.e. rho != f(p)
static const bool incompressible = false;
//- Return true if the equation of state is isochoric
// i.e. rho = const
static const bool isochoric = true;
//- Return density [kg/m^3] //- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const; inline scalar rho(scalar p, scalar T) const;
@ -94,8 +102,11 @@ public:
//- Return compression factor [] //- Return compression factor []
inline scalar Z(scalar p, scalar T) const; inline scalar Z(scalar p, scalar T) const;
//- Return (cp - cv) [J/(kmol K]
inline scalar cpMcv(scalar p, scalar T) const;
// I-O
// IO
//- Write to Ostream //- Write to Ostream
void write(Ostream& os) const; void write(Ostream& os) const;
@ -103,42 +114,42 @@ public:
// Member operators // Member operators
inline void operator+=(const incompressible&); inline void operator+=(const rhoConst&);
inline void operator-=(const incompressible&); inline void operator-=(const rhoConst&);
inline void operator*=(const scalar); inline void operator*=(const scalar);
// Friend operators // Friend operators
inline friend incompressible operator+ inline friend rhoConst operator+
( (
const incompressible&, const rhoConst&,
const incompressible& const rhoConst&
); );
inline friend incompressible operator- inline friend rhoConst operator-
( (
const incompressible&, const rhoConst&,
const incompressible& const rhoConst&
); );
inline friend incompressible operator* inline friend rhoConst operator*
( (
const scalar s, const scalar s,
const incompressible& const rhoConst&
); );
inline friend incompressible operator== inline friend rhoConst operator==
( (
const incompressible&, const rhoConst&,
const incompressible& const rhoConst&
); );
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream&, const incompressible&); friend Ostream& operator<<(Ostream&, const rhoConst&);
}; };
@ -148,7 +159,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "incompressibleI.H" #include "rhoConstI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,11 +23,11 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "incompressible.H" #include "rhoConst.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::incompressible::incompressible inline Foam::rhoConst::rhoConst
( (
const specie& sp, const specie& sp,
const scalar rho const scalar rho
@ -40,42 +40,52 @@ inline Foam::incompressible::incompressible
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::incompressible::incompressible inline Foam::rhoConst::rhoConst
( (
const word& name, const word& name,
const incompressible& ico const rhoConst& ico
) )
: :
specie(name, ico), specie(name, ico),
rho_(ico.rho_) rho_(ico.rho_)
{} {}
inline Foam::autoPtr<Foam::incompressible>
Foam::incompressible::clone() const inline Foam::autoPtr<Foam::rhoConst>
Foam::rhoConst::clone() const
{ {
return autoPtr<incompressible>(new incompressible(*this)); return autoPtr<rhoConst>(new rhoConst(*this));
} }
inline Foam::autoPtr<Foam::incompressible>
Foam::incompressible::New(Istream& is) inline Foam::autoPtr<Foam::rhoConst>
Foam::rhoConst::New(Istream& is)
{ {
return autoPtr<incompressible>(new incompressible(is)); return autoPtr<rhoConst>(new rhoConst(is));
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::incompressible::rho(scalar p, scalar T) const inline Foam::scalar Foam::rhoConst::rho(scalar p, scalar T) const
{ {
return rho_; return rho_;
} }
inline Foam::scalar Foam::incompressible::psi(scalar, scalar T) const
inline Foam::scalar Foam::rhoConst::psi(scalar, scalar T) const
{ {
return 0.0; return 0.0;
} }
inline Foam::scalar Foam::incompressible::Z(scalar, scalar) const
inline Foam::scalar Foam::rhoConst::Z(scalar, scalar) const
{
return 0.0;
}
inline Foam::scalar Foam::rhoConst::cpMcv(scalar, scalar) const
{ {
return 0.0; return 0.0;
} }
@ -83,7 +93,7 @@ inline Foam::scalar Foam::incompressible::Z(scalar, scalar) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::incompressible::operator+=(const incompressible& ico) inline void Foam::rhoConst::operator+=(const rhoConst& ico)
{ {
scalar molr1 = this->nMoles(); scalar molr1 = this->nMoles();
@ -95,7 +105,8 @@ inline void Foam::incompressible::operator+=(const incompressible& ico)
rho_ = molr1*rho_ + molr2*ico.rho_; rho_ = molr1*rho_ + molr2*ico.rho_;
} }
inline void Foam::incompressible::operator-=(const incompressible& ico)
inline void Foam::rhoConst::operator-=(const rhoConst& ico)
{ {
scalar molr1 = this->nMoles(); scalar molr1 = this->nMoles();
@ -107,7 +118,8 @@ inline void Foam::incompressible::operator-=(const incompressible& ico)
rho_ = molr1*rho_ - molr2*ico.rho_; rho_ = molr1*rho_ - molr2*ico.rho_;
} }
inline void Foam::incompressible::operator*=(const scalar s)
inline void Foam::rhoConst::operator*=(const scalar s)
{ {
specie::operator*=(s); specie::operator*=(s);
} }
@ -115,17 +127,17 @@ inline void Foam::incompressible::operator*=(const scalar s)
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline Foam::incompressible Foam::operator+ inline Foam::rhoConst Foam::operator+
( (
const incompressible& ico1, const rhoConst& ico1,
const incompressible& ico2 const rhoConst& ico2
) )
{ {
scalar nMoles = ico1.nMoles() + ico2.nMoles(); scalar nMoles = ico1.nMoles() + ico2.nMoles();
scalar molr1 = ico1.nMoles()/nMoles; scalar molr1 = ico1.nMoles()/nMoles;
scalar molr2 = ico2.nMoles()/nMoles; scalar molr2 = ico2.nMoles()/nMoles;
return incompressible return rhoConst
( (
static_cast<const specie&>(ico1) static_cast<const specie&>(ico1)
+ static_cast<const specie&>(ico2), + static_cast<const specie&>(ico2),
@ -133,17 +145,18 @@ inline Foam::incompressible Foam::operator+
); );
} }
inline Foam::incompressible Foam::operator-
inline Foam::rhoConst Foam::operator-
( (
const incompressible& ico1, const rhoConst& ico1,
const incompressible& ico2 const rhoConst& ico2
) )
{ {
scalar nMoles = ico1.nMoles() + ico2.nMoles(); scalar nMoles = ico1.nMoles() + ico2.nMoles();
scalar molr1 = ico1.nMoles()/nMoles; scalar molr1 = ico1.nMoles()/nMoles;
scalar molr2 = ico2.nMoles()/nMoles; scalar molr2 = ico2.nMoles()/nMoles;
return incompressible return rhoConst
( (
static_cast<const specie&>(ico1) static_cast<const specie&>(ico1)
- static_cast<const specie&>(ico2), - static_cast<const specie&>(ico2),
@ -151,19 +164,21 @@ inline Foam::incompressible Foam::operator-
); );
} }
inline Foam::incompressible Foam::operator*
inline Foam::rhoConst Foam::operator*
( (
const scalar s, const scalar s,
const incompressible& ico const rhoConst& ico
) )
{ {
return incompressible(s*static_cast<const specie&>(ico), ico.rho_); return rhoConst(s*static_cast<const specie&>(ico), ico.rho_);
} }
inline Foam::incompressible Foam::operator==
inline Foam::rhoConst Foam::operator==
( (
const incompressible& ico1, const rhoConst& ico1,
const incompressible& ico2 const rhoConst& ico2
) )
{ {
return ico2 - ico1; return ico2 - ico1;

View File

@ -47,9 +47,10 @@ namespace Foam
typedef Reaction<gasThermoPhysics> gasReaction; typedef Reaction<gasThermoPhysics> gasReaction;
typedef Reaction<constIsobaricGasThermoPhysics> constIsobaricGasReaction; typedef Reaction<constIncompressibleGasThermoPhysics>
constIncompressibleGasReaction;
typedef Reaction<isobaricGasThermoPhysics> isobaricGasReaction; typedef Reaction<incompressibleGasThermoPhysics> incompressibleGasReaction;
typedef Reaction<icoPoly8ThermoPhysics> icoPoly8Reaction; typedef Reaction<icoPoly8ThermoPhysics> icoPoly8Reaction;
} }

View File

@ -33,7 +33,7 @@ Description
#define thermoPhysicsTypes_H #define thermoPhysicsTypes_H
#include "perfectGas.H" #include "perfectGas.H"
#include "isobaricPerfectGas.H" #include "incompressiblePerfectGas.H"
#include "hConstThermo.H" #include "hConstThermo.H"
#include "janafThermo.H" #include "janafThermo.H"
#include "sensibleEnthalpy.H" #include "sensibleEnthalpy.H"
@ -82,11 +82,11 @@ namespace Foam
< <
hConstThermo hConstThermo
< <
isobaricPerfectGas incompressiblePerfectGas
>, >,
sensibleEnthalpy sensibleEnthalpy
> >
> constIsobaricGasThermoPhysics; > constIncompressibleGasThermoPhysics;
typedef typedef
sutherlandTransport sutherlandTransport
@ -95,11 +95,11 @@ namespace Foam
< <
janafThermo janafThermo
< <
isobaricPerfectGas incompressiblePerfectGas
>, >,
sensibleEnthalpy sensibleEnthalpy
> >
> isobaricGasThermoPhysics; > incompressibleGasThermoPhysics;
typedef typedef
polynomialTransport polynomialTransport

View File

@ -85,8 +85,12 @@ namespace Foam
{ {
makeReactions(constGasThermoPhysics, constGasReaction) makeReactions(constGasThermoPhysics, constGasReaction)
makeReactions(gasThermoPhysics, gasReaction) makeReactions(gasThermoPhysics, gasReaction)
makeReactions(constIsobaricGasThermoPhysics, constIsobaricGasReaction) makeReactions
makeReactions(isobaricGasThermoPhysics, isobaricGasReaction) (
constIncompressibleGasThermoPhysics,
constIncompressibleGasReaction
)
makeReactions(incompressibleGasThermoPhysics, incompressibleGasReaction)
makeReactions(icoPoly8ThermoPhysics, icoPoly8Reaction) makeReactions(icoPoly8ThermoPhysics, icoPoly8Reaction)
} }

View File

@ -106,7 +106,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::cp
const scalar T const scalar T
) const ) const
{ {
return Cv_*this->W() + specie::RR; return Cv_*this->W() + this->cpMcv(p, T);
} }

View File

@ -118,7 +118,7 @@ template<class Thermo, template<class> class Type>
inline Foam::scalar inline Foam::scalar
Foam::specieThermo<Thermo, Type>::cv(const scalar p, const scalar T) const Foam::specieThermo<Thermo, Type>::cv(const scalar p, const scalar T) const
{ {
return this->cp(p, T) - this->RR; return this->cp(p, T) - this->cpMcv(p, T);
} }
@ -134,8 +134,8 @@ template<class Thermo, template<class> class Type>
inline Foam::scalar inline Foam::scalar
Foam::specieThermo<Thermo, Type>::gamma(const scalar p, const scalar T) const Foam::specieThermo<Thermo, Type>::gamma(const scalar p, const scalar T) const
{ {
scalar CP = this->cp(p, T); scalar cp = this->cp(p, T);
return CP/(CP - this->RR); return cp/(cp - this->cpMcv(p, T));
} }
@ -151,7 +151,7 @@ template<class Thermo, template<class> class Type>
inline Foam::scalar inline Foam::scalar
Foam::specieThermo<Thermo, Type>::es(const scalar p, const scalar T) const Foam::specieThermo<Thermo, Type>::es(const scalar p, const scalar T) const
{ {
return this->hs(p, T) - this->RR*(T - this->Tstd); return this->hs(p, T) - p*this->W()/this->rho(p, T);
} }
@ -159,7 +159,7 @@ template<class Thermo, template<class> class Type>
inline Foam::scalar inline Foam::scalar
Foam::specieThermo<Thermo, Type>::ea(const scalar p, const scalar T) const Foam::specieThermo<Thermo, Type>::ea(const scalar p, const scalar T) const
{ {
return this->ha(p, T) - this->RR*(T - this->Tstd); return this->ha(p, T) - p*this->W()/this->rho(p, T);
} }

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heSolidThermo<reactingSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<reactingSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
solidComponents solidComponents
( (

View File

@ -110,7 +110,7 @@ dictionaryReplacement
// Solid thermo // Solid thermo
thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
mixture mixture

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
mixture mixture
{ {

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>; thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>;
mixture mixture
{ {

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
mixture mixture
{ {

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
mixture mixture
{ {

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
mixture mixture
{ {

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>;
mixture mixture
{ {