From dd3ab88f47e6706378e8aa6056eb92ced7a68bf5 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Tue, 11 Sep 2012 14:07:22 +0100 Subject: [PATCH] Thermodynamics: renamed isobaricPerfectGas -> incompressiblePerfectGas and incompressible -> rhoConst Added isochoric and incompressible identifiers to equations of state to indicate the supported processes --- .../functions/Polynomial/Polynomial.C | 82 ++++++++--------- .../functions/Polynomial/Polynomial.H | 17 ++-- .../mixtures/basicMixture/basicMixtures.C | 20 ++--- .../rhoThermo/heRhoThermo/heRhoThermos.C | 20 ++--- .../psiChemistryModel/psiChemistryModels.C | 4 +- .../rhoChemistryModel/rhoChemistryModels.C | 4 +- .../chemistrySolver/makeChemistrySolvers.C | 16 +++- .../chemistryReader/makeChemistryReaders.C | 12 ++- .../heRhoReactionThermos.C | 22 ++--- .../include/solidThermoPhysicsTypes.H | 6 +- .../heSolidThermo/heSolidThermos.C | 12 +-- .../basicSolidMixture/basicSolidMixtures.C | 12 +-- src/thermophysicalModels/specie/Make/files | 4 +- .../icoPolynomial/icoPolynomial.H | 13 ++- .../icoPolynomial/icoPolynomialI.H | 11 +++ .../incompressiblePerfectGas.C} | 17 ++-- .../incompressiblePerfectGas.H} | 83 ++++++++++------- .../incompressiblePerfectGasI.H} | 90 ++++++++++++------- .../equationOfState/perfectGas/perfectGas.H | 13 ++- .../equationOfState/perfectGas/perfectGasI.H | 6 ++ .../incompressible.C => rhoConst/rhoConst.C} | 16 ++-- .../incompressible.H => rhoConst/rhoConst.H} | 73 ++++++++------- .../rhoConstI.H} | 77 +++++++++------- .../specie/include/reactionTypes.H | 5 +- .../specie/include/thermoPhysicsTypes.H | 10 +-- .../reactions/makeReactionThermoReactions.C | 8 +- .../specie/thermo/eConst/eConstThermoI.H | 2 +- .../thermo/specieThermo/specieThermoI.H | 10 +-- .../panelRegion/thermophysicalProperties | 2 +- .../system/changeDictionaryDict.baffleRegion | 2 +- .../constant/heater/thermophysicalProperties | 2 +- .../bottomWater/thermophysicalProperties | 2 +- .../constant/heater/thermophysicalProperties | 2 +- .../constant/heater/thermophysicalProperties | 2 +- .../constant/heater/thermophysicalProperties | 2 +- .../constant/heater/thermophysicalProperties | 2 +- 36 files changed, 405 insertions(+), 276 deletions(-) rename src/thermophysicalModels/specie/equationOfState/{isobaricPerfectGas/isobaricPerfectGas.C => incompressiblePerfectGas/incompressiblePerfectGas.C} (78%) rename src/thermophysicalModels/specie/equationOfState/{isobaricPerfectGas/isobaricPerfectGas.H => incompressiblePerfectGas/incompressiblePerfectGas.H} (56%) rename src/thermophysicalModels/specie/equationOfState/{isobaricPerfectGas/isobaricPerfectGasI.H => incompressiblePerfectGas/incompressiblePerfectGasI.H} (52%) rename src/thermophysicalModels/specie/equationOfState/{incompressible/incompressible.C => rhoConst/rhoConst.C} (79%) rename src/thermophysicalModels/specie/equationOfState/{incompressible/incompressible.H => rhoConst/rhoConst.H} (65%) rename src/thermophysicalModels/specie/equationOfState/{incompressible/incompressibleI.H => rhoConst/rhoConstI.H} (66%) diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C index 87deb1bd8d5..5a545f150cf 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- 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> 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]; // avoid costly pow() in calculation - scalar powX = x; + scalar powX = 1; for (label i=1; i<PolySize; ++i) { - val += this->v_[i]*powX; powX *= x; + val += this->v_[i]*powX; } if (logActive_) @@ -195,39 +171,57 @@ Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const template<int PolySize> -Foam::scalar Foam::Polynomial<PolySize>::integrate -( - const scalar x1, - const scalar x2 -) const +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_) { - FatalErrorIn - ( - "scalar Polynomial<PolySize>::integrate" - "(" - "const scalar, " - "const scalar" - ") const" - ) << "Cannot integrate polynomial with logarithmic coefficients" - << nl << abort(FatalError); + deriv += logCoeff_/x; } + return deriv; +} + +template<int PolySize> +Foam::scalar Foam::Polynomial<PolySize>::integral +( + const scalar x1, + const scalar x2 +) const +{ // avoid costly pow() in calculation scalar powX1 = x1; scalar powX2 = x2; - scalar val = this->v_[0]*(powX2 - powX1); + scalar integ = this->v_[0]*(powX2 - powX1); for (label i=1; i<PolySize; ++i) { - val += this->v_[i]/(i + 1) * (powX2 - powX1); powX1 *= x1; 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; } diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H index 3d1da394c01..c4848302122 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,13 +27,14 @@ Class Description 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 - integer powers, starting at zero - 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 - increases the size (order) - integralMinus1() to return a new, integral coeff polynomial where @@ -136,16 +137,18 @@ public: //- Return polynomial value scalar value(const scalar x) const; - //- Integrate between two values - scalar integrate(const scalar x1, const scalar x2) const; + //- Return derivative of the polynomial at the given x + scalar derivative(const scalar x) const; + //- Return integral between two values + scalar integral(const scalar x1, const scalar x2) const; //- 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; //- 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; diff --git a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C b/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C index 248bbed9fe3..c439348fc04 100644 --- a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C +++ b/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C @@ -32,8 +32,8 @@ Description #include "makeBasicMixture.H" #include "perfectGas.H" -#include "incompressible.H" -#include "isobaricPerfectGas.H" +#include "rhoConst.H" +#include "incompressiblePerfectGas.H" #include "eConstThermo.H" @@ -94,7 +94,7 @@ makeBasicMixture constTransport, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeBasicPolyMixture @@ -118,7 +118,7 @@ makeBasicMixture constTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeBasicMixture @@ -127,7 +127,7 @@ makeBasicMixture sutherlandTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeBasicMixture @@ -136,7 +136,7 @@ makeBasicMixture sutherlandTransport, sensibleEnthalpy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); @@ -175,7 +175,7 @@ makeBasicMixture constTransport, sensibleInternalEnergy, hConstThermo, - incompressible + rhoConst ); makeBasicPolyMixture @@ -199,7 +199,7 @@ makeBasicMixture constTransport, sensibleInternalEnergy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeBasicMixture @@ -208,7 +208,7 @@ makeBasicMixture sutherlandTransport, sensibleInternalEnergy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeBasicMixture @@ -217,7 +217,7 @@ makeBasicMixture sutherlandTransport, sensibleInternalEnergy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo/heRhoThermos.C b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo/heRhoThermos.C index e9272e97b84..b39ad010d44 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo/heRhoThermos.C +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo/heRhoThermos.C @@ -27,8 +27,8 @@ License #include "makeThermo.H" #include "perfectGas.H" -#include "isobaricPerfectGas.H" -#include "incompressible.H" +#include "incompressiblePerfectGas.H" +#include "rhoConst.H" #include "hConstThermo.H" #include "janafThermo.H" @@ -94,7 +94,7 @@ makeThermo constTransport, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makePolyThermo @@ -123,7 +123,7 @@ makeThermo constTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeThermo @@ -134,7 +134,7 @@ makeThermo sutherlandTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeThermo @@ -145,7 +145,7 @@ makeThermo sutherlandTransport, sensibleEnthalpy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); @@ -192,7 +192,7 @@ makeThermo constTransport, sensibleInternalEnergy, hConstThermo, - incompressible + rhoConst ); makePolyThermo @@ -221,7 +221,7 @@ makeThermo constTransport, sensibleInternalEnergy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeThermo @@ -232,7 +232,7 @@ makeThermo sutherlandTransport, sensibleInternalEnergy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeThermo @@ -243,7 +243,7 @@ makeThermo sutherlandTransport, sensibleInternalEnergy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C index c84c43531bf..cc271358cc8 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C @@ -57,14 +57,14 @@ namespace Foam ( ODEChemistryModel, psiChemistryModel, - constIsobaricGasThermoPhysics + constIncompressibleGasThermoPhysics ); makeChemistryModel ( ODEChemistryModel, psiChemistryModel, - isobaricGasThermoPhysics + incompressibleGasThermoPhysics ); makeChemistryModel diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C index a5516752fdd..30488a68567 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C @@ -57,14 +57,14 @@ namespace Foam ( ODEChemistryModel, rhoChemistryModel, - constIsobaricGasThermoPhysics + constIncompressibleGasThermoPhysics ); makeChemistryModel ( ODEChemistryModel, rhoChemistryModel, - isobaricGasThermoPhysics + incompressibleGasThermoPhysics ); makeChemistryModel diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C index 54239f49578..189d43bdfa9 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C @@ -35,13 +35,21 @@ namespace Foam { makeChemistrySolverTypes(psiChemistryModel, constGasThermoPhysics); makeChemistrySolverTypes(psiChemistryModel, gasThermoPhysics); - makeChemistrySolverTypes(psiChemistryModel, constIsobaricGasThermoPhysics); - makeChemistrySolverTypes(psiChemistryModel, isobaricGasThermoPhysics); + makeChemistrySolverTypes + ( + psiChemistryModel, + constIncompressibleGasThermoPhysics + ); + makeChemistrySolverTypes(psiChemistryModel, incompressibleGasThermoPhysics); makeChemistrySolverTypes(psiChemistryModel, icoPoly8ThermoPhysics); makeChemistrySolverTypes(rhoChemistryModel, constGasThermoPhysics); makeChemistrySolverTypes(rhoChemistryModel, gasThermoPhysics); - makeChemistrySolverTypes(rhoChemistryModel, constIsobaricGasThermoPhysics); - makeChemistrySolverTypes(rhoChemistryModel, isobaricGasThermoPhysics); + makeChemistrySolverTypes + ( + rhoChemistryModel, + constIncompressibleGasThermoPhysics + ); + makeChemistrySolverTypes(rhoChemistryModel, incompressibleGasThermoPhysics); makeChemistrySolverTypes(rhoChemistryModel, icoPoly8ThermoPhysics); } diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C index 195cc764ed0..7ee6324527e 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C @@ -38,14 +38,18 @@ namespace Foam makeChemistryReader(constGasThermoPhysics); makeChemistryReader(gasThermoPhysics); -makeChemistryReader(constIsobaricGasThermoPhysics); -makeChemistryReader(isobaricGasThermoPhysics); +makeChemistryReader(constIncompressibleGasThermoPhysics); +makeChemistryReader(incompressibleGasThermoPhysics); makeChemistryReader(icoPoly8ThermoPhysics); makeChemistryReaderType(foamChemistryReader, constGasThermoPhysics); makeChemistryReaderType(foamChemistryReader, gasThermoPhysics); -makeChemistryReaderType(foamChemistryReader, constIsobaricGasThermoPhysics); -makeChemistryReaderType(foamChemistryReader, isobaricGasThermoPhysics); +makeChemistryReaderType +( + foamChemistryReader, + constIncompressibleGasThermoPhysics +); +makeChemistryReaderType(foamChemistryReader, incompressibleGasThermoPhysics); makeChemistryReaderType(foamChemistryReader, icoPoly8ThermoPhysics); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/heRhoReactionThermo/heRhoReactionThermos.C b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/heRhoReactionThermo/heRhoReactionThermos.C index 74fb78cb166..38e50afd57e 100644 --- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/heRhoReactionThermo/heRhoReactionThermos.C +++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/heRhoReactionThermo/heRhoReactionThermos.C @@ -29,7 +29,7 @@ License #include "heRhoReactionThermo.H" #include "perfectGas.H" -#include "isobaricPerfectGas.H" +#include "incompressiblePerfectGas.H" #include "hConstThermo.H" #include "janafThermo.H" @@ -137,7 +137,7 @@ makeReactionThermo constTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeReactionThermo @@ -149,7 +149,7 @@ makeReactionThermo constTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeReactionThermo @@ -161,7 +161,7 @@ makeReactionThermo constTransport, sensibleEnthalpy, hConstThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeReactionThermo @@ -173,7 +173,7 @@ makeReactionThermo sutherlandTransport, sensibleEnthalpy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeReactionThermo @@ -185,7 +185,7 @@ makeReactionThermo sutherlandTransport, sensibleEnthalpy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); makeReactionThermo @@ -197,7 +197,7 @@ makeReactionThermo sutherlandTransport, sensibleEnthalpy, janafThermo, - isobaricPerfectGas + incompressiblePerfectGas ); @@ -227,7 +227,7 @@ makeReactionMixtureThermo rhoReactionThermo, heRhoReactionThermo, multiComponentMixture, - constIsobaricGasThermoPhysics + constIncompressibleGasThermoPhysics ); makeReactionMixtureThermo @@ -236,7 +236,7 @@ makeReactionMixtureThermo rhoReactionThermo, heRhoReactionThermo, multiComponentMixture, - isobaricGasThermoPhysics + incompressibleGasThermoPhysics ); makeReactionMixtureThermo @@ -275,7 +275,7 @@ makeReactionMixtureThermo rhoReactionThermo, heRhoReactionThermo, reactingMixture, - constIsobaricGasThermoPhysics + constIncompressibleGasThermoPhysics ); makeReactionMixtureThermo @@ -284,7 +284,7 @@ makeReactionMixtureThermo rhoReactionThermo, heRhoReactionThermo, reactingMixture, - isobaricGasThermoPhysics + incompressibleGasThermoPhysics ); makeReactionMixtureThermo diff --git a/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H b/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H index 753dfdc3e4b..9f15c3fe0f7 100644 --- a/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H +++ b/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H @@ -32,7 +32,7 @@ Description #ifndef solidThermoPhysicsTypes_H #define solidThermoPhysicsTypes_H -#include "incompressible.H" +#include "rhoConst.H" #include "hConstThermo.H" #include "hExponentialThermo.H" @@ -59,7 +59,7 @@ namespace Foam < hConstThermo < - incompressible + rhoConst >, sensibleEnthalpy > @@ -76,7 +76,7 @@ namespace Foam < hExponentialThermo < - incompressible + rhoConst >, sensibleEnthalpy > diff --git a/src/thermophysicalModels/solidThermo/heSolidThermo/heSolidThermos.C b/src/thermophysicalModels/solidThermo/heSolidThermo/heSolidThermos.C index 128cdb0c8b9..6d7ffa538f1 100644 --- a/src/thermophysicalModels/solidThermo/heSolidThermo/heSolidThermos.C +++ b/src/thermophysicalModels/solidThermo/heSolidThermo/heSolidThermos.C @@ -26,7 +26,7 @@ License #include "makeSolidThermo.H" -#include "incompressible.H" +#include "rhoConst.H" #include "hConstThermo.H" #include "hExponentialThermo.H" @@ -67,7 +67,7 @@ makeSolidThermo constSolidRad, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeSolidThermo @@ -79,7 +79,7 @@ makeSolidThermo constSolidRad, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeSolidThermo @@ -91,7 +91,7 @@ makeSolidThermo constSolidRad, sensibleEnthalpy, hExponentialThermo, - incompressible + rhoConst ); makeSolidThermo @@ -103,7 +103,7 @@ makeSolidThermo constSolidRad, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeSolidThermo @@ -115,7 +115,7 @@ makeSolidThermo constSolidRad, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); diff --git a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C b/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C index 91e81277517..67c91ab806f 100644 --- a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C +++ b/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C @@ -30,7 +30,7 @@ Description #include "makeBasicMixture.H" -#include "incompressible.H" +#include "rhoConst.H" #include "hConstThermo.H" #include "hExponentialThermo.H" @@ -64,7 +64,7 @@ makeBasicMixture constIsoSolidTransport, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeBasicMixture @@ -73,7 +73,7 @@ makeBasicMixture constAnIsoSolidTransport, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeBasicMixture @@ -82,7 +82,7 @@ makeBasicMixture exponentialSolidTransport, sensibleEnthalpy, hExponentialThermo, - incompressible + rhoConst ); makeBasicMixture @@ -91,7 +91,7 @@ makeBasicMixture constIsoSolidTransport, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); makeBasicMixture @@ -100,7 +100,7 @@ makeBasicMixture constIsoSolidTransport, sensibleEnthalpy, hConstThermo, - incompressible + rhoConst ); diff --git a/src/thermophysicalModels/specie/Make/files b/src/thermophysicalModels/specie/Make/files index 0d1d4f73da1..23a7bdf3a9e 100644 --- a/src/thermophysicalModels/specie/Make/files +++ b/src/thermophysicalModels/specie/Make/files @@ -6,8 +6,8 @@ reactions = reaction/reactions $(atomicWeights)/atomicWeights.C $(specie)/specie.C $(equationOfState)/perfectGas/perfectGas.C -$(equationOfState)/incompressible/incompressible.C -$(equationOfState)/isobaricPerfectGas/isobaricPerfectGas.C +$(equationOfState)/rhoConst/rhoConst.C +$(equationOfState)/incompressiblePerfectGas/incompressiblePerfectGas.C $(reactions)/makeReactionThermoReactions.C $(reactions)/makeLangmuirHinshelwoodReactions.C diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H index d293abc8f91..73b010347ca 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H @@ -140,6 +140,14 @@ public: // 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] inline scalar rho(scalar p, scalar T) const; @@ -149,8 +157,11 @@ public: //- Return compression factor [] 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 void write(Ostream& os) const; diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H index b21a9be240d..0d8aa174ad0 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H @@ -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 * * * * * * * * * * * * * // template<int PolySize> diff --git a/src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGas.C b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.C similarity index 78% rename from src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGas.C rename to src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.C index 314dafd86c1..700980e44fd 100644 --- a/src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGas.C +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.C @@ -23,21 +23,21 @@ License \*---------------------------------------------------------------------------*/ -#include "isobaricPerfectGas.H" +#include "incompressiblePerfectGas.H" #include "IOstreams.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::isobaricPerfectGas::isobaricPerfectGas(Istream& is) +Foam::incompressiblePerfectGas::incompressiblePerfectGas(Istream& is) : specie(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), pRef_(readScalar(dict.subDict("equationOfState").lookup("pRef"))) @@ -46,7 +46,7 @@ Foam::isobaricPerfectGas::isobaricPerfectGas(const dictionary& dict) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::isobaricPerfectGas::write(Ostream& os) const +void Foam::incompressiblePerfectGas::write(Ostream& os) const { specie::write(os); dictionary dict("equationOfState"); @@ -58,12 +58,15 @@ void Foam::isobaricPerfectGas::write(Ostream& os) const // * * * * * * * * * * * * * * * 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) << token::SPACE << pg.pRef_; - os.check("Ostream& operator<<(Ostream& os, const isobaricPerfectGas& st)"); + os.check + ( + "Ostream& operator<<(Ostream& os, const incompressiblePerfectGas& st)" + ); return os; } diff --git a/src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGas.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H similarity index 56% rename from src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGas.H rename to src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H index 310d72f0ab8..b7b69df0f23 100644 --- a/src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H @@ -22,20 +22,21 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::isobaricPerfectGas + Foam::incompressiblePerfectGas Description - Perfect gas equation of state using a reference pressure - rather than the local pressure. + Incompressible gas equation of state using a constant reference pressure in + the perfect gas equation of state rather than the local pressure so that the + density only varies with temperature and composition. SourceFiles - isobaricPerfectGasI.H - isobaricPerfectGas.C + incompressiblePerfectGasI.H + incompressiblePerfectGas.C \*---------------------------------------------------------------------------*/ -#ifndef isobaricPerfectGas_H -#define isobaricPerfectGas_H +#ifndef incompressiblePerfectGas_H +#define incompressiblePerfectGas_H #include "specie.H" #include "autoPtr.H" @@ -46,10 +47,10 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class isobaricPerfectGas Declaration + Class incompressiblePerfectGas Declaration \*---------------------------------------------------------------------------*/ -class isobaricPerfectGas +class incompressiblePerfectGas : public specie { @@ -64,31 +65,46 @@ public: // Constructors //- Construct from components - inline isobaricPerfectGas(const specie& sp); + inline incompressiblePerfectGas(const specie& sp); //- Construct from Istream - isobaricPerfectGas(Istream&); + incompressiblePerfectGas(Istream&); //- Construct from dictionary - isobaricPerfectGas(const dictionary& dict); + incompressiblePerfectGas(const dictionary& dict); //- Construct as named copy - inline isobaricPerfectGas(const word& name, const isobaricPerfectGas&); + inline incompressiblePerfectGas + ( + const word& name, + const incompressiblePerfectGas& + ); //- Construct and return a clone - inline autoPtr<isobaricPerfectGas> clone() const; + inline autoPtr<incompressiblePerfectGas> clone() const; // Selector from Istream - inline static autoPtr<isobaricPerfectGas> New(Istream& is); + inline static autoPtr<incompressiblePerfectGas> New(Istream& is); // Selector from dictionary - inline static autoPtr<isobaricPerfectGas> New(const dictionary& dict); + inline static autoPtr<incompressiblePerfectGas> New + ( + const dictionary& dict + ); // Member functions // 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] inline scalar rho(scalar p, scalar T) const; @@ -98,8 +114,11 @@ public: //- Return compression factor [] 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 void write(Ostream& os) const; @@ -107,42 +126,42 @@ public: // Member operators - inline void operator+=(const isobaricPerfectGas&); - inline void operator-=(const isobaricPerfectGas&); + inline void operator+=(const incompressiblePerfectGas&); + inline void operator-=(const incompressiblePerfectGas&); inline void operator*=(const scalar); // Friend operators - inline friend isobaricPerfectGas operator+ + inline friend incompressiblePerfectGas operator+ ( - const isobaricPerfectGas&, - const isobaricPerfectGas& + const incompressiblePerfectGas&, + const incompressiblePerfectGas& ); - inline friend isobaricPerfectGas operator- + inline friend incompressiblePerfectGas operator- ( - const isobaricPerfectGas&, - const isobaricPerfectGas& + const incompressiblePerfectGas&, + const incompressiblePerfectGas& ); - inline friend isobaricPerfectGas operator* + inline friend incompressiblePerfectGas operator* ( const scalar s, - const isobaricPerfectGas& + const incompressiblePerfectGas& ); - inline friend isobaricPerfectGas operator== + inline friend incompressiblePerfectGas operator== ( - const isobaricPerfectGas&, - const isobaricPerfectGas& + const incompressiblePerfectGas&, + const incompressiblePerfectGas& ); // 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" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGasI.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H similarity index 52% rename from src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGasI.H rename to src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H index 915ef8ab305..d179d5e2a18 100644 --- a/src/thermophysicalModels/specie/equationOfState/isobaricPerfectGas/isobaricPerfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H @@ -23,11 +23,14 @@ License \*---------------------------------------------------------------------------*/ -#include "isobaricPerfectGas.H" +#include "incompressiblePerfectGas.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -inline Foam::isobaricPerfectGas::isobaricPerfectGas(const specie& sp) +inline Foam::incompressiblePerfectGas::incompressiblePerfectGas +( + const specie& sp +) : specie(sp) {} @@ -35,76 +38,101 @@ inline Foam::isobaricPerfectGas::isobaricPerfectGas(const specie& sp) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::isobaricPerfectGas::isobaricPerfectGas +inline Foam::incompressiblePerfectGas::incompressiblePerfectGas ( const word& name, - const isobaricPerfectGas& pg + const incompressiblePerfectGas& pg ) : specie(name, pg) {} -inline Foam::autoPtr<Foam::isobaricPerfectGas> Foam::isobaricPerfectGas:: -clone() const +inline Foam::autoPtr<Foam::incompressiblePerfectGas> +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 ) { - 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 ) { - return autoPtr<isobaricPerfectGas>(new isobaricPerfectGas(dict)); + return autoPtr<incompressiblePerfectGas> + ( + new incompressiblePerfectGas(dict) + ); } // * * * * * * * * * * * * * * * 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); } -inline Foam::scalar Foam::isobaricPerfectGas::psi(scalar, scalar T) const +inline Foam::scalar Foam::incompressiblePerfectGas::psi(scalar, scalar T) const { return 0.0; } -inline Foam::scalar Foam::isobaricPerfectGas::Z(scalar, scalar) const +inline Foam::scalar Foam::incompressiblePerfectGas::Z(scalar, scalar) const { return 0.0; } +inline Foam::scalar Foam::incompressiblePerfectGas::cpMcv(scalar, scalar) const +{ + return this->RR; +} + + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline void Foam::isobaricPerfectGas::operator+=(const isobaricPerfectGas& pg) +inline void Foam::incompressiblePerfectGas::operator+= +( + const incompressiblePerfectGas& pg +) { specie::operator+=(pg); } -inline void Foam::isobaricPerfectGas::operator-=(const isobaricPerfectGas& pg) +inline void Foam::incompressiblePerfectGas::operator-= +( + const incompressiblePerfectGas& pg +) { specie::operator-=(pg); } -inline void Foam::isobaricPerfectGas::operator*=(const scalar s) +inline void Foam::incompressiblePerfectGas::operator*=(const scalar s) { specie::operator*=(s); } @@ -112,13 +140,13 @@ inline void Foam::isobaricPerfectGas::operator*=(const scalar s) // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -inline Foam::isobaricPerfectGas Foam::operator+ +inline Foam::incompressiblePerfectGas Foam::operator+ ( - const isobaricPerfectGas& pg1, - const isobaricPerfectGas& pg2 + const incompressiblePerfectGas& pg1, + const incompressiblePerfectGas& pg2 ) { - return isobaricPerfectGas + return incompressiblePerfectGas ( static_cast<const specie&>(pg1) + 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 isobaricPerfectGas& pg2 + const incompressiblePerfectGas& pg1, + const incompressiblePerfectGas& pg2 ) { - return isobaricPerfectGas + return incompressiblePerfectGas ( static_cast<const specie&>(pg1) - 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 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 isobaricPerfectGas& pg2 + const incompressiblePerfectGas& pg1, + const incompressiblePerfectGas& pg2 ) { return pg2 - pg1; diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H index 6a66e5c7981..cd08864288e 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H @@ -83,6 +83,14 @@ public: // 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] inline scalar rho(scalar p, scalar T) const; @@ -92,8 +100,11 @@ public: //- Return compression factor [] 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 void write(Ostream& os) const; diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H index 0a9ea8f10da..db14e98446b 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H @@ -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 * * * * * * * * * * * * * // inline void Foam::perfectGas::operator+=(const perfectGas& pg) diff --git a/src/thermophysicalModels/specie/equationOfState/incompressible/incompressible.C b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.C similarity index 79% rename from src/thermophysicalModels/specie/equationOfState/incompressible/incompressible.C rename to src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.C index eee1666d2ea..97e825ffb3e 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressible/incompressible.C +++ b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,21 +23,21 @@ License \*---------------------------------------------------------------------------*/ -#include "incompressible.H" +#include "rhoConst.H" #include "IOstreams.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::incompressible::incompressible(Istream& is) +Foam::rhoConst::rhoConst(Istream& is) : specie(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), rho_(readScalar(dict.subDict("equationOfState").lookup("rho"))) @@ -46,7 +46,7 @@ Foam::incompressible::incompressible(const dictionary& dict) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::incompressible::write(Ostream& os) const +void Foam::rhoConst::write(Ostream& os) const { specie::write(os); @@ -59,12 +59,12 @@ void Foam::incompressible::write(Ostream& os) const // * * * * * * * * * * * * * * * 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) << token::SPACE << ico.rho_; - os.check("Ostream& operator<<(Ostream& os, const incompressible& ico)"); + os.check("Ostream& operator<<(Ostream& os, const rhoConst& ico)"); return os; } diff --git a/src/thermophysicalModels/specie/equationOfState/incompressible/incompressible.H b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.H similarity index 65% rename from src/thermophysicalModels/specie/equationOfState/incompressible/incompressible.H rename to src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.H index 367407cb7a7..b1c0067f2f0 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressible/incompressible.H +++ b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,19 +22,19 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible + Foam::rhoConst Description - Incompressible gas/liquid equation of state. + RhoConst (rho = const) of state. SourceFiles - incompressibleI.H - incompressible.C + rhoConstI.H + rhoConst.C \*---------------------------------------------------------------------------*/ -#ifndef incompressible_H -#define incompressible_H +#ifndef rhoConst_H +#define rhoConst_H #include "specie.H" #include "autoPtr.H" @@ -45,10 +45,10 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class incompressible Declaration + Class rhoConst Declaration \*---------------------------------------------------------------------------*/ -class incompressible +class rhoConst : public specie { @@ -63,28 +63,36 @@ public: // Constructors //- Construct from components - inline incompressible(const specie& sp, const scalar rho); + inline rhoConst(const specie& sp, const scalar rho); //- Construct from Istream - incompressible(Istream&); + rhoConst(Istream&); //- Construct from dictionary - incompressible(const dictionary& dict); + rhoConst(const dictionary& dict); //- Construct as named copy - inline incompressible(const word& name, const incompressible&); + inline rhoConst(const word& name, const rhoConst&); //- Construct and return a clone - inline autoPtr<incompressible> clone() const; + inline autoPtr<rhoConst> clone() const; // Selector from Istream - inline static autoPtr<incompressible> New(Istream& is); + inline static autoPtr<rhoConst> New(Istream& is); // Member functions // 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] inline scalar rho(scalar p, scalar T) const; @@ -94,8 +102,11 @@ public: //- Return compression factor [] 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 void write(Ostream& os) const; @@ -103,42 +114,42 @@ public: // Member operators - inline void operator+=(const incompressible&); - inline void operator-=(const incompressible&); + inline void operator+=(const rhoConst&); + inline void operator-=(const rhoConst&); inline void operator*=(const scalar); // Friend operators - inline friend incompressible operator+ + inline friend rhoConst operator+ ( - const incompressible&, - const incompressible& + const rhoConst&, + const rhoConst& ); - inline friend incompressible operator- + inline friend rhoConst operator- ( - const incompressible&, - const incompressible& + const rhoConst&, + const rhoConst& ); - inline friend incompressible operator* + inline friend rhoConst operator* ( const scalar s, - const incompressible& + const rhoConst& ); - inline friend incompressible operator== + inline friend rhoConst operator== ( - const incompressible&, - const incompressible& + const rhoConst&, + const rhoConst& ); // 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" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/equationOfState/incompressible/incompressibleI.H b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConstI.H similarity index 66% rename from src/thermophysicalModels/specie/equationOfState/incompressible/incompressibleI.H rename to src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConstI.H index 3c747548170..79faf014d4e 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressible/incompressibleI.H +++ b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConstI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,11 +23,11 @@ License \*---------------------------------------------------------------------------*/ -#include "incompressible.H" +#include "rhoConst.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -inline Foam::incompressible::incompressible +inline Foam::rhoConst::rhoConst ( const specie& sp, const scalar rho @@ -40,42 +40,52 @@ inline Foam::incompressible::incompressible // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::incompressible::incompressible +inline Foam::rhoConst::rhoConst ( const word& name, - const incompressible& ico + const rhoConst& ico ) : specie(name, ico), 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 * * * * * * * * * * * * * // -inline Foam::scalar Foam::incompressible::rho(scalar p, scalar T) const +inline Foam::scalar Foam::rhoConst::rho(scalar p, scalar T) const { 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; +} + + +inline Foam::scalar Foam::rhoConst::Z(scalar, scalar) const { return 0.0; } -inline Foam::scalar Foam::incompressible::Z(scalar, scalar) const + +inline Foam::scalar Foam::rhoConst::cpMcv(scalar, scalar) const { return 0.0; } @@ -83,7 +93,7 @@ inline Foam::scalar Foam::incompressible::Z(scalar, scalar) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline void Foam::incompressible::operator+=(const incompressible& ico) +inline void Foam::rhoConst::operator+=(const rhoConst& ico) { scalar molr1 = this->nMoles(); @@ -95,7 +105,8 @@ inline void Foam::incompressible::operator+=(const incompressible& ico) 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(); @@ -107,7 +118,8 @@ inline void Foam::incompressible::operator-=(const incompressible& ico) 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); } @@ -115,17 +127,17 @@ inline void Foam::incompressible::operator*=(const scalar s) // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -inline Foam::incompressible Foam::operator+ +inline Foam::rhoConst Foam::operator+ ( - const incompressible& ico1, - const incompressible& ico2 + const rhoConst& ico1, + const rhoConst& ico2 ) { scalar nMoles = ico1.nMoles() + ico2.nMoles(); scalar molr1 = ico1.nMoles()/nMoles; scalar molr2 = ico2.nMoles()/nMoles; - return incompressible + return rhoConst ( static_cast<const specie&>(ico1) + 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 incompressible& ico2 + const rhoConst& ico1, + const rhoConst& ico2 ) { scalar nMoles = ico1.nMoles() + ico2.nMoles(); scalar molr1 = ico1.nMoles()/nMoles; scalar molr2 = ico2.nMoles()/nMoles; - return incompressible + return rhoConst ( static_cast<const specie&>(ico1) - 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 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 incompressible& ico2 + const rhoConst& ico1, + const rhoConst& ico2 ) { return ico2 - ico1; diff --git a/src/thermophysicalModels/specie/include/reactionTypes.H b/src/thermophysicalModels/specie/include/reactionTypes.H index 2d42804c68c..8b0a5f20d55 100644 --- a/src/thermophysicalModels/specie/include/reactionTypes.H +++ b/src/thermophysicalModels/specie/include/reactionTypes.H @@ -47,9 +47,10 @@ namespace Foam typedef Reaction<gasThermoPhysics> gasReaction; - typedef Reaction<constIsobaricGasThermoPhysics> constIsobaricGasReaction; + typedef Reaction<constIncompressibleGasThermoPhysics> + constIncompressibleGasReaction; - typedef Reaction<isobaricGasThermoPhysics> isobaricGasReaction; + typedef Reaction<incompressibleGasThermoPhysics> incompressibleGasReaction; typedef Reaction<icoPoly8ThermoPhysics> icoPoly8Reaction; } diff --git a/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H b/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H index e301be5614f..53224e8f6f5 100644 --- a/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H +++ b/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H @@ -33,7 +33,7 @@ Description #define thermoPhysicsTypes_H #include "perfectGas.H" -#include "isobaricPerfectGas.H" +#include "incompressiblePerfectGas.H" #include "hConstThermo.H" #include "janafThermo.H" #include "sensibleEnthalpy.H" @@ -82,11 +82,11 @@ namespace Foam < hConstThermo < - isobaricPerfectGas + incompressiblePerfectGas >, sensibleEnthalpy > - > constIsobaricGasThermoPhysics; + > constIncompressibleGasThermoPhysics; typedef sutherlandTransport @@ -95,11 +95,11 @@ namespace Foam < janafThermo < - isobaricPerfectGas + incompressiblePerfectGas >, sensibleEnthalpy > - > isobaricGasThermoPhysics; + > incompressibleGasThermoPhysics; typedef polynomialTransport diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C b/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C index 5d7b3de1f23..ff13e68b69a 100644 --- a/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C +++ b/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C @@ -85,8 +85,12 @@ namespace Foam { makeReactions(constGasThermoPhysics, constGasReaction) makeReactions(gasThermoPhysics, gasReaction) - makeReactions(constIsobaricGasThermoPhysics, constIsobaricGasReaction) - makeReactions(isobaricGasThermoPhysics, isobaricGasReaction) + makeReactions + ( + constIncompressibleGasThermoPhysics, + constIncompressibleGasReaction + ) + makeReactions(incompressibleGasThermoPhysics, incompressibleGasReaction) makeReactions(icoPoly8ThermoPhysics, icoPoly8Reaction) } diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index 752c6d1c1fa..b465f80497f 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H @@ -106,7 +106,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::cp const scalar T ) const { - return Cv_*this->W() + specie::RR; + return Cv_*this->W() + this->cpMcv(p, T); } diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H index 6c3960562bc..c18ea8aa27d 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H @@ -118,7 +118,7 @@ template<class Thermo, template<class> class Type> inline Foam::scalar 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 Foam::specieThermo<Thermo, Type>::gamma(const scalar p, const scalar T) const { - scalar CP = this->cp(p, T); - return CP/(CP - this->RR); + scalar cp = this->cp(p, T); + return cp/(cp - this->cpMcv(p, T)); } @@ -151,7 +151,7 @@ template<class Thermo, template<class> class Type> inline Foam::scalar 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 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); } diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties index 85ce42ca854..a70c4ca65c1 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heSolidThermo<reactingSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; +thermoType heSolidThermo<reactingSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; solidComponents ( diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion index 97cc072e8b4..5ab7e81015a 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion @@ -110,7 +110,7 @@ dictionaryReplacement // Solid thermo - thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; + thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; mixture diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties index 92f7ec50a21..cdcb5bdf499 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; +thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; mixture { diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/bottomWater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/bottomWater/thermophysicalProperties index 128f32aaf08..3bbae321136 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/bottomWater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/bottomWater/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>; +thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>; mixture { diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties index c69bb30b34d..15b8d00f3de 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; +thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; mixture { diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties index c69bb30b34d..15b8d00f3de 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; +thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; mixture { diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties index c69bb30b34d..15b8d00f3de 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; +thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; mixture { diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties index ad17f2cadcd..5008ddbcebc 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<incompressible>,sensibleEnthalpy>>>>>; +thermoType heSolidThermo<pureSolidMixture<constIsoSolidTransport<constSolidRad<specieThermo<hConstThermo<rhoConst>,sensibleEnthalpy>>>>>; mixture { -- GitLab