diff --git a/src/OpenFOAM/global/constants/constants.C b/src/OpenFOAM/global/constants/constants.C index 202855d8d2bfaad8ea3bed3721c066ef55e05b08..926bcdf1a631c59b721d4522a1cf662b76c9ecab 100644 --- a/src/OpenFOAM/global/constants/constants.C +++ b/src/OpenFOAM/global/constants/constants.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 @@ -28,11 +28,12 @@ License // Constants supplied in the main controlDict #include "fundamentalConstants.C" -// Derived constants. Note:order is important +// Derived constants. +// Note: order is important #include "universalConstants.C" #include "electromagneticConstants.C" #include "atomicConstants.C" #include "physicoChemicalConstants.C" - +#include "thermodynamicConstants.C" // ************************************************************************* // diff --git a/src/OpenFOAM/global/constants/constants.H b/src/OpenFOAM/global/constants/constants.H index e00b31bb6bf3e7f6896d46630c8c4913e8094d5d..ae139b035e00ab883465912368f80762c7067570 100644 --- a/src/OpenFOAM/global/constants/constants.H +++ b/src/OpenFOAM/global/constants/constants.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-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,14 +34,9 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Dimensionless coefficents - // Mathematical constants #include "mathematicalConstants.H" - -// Dimensioned constants - // Fundamental constants #include "fundamentalConstants.H" @@ -50,6 +45,7 @@ Description #include "electromagneticConstants.H" #include "atomicConstants.H" #include "physicoChemicalConstants.H" +#include "thermodynamicConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H index e1c872ff7f378b3dcad863caec3faa5ed059b22a..40cee9b5f3d71b634eb43aeb037209120068b247 100644 --- a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H @@ -66,7 +66,6 @@ namespace physicoChemical //- Second radiation constant: default SI units: [m.K] extern const dimensionedScalar c2; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace physicoChemical diff --git a/src/OpenFOAM/global/constants/thermodynamic/thermodynamicConstants.C b/src/OpenFOAM/global/constants/thermodynamic/thermodynamicConstants.C new file mode 100644 index 0000000000000000000000000000000000000000..65fedd44ed11fa7ed94393bf5f9a5026a5b6ce4c --- /dev/null +++ b/src/OpenFOAM/global/constants/thermodynamic/thermodynamicConstants.C @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "thermodynamicConstants.H" +#include "physicoChemicalConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace thermodynamic +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + // Note: the 1e3 converts from /mol to /kmol for consistency with the + // SI choice of kg rather than g for mass. + // This is not appropriate for USCS and will be changed to an entry in + // the DimensionedConstants dictionary in etc/controlDict + const scalar RR = 1e3*physicoChemical::R.value(); + + const scalar Pstd = standard::Pstd.value(); + const scalar Tstd = standard::Tstd.value(); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace thermodynamic +} // End namespace constant +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/constants/thermodynamic/thermodynamicConstants.H b/src/OpenFOAM/global/constants/thermodynamic/thermodynamicConstants.H new file mode 100644 index 0000000000000000000000000000000000000000..0c8378f87f48ff1515c6574c16b0d1c4a88ef694 --- /dev/null +++ b/src/OpenFOAM/global/constants/thermodynamic/thermodynamicConstants.H @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Namespace + Foam::constant::thermodynamic + +Description + Thermodynamic scalar constants + +\*---------------------------------------------------------------------------*/ + +#ifndef thermodynamicConstants_H +#define thermodynamicConstants_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace thermodynamic +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + //- Universal gas constant (default in [J/(kmol K)]) + extern const scalar RR; + + //- Standard pressure (default in [Pa]) + extern const scalar Pstd; + + //- Standard temperature (default in [K]) + extern const scalar Tstd; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace thermodynamic +} // End namespace constant +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/properties/liquidMixtureProperties/liquidMixtureProperties/liquidMixtureProperties.C b/src/thermophysicalModels/properties/liquidMixtureProperties/liquidMixtureProperties/liquidMixtureProperties.C index ac26ec1390ed5d228ef4437d38915c64566b69e1..5fec22dc9aa4bf226fb435343a469c7f3aa9bb3b 100644 --- a/src/thermophysicalModels/properties/liquidMixtureProperties/liquidMixtureProperties/liquidMixtureProperties.C +++ b/src/thermophysicalModels/properties/liquidMixtureProperties/liquidMixtureProperties/liquidMixtureProperties.C @@ -187,7 +187,7 @@ Foam::scalar Foam::liquidMixtureProperties::Ppc(const scalarField& x) const Zc += x[i]*properties_[i].Zc(); } - return specie::RR*Zc*Tpc(x)/Vc; + return RR*Zc*Tpc(x)/Vc; } diff --git a/src/thermophysicalModels/properties/solidProperties/solidProperties/solidPropertiesI.H b/src/thermophysicalModels/properties/solidProperties/solidProperties/solidPropertiesI.H index 05b6ad9c949d33af3f9ce5db527bb2989c3f8470..dda7e94287488d16e8ced1668805f5ba3e54d4f4 100644 --- a/src/thermophysicalModels/properties/solidProperties/solidProperties/solidPropertiesI.H +++ b/src/thermophysicalModels/properties/solidProperties/solidProperties/solidPropertiesI.H @@ -53,7 +53,7 @@ inline Foam::scalar Foam::solidProperties::Hf() const inline Foam::scalar Foam::solidProperties::Hs(const scalar T) const { - return Cp_*(T - specie::Tstd); + return Cp_*(T - Tstd); } diff --git a/src/thermophysicalModels/specie/Make/options b/src/thermophysicalModels/specie/Make/options index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..34572985089de6d7f81e51e56523184aaf94bec3 100644 --- a/src/thermophysicalModels/specie/Make/options +++ b/src/thermophysicalModels/specie/Make/options @@ -0,0 +1 @@ +LIB_LIBS = -lOpenFOAM diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C index c3fefab779606e5335f5c29c157ddd0207566978..baf20aeba98c0ea2974eecc4cd65556f4c87de35 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGas.C @@ -55,7 +55,7 @@ Foam::PengRobinsonGas<Specie>::PengRobinsonGas Pc_(readScalar(dict.subDict("equationOfState").lookup("Pc"))), omega_(readScalar(dict.subDict("equationOfState").lookup("omega"))) { - Zc_ = Pc_*Vc_/(specie::RR*Tc_); + Zc_ = Pc_*Vc_/(RR*Tc_); } diff --git a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H index d5b0c47594d87c36c00ed98d9d992888f6d31ba0..69619542086f3aec14b0c9547135fbb502d2f7d2 100644 --- a/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/PengRobinsonGas/PengRobinsonGasI.H @@ -201,7 +201,7 @@ inline Foam::scalar Foam::PengRobinsonGas<Specie>::cpMcv scalar T ) const { - return this->RR*Z(p, T); + return RR*Z(p, T); } @@ -222,7 +222,7 @@ inline void Foam::PengRobinsonGas<Specie>::operator+= Tc_ = molr1*Tc_ + molr2*pg.Tc_; Vc_ = molr1*Vc_ + molr2*pg.Vc_; Zc_ = molr1*Zc_ + molr2*pg.Zc_; - Pc_ = specie::RR*Zc_*Tc_/Vc_; + Pc_ = RR*Zc_*Tc_/Vc_; omega_ = molr1*omega_ + molr2*pg.omega_; } @@ -243,7 +243,7 @@ inline void Foam::PengRobinsonGas<Specie>::operator-= Tc_ = molr1*Tc_ - molr2*pg.Tc_; Vc_ = molr1*Vc_ - molr2*pg.Vc_; Zc_ = molr1*Zc_ - molr2*pg.Zc_; - Pc_ = specie::RR*Zc_*Tc_/Vc_; + Pc_ = RR*Zc_*Tc_/Vc_; omega_ = molr1*omega_ - molr2*pg.omega_; } @@ -280,7 +280,7 @@ Foam::PengRobinsonGas<Specie> Foam::operator+ Tc, Vc, Zc, - specie::RR*Zc*Tc/Vc, + RR*Zc*Tc/Vc, molr1*pg1.omega_ + molr2*pg2.omega_ ); } @@ -308,7 +308,7 @@ Foam::PengRobinsonGas<Specie> Foam::operator- Tc, Vc, Zc, - specie::RR*Zc*Tc/Vc, + RR*Zc*Tc/Vc, molr1*pg1.omega_ - molr2*pg2.omega_ ); } diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H index 0444104e1c5d4dc3305764a5c10f63a35323d49f..e84b5a226f918d6d4aa6e887b8c6056ec1a5484f 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H @@ -143,7 +143,7 @@ inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::cpMcv scalar ) const { - return this->RR; + return RR; } diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H index 7d5c6832ba8ca98ef77123a74b84895ebf9d1901..a97eb1b4f6d7d2ce1da8750d96be4712c44983be 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H @@ -99,7 +99,7 @@ inline Foam::scalar Foam::perfectGas<Specie>::Z(scalar, scalar) const template<class Specie> inline Foam::scalar Foam::perfectGas<Specie>::cpMcv(scalar, scalar) const { - return this->RR; + return RR; } diff --git a/src/thermophysicalModels/specie/specie/specie.C b/src/thermophysicalModels/specie/specie/specie.C index a35e5850e9485c8ebe75d64bb7bbedb61cbf3ced..8a4f7612a68e8ec4117ae769c9273ec1e62614fa 100644 --- a/src/thermophysicalModels/specie/specie/specie.C +++ b/src/thermophysicalModels/specie/specie/specie.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 @@ -29,18 +29,9 @@ License /* * * * * * * * * * * * * * * public constants * * * * * * * * * * * * * * */ -//- Universal gas constant (default in [J/(kmol K)]) -const Foam::scalar Foam::specie::RR = constant::physicoChemical::R.value()*1000; - -//- Standard pressure (default in [Pa]) -const Foam::scalar Foam::specie::Pstd = constant::standard::Pstd.value(); - -//- Standard temperature (default in [K]) -const Foam::scalar Foam::specie::Tstd = constant::standard::Tstd.value(); - namespace Foam { -defineTypeNameAndDebug(specie, 0); + defineTypeNameAndDebug(specie, 0); } diff --git a/src/thermophysicalModels/specie/specie/specie.H b/src/thermophysicalModels/specie/specie/specie.H index 354fdcceea3114e997de0b0c41f3359bb0462319..ffe602dc4bd0b1db8dff2b7f651efe7d0e277475 100644 --- a/src/thermophysicalModels/specie/specie/specie.H +++ b/src/thermophysicalModels/specie/specie/specie.H @@ -40,6 +40,9 @@ SourceFiles #include "scalar.H" #include "dictionary.H" +#include "thermodynamicConstants.H" +using namespace Foam::constant::thermodynamic; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -72,20 +75,6 @@ public: ClassName("specie"); - // Public constants - - // Thermodynamic constants - - //- Universal gas constant [J/(kmol K)] - static const scalar RR; - - //- Standard pressure [Pa] - static const scalar Pstd; - - //- Standard temperature [K] - static const scalar Tstd; - - // Constructors diff --git a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H b/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H index d0130eb5120ac444c8ae756bf47339b3262c7323..33e3b31c816d19cb20215538daedbec43b85f1c7 100644 --- a/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hExponential/hExponentialThermoI.H @@ -156,7 +156,7 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::ha const scalar p, const scalar T ) const { - scalar hOffset = integrateCp(specie::Tstd); + scalar hOffset = integrateCp(Tstd); return ( @@ -171,7 +171,7 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::hs const scalar p, const scalar T ) const { - scalar hOffset = integrateCp(specie::Tstd); + scalar hOffset = integrateCp(Tstd); return (integrateCp(T) - hOffset); } diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 4824b997d5446bdafa9046e82d366bd59f26d64f..bda645c0f3751ea27a8fc04d791a52f5f5acc006 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -49,10 +49,10 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo sCoeffs_ = CpCoeffs_.integralMinus1(); // Offset h poly so that it is relative to the enthalpy at Tstd - hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd); + hCoeffs_[0] += Hf_ - hCoeffs_.value(Tstd); // Offset s poly so that it is relative to the entropy at Tstd - sCoeffs_[0] += Sf_ - sCoeffs_.value(specie::Tstd); + sCoeffs_[0] += Sf_ - sCoeffs_.value(Tstd); } @@ -83,10 +83,10 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo sCoeffs_ = CpCoeffs_.integralMinus1(); // Offset h poly so that it is relative to the enthalpy at Tstd - hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd); + hCoeffs_[0] += Hf_ - hCoeffs_.value(Tstd); // Offset s poly so that it is relative to the entropy at Tstd - sCoeffs_[0] += Sf_ - sCoeffs_.value(specie::Tstd); + sCoeffs_[0] += Sf_ - sCoeffs_.value(Tstd); } diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H index 1b0843f78db8c6e9a4fcf8fc0e9c853c74c41f24..f639ffce97224dd257d06bd25eef0c5cb02b7d1c 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H @@ -164,7 +164,7 @@ inline Foam::scalar Foam::janafThermo<EquationOfState>::cp ) const { const coeffArray& a = coeffs(T); - return this->RR*((((a[4]*T + a[3])*T + a[2])*T + a[1])*T + a[0]); + return RR*((((a[4]*T + a[3])*T + a[2])*T + a[1])*T + a[0]); } @@ -176,7 +176,7 @@ inline Foam::scalar Foam::janafThermo<EquationOfState>::ha ) const { const coeffArray& a = coeffs(T); - return this->RR* + return RR* ( ((((a[4]/5.0*T + a[3]/4.0)*T + a[2]/3.0)*T + a[1]/2.0)*T + a[0])*T + a[5] @@ -199,8 +199,7 @@ template<class EquationOfState> inline Foam::scalar Foam::janafThermo<EquationOfState>::hc() const { const coeffArray& a = lowCpCoeffs_; - const scalar Tstd = specie::Tstd; - return this->RR* + return RR* ( ( (((a[4]/5.0*Tstd + a[3]/4.0)*Tstd + a[2]/3.0)*Tstd + a[1]/2.0)*Tstd @@ -219,7 +218,7 @@ inline Foam::scalar Foam::janafThermo<EquationOfState>::s { const coeffArray& a = coeffs(T); return - this->RR* + RR* ( (((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*::log(T) + a[6] diff --git a/src/thermophysicalModels/specie/thermo/thermo/thermo.H b/src/thermophysicalModels/specie/thermo/thermo/thermo.H index f545b798fab63ec8838ad66176278241131c70a6..3136307fe91c020ea01c144c3edeeab09dfbe8cd 100644 --- a/src/thermophysicalModels/specie/thermo/thermo/thermo.H +++ b/src/thermophysicalModels/specie/thermo/thermo/thermo.H @@ -38,6 +38,9 @@ SourceFiles #ifndef thermo_H #define thermo_H +#include "thermodynamicConstants.H" +using namespace Foam::constant::thermodynamic; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam diff --git a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H index 1de3149916c9acb4fffc5771511dbb12e25e9fcb..07068363816d21158bde34dbc5380d3573f9dd3f 100644 --- a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H +++ b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H @@ -290,7 +290,7 @@ template<class Thermo, template<class> class Type> inline Foam::scalar Foam::species::thermo<Thermo, Type>::K(const scalar p, const scalar T) const { - scalar arg = -this->nMoles()*this->g(p, T)/(this->RR*T); + scalar arg = -this->nMoles()*this->g(p, T)/(RR*T); if (arg < 600.0) { @@ -321,7 +321,7 @@ Foam::species::thermo<Thermo, Type>::Kc(const scalar p, const scalar T) const } else { - return Kp(p, T)*pow(this->Pstd/(this->RR*T), this->nMoles()); + return Kp(p, T)*pow(Pstd/(RR*T), this->nMoles()); } } @@ -339,7 +339,7 @@ inline Foam::scalar Foam::species::thermo<Thermo, Type>::Kx } else { - return Kp(p, T)*pow(this->Pstd/p, this->nMoles()); + return Kp(p, T)*pow(Pstd/p, this->nMoles()); } } @@ -358,7 +358,7 @@ inline Foam::scalar Foam::species::thermo<Thermo, Type>::Kn } else { - return Kp(p, T)*pow(n*this->Pstd/p, this->nMoles()); + return Kp(p, T)*pow(n*Pstd/p, this->nMoles()); } }