diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files index 9e33850574..a9a67d5be8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files @@ -77,6 +77,4 @@ BlendedInterfacialModel/blendingMethods/noBlending/noBlending.C BlendedInterfacialModel/blendingMethods/linear/linear.C BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C -reactionThermo/hRefConstThermos.C - LIB = $(FOAM_LIBBIN)/libreactingPhaseSystem diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C deleted file mode 100644 index e7b8631cf4..0000000000 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C +++ /dev/null @@ -1,303 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 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 "makeReactionThermo.H" -#include "makeThermo.H" - -#include "rhoReactionThermo.H" -#include "heRhoThermo.H" - -#include "specie.H" -#include "perfectGas.H" -#include "rPolynomial.H" -#include "rhoConst.H" - -#include "sensibleEnthalpy.H" - -#include "hRefConstThermo.H" -#include "eRefConstThermo.H" -#include "janafThermo.H" - -#include "constTransport.H" - -#include "pureMixture.H" -#include "multiComponentMixture.H" - -#include "thermoPhysicsTypes.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Thermo type typedefs: - -typedef -constTransport -< - species::thermo - < - hRefConstThermo - < - perfectGas - >, - sensibleEnthalpy - > -> constRefGasHThermoPhysics; - -typedef -constTransport -< - species::thermo - < - hRefConstThermo - < - rPolynomial - >, - sensibleEnthalpy - > -> constRefFluidHThermoPhysics; - -typedef -constTransport -< - species::thermo - < - eRefConstThermo - < - perfectGas - >, - sensibleInternalEnergy - > -> constRefGasEThermoPhysics; - -typedef -constTransport -< - species::thermo - < - eRefConstThermo - < - rPolynomial - >, - sensibleInternalEnergy - > -> constRefFluidEThermoPhysics; - -typedef -constTransport -< - species::thermo - < - eRefConstThermo - < - rhoConst - >, - sensibleInternalEnergy - > -> constRefRhoConstEThermoPhysics; - -typedef -constTransport -< - species::thermo - < - hRefConstThermo - < - rhoConst - >, - sensibleEnthalpy - > -> constRefRhoConstHThermoPhysics; - -typedef -constTransport -< - species::thermo - < - janafThermo - < - rhoConst - >, - sensibleInternalEnergy - > -> constJanafRhoConstEThermoPhysics; - - -// pureMixture, sensibleEnthalpy: - -makeThermos -( - rhoThermo, - heRhoThermo, - pureMixture, - constTransport, - sensibleEnthalpy, - hRefConstThermo, - perfectGas, - specie -); - -makeThermos -( - rhoThermo, - heRhoThermo, - pureMixture, - constTransport, - sensibleEnthalpy, - hRefConstThermo, - rPolynomial, - specie -); - -makeThermos -( - rhoThermo, - heRhoThermo, - pureMixture, - constTransport, - sensibleEnthalpy, - hRefConstThermo, - rhoConst, - specie -); - - -// pureMixture, sensibleInternalEnergy: - -makeThermos -( - rhoThermo, - heRhoThermo, - pureMixture, - constTransport, - sensibleInternalEnergy, - eRefConstThermo, - perfectGas, - specie -); - -makeThermos -( - rhoThermo, - heRhoThermo, - pureMixture, - constTransport, - sensibleInternalEnergy, - eRefConstThermo, - rPolynomial, - specie -); - -makeThermos -( - rhoThermo, - heRhoThermo, - pureMixture, - constTransport, - sensibleInternalEnergy, - eRefConstThermo, - rhoConst, - specie -); - - -// multiComponentMixture, sensibleInternalEnergy: - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constRefGasEThermoPhysics -); - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constRefFluidEThermoPhysics -); - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constRefRhoConstEThermoPhysics -); - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constJanafRhoConstEThermoPhysics -); - - -// multiComponentMixture, sensibleEnthalpy: - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constRefRhoConstHThermoPhysics -); - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constRefFluidHThermoPhysics -); - -makeThermoPhysicsReactionThermos -( - rhoThermo, - rhoReactionThermo, - heRhoThermo, - multiComponentMixture, - constRefGasHThermoPhysics -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C index 2932e2bf34..6ff4f7a177 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,9 @@ Foam::eConstThermo::eConstThermo(const dictionary& dict) : EquationOfState(dict), Cv_(dict.subDict("thermodynamics").lookup("Cv")), - Hf_(dict.subDict("thermodynamics").lookup("Hf")) + Hf_(dict.subDict("thermodynamics").lookup("Hf")), + Tref_(dict.subDict("thermodynamics").lookupOrDefault("Tref", Tstd)), + Esref_(dict.subDict("thermodynamics").lookupOrDefault("Esref", 0)) {} @@ -47,6 +49,14 @@ void Foam::eConstThermo::write(Ostream& os) const dictionary dict("thermodynamics"); dict.add("Cv", Cv_); dict.add("Hf", Hf_); + if (Tref_ != Tstd) + { + dict.add("Tref", Tref_); + } + if (Esref_ != 0) + { + dict.add("Esref", Esref_); + } os << indent << dict.dictName() << dict; } diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H index 6873033b89..26450fcdb4 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,8 +37,6 @@ SourceFiles #ifndef eConstThermo_H #define eConstThermo_H -#include "thermo.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -94,6 +92,12 @@ class eConstThermo //- Heat of formation [J/kg] scalar Hf_; + //- Reference temperature around which to linearise [K] + scalar Tref_; + + //- Reference sensible enthalpy around which to linearise [J/kg] + scalar Esref_; + // Private Member Functions @@ -101,8 +105,10 @@ class eConstThermo inline eConstThermo ( const EquationOfState& st, - const scalar cv, - const scalar hf + const scalar Cv, + const scalar Hf, + const scalar Tref, + const scalar Esref ); @@ -119,7 +125,7 @@ public: //- Construct and return a clone inline autoPtr clone() const; - // Selector from dictionary + //- Selector from dictionary inline static autoPtr New(const dictionary& dict); diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index 5a3b9e7d20..308cc8d7bd 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,13 +29,17 @@ template inline Foam::eConstThermo::eConstThermo ( const EquationOfState& st, - const scalar cv, - const scalar hf + const scalar Cv, + const scalar Hf, + const scalar Tref, + const scalar Esref ) : EquationOfState(st), - Cv_(cv), - Hf_(hf) + Cv_(Cv), + Hf_(Hf), + Tref_(Tref), + Esref_(Esref) {} @@ -45,12 +49,14 @@ template inline Foam::eConstThermo::eConstThermo ( const word& name, - const eConstThermo& ct + const eConstThermo& ct ) : EquationOfState(name, ct), Cv_(ct.Cv_), - Hf_(ct.Hf_) + Hf_(ct.Hf_), + Tref_(ct.Tref_), + Esref_(ct.Esref_) {} @@ -106,7 +112,7 @@ inline Foam::scalar Foam::eConstThermo::Es const scalar T ) const { - return Cv_*T + EquationOfState::E(p, T); + return Cv_*(T - Tref_) + Esref_ + EquationOfState::E(p, T); } @@ -146,7 +152,7 @@ inline Foam::scalar Foam::eConstThermo::Gstd ) const { return - Cv_*T + Hc() + Pstd/EquationOfState::rho(Pstd, T) + Cv_*(T - Tref_) + Esref_ + Hc() + Pstd/EquationOfState::rho(Pstd, T) - Cp(Pstd, T)*T*log(T/Tstd); } @@ -187,11 +193,26 @@ inline void Foam::eConstThermo::operator+= if (mag(this->Y()) > small) { + if + ( + eConstThermo::debug + && notEqual(Tref_, ct.Tref_) + ) + { + FatalErrorInFunction + << "Tref " << Tref_ << " for " + << (this->name().size() ? this->name() : "others") + << " != " << ct.Tref_ << " for " + << (ct.name().size() ? ct.name() : "others") + << exit(FatalError); + } + Y1 /= this->Y(); const scalar Y2 = ct.Y()/this->Y(); Cv_ = Y1*Cv_ + Y2*ct.Cv_; Hf_ = Y1*Hf_ + Y2*ct.Hf_; + Esref_ = Y1*Esref_ + Y2*ct.Esref_; } } @@ -217,18 +238,37 @@ inline Foam::eConstThermo Foam::operator+ ( eofs, ct1.Cv_, - ct1.Hf_ + ct1.Hf_, + ct1.Tref_, + ct1.Esref_ ); } else { + if + ( + eConstThermo::debug + && notEqual(ct1.Tref_, ct2.Tref_) + ) + { + FatalErrorInFunction + << "Tref " << ct1.Tref_ << " for " + << (ct1.name().size() ? ct1.name() : "others") + << " != " << ct2.Tref_ << " for " + << (ct2.name().size() ? ct2.name() : "others") + << exit(FatalError); + } + return eConstThermo ( eofs, ct1.Y()/eofs.Y()*ct1.Cv_ + ct2.Y()/eofs.Y()*ct2.Cv_, ct1.Y()/eofs.Y()*ct1.Hf_ - + ct2.Y()/eofs.Y()*ct2.Hf_ + + ct2.Y()/eofs.Y()*ct2.Hf_, + ct1.Tref_, + ct1.Y()/eofs.Y()*ct1.Esref_ + + ct2.Y()/eofs.Y()*ct2.Esref_ ); } } @@ -245,7 +285,9 @@ inline Foam::eConstThermo Foam::operator* ( s*static_cast(ct), ct.Cv_, - ct.Hf_ + ct.Hf_, + ct.Tref_, + ct.Esref_ ); } @@ -263,13 +305,30 @@ inline Foam::eConstThermo Foam::operator== == static_cast(ct2) ); + if + ( + eConstThermo::debug + && notEqual(ct1.Tref_, ct2.Tref_) + ) + { + FatalErrorInFunction + << "Tref " << ct1.Tref_ << " for " + << (ct1.name().size() ? ct1.name() : "others") + << " != " << ct2.Tref_ << " for " + << (ct2.name().size() ? ct2.name() : "others") + << exit(FatalError); + } + return eConstThermo ( eofs, ct2.Y()/eofs.Y()*ct2.Cv_ - ct1.Y()/eofs.Y()*ct1.Cv_, ct2.Y()/eofs.Y()*ct2.Hf_ - - ct1.Y()/eofs.Y()*ct1.Hf_ + - ct1.Y()/eofs.Y()*ct1.Hf_, + ct1.Tref_, + ct2.Y()/eofs.Y()*ct2.Esref_ + - ct1.Y()/eofs.Y()*ct1.Esref_ ); } diff --git a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.C b/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.C deleted file mode 100644 index be1f5fbee7..0000000000 --- a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.C +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 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 "eRefConstThermo.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::eRefConstThermo::eRefConstThermo(const dictionary& dict) -: - EquationOfState(dict), - Cv_(dict.subDict("thermodynamics").lookup("Cv")), - Hf_(dict.subDict("thermodynamics").lookup("Hf")), - Tref_(dict.subDict("thermodynamics").lookup("Tref")), - Eref_(dict.subDict("thermodynamics").lookup("Eref")) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::eRefConstThermo::write(Ostream& os) const -{ - EquationOfState::write(os); - - dictionary dict("thermodynamics"); - dict.add("Cv", Cv_); - dict.add("Hf", Hf_); - dict.add("Tref", Tref_); - dict.add("Eref", Eref_); - os << indent << dict.dictName() << dict; -} - - -// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // - -template -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const eRefConstThermo& ct -) -{ - ct.write(os); - return os; -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H b/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H deleted file mode 100644 index 7678e596c8..0000000000 --- a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H +++ /dev/null @@ -1,227 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 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 . - -Class - Foam::eRefConstThermo - -Description - Constant properties thermodynamics package - templated into the EquationOfState. - -SourceFiles - eRefConstThermoI.H - eRefConstThermo.C - -\*---------------------------------------------------------------------------*/ - -#ifndef eRefConstThermo_H -#define eRefConstThermo_H - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of friend functions and operators - -template class eRefConstThermo; - -template -inline eRefConstThermo operator+ -( - const eRefConstThermo&, - const eRefConstThermo& -); - -template -inline eRefConstThermo operator* -( - const scalar, - const eRefConstThermo& -); - -template -inline eRefConstThermo operator== -( - const eRefConstThermo&, - const eRefConstThermo& -); - -template -Ostream& operator<< -( - Ostream&, - const eRefConstThermo& -); - - -/*---------------------------------------------------------------------------*\ - Class eRefConstThermo Declaration -\*---------------------------------------------------------------------------*/ - -template -class eRefConstThermo -: - public EquationOfState -{ - // Private Data - - scalar Cv_; - scalar Hf_; - scalar Tref_; - scalar Eref_; - - - // Private Member Functions - - //- Construct from components - inline eRefConstThermo - ( - const EquationOfState& st, - const scalar cv, - const scalar hf, - const scalar tref, - const scalar eref - ); - - -public: - - // Constructors - - //- Construct from dictionary - eRefConstThermo(const dictionary& dict); - - //- Construct as named copy - inline eRefConstThermo(const word&, const eRefConstThermo&); - - //- Construct and return a clone - inline autoPtr clone() const; - - //- Selector from dictionary - inline static autoPtr New(const dictionary& dict); - - - // Member Functions - - //- Return the instantiated type name - static word typeName() - { - return "eRefConst<" + EquationOfState::typeName() + '>'; - } - - //- Limit the temperature to be in the range Tlow_ to Thigh_ - inline scalar limit(const scalar T) const; - - - // Fundamental properties - - //- Heat capacity at constant volume [J/kg/K] - inline scalar Cv(const scalar p, const scalar T) const; - - //- Sensible internal energy [J/kg] - inline scalar Es(const scalar p, const scalar T) const; - - //- Absolute internal energy [J/kg] - inline scalar Ea(const scalar p, const scalar T) const; - - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; - - //- Entropy [J/kg/K] - inline scalar S(const scalar p, const scalar T) const; - - //- Gibbs free energy of the mixture in the standard state [J/kg] - inline scalar Gstd(const scalar T) const; - - #include "EtoHthermo.H" - - - // Derivative term used for Jacobian - - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - - //- Temperature derivative of heat capacity at constant pressure - inline scalar dCpdT(const scalar p, const scalar T) const; - - - // I-O - - //- Write to Ostream - void write(Ostream& os) const; - - - // Member Operators - - inline void operator+=(const eRefConstThermo&); - - - // Friend operators - - friend eRefConstThermo operator+ - ( - const eRefConstThermo&, - const eRefConstThermo& - ); - - friend eRefConstThermo operator* - ( - const scalar, - const eRefConstThermo& - ); - - friend eRefConstThermo operator== - ( - const eRefConstThermo&, - const eRefConstThermo& - ); - - - // IOstream Operators - - friend Ostream& operator<< - ( - Ostream&, - const eRefConstThermo& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "eRefConstThermoI.H" - -#ifdef NoRepository - #include "eRefConstThermo.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermoI.H b/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermoI.H deleted file mode 100644 index fbde869213..0000000000 --- a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermoI.H +++ /dev/null @@ -1,336 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 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 . - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -inline Foam::eRefConstThermo::eRefConstThermo -( - const EquationOfState& st, - const scalar cv, - const scalar hf, - const scalar tref, - const scalar eref -) -: - EquationOfState(st), - Cv_(cv), - Hf_(hf), - Tref_(tref), - Eref_(eref) -{} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -inline Foam::eRefConstThermo::eRefConstThermo -( - const word& name, - const eRefConstThermo& ct -) -: - EquationOfState(name, ct), - Cv_(ct.Cv_), - Hf_(ct.Hf_), - Tref_(ct.Tref_), - Eref_(ct.Eref_) -{} - - -template -inline Foam::autoPtr> -Foam::eRefConstThermo::clone() const -{ - return autoPtr> - ( - new eRefConstThermo(*this) - ); -} - - -template -inline Foam::autoPtr> -Foam::eRefConstThermo::New(const dictionary& dict) -{ - return autoPtr> - ( - new eRefConstThermo(dict) - ); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -inline Foam::scalar Foam::eRefConstThermo::limit -( - const scalar T -) const -{ - return T; -} - - -template -inline Foam::scalar Foam::eRefConstThermo::Cv -( - const scalar p, - const scalar T -) const -{ - return Cv_ + EquationOfState::Cv(p, T); -} - - -template -inline Foam::scalar Foam::eRefConstThermo::Es -( - const scalar p, - const scalar T -) const -{ - return Cv_*(T - Tref_) + Eref_ + EquationOfState::E(p, T); -} - - -template -inline Foam::scalar Foam::eRefConstThermo::Hc() const -{ - return Hf_; -} - - -template -inline Foam::scalar Foam::eRefConstThermo::Ea -( - const scalar p, - const scalar T -) const -{ - return Es(p, T) + Hc(); -} - - -template -inline Foam::scalar Foam::eRefConstThermo::S -( - const scalar p, - const scalar T -) const -{ - return Cp(p, T)*log(T/Tstd) + EquationOfState::S(p, T); -} - - -template -inline Foam::scalar Foam::eRefConstThermo::Gstd -( - const scalar T -) const -{ - return - Cv_*(T - Tref_) + Eref_ + Hc() + Pstd/EquationOfState::rho(Pstd, T) - - Cp(Pstd, T)*T*log(T/Tstd); -} - - -template -inline Foam::scalar Foam::eRefConstThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - return 0; -} - - -template -inline Foam::scalar Foam::eRefConstThermo::dCpdT -( - const scalar p, - const scalar T -) const -{ - return 0; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template -inline void Foam::eRefConstThermo::operator+= -( - const eRefConstThermo& ct -) -{ - scalar Y1 = this->Y(); - - EquationOfState::operator+=(ct); - - if (mag(this->Y()) > small) - { - if - ( - eRefConstThermo::debug - && notEqual(Tref_, ct.Tref_) - ) - { - FatalErrorInFunction - << "Tref " << Tref_ << " for " - << (this->name().size() ? this->name() : "others") - << " != " << ct.Tref_ << " for " - << (ct.name().size() ? ct.name() : "others") - << exit(FatalError); - } - - Y1 /= this->Y(); - const scalar Y2 = ct.Y()/this->Y(); - - Cv_ = Y1*Cv_ + Y2*ct.Cv_; - Hf_ = Y1*Hf_ + Y2*ct.Hf_; - Eref_ = Y1*Eref_ + Y2*ct.Eref_; - } -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -template -inline Foam::eRefConstThermo Foam::operator+ -( - const eRefConstThermo& ct1, - const eRefConstThermo& ct2 -) -{ - EquationOfState eofs - ( - static_cast(ct1) - + static_cast(ct2) - ); - - if (mag(eofs.Y()) < small) - { - return eRefConstThermo - ( - eofs, - ct1.Cv_, - ct1.Hf_, - ct1.Tref_, - ct1.Eref_ - ); - } - else - { - if - ( - eRefConstThermo::debug - && notEqual(ct1.Tref_, ct2.Tref_) - ) - { - FatalErrorInFunction - << "Tref " << ct1.Tref_ << " for " - << (ct1.name().size() ? ct1.name() : "others") - << " != " << ct2.Tref_ << " for " - << (ct2.name().size() ? ct2.name() : "others") - << exit(FatalError); - } - - return eRefConstThermo - ( - eofs, - ct1.Y()/eofs.Y()*ct1.Cv_ - + ct2.Y()/eofs.Y()*ct2.Cv_, - ct1.Y()/eofs.Y()*ct1.Hf_ - + ct2.Y()/eofs.Y()*ct2.Hf_, - ct1.Tref_, - ct1.Y()/eofs.Y()*ct1.Eref_ - + ct2.Y()/eofs.Y()*ct2.Eref_ - ); - } -} - - -template -inline Foam::eRefConstThermo Foam::operator* -( - const scalar s, - const eRefConstThermo& ct -) -{ - return eRefConstThermo - ( - s*static_cast(ct), - ct.Cv_, - ct.Hf_, - ct.Tref_, - ct.Eref_ - ); -} - - -template -inline Foam::eRefConstThermo Foam::operator== -( - const eRefConstThermo& ct1, - const eRefConstThermo& ct2 -) -{ - EquationOfState eofs - ( - static_cast(ct1) - == static_cast(ct2) - ); - - if - ( - eRefConstThermo::debug - && notEqual(ct1.Tref_, ct2.Tref_) - ) - { - FatalErrorInFunction - << "Tref " << ct1.Tref_ << " for " - << (ct1.name().size() ? ct1.name() : "others") - << " != " << ct2.Tref_ << " for " - << (ct2.name().size() ? ct2.name() : "others") - << exit(FatalError); - } - - return eRefConstThermo - ( - eofs, - ct2.Y()/eofs.Y()*ct2.Cv_ - - ct1.Y()/eofs.Y()*ct1.Cv_, - ct2.Y()/eofs.Y()*ct2.Hf_ - - ct1.Y()/eofs.Y()*ct1.Hf_, - ct1.Tref_, - ct2.Y()/eofs.Y()*ct2.Eref_ - - ct1.Y()/eofs.Y()*ct1.Eref_ - ); -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C index f2111fffb8..e42b30108e 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,9 @@ Foam::hConstThermo::hConstThermo(const dictionary& dict) : EquationOfState(dict), Cp_(dict.subDict("thermodynamics").lookup("Cp")), - Hf_(dict.subDict("thermodynamics").lookup("Hf")) + Hf_(dict.subDict("thermodynamics").lookup("Hf")), + Tref_(dict.subDict("thermodynamics").lookupOrDefault("Tref", Tstd)), + Hsref_(dict.subDict("thermodynamics").lookupOrDefault("Hsref", 0)) {} @@ -47,6 +49,14 @@ void Foam::hConstThermo::write(Ostream& os) const dictionary dict("thermodynamics"); dict.add("Cp", Cp_); dict.add("Hf", Hf_); + if (Tref_ != Tstd) + { + dict.add("Tref", Tref_); + } + if (Hsref_ != 0) + { + dict.add("Hsref", Hsref_); + } os << indent << dict.dictName() << dict; } diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H index f2bfc94ae7..8eded2ec7c 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,6 +92,12 @@ class hConstThermo //- Heat of formation [J/kg] scalar Hf_; + //- Reference temperature around which to linearise [K] + scalar Tref_; + + //- Reference sensible enthalpy around which to linearise [J/kg] + scalar Hsref_; + // Private Member Functions @@ -99,8 +105,10 @@ class hConstThermo inline hConstThermo ( const EquationOfState& st, - const scalar cp, - const scalar hf + const scalar Cp, + const scalar Hf, + const scalar Tref, + const scalar Hsref ); diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H index 0b2b3a4309..a2c53d7927 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,13 +29,17 @@ template inline Foam::hConstThermo::hConstThermo ( const EquationOfState& st, - const scalar cp, - const scalar hf + const scalar Cp, + const scalar Hf, + const scalar Tref, + const scalar Href ) : EquationOfState(st), - Cp_(cp), - Hf_(hf) + Cp_(Cp), + Hf_(Hf), + Tref_(Tref), + Hsref_(Href) {} @@ -50,7 +54,9 @@ inline Foam::hConstThermo::hConstThermo : EquationOfState(name, ct), Cp_(ct.Cp_), - Hf_(ct.Hf_) + Hf_(ct.Hf_), + Tref_(ct.Tref_), + Hsref_(ct.Hsref_) {} @@ -106,7 +112,7 @@ inline Foam::scalar Foam::hConstThermo::Hs const scalar T ) const { - return Cp_*T + EquationOfState::H(p, T); + return Cp_*(T - Tref_) + Hsref_ + EquationOfState::H(p, T); } @@ -145,7 +151,7 @@ inline Foam::scalar Foam::hConstThermo::Gstd const scalar T ) const { - return Cp_*T + Hc() - Cp_*T*log(T/Tstd); + return Cp_*(T - Tref_) + Hsref_ + Hc() - Cp_*T*log(T/Tstd); } @@ -185,11 +191,26 @@ inline void Foam::hConstThermo::operator+= if (mag(this->Y()) > small) { + if + ( + hConstThermo::debug + && notEqual(Tref_, ct.Tref_) + ) + { + FatalErrorInFunction + << "Tref " << Tref_ << " for " + << (this->name().size() ? this->name() : "others") + << " != " << ct.Tref_ << " for " + << (ct.name().size() ? ct.name() : "others") + << exit(FatalError); + } + Y1 /= this->Y(); - scalar Y2 = ct.Y()/this->Y(); + const scalar Y2 = ct.Y()/this->Y(); Cp_ = Y1*Cp_ + Y2*ct.Cp_; Hf_ = Y1*Hf_ + Y2*ct.Hf_; + Hsref_ = Y1*Hsref_ + Y2*ct.Hsref_; } } @@ -215,18 +236,37 @@ inline Foam::hConstThermo Foam::operator+ ( eofs, ct1.Cp_, - ct1.Hf_ + ct1.Hf_, + ct1.Tref_, + ct1.Hsref_ ); } else { + if + ( + hConstThermo::debug + && notEqual(ct1.Tref_, ct2.Tref_) + ) + { + FatalErrorInFunction + << "Tref " << ct1.Tref_ << " for " + << (ct1.name().size() ? ct1.name() : "others") + << " != " << ct2.Tref_ << " for " + << (ct2.name().size() ? ct2.name() : "others") + << exit(FatalError); + } + return hConstThermo ( eofs, ct1.Y()/eofs.Y()*ct1.Cp_ + ct2.Y()/eofs.Y()*ct2.Cp_, ct1.Y()/eofs.Y()*ct1.Hf_ - + ct2.Y()/eofs.Y()*ct2.Hf_ + + ct2.Y()/eofs.Y()*ct2.Hf_, + ct1.Tref_, + ct1.Y()/eofs.Y()*ct1.Hsref_ + + ct2.Y()/eofs.Y()*ct2.Hsref_ ); } } @@ -243,7 +283,9 @@ inline Foam::hConstThermo Foam::operator* ( s*static_cast(ct), ct.Cp_, - ct.Hf_ + ct.Hf_, + ct.Tref_, + ct.Hsref_ ); } @@ -261,13 +303,30 @@ inline Foam::hConstThermo Foam::operator== == static_cast(ct2) ); + if + ( + hConstThermo::debug + && notEqual(ct1.Tref_, ct2.Tref_) + ) + { + FatalErrorInFunction + << "Tref " << ct1.Tref_ << " for " + << (ct1.name().size() ? ct1.name() : "others") + << " != " << ct2.Tref_ << " for " + << (ct2.name().size() ? ct2.name() : "others") + << exit(FatalError); + } + return hConstThermo ( eofs, ct2.Y()/eofs.Y()*ct2.Cp_ - ct1.Y()/eofs.Y()*ct1.Cp_, ct2.Y()/eofs.Y()*ct2.Hf_ - - ct1.Y()/eofs.Y()*ct1.Hf_ + - ct1.Y()/eofs.Y()*ct1.Hf_, + ct1.Tref_, + ct2.Y()/eofs.Y()*ct2.Hsref_ + - ct1.Y()/eofs.Y()*ct1.Hsref_ ); } diff --git a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.C b/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.C deleted file mode 100644 index 07671a5a91..0000000000 --- a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.C +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 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 "hRefConstThermo.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::hRefConstThermo::hRefConstThermo(const dictionary& dict) -: - EquationOfState(dict), - Cp_(dict.subDict("thermodynamics").lookup("Cp")), - Hf_(dict.subDict("thermodynamics").lookup("Hf")), - Tref_(dict.subDict("thermodynamics").lookup("Tref")), - Href_(dict.subDict("thermodynamics").lookup("Href")) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::hRefConstThermo::write(Ostream& os) const -{ - EquationOfState::write(os); - - dictionary dict("thermodynamics"); - dict.add("Cp", Cp_); - dict.add("Hf", Hf_); - dict.add("Tref", Tref_); - dict.add("Href", Href_); - os << indent << dict.dictName() << dict; -} - - -// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // - -template -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const hRefConstThermo& ct -) -{ - ct.write(os); - return os; -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H b/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H deleted file mode 100644 index 7fc39ca9f8..0000000000 --- a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H +++ /dev/null @@ -1,227 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 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 . - -Class - Foam::hRefConstThermo - -Description - Constant properties thermodynamics package - templated into the EquationOfState. - -SourceFiles - hRefConstThermoI.H - hRefConstThermo.C - -\*---------------------------------------------------------------------------*/ - -#ifndef hRefConstThermo_H -#define hRefConstThermo_H - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of friend functions and operators - -template class hRefConstThermo; - -template -inline hRefConstThermo operator+ -( - const hRefConstThermo&, - const hRefConstThermo& -); - -template -inline hRefConstThermo operator* -( - const scalar, - const hRefConstThermo& -); - -template -inline hRefConstThermo operator== -( - const hRefConstThermo&, - const hRefConstThermo& -); - -template -Ostream& operator<< -( - Ostream&, - const hRefConstThermo& -); - - -/*---------------------------------------------------------------------------*\ - Class hRefConstThermo Declaration -\*---------------------------------------------------------------------------*/ - -template -class hRefConstThermo -: - public EquationOfState -{ - // Private Data - - scalar Cp_; - scalar Hf_; - scalar Tref_; - scalar Href_; - - - // Private Member Functions - - //- Construct from components - inline hRefConstThermo - ( - const EquationOfState& st, - const scalar cp, - const scalar hf, - const scalar tref, - const scalar href - ); - - -public: - - // Constructors - - //- Construct from dictionary - hRefConstThermo(const dictionary& dict); - - //- Construct as named copy - inline hRefConstThermo(const word&, const hRefConstThermo&); - - //- Construct and return a clone - inline autoPtr clone() const; - - //- Selector from dictionary - inline static autoPtr New(const dictionary& dict); - - - // Member Functions - - //- Return the instantiated type name - static word typeName() - { - return "hRefConst<" + EquationOfState::typeName() + '>'; - } - - //- Limit the temperature to be in the range Tlow_ to Thigh_ - inline scalar limit(const scalar T) const; - - - // Fundamental properties - - //- Heat capacity at constant pressure [J/kg/K] - inline scalar Cp(const scalar p, const scalar T) const; - - //- Absolute enthalpy [J/kg] - inline scalar Ha(const scalar p, const scalar T) const; - - //- Sensible enthalpy [J/kg] - inline scalar Hs(const scalar p, const scalar T) const; - - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; - - //- Entropy [J/kg/K] - inline scalar S(const scalar p, const scalar T) const; - - //- Gibbs free energy of the mixture in the standard state [J/kg] - inline scalar Gstd(const scalar T) const; - - #include "HtoEthermo.H" - - - // Derivative term used for Jacobian - - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - - //- Temperature derivative of heat capacity at constant pressure - inline scalar dCpdT(const scalar p, const scalar T) const; - - - // I-O - - //- Write to Ostream - void write(Ostream& os) const; - - - // Member Operators - - inline void operator+=(const hRefConstThermo&); - - - // Friend operators - - friend hRefConstThermo operator+ - ( - const hRefConstThermo&, - const hRefConstThermo& - ); - - friend hRefConstThermo operator* - ( - const scalar, - const hRefConstThermo& - ); - - friend hRefConstThermo operator== - ( - const hRefConstThermo&, - const hRefConstThermo& - ); - - - // IOstream Operators - - friend Ostream& operator<< - ( - Ostream&, - const hRefConstThermo& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "hRefConstThermoI.H" - -#ifdef NoRepository - #include "hRefConstThermo.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermoI.H b/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermoI.H deleted file mode 100644 index 8c020e9837..0000000000 --- a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermoI.H +++ /dev/null @@ -1,334 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 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 . - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -inline Foam::hRefConstThermo::hRefConstThermo -( - const EquationOfState& st, - const scalar cp, - const scalar hf, - const scalar tref, - const scalar href -) -: - EquationOfState(st), - Cp_(cp), - Hf_(hf), - Tref_(tref), - Href_(href) -{} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -inline Foam::hRefConstThermo::hRefConstThermo -( - const word& name, - const hRefConstThermo& ct -) -: - EquationOfState(name, ct), - Cp_(ct.Cp_), - Hf_(ct.Hf_), - Tref_(ct.Tref_), - Href_(ct.Href_) -{} - - -template -inline Foam::autoPtr> -Foam::hRefConstThermo::clone() const -{ - return autoPtr> - ( - new hRefConstThermo(*this) - ); -} - - -template -inline Foam::autoPtr> -Foam::hRefConstThermo::New(const dictionary& dict) -{ - return autoPtr> - ( - new hRefConstThermo(dict) - ); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -inline Foam::scalar Foam::hRefConstThermo::limit -( - const scalar T -) const -{ - return T; -} - - -template -inline Foam::scalar Foam::hRefConstThermo::Cp -( - const scalar p, - const scalar T -) const -{ - return Cp_ + EquationOfState::Cp(p, T); -} - - -template -inline Foam::scalar Foam::hRefConstThermo::Hs -( - const scalar p, - const scalar T -) const -{ - return Cp_*(T - Tref_) + Href_ + EquationOfState::H(p, T); -} - - -template -inline Foam::scalar Foam::hRefConstThermo::Hc() const -{ - return Hf_; -} - - -template -inline Foam::scalar Foam::hRefConstThermo::Ha -( - const scalar p, - const scalar T -) const -{ - return Hs(p, T) + Hc(); -} - - -template -inline Foam::scalar Foam::hRefConstThermo::S -( - const scalar p, - const scalar T -) const -{ - return Cp_*log(T/Tstd) + EquationOfState::S(p, T); -} - - -template -inline Foam::scalar Foam::hRefConstThermo::Gstd -( - const scalar T -) const -{ - return Cp_*(T - Tref_) + Href_ + Hc() - Cp_*T*log(T/Tstd); -} - - -template -inline Foam::scalar Foam::hRefConstThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - return 0; -} - - -template -inline Foam::scalar Foam::hRefConstThermo::dCpdT -( - const scalar p, - const scalar T -) const -{ - return 0; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template -inline void Foam::hRefConstThermo::operator+= -( - const hRefConstThermo& ct -) -{ - scalar Y1 = this->Y(); - - EquationOfState::operator+=(ct); - - if (mag(this->Y()) > small) - { - if - ( - hRefConstThermo::debug - && notEqual(Tref_, ct.Tref_) - ) - { - FatalErrorInFunction - << "Tref " << Tref_ << " for " - << (this->name().size() ? this->name() : "others") - << " != " << ct.Tref_ << " for " - << (ct.name().size() ? ct.name() : "others") - << exit(FatalError); - } - - Y1 /= this->Y(); - const scalar Y2 = ct.Y()/this->Y(); - - Cp_ = Y1*Cp_ + Y2*ct.Cp_; - Hf_ = Y1*Hf_ + Y2*ct.Hf_; - Href_ = Y1*Href_ + Y2*ct.Href_; - } -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -template -inline Foam::hRefConstThermo Foam::operator+ -( - const hRefConstThermo& ct1, - const hRefConstThermo& ct2 -) -{ - EquationOfState eofs - ( - static_cast(ct1) - + static_cast(ct2) - ); - - if (mag(eofs.Y()) < small) - { - return hRefConstThermo - ( - eofs, - ct1.Cp_, - ct1.Hf_, - ct1.Tref_, - ct1.Href_ - ); - } - else - { - if - ( - hRefConstThermo::debug - && notEqual(ct1.Tref_, ct2.Tref_) - ) - { - FatalErrorInFunction - << "Tref " << ct1.Tref_ << " for " - << (ct1.name().size() ? ct1.name() : "others") - << " != " << ct2.Tref_ << " for " - << (ct2.name().size() ? ct2.name() : "others") - << exit(FatalError); - } - - return hRefConstThermo - ( - eofs, - ct1.Y()/eofs.Y()*ct1.Cp_ - + ct2.Y()/eofs.Y()*ct2.Cp_, - ct1.Y()/eofs.Y()*ct1.Hf_ - + ct2.Y()/eofs.Y()*ct2.Hf_, - ct1.Tref_, - ct1.Y()/eofs.Y()*ct1.Href_ - + ct2.Y()/eofs.Y()*ct2.Href_ - ); - } -} - - -template -inline Foam::hRefConstThermo Foam::operator* -( - const scalar s, - const hRefConstThermo& ct -) -{ - return hRefConstThermo - ( - s*static_cast(ct), - ct.Cp_, - ct.Hf_, - ct.Tref_, - ct.Href_ - ); -} - - -template -inline Foam::hRefConstThermo Foam::operator== -( - const hRefConstThermo& ct1, - const hRefConstThermo& ct2 -) -{ - EquationOfState eofs - ( - static_cast(ct1) - == static_cast(ct2) - ); - - if - ( - hRefConstThermo::debug - && notEqual(ct1.Tref_, ct2.Tref_) - ) - { - FatalErrorInFunction - << "Tref " << ct1.Tref_ << " for " - << (ct1.name().size() ? ct1.name() : "others") - << " != " << ct2.Tref_ << " for " - << (ct2.name().size() ? ct2.name() : "others") - << exit(FatalError); - } - - return hRefConstThermo - ( - eofs, - ct2.Y()/eofs.Y()*ct2.Cp_ - - ct1.Y()/eofs.Y()*ct1.Cp_, - ct2.Y()/eofs.Y()*ct2.Hf_ - - ct1.Y()/eofs.Y()*ct1.Hf_, - ct1.Tref_, - ct2.Y()/eofs.Y()*ct2.Href_ - - ct1.Y()/eofs.Y()*ct1.Href_ - ); -} - - -// ************************************************************************* // diff --git a/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/Allrun b/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/Allrun index d29e2e3aec..4ba94f1d2b 100755 --- a/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/Allrun +++ b/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/Allrun @@ -12,7 +12,7 @@ setThermoAndEnergy() he=${1%.*} phase=${1#*.} - foamDictionary -entry thermoType.thermo -set ${he}RefConst \ + foamDictionary -entry thermoType.thermo -set ${he}Const \ constant/thermophysicalProperties.$phase case $he in diff --git a/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.steam.orig b/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.steam.orig index 31a08dd32e..c52dcf7f7e 100644 --- a/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.steam.orig +++ b/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.steam.orig @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState perfectGas; specie specie; energy sensibleInternalEnergy; @@ -38,8 +38,8 @@ mixture Cp 2078.4; Cv 1616.9; Tref 372.76; - Href 128652; - Eref -43381.7; + Hsref 128652; + Esref -43381.7; } transport { diff --git a/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.water.orig b/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.water.orig index c11c01629d..1cdab1c59f 100644 --- a/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.water.orig +++ b/test/multiphase/reactingTwoPhaseEulerFoam/thermal/waterEvaporation/constant/thermophysicalProperties.water.orig @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState rhoConst; specie specie; energy sensibleInternalEnergy; @@ -42,8 +42,8 @@ mixture Cv 4195; Cp 4195; Tref 372.76; - Href 312508; - Eref 312410; + Hsref 312508; + Esref 312410; } transport { diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas index f37df82b9e..ec2081a6db 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState perfectGas; specie specie; energy sensibleInternalEnergy; @@ -38,7 +38,7 @@ mixture Hf 0; Cv 1252; Tref 359.981; - Eref 363410; + Esref 363410; } transport { diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas2 b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas2 index f37df82b9e..ec2081a6db 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas2 +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.gas2 @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState perfectGas; specie specie; energy sensibleInternalEnergy; @@ -38,7 +38,7 @@ mixture Hf 0; Cv 1252; Tref 359.981; - Eref 363410; + Esref 363410; } transport { diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.liquid b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.liquid index 152dabc566..c5139d1d65 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.liquid +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/thermophysicalProperties.liquid @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState rhoConst; specie specie; energy sensibleInternalEnergy; @@ -42,7 +42,7 @@ mixture Hf 0; Cv 1394.5; Tref 359.981; - Eref 290090; + Esref 290090; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.gas b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.gas index f37df82b9e..ec2081a6db 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.gas +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.gas @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState perfectGas; specie specie; energy sensibleInternalEnergy; @@ -38,7 +38,7 @@ mixture Hf 0; Cv 1252; Tref 359.981; - Eref 363410; + Esref 363410; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.liquid index 152dabc566..c5139d1d65 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/constant/thermophysicalProperties.liquid @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState rhoConst; specie specie; energy sensibleInternalEnergy; @@ -42,7 +42,7 @@ mixture Hf 0; Cv 1394.5; Tref 359.981; - Eref 290090; + Esref 290090; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.gas b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.gas index f37df82b9e..ec2081a6db 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.gas +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.gas @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState perfectGas; specie specie; energy sensibleInternalEnergy; @@ -38,7 +38,7 @@ mixture Hf 0; Cv 1252; Tref 359.981; - Eref 363410; + Esref 363410; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.liquid index 152dabc566..c5139d1d65 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/thermophysicalProperties.liquid @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState rhoConst; specie specie; energy sensibleInternalEnergy; @@ -42,7 +42,7 @@ mixture Hf 0; Cv 1394.5; Tref 359.981; - Eref 290090; + Esref 290090; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.gas b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.gas index f37df82b9e..ec2081a6db 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.gas +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.gas @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState perfectGas; specie specie; energy sensibleInternalEnergy; @@ -38,7 +38,7 @@ mixture Hf 0; Cv 1252; Tref 359.981; - Eref 363410; + Esref 363410; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.liquid index 152dabc566..c5139d1d65 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/thermophysicalProperties.liquid @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState rhoConst; specie specie; energy sensibleInternalEnergy; @@ -42,7 +42,7 @@ mixture Hf 0; Cv 1394.5; Tref 359.981; - Eref 290090; + Esref 290090; } transport { diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.steam b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.steam index b48b1cb208..f8207437ac 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.steam +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.steam @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo hRefConst; + thermo hConst; equationOfState perfectGas; specie specie; energy sensibleEnthalpy; @@ -42,7 +42,7 @@ mixture Hf 0; Cp 2078.4; Tref 372.76; - Href 2675500; + Hsref 2675500; } transport diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.water b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.water index 19436866e9..9bc6de553e 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.water +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/constant/thermophysicalProperties.water @@ -20,7 +20,7 @@ thermoType type heRhoThermo; mixture pureMixture; transport const; - thermo eRefConst; + thermo eConst; equationOfState rPolynomial; specie specie; energy sensibleInternalEnergy; @@ -45,7 +45,7 @@ mixture Hf 0; Cv 4195; Tref 372.76; - Eref 417500; + Esref 417500; } transport