diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C index d84522096f..f6dd8d7d37 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C @@ -39,7 +39,7 @@ defineTemplateTypeNameAndDebugWithName defineTemplateTypeNameAndDebugWithName ( Foam::compressible::expoSolid_thermalBaffle1DFvPatchScalarField, - "compressible::thermalBaffle1D", + "compressible::thermalBaffle1D", 0 ); diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H index 8a3187abcd..80de9ac98e 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H @@ -45,7 +45,7 @@ namespace compressible typedef thermalBaffle1DFvPatchScalarField < - hExponentialSolidThermoPhysics + hPowerSolidThermoPhysics >expoSolid_thermalBaffle1DFvPatchScalarField; diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C index 7b0561ee7b..fd48f12692 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,11 +79,11 @@ makeChemistryReaderType(foamChemistryReader, icoPoly8EThermoPhysics); // Solid chemistry readers for solids based on sensibleInternalEnergy makeChemistryReader(hConstSolidThermoPhysics); -makeChemistryReader(hExponentialSolidThermoPhysics); +makeChemistryReader(hPowerSolidThermoPhysics); makeChemistryReader(hExpKappaConstSolidThermoPhysics); makeChemistryReaderType(foamChemistryReader, hConstSolidThermoPhysics); -makeChemistryReaderType(foamChemistryReader, hExponentialSolidThermoPhysics); +makeChemistryReaderType(foamChemistryReader, hPowerSolidThermoPhysics); makeChemistryReaderType(foamChemistryReader, hExpKappaConstSolidThermoPhysics); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C index b8f99a9118..01360b7b44 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C @@ -54,7 +54,7 @@ makeSolidChemistryModel solidChemistryModel, pyrolysisChemistryModel, basicSolidChemistryModel, - hExponentialSolidThermoPhysics, + hPowerSolidThermoPhysics, gasHThermoPhysics ); diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C index 7d0f5d255d..4f669f024f 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ namespace Foam ( pyrolysisChemistryModel, basicSolidChemistryModel, - hExponentialSolidThermoPhysics, + hPowerSolidThermoPhysics, gasHThermoPhysics ) diff --git a/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H b/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H index 968898479a..ff6e26e76b 100644 --- a/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H +++ b/src/thermophysicalModels/solidSpecie/include/solidThermoPhysicsTypes.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ Description #include "rhoConst.H" #include "hConstThermo.H" #include "hPolynomialThermo.H" -#include "hExponentialThermo.H" +#include "hPowerThermo.H" #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" #include "exponentialSolidTransport.H" @@ -68,13 +68,13 @@ namespace Foam < species::thermo < - hExponentialThermo + hPowerThermo < rhoConst >, sensibleEnthalpy > - > hExponentialSolidThermoPhysics; + > hPowerSolidThermoPhysics; typedef polynomialSolidTransport @@ -96,7 +96,7 @@ namespace Foam < species::thermo < - hExponentialThermo + hPowerThermo < rhoConst >, diff --git a/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C b/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C index 3241eb9ed8..7213675111 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C +++ b/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ makeSolidIRReactions(hConstSolidThermoPhysics, solidArrheniusReactionRate) makeSolidIRReactions ( - hExponentialSolidThermoPhysics, + hPowerSolidThermoPhysics, solidArrheniusReactionRate ) diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C index f8fde90475..ca559a505a 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,7 @@ License #include "specie.H" #include "rhoConst.H" #include "hConstThermo.H" -#include "hExponentialThermo.H" +#include "hPowerThermo.H" #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" #include "exponentialSolidTransport.H" @@ -69,7 +69,7 @@ makeReactingSolidThermo reactingMixture, constIsoSolidTransport, sensibleEnthalpy, - hExponentialThermo, + hPowerThermo, rhoConst, specie ); diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C index 020dbfda92..ea8f5fd099 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,7 @@ License #include "specie.H" #include "rhoConst.H" #include "hConstThermo.H" -#include "hExponentialThermo.H" +#include "hPowerThermo.H" #include "hPolynomialThermo.H" #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" @@ -81,7 +81,7 @@ makeSolidThermo pureMixture, exponentialSolidTransport, sensibleEnthalpy, - hExponentialThermo, + hPowerThermo, rhoConst, specie ); diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H index 568b35a3c5..8a24f6e104 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.H @@ -168,6 +168,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H index 6961954208..6e5f131ab0 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H @@ -116,6 +116,19 @@ inline Foam::scalar Foam::PengRobinsonGas::rho } +template +inline Foam::scalar Foam::PengRobinsonGas::s +( + scalar p, + scalar T +) const +{ + //***HGW This is the expression for a perfect gas + // Need to add the entropy defect for Peng-Robinson + return -RR*log(p/Pstd); +} + + template inline Foam::scalar Foam::PengRobinsonGas::psi ( diff --git a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H index 6ebd728fa8..3b391410ce 100644 --- a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H +++ b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -167,6 +167,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H index 4521e71946..e92266ed16 100644 --- a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H +++ b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,18 +104,32 @@ template inline Foam::scalar Foam::adiabaticPerfectFluid::rho ( scalar p, - scalar + scalar T ) const { return rho0_*pow((p + B_)/(p0_ + B_), 1.0/gamma_); } +template +inline Foam::scalar Foam::adiabaticPerfectFluid::s +( + scalar p, + scalar T +) const +{ + scalar n = 1 - 1.0/gamma_; + return + -pow(p0_ + B_, 1.0/gamma_)*(pow((p + B_), n) - pow((Pstd + B_), n)) + /(rho0_*T*n); +} + + template inline Foam::scalar Foam::adiabaticPerfectFluid::psi ( scalar p, - scalar + scalar T ) const { return @@ -127,15 +141,15 @@ inline Foam::scalar Foam::adiabaticPerfectFluid::psi template inline Foam::scalar Foam::adiabaticPerfectFluid::Z(scalar, scalar) const { - return 1.0; + return 1; } template inline Foam::scalar Foam::adiabaticPerfectFluid::cpMcv ( - scalar, - scalar + scalar p, + scalar T ) const { return 0; diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H index 0665f89e80..e2dde3e35a 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -155,6 +155,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H index dbe3772ec0..2d30033b46 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,7 +102,7 @@ Foam::icoPolynomial::New(const dictionary& dict) template inline Foam::scalar Foam::icoPolynomial::rho ( - scalar, + scalar p, scalar T ) const { @@ -111,24 +111,35 @@ inline Foam::scalar Foam::icoPolynomial::rho template -inline Foam::scalar Foam::icoPolynomial::psi +inline Foam::scalar Foam::icoPolynomial::s ( - scalar, - scalar + scalar p, + scalar T ) const { - return 0.0; + return 0; +} + + +template +inline Foam::scalar Foam::icoPolynomial::psi +( + scalar p, + scalar T +) const +{ + return 0; } template inline Foam::scalar Foam::icoPolynomial::Z ( - scalar, - scalar + scalar p, + scalar T ) const { - return 0.0; + return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H index a3f21ef797..0beacf03e5 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -158,6 +158,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H index fa1505700b..e08b1d9208 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H @@ -115,39 +115,49 @@ inline Foam::scalar Foam::incompressiblePerfectGas::rho template -inline Foam::scalar Foam::incompressiblePerfectGas::psi +inline Foam::scalar Foam::incompressiblePerfectGas::s ( - scalar, + scalar p, scalar T ) const { - return 0.0; + return 0; +} + + +template +inline Foam::scalar Foam::incompressiblePerfectGas::psi +( + scalar p, + scalar T +) const +{ + return 0; } template inline Foam::scalar Foam::incompressiblePerfectGas::Z ( - scalar, - scalar + scalar p, + scalar T ) const { - return 0.0; + return 0; } template inline Foam::scalar Foam::incompressiblePerfectGas::cpMcv ( - scalar, - scalar + scalar p, + scalar T ) const { return RR; } - // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/equationOfState/linear/linear.H b/src/thermophysicalModels/specie/equationOfState/linear/linear.H index 82d9485653..acdbda0134 100644 --- a/src/thermophysicalModels/specie/equationOfState/linear/linear.H +++ b/src/thermophysicalModels/specie/equationOfState/linear/linear.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -156,6 +156,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/linear/linearI.H b/src/thermophysicalModels/specie/equationOfState/linear/linearI.H index ea05aa6333..3972e0e25b 100644 --- a/src/thermophysicalModels/specie/equationOfState/linear/linearI.H +++ b/src/thermophysicalModels/specie/equationOfState/linear/linearI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,21 +93,28 @@ inline Foam::scalar Foam::linear::rho(scalar p, scalar T) const template -inline Foam::scalar Foam::linear::psi(scalar, scalar T) const +inline Foam::scalar Foam::linear::s(scalar p, scalar T) const +{ + return -log((rho0_ + psi_*p)/(rho0_ + psi_*Pstd))/(T*psi_); +} + + +template +inline Foam::scalar Foam::linear::psi(scalar p, scalar T) const { return psi_; } template -inline Foam::scalar Foam::linear::Z(scalar, scalar) const +inline Foam::scalar Foam::linear::Z(scalar p, scalar T) const { - return 1.0; + return 1; } template -inline Foam::scalar Foam::linear::cpMcv(scalar, scalar) const +inline Foam::scalar Foam::linear::cpMcv(scalar p, scalar T) const { return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H index 9229fd34a4..fcd1b373f3 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -155,6 +155,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H index c21d6885f9..1de935d350 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,21 +100,28 @@ inline Foam::scalar Foam::perfectFluid::rho(scalar p, scalar T) const template -inline Foam::scalar Foam::perfectFluid::psi(scalar, scalar T) const +inline Foam::scalar Foam::perfectFluid::s(scalar p, scalar T) const +{ + return -RR*log(p/Pstd); +} + + +template +inline Foam::scalar Foam::perfectFluid::psi(scalar p, scalar T) const { return 1.0/(this->R()*T); } template -inline Foam::scalar Foam::perfectFluid::Z(scalar, scalar) const +inline Foam::scalar Foam::perfectFluid::Z(scalar p, scalar T) const { - return 1.0; + return 1; } template -inline Foam::scalar Foam::perfectFluid::cpMcv(scalar, scalar) const +inline Foam::scalar Foam::perfectFluid::cpMcv(scalar p, scalar T) const { return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H index c2421db5d8..986eecce70 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -139,6 +139,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H index e03bbb7973..fde836224e 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H @@ -83,21 +83,28 @@ inline Foam::scalar Foam::perfectGas::rho(scalar p, scalar T) const template -inline Foam::scalar Foam::perfectGas::psi(scalar, scalar T) const +inline Foam::scalar Foam::perfectGas::s(scalar p, scalar T) const +{ + return -RR*log(p/Pstd); +} + + +template +inline Foam::scalar Foam::perfectGas::psi(scalar p, scalar T) const { return 1.0/(this->R()*T); } template -inline Foam::scalar Foam::perfectGas::Z(scalar, scalar) const +inline Foam::scalar Foam::perfectGas::Z(scalar p, scalar T) const { - return 1.0; + return 1; } template -inline Foam::scalar Foam::perfectGas::cpMcv(scalar, scalar) const +inline Foam::scalar Foam::perfectGas::cpMcv(scalar p, scalar T) const { return RR; } diff --git a/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.H b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.H index ac7d62b891..98f2547123 100644 --- a/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConst.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) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -141,6 +141,9 @@ public: //- Return density [kg/m^3] inline scalar rho(scalar p, scalar T) const; + //- Return entropy [J/(kmol K)] + inline scalar s(const scalar p, const scalar T) const; + //- Return compressibility rho/p [s^2/m^2] inline scalar psi(scalar p, scalar T) const; diff --git a/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConstI.H b/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConstI.H index a3898a4d69..7f415e9b3c 100644 --- a/src/thermophysicalModels/specie/equationOfState/rhoConst/rhoConstI.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) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,23 +79,30 @@ inline Foam::scalar Foam::rhoConst::rho(scalar p, scalar T) const template -inline Foam::scalar Foam::rhoConst::psi(scalar, scalar T) const +inline Foam::scalar Foam::rhoConst::s(scalar p, scalar T) const { - return 0.0; + return 0; } template -inline Foam::scalar Foam::rhoConst::Z(scalar, scalar) const +inline Foam::scalar Foam::rhoConst::psi(scalar p, scalar T) const { - return 0.0; + return 0; } template -inline Foam::scalar Foam::rhoConst::cpMcv(scalar, scalar) const +inline Foam::scalar Foam::rhoConst::Z(scalar p, scalar T) const { - return 0.0; + return 0; +} + + +template +inline Foam::scalar Foam::rhoConst::cpMcv(scalar p, scalar T) const +{ + return 0; } diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index 687ebae355..87a7e80cb9 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,12 +146,7 @@ inline Foam::scalar Foam::eConstThermo::s const scalar T ) const { - notImplemented - ( - "scalar eConstThermo::" - "s(const scalar p, const scalar) const" - ); - return T; + return cp()*log(T/Tstd) + EquationOfState::s(p, T); } diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C index b117f82bc7..e4c60c18d6 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,10 +28,10 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::hConstThermo::hConstThermo(Istream& is) +template +Foam::hConstThermo::hConstThermo(Istream& is) : - equationOfState(is), + EquationOfState(is), Cp_(readScalar(is)), Hf_(readScalar(is)) { @@ -42,10 +42,10 @@ Foam::hConstThermo::hConstThermo(Istream& is) } -template -Foam::hConstThermo::hConstThermo(const dictionary& dict) +template +Foam::hConstThermo::hConstThermo(const dictionary& dict) : - equationOfState(dict), + EquationOfState(dict), Cp_(readScalar(dict.subDict("thermodynamics").lookup("Cp"))), Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf"))) { @@ -56,10 +56,10 @@ Foam::hConstThermo::hConstThermo(const dictionary& dict) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::hConstThermo::write(Ostream& os) const +template +void Foam::hConstThermo::write(Ostream& os) const { - equationOfState::write(os); + EquationOfState::write(os); dictionary dict("thermodynamics"); dict.add("Cp", Cp_/this->W()); @@ -70,14 +70,14 @@ void Foam::hConstThermo::write(Ostream& os) const // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -template +template Foam::Ostream& Foam::operator<< ( Ostream& os, - const hConstThermo& ct + const hConstThermo& ct ) { - os << static_cast(ct) << tab + os << static_cast(ct) << tab << ct.Cp_/ct.W() << tab << ct.Hf_/ct.W(); os.check("Ostream& operator<<(Ostream& os, const hConstThermo& ct)"); diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H index f3bf052209..ef33aeaf4c 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Class Description Constant properties thermodynamics package - templated into the equationOfState. + templated into the EquationOfState. SourceFiles hConstThermoI.H diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H index 3fda6268c3..bb272ce9c6 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,15 +25,15 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -inline Foam::hConstThermo::hConstThermo +template +inline Foam::hConstThermo::hConstThermo ( - const equationOfState& st, + const EquationOfState& st, const scalar cp, const scalar hf ) : - equationOfState(st), + EquationOfState(st), Cp_(cp), Hf_(hf) {} @@ -41,48 +41,48 @@ inline Foam::hConstThermo::hConstThermo // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -inline Foam::hConstThermo::hConstThermo +template +inline Foam::hConstThermo::hConstThermo ( const word& name, const hConstThermo& ct ) : - equationOfState(name, ct), + EquationOfState(name, ct), Cp_(ct.Cp_), Hf_(ct.Hf_) {} -template -inline Foam::autoPtr > -Foam::hConstThermo::clone() const +template +inline Foam::autoPtr > +Foam::hConstThermo::clone() const { - return autoPtr > + return autoPtr > ( - new hConstThermo(*this) + new hConstThermo(*this) ); } -template -inline Foam::autoPtr > -Foam::hConstThermo::New(Istream& is) +template +inline Foam::autoPtr > +Foam::hConstThermo::New(Istream& is) { - return autoPtr > + return autoPtr > ( - new hConstThermo(is) + new hConstThermo(is) ); } -template -inline Foam::autoPtr > -Foam::hConstThermo::New(const dictionary& dict) +template +inline Foam::autoPtr > +Foam::hConstThermo::New(const dictionary& dict) { - return autoPtr > + return autoPtr > ( - new hConstThermo(dict) + new hConstThermo(dict) ); } @@ -99,8 +99,8 @@ inline Foam::scalar Foam::hConstThermo::limit } -template -inline Foam::scalar Foam::hConstThermo::cp +template +inline Foam::scalar Foam::hConstThermo::cp ( const scalar p, const scalar T @@ -110,8 +110,8 @@ inline Foam::scalar Foam::hConstThermo::cp } -template -inline Foam::scalar Foam::hConstThermo::ha +template +inline Foam::scalar Foam::hConstThermo::ha ( const scalar p, const scalar T ) const @@ -120,8 +120,8 @@ inline Foam::scalar Foam::hConstThermo::ha } -template -inline Foam::scalar Foam::hConstThermo::hs +template +inline Foam::scalar Foam::hConstThermo::hs ( const scalar p, const scalar T ) const @@ -130,39 +130,34 @@ inline Foam::scalar Foam::hConstThermo::hs } -template -inline Foam::scalar Foam::hConstThermo::hc() const +template +inline Foam::scalar Foam::hConstThermo::hc() const { return Hf_; } -template -inline Foam::scalar Foam::hConstThermo::s +template +inline Foam::scalar Foam::hConstThermo::s ( const scalar p, const scalar T ) const { - notImplemented - ( - "scalar hConstThermo::" - "s(const scalar p, const scalar T) const" - ); - return T; + return Cp_*log(T/Tstd) + EquationOfState::s(p, T); } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::hConstThermo::operator+= +template +inline void Foam::hConstThermo::operator+= ( - const hConstThermo& ct + const hConstThermo& ct ) { scalar molr1 = this->nMoles(); - equationOfState::operator+=(ct); + EquationOfState::operator+=(ct); molr1 /= this->nMoles(); scalar molr2 = ct.nMoles()/this->nMoles(); @@ -172,15 +167,15 @@ inline void Foam::hConstThermo::operator+= } -template -inline void Foam::hConstThermo::operator-= +template +inline void Foam::hConstThermo::operator-= ( - const hConstThermo& ct + const hConstThermo& ct ) { scalar molr1 = this->nMoles(); - equationOfState::operator-=(ct); + EquationOfState::operator-=(ct); molr1 /= this->nMoles(); scalar molr2 = ct.nMoles()/this->nMoles(); @@ -192,20 +187,20 @@ inline void Foam::hConstThermo::operator-= // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -template -inline Foam::hConstThermo Foam::operator+ +template +inline Foam::hConstThermo Foam::operator+ ( - const hConstThermo& ct1, - const hConstThermo& ct2 + const hConstThermo& ct1, + const hConstThermo& ct2 ) { - equationOfState eofs + EquationOfState eofs ( - static_cast(ct1) - + static_cast(ct2) + static_cast(ct1) + + static_cast(ct2) ); - return hConstThermo + return hConstThermo ( eofs, ct1.nMoles()/eofs.nMoles()*ct1.Cp_ @@ -216,20 +211,20 @@ inline Foam::hConstThermo Foam::operator+ } -template -inline Foam::hConstThermo Foam::operator- +template +inline Foam::hConstThermo Foam::operator- ( - const hConstThermo& ct1, - const hConstThermo& ct2 + const hConstThermo& ct1, + const hConstThermo& ct2 ) { - equationOfState eofs + EquationOfState eofs ( - static_cast(ct1) - - static_cast(ct2) + static_cast(ct1) + - static_cast(ct2) ); - return hConstThermo + return hConstThermo ( eofs, ct1.nMoles()/eofs.nMoles()*ct1.Cp_ @@ -240,27 +235,27 @@ inline Foam::hConstThermo Foam::operator- } -template -inline Foam::hConstThermo Foam::operator* +template +inline Foam::hConstThermo Foam::operator* ( const scalar s, - const hConstThermo& ct + const hConstThermo& ct ) { - return hConstThermo + return hConstThermo ( - s*static_cast(ct), + s*static_cast(ct), ct.Cp_, ct.Hf_ ); } -template -inline Foam::hConstThermo Foam::operator== +template +inline Foam::hConstThermo Foam::operator== ( - const hConstThermo& ct1, - const hConstThermo& ct2 + const hConstThermo& ct1, + const hConstThermo& ct2 ) { return ct2 - ct1; diff --git a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H b/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H deleted file mode 100644 index b46543a400..0000000000 --- a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H +++ /dev/null @@ -1,328 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "hExponentialThermo.H" -#include "specie.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -inline void Foam::hExponentialThermo::checkT -( - const scalar T -) const -{ - if (T < 0.0) - { - FatalErrorIn - ( - "hExponentialThermo::checkT(const scalar T) const" - ) << "attempt to use hExponentialThermo" - " out of temperature range " - << T - << abort(FatalError); - } -} - - -template -inline Foam::scalar Foam::hExponentialThermo::integrateCp -( - const scalar T -) const -{ - return - ( - c0_*pow(T, n0_ + 1.0)/(pow(Tref_, n0_)*(n0_ + 1.0)) - ); -} - - -template -inline Foam::hExponentialThermo::hExponentialThermo -( - const word& name, - const hExponentialThermo& jt -) -: - equationOfState(name, jt), - c0_(jt.c0_), - n0_(jt.n0_), - Tref_(jt.Tref_), - Hf_(jt.Hf_) -{} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -inline Foam::hExponentialThermo::hExponentialThermo -( - const equationOfState& st, - const scalar c0, - const scalar n0, - const scalar Tref, - const scalar Hf -) -: - equationOfState(st), - c0_(c0), - n0_(n0), - Tref_(Tref), - Hf_(Hf) -{} - - -template -inline Foam::autoPtr > -Foam::hExponentialThermo::clone() const -{ - return autoPtr > - ( - new hExponentialThermo(*this) - ); -} - - -template -inline Foam::autoPtr > -Foam::hExponentialThermo::New(Istream& is) -{ - return autoPtr > - ( - new hExponentialThermo(is) - ); -} - - -template -inline Foam::autoPtr > -Foam::hExponentialThermo::New(const dictionary& dict) -{ - return autoPtr > - ( - new hExponentialThermo(dict) - ); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -inline Foam::scalar Foam::hExponentialThermo::limit -( - const scalar T -) const -{ - return T; -} - - -template -inline Foam::scalar Foam::hExponentialThermo::cp -( - const scalar p, const scalar T -) const -{ - return c0_*pow(T/Tref_, n0_); -} - - -template -inline Foam::scalar Foam::hExponentialThermo::ha -( - const scalar p, const scalar T -) const -{ - scalar hOffset = integrateCp(Tstd); - - return - ( - (integrateCp(T) + Hf_ - hOffset) - ); -} - - -template -inline Foam::scalar Foam::hExponentialThermo::hs -( - const scalar p, const scalar T -) const -{ - scalar hOffset = integrateCp(Tstd); - return (integrateCp(T) - hOffset); -} - - -template -inline Foam::scalar Foam::hExponentialThermo::hc() const -{ - return Hf_; -} - - -template -inline Foam::scalar Foam::hExponentialThermo::s -( - const scalar p, const scalar T -) const -{ - notImplemented - ( - "scalar hExponentialThermo::" - "s(const scalar p, const scalar T) const" - ); - return T; -} - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template -inline void Foam::hExponentialThermo::operator+= -( - const hExponentialThermo& ct -) -{ - scalar molr1 = this->nMoles(); - - equationOfState::operator+=(ct); - molr1 /= this->nMoles(); - scalar molr2 = ct.nMoles()/this->nMoles(); - - Hf_ = molr1*Hf_ + molr2*ct.Hf_; - c0_ = molr1*c0_ + molr2*ct.c0_; - n0_ = molr1*n0_ + molr2*ct.n0_; - Tref_ = molr1*Tref_ + molr2*ct.Tref_; -} - - -template -inline void Foam::hExponentialThermo::operator-= -( - const hExponentialThermo& ct -) -{ - scalar molr1 = this->nMoles(); - - equationOfState::operator-=(ct); - - molr1 /= this->nMoles(); - scalar molr2 = ct.nMoles()/this->nMoles(); - - Hf_ = molr1*Hf_ - molr2*ct.Hf_; - c0_ = (molr1*c0_ - molr2*ct.c0_); - n0_ = (molr1*n0_ - molr2*ct.n0_); - Tref_ = (molr1*Tref_ - molr2*ct.Tref_); -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -template -inline Foam::hExponentialThermo Foam::operator+ -( - const hExponentialThermo& ct1, - const hExponentialThermo& ct2 -) -{ - equationOfState eofs - ( - static_cast(ct1) - + static_cast(ct2) - ); - - return hExponentialThermo - ( - eofs, - ct1.nMoles()/eofs.nMoles()*ct1.c0_ - + ct2.nMoles()/eofs.nMoles()*ct2.c0_, - ct1.nMoles()/eofs.nMoles()*ct1.n0_ - + ct2.nMoles()/eofs.nMoles()*ct2.n0_, - ct1.nMoles()/eofs.nMoles()*ct1.Tref_ - + ct2.nMoles()/eofs.nMoles()*ct2.Tref_, - ct1.nMoles()/eofs.nMoles()*ct1.Hf_ - + ct2.nMoles()/eofs.nMoles()*ct2.Hf_ - ); -} - - -template -inline Foam::hExponentialThermo Foam::operator- -( - const hExponentialThermo& ct1, - const hExponentialThermo& ct2 -) -{ - equationOfState eofs - ( - static_cast(ct1) - + static_cast(ct2) - ); - - return hExponentialThermo - ( - eofs, - ct1.nMoles()/eofs.nMoles()*ct1.c0_ - - ct2.nMoles()/eofs.nMoles()*ct2.c0_, - ct1.nMoles()/eofs.nMoles()*ct1.n0_ - - ct2.nMoles()/eofs.nMoles()*ct2.n0_, - ct1.nMoles()/eofs.nMoles()*ct1.Tref_ - - ct2.nMoles()/eofs.nMoles()*ct2.Tref_, - ct1.nMoles()/eofs.nMoles()*ct1.Hf_ - - ct2.nMoles()/eofs.nMoles()*ct2.Hf_ - ); -} - - -template -inline Foam::hExponentialThermo Foam::operator* -( - const scalar s, - const hExponentialThermo& ct -) -{ - return hExponentialThermo - ( - s*static_cast(ct), - ct.c0_, - ct.n0_, - ct.Tref_, - ct.Hf_ - ); -} - - -template -inline Foam::hExponentialThermo Foam::operator== -( - const hExponentialThermo& ct1, - const hExponentialThermo& ct2 -) -{ - return ct2 - ct1; -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H index e06d563607..47b02e3cc7 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,7 +137,7 @@ inline Foam::scalar Foam::hPolynomialThermo::s const scalar T ) const { - return sCoeffs_.value(T); + return sCoeffs_.value(T) + EquationOfState::s(p, T); } diff --git a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermo.C b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.C similarity index 76% rename from src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermo.C rename to src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.C index 562ae0d63d..4ab71b4e65 100644 --- a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,33 +23,33 @@ License \*---------------------------------------------------------------------------*/ -#include "hExponentialThermo.H" +#include "hPowerThermo.H" #include "IOstreams.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::hExponentialThermo::hExponentialThermo(Istream& is) +template +Foam::hPowerThermo::hPowerThermo(Istream& is) : - equationOfState(is), + EquationOfState(is), n0_(readScalar(is)), Tref_(readScalar(is)), Hf_(readScalar(is)) { - is.check("hExponentialThermo::hExponentialThermo(Istream& is)"); + is.check("hPowerThermo::hPowerThermo(Istream& is)"); c0_ *= this->W(); Hf_ *= this->W(); } -template -Foam::hExponentialThermo::hExponentialThermo +template +Foam::hPowerThermo::hPowerThermo ( const dictionary& dict ) : - equationOfState(dict), + EquationOfState(dict), c0_(readScalar(dict.subDict("thermodynamics").lookup("C0"))), n0_(readScalar(dict.subDict("thermodynamics").lookup("n0"))), Tref_(readScalar(dict.subDict("thermodynamics").lookup("Tref"))), @@ -62,14 +62,14 @@ Foam::hExponentialThermo::hExponentialThermo // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -template +template Foam::Ostream& Foam::operator<< ( Ostream& os, - const hExponentialThermo& et + const hPowerThermo& et ) { - os << static_cast(et) << nl + os << static_cast(et) << nl << " " << et.c0_ << tab << et.n0_ << tab << et.Tref_ @@ -81,7 +81,7 @@ Foam::Ostream& Foam::operator<< os.check ( - "operator<<(Ostream& os, const hExponentialThermo& et)" + "operator<<(Ostream& os, const hPowerThermo& et)" ); return os; diff --git a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermo.H b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H similarity index 63% rename from src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermo.H rename to src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H index b9fd88b232..8285262765 100644 --- a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H @@ -22,59 +22,65 @@ License along with OpenFOAM. If not, see . Class - Foam::hExponentialThermo + Foam::hPowerThermo Description - Exponential properties thermodynamics package - templated into the equationOfState. + Power-function based thermodynamics package templated on EquationOfState. + + In this thermodynamics package the heat capacity is a simple power of + temperature: + + Cp(T) = c0*(T/Tref)^n0; + + which is particularly suitable for solids. SourceFiles - hExponentialThermoI.H - hExponentialThermo.C + hPowerThermoI.H + hPowerThermo.C \*---------------------------------------------------------------------------*/ -#ifndef hExponentialThermo_H -#define hExponentialThermo_H +#ifndef hPowerThermo_H +#define hPowerThermo_H #include "scalar.H" -#include "dictionary.H" -#include "specie.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -template class hExponentialThermo; +// Forward declaration of friend functions and operators + +template class hPowerThermo; template -inline hExponentialThermo operator+ +inline hPowerThermo operator+ ( - const hExponentialThermo&, - const hExponentialThermo& + const hPowerThermo&, + const hPowerThermo& ); template -inline hExponentialThermo operator- +inline hPowerThermo operator- ( - const hExponentialThermo&, - const hExponentialThermo& + const hPowerThermo&, + const hPowerThermo& ); template -inline hExponentialThermo operator* +inline hPowerThermo operator* ( const scalar, - const hExponentialThermo& + const hPowerThermo& ); template -inline hExponentialThermo operator== +inline hPowerThermo operator== ( - const hExponentialThermo&, - const hExponentialThermo& + const hPowerThermo&, + const hPowerThermo& ); @@ -82,20 +88,19 @@ template Ostream& operator<< ( Ostream&, - const hExponentialThermo& + const hPowerThermo& ); /*---------------------------------------------------------------------------*\ - Class hExponentialThermo Declaration + Class hPowerThermo Declaration \*---------------------------------------------------------------------------*/ template -class hExponentialThermo +class hPowerThermo : public EquationOfState { - // Private data scalar c0_; @@ -109,11 +114,8 @@ class hExponentialThermo //- Check given temperature is within the range of the fitted coeffs inline void checkT(const scalar T) const; - //- Integrate Cp expression - inline scalar integrateCp(const scalar T) const; - //- Construct from components - inline hExponentialThermo + inline hPowerThermo ( const EquationOfState& st, const scalar c0, @@ -122,31 +124,32 @@ class hExponentialThermo const scalar Hf ); + public: // Constructors //- Construct from Istream - hExponentialThermo(Istream&); + hPowerThermo(Istream&); //- Construct from dictionary - hExponentialThermo(const dictionary&); + hPowerThermo(const dictionary&); //- Construct as a named copy - inline hExponentialThermo + inline hPowerThermo ( const word&, - const hExponentialThermo& + const hPowerThermo& ); //- Construct and return a clone - inline autoPtr clone() const; + inline autoPtr clone() const; //- Selector from Istream - inline static autoPtr New(Istream& is); + inline static autoPtr New(Istream& is); //- Selector from dictionary - inline static autoPtr New(const dictionary& dict); + inline static autoPtr New(const dictionary& dict); // Member Functions @@ -154,7 +157,7 @@ public: //- Return the instantiated type name static word typeName() { - return "hExponential<" + EquationOfState::typeName() + '>'; + return "hPower<" + EquationOfState::typeName() + '>'; } //- Limit the temperature to be in the range Tlow_ to Thigh_ @@ -181,35 +184,35 @@ public: // Member operators - inline void operator+=(const hExponentialThermo&); - inline void operator-=(const hExponentialThermo&); + inline void operator+=(const hPowerThermo&); + inline void operator-=(const hPowerThermo&); // Friend operators - friend hExponentialThermo operator+ + friend hPowerThermo operator+ ( - const hExponentialThermo&, - const hExponentialThermo& + const hPowerThermo&, + const hPowerThermo& ); - friend hExponentialThermo operator- + friend hPowerThermo operator- ( - const hExponentialThermo&, - const hExponentialThermo& + const hPowerThermo&, + const hPowerThermo& ); - friend hExponentialThermo operator* + friend hPowerThermo operator* ( const scalar, - const hExponentialThermo& + const hPowerThermo& ); - friend hExponentialThermo operator== + friend hPowerThermo operator== ( - const hExponentialThermo&, - const hExponentialThermo& + const hPowerThermo&, + const hPowerThermo& ); @@ -218,7 +221,7 @@ public: friend Ostream& operator<< ( Ostream&, - const hExponentialThermo& + const hPowerThermo& ); }; @@ -229,10 +232,9 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #ifdef NoRepository -# include "hExponentialThermoI.H" -# include "hExponentialThermo.C" +# include "hPowerThermoI.H" +# include "hPowerThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H new file mode 100644 index 0000000000..371394fd14 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H @@ -0,0 +1,307 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "hPowerThermo.H" +#include "specie.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline void Foam::hPowerThermo::checkT +( + const scalar T +) const +{ + if (T < 0) + { + FatalErrorIn + ( + "hPowerThermo::checkT(const scalar T) const" + ) << "attempt to evaluate hPowerThermo" + " for negative temperature " << T + << abort(FatalError); + } +} + + +template +inline Foam::hPowerThermo::hPowerThermo +( + const word& name, + const hPowerThermo& jt +) +: + EquationOfState(name, jt), + c0_(jt.c0_), + n0_(jt.n0_), + Tref_(jt.Tref_), + Hf_(jt.Hf_) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::hPowerThermo::hPowerThermo +( + const EquationOfState& st, + const scalar c0, + const scalar n0, + const scalar Tref, + const scalar Hf +) +: + EquationOfState(st), + c0_(c0), + n0_(n0), + Tref_(Tref), + Hf_(Hf) +{} + + +template +inline Foam::autoPtr > +Foam::hPowerThermo::clone() const +{ + return autoPtr > + ( + new hPowerThermo(*this) + ); +} + + +template +inline Foam::autoPtr > +Foam::hPowerThermo::New(Istream& is) +{ + return autoPtr > + ( + new hPowerThermo(is) + ); +} + + +template +inline Foam::autoPtr > +Foam::hPowerThermo::New(const dictionary& dict) +{ + return autoPtr > + ( + new hPowerThermo(dict) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::hPowerThermo::limit +( + const scalar T +) const +{ + return T; +} + + +template +inline Foam::scalar Foam::hPowerThermo::cp +( + const scalar p, const scalar T +) const +{ + return c0_*pow(T/Tref_, n0_); +} + + +template +inline Foam::scalar Foam::hPowerThermo::ha +( + const scalar p, const scalar T +) const +{ + return hs(p, T) + hc(); +} + + +template +inline Foam::scalar Foam::hPowerThermo::hs +( + const scalar p, const scalar T +) const +{ + return + c0_*(pow(T, n0_ + 1) - pow(Tstd, n0_ + 1))/(pow(Tref_, n0_)*(n0_ + 1)); +} + + +template +inline Foam::scalar Foam::hPowerThermo::hc() const +{ + return Hf_; +} + + +template +inline Foam::scalar Foam::hPowerThermo::s +( + const scalar p, const scalar T +) const +{ + return + c0_*(pow(T, n0_) - pow(Tstd, n0_))/(pow(Tref_, n0_)*n0_) + + EquationOfState::s(p, T); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +inline void Foam::hPowerThermo::operator+= +( + const hPowerThermo& ct +) +{ + scalar molr1 = this->nMoles(); + + EquationOfState::operator+=(ct); + molr1 /= this->nMoles(); + scalar molr2 = ct.nMoles()/this->nMoles(); + + Hf_ = molr1*Hf_ + molr2*ct.Hf_; + c0_ = molr1*c0_ + molr2*ct.c0_; + n0_ = molr1*n0_ + molr2*ct.n0_; + Tref_ = molr1*Tref_ + molr2*ct.Tref_; +} + + +template +inline void Foam::hPowerThermo::operator-= +( + const hPowerThermo& ct +) +{ + scalar molr1 = this->nMoles(); + + EquationOfState::operator-=(ct); + + molr1 /= this->nMoles(); + scalar molr2 = ct.nMoles()/this->nMoles(); + + Hf_ = molr1*Hf_ - molr2*ct.Hf_; + c0_ = (molr1*c0_ - molr2*ct.c0_); + n0_ = (molr1*n0_ - molr2*ct.n0_); + Tref_ = (molr1*Tref_ - molr2*ct.Tref_); +} + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +template +inline Foam::hPowerThermo Foam::operator+ +( + const hPowerThermo& ct1, + const hPowerThermo& ct2 +) +{ + EquationOfState eofs + ( + static_cast(ct1) + + static_cast(ct2) + ); + + return hPowerThermo + ( + eofs, + ct1.nMoles()/eofs.nMoles()*ct1.c0_ + + ct2.nMoles()/eofs.nMoles()*ct2.c0_, + ct1.nMoles()/eofs.nMoles()*ct1.n0_ + + ct2.nMoles()/eofs.nMoles()*ct2.n0_, + ct1.nMoles()/eofs.nMoles()*ct1.Tref_ + + ct2.nMoles()/eofs.nMoles()*ct2.Tref_, + ct1.nMoles()/eofs.nMoles()*ct1.Hf_ + + ct2.nMoles()/eofs.nMoles()*ct2.Hf_ + ); +} + + +template +inline Foam::hPowerThermo Foam::operator- +( + const hPowerThermo& ct1, + const hPowerThermo& ct2 +) +{ + EquationOfState eofs + ( + static_cast(ct1) + + static_cast(ct2) + ); + + return hPowerThermo + ( + eofs, + ct1.nMoles()/eofs.nMoles()*ct1.c0_ + - ct2.nMoles()/eofs.nMoles()*ct2.c0_, + ct1.nMoles()/eofs.nMoles()*ct1.n0_ + - ct2.nMoles()/eofs.nMoles()*ct2.n0_, + ct1.nMoles()/eofs.nMoles()*ct1.Tref_ + - ct2.nMoles()/eofs.nMoles()*ct2.Tref_, + ct1.nMoles()/eofs.nMoles()*ct1.Hf_ + - ct2.nMoles()/eofs.nMoles()*ct2.Hf_ + ); +} + + +template +inline Foam::hPowerThermo Foam::operator* +( + const scalar s, + const hPowerThermo& ct +) +{ + return hPowerThermo + ( + s*static_cast(ct), + ct.c0_, + ct.n0_, + ct.Tref_, + ct.Hf_ + ); +} + + +template +inline Foam::hPowerThermo Foam::operator== +( + const hPowerThermo& ct1, + const hPowerThermo& ct2 +) +{ + return ct2 - ct1; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H index 3fa4f8dd08..e3e4c1657f 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H index c92082dae7..b995777533 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H @@ -220,9 +220,10 @@ inline Foam::scalar Foam::janafThermo::s return RR* ( - (((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*::log(T) + (((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*log(T) + a[6] - ); + ) + + EquationOfState::s(p, T); }