From c109bec4cc3702ac6dba172efdd30ec6916e73a1 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 10 Jun 2020 15:38:54 +0100 Subject: [PATCH] chtMultiRegionFoam: Changed solid energy from enthalpy to internal energy The solid is currently assumed incompressible (the solid pressure is not updated) and in general would be near incompressible so internal energy is a more appropriate energy choice than enthalpy which would require a pressure work term currently not implemented. Additionally due to the way in which the conduction is handled in terms of the gradient of energy the accuracy of the current enthalpy implementation is sensitive to the pressure distribution as this introduces an enthalpy gradient from the p/rho term which would need to be corrected; this issue is avoided by solving for internal energy instead. This improvement requires the scheme and solver settings for the solids in chtMultiRegionFoam cases to be changed from "h" to "e" and the thermo-physical properties in /thermophysicalProperties to be set to the corresponding internal energy forms, e.g.: thermo eConst; . . . energy sensibleInternalEnergy; All tutorials have be updated to reflect this and provide guidance when updating cases. --- .../solid/createSolidFields.H | 8 +- .../solid/setRegionSolidFields.H | 10 +- .../chtMultiRegionFoam/solid/solveSolid.H | 18 +- .../aluminium/thermophysicalProperties | 6 +- .../materials/copper/thermophysicalProperties | 6 +- .../thermalBaffle1DFvPatchScalarFields.C | 22 +- .../solidSpecie/include/forSolids.H | 15 +- .../specie/thermo/eConst/eConstThermoI.H | 7 +- .../thermo/ePolynomial/ePolynomialThermo.C | 97 ++++++ .../thermo/ePolynomial/ePolynomialThermo.H | 270 +++++++++++++++ .../thermo/ePolynomial/ePolynomialThermoI.H | 280 ++++++++++++++++ .../specie/thermo/ePower/ePowerThermo.C | 59 ++++ .../specie/thermo/ePower/ePowerThermo.H | 235 +++++++++++++ .../specie/thermo/ePower/ePowerThermoI.H | 312 ++++++++++++++++++ .../aluminium/thermophysicalProperties | 6 +- .../materials/copper/thermophysicalProperties | 6 +- .../templates/system/solid/fvOptions | 2 +- .../heatExchanger/constant/porous/fvOptions | 2 +- .../heatedDuct/constant/heater/fvOptions | 2 +- .../constant/heater/thermophysicalProperties | 6 +- .../constant/metal/thermophysicalProperties | 6 +- .../heatedDuct/system/heater/fvSchemes | 2 +- .../heatedDuct/system/heater/fvSolution | 6 +- .../heatedDuct/system/metal/fvSchemes | 2 +- .../heatedDuct/system/metal/fvSolution | 6 +- .../constant/solid/thermophysicalProperties | 6 +- .../reverseBurner/system/solid/fvSchemes | 2 +- .../reverseBurner/system/solid/fvSolution | 8 +- .../constant/solid/thermophysicalProperties | 6 +- .../system/solid/fvSchemes | 2 +- .../system/solid/fvSolution | 2 +- 31 files changed, 1335 insertions(+), 82 deletions(-) create mode 100644 src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.C create mode 100644 src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.H create mode 100644 src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermoI.H create mode 100644 src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.C create mode 100644 src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.H create mode 100644 src/thermophysicalModels/specie/thermo/ePower/ePowerThermoI.H diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H index 9121c3deb0..7adb883682 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H @@ -34,8 +34,8 @@ forAll(solidRegions, i) coordinateSystem::New(solidRegions[i], thermos[i]) ); - tmp tkappaByCp = - thermos[i].Kappa()/thermos[i].Cp(); + tmp tkappaByCv = + thermos[i].Kappa()/thermos[i].Cv(); aniAlphas.set ( @@ -54,7 +54,7 @@ forAll(solidRegions, i) dimensionedSymmTensor ( "zero", - tkappaByCp().dimensions(), + tkappaByCv().dimensions(), Zero ), zeroGradientFvPatchSymmTensorField::typeName @@ -62,7 +62,7 @@ forAll(solidRegions, i) ); aniAlphas[i].primitiveFieldRef() = - coordinates[i].R().transformVector(tkappaByCp()); + coordinates[i].R().transformVector(tkappaByCv()); aniAlphas[i].correctBoundaryConditions(); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index f99bbb4e8b..27433a0b0e 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -3,18 +3,18 @@ solidThermo& thermo = thermos[i]; tmp trho = thermo.rho(); const volScalarField& rho = trho(); -tmp tcp = thermo.Cp(); -const volScalarField& cp = tcp(); +tmp tCv = thermo.Cv(); +const volScalarField& Cv = tCv(); tmp taniAlpha; if (!thermo.isotropic()) { volSymmTensorField& aniAlpha = aniAlphas[i]; - tmp tkappaByCp = thermo.Kappa()/cp; + tmp tkappaByCv = thermo.Kappa()/Cv; const coordinateSystem& coodSys = coordinates[i]; aniAlpha.primitiveFieldRef() = - coodSys.R().transformVector(tkappaByCp()); + coodSys.R().transformVector(tkappaByCv()); aniAlpha.correctBoundaryConditions(); taniAlpha = tmp @@ -24,7 +24,7 @@ if (!thermo.isotropic()) } -volScalarField& h = thermo.he(); +volScalarField& e = thermo.he(); const volScalarField& betav = betavSolid[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index 9bc0375ce1..b0dcb6b36a 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -1,25 +1,25 @@ { while (pimple.correctNonOrthogonal()) { - fvScalarMatrix hEqn + fvScalarMatrix eEqn ( - fvm::ddt(betav*rho, h) + fvm::ddt(betav*rho, e) - ( thermo.isotropic() - ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") - : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") + ? fvm::laplacian(betav*thermo.alpha(), e, "laplacian(alpha,e)") + : fvm::laplacian(betav*taniAlpha(), e, "laplacian(alpha,e)") ) == - fvOptions(rho, h) + fvOptions(rho, e) ); - hEqn.relax(); + eEqn.relax(); - fvOptions.constrain(hEqn); + fvOptions.constrain(eEqn); - hEqn.solve(); + eEqn.solve(); - fvOptions.correct(h); + fvOptions.correct(e); } } diff --git a/etc/templates/singleFluidCHT/templates/materials/aluminium/thermophysicalProperties b/etc/templates/singleFluidCHT/templates/materials/aluminium/thermophysicalProperties index d46051b9ab..11e771fc76 100644 --- a/etc/templates/singleFluidCHT/templates/materials/aluminium/thermophysicalProperties +++ b/etc/templates/singleFluidCHT/templates/materials/aluminium/thermophysicalProperties @@ -19,10 +19,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -41,7 +41,7 @@ mixture thermodynamics { Hf 0; - Cp 896; // [J/kg/K] + Cv 896; // [J/kg/K] } equationOfState diff --git a/etc/templates/singleFluidCHT/templates/materials/copper/thermophysicalProperties b/etc/templates/singleFluidCHT/templates/materials/copper/thermophysicalProperties index fb49f36917..b69d68b494 100644 --- a/etc/templates/singleFluidCHT/templates/materials/copper/thermophysicalProperties +++ b/etc/templates/singleFluidCHT/templates/materials/copper/thermophysicalProperties @@ -19,10 +19,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -41,7 +41,7 @@ mixture thermodynamics { Hf 0; - Cp 385; // [J/kg/K] + Cv 385; // [J/kg/K] } equationOfState diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C b/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C index 7e57f0fc7c..fc48ded1ac 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C @@ -24,9 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "thermalBaffle1DFvPatchScalarField.H" - #include "forSolids.H" - #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,22 +37,22 @@ typedef < species::thermo < - hConstThermo + eConstThermo < rhoConst >, - sensibleEnthalpy + sensibleInternalEnergy > - > hConstSolidThermoPhysics; + > eConstSolidThermoPhysics; typedef - compressible::thermalBaffle1DFvPatchScalarField + compressible::thermalBaffle1DFvPatchScalarField thermalBaffle1DHConstSolidThermoPhysicsFvPatchScalarField; defineTemplateTypeNameAndDebugWithName ( thermalBaffle1DHConstSolidThermoPhysicsFvPatchScalarField, - "compressible::thermalBaffle1D", + "compressible::thermalBaffle1D", 0 ); @@ -69,22 +67,22 @@ typedef < species::thermo < - hPowerThermo + ePowerThermo < rhoConst >, - sensibleEnthalpy + sensibleInternalEnergy > - > hPowerSolidThermoPhysics; + > ePowerSolidThermoPhysics; typedef - compressible::thermalBaffle1DFvPatchScalarField + compressible::thermalBaffle1DFvPatchScalarField thermalBaffle1DHPowerSolidThermoPhysicsFvPatchScalarField; defineTemplateTypeNameAndDebugWithName ( thermalBaffle1DHPowerSolidThermoPhysicsFvPatchScalarField, - "compressible::thermalBaffle1D", + "compressible::thermalBaffle1D", 0 ); diff --git a/src/thermophysicalModels/solidSpecie/include/forSolids.H b/src/thermophysicalModels/solidSpecie/include/forSolids.H index c496e51492..3c27d99d1e 100644 --- a/src/thermophysicalModels/solidSpecie/include/forSolids.H +++ b/src/thermophysicalModels/solidSpecie/include/forSolids.H @@ -30,11 +30,11 @@ License #include "rhoConst.H" -#include "hConstThermo.H" -#include "hPolynomialThermo.H" -#include "hPowerThermo.H" +#include "eConstThermo.H" +#include "ePolynomialThermo.H" +#include "ePowerThermo.H" -#include "sensibleEnthalpy.H" +#include "sensibleInternalEnergy.H" #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" @@ -51,9 +51,10 @@ License forThermo(Mu, He, Cp, rhoConst, specie, Macro, Args) #define forSolidEnergiesAndThermos(Mu, Macro, Args...) \ - forSolidEquations(Mu, sensibleEnthalpy, hConstThermo, Macro, Args); \ - forSolidEquations(Mu, sensibleEnthalpy, hPolynomialThermo, Macro, Args); \ - forSolidEquations(Mu, sensibleEnthalpy, hPowerThermo, Macro, Args) + forSolidEquations(Mu, sensibleInternalEnergy, eConstThermo, Macro, Args); \ + forSolidEquations \ + (Mu, sensibleInternalEnergy, ePolynomialThermo, Macro, Args); \ + forSolidEquations(Mu, sensibleInternalEnergy, ePowerThermo, Macro, Args) #define forSolidTransports(Macro, Args...) \ forSolidEnergiesAndThermos(constIsoSolidTransport, Macro, Args); \ diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index 5694c32473..f5a49845b8 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H @@ -141,7 +141,8 @@ inline Foam::scalar Foam::eConstThermo::S const scalar T ) const { - return Cp(p, T)*log(T/Tstd) + EquationOfState::S(p, T); + return Cp(p, T)*log(T/Tstd) + + EquationOfState::S(p, T); // Requires EquationOfState::S for Cv } @@ -153,7 +154,7 @@ inline Foam::scalar Foam::eConstThermo::Gstd { return Cv_*(T - Tref_) + Esref_ + Hf() + Pstd/EquationOfState::rho(Pstd, T) - - Cp(Pstd, T)*T*log(T/Tstd); + - S(Pstd, T)*T; } @@ -164,7 +165,7 @@ inline Foam::scalar Foam::eConstThermo::dCpdT const scalar T ) const { - return 0; + return 0; // EquationOfState::dCpdT } diff --git a/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.C b/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.C new file mode 100644 index 0000000000..5412729174 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "ePolynomialThermo.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ePolynomialThermo::ePolynomialThermo +( + const dictionary& dict +) +: + EquationOfState(dict), + Hf_(dict.subDict("thermodynamics").lookup("Hf")), + Sf_(dict.subDict("thermodynamics").lookup("Sf")), + CvCoeffs_ + ( + dict.subDict("thermodynamics").lookup + ( + "CvCoeffs<" + Foam::name(PolySize) + '>' + ) + ), + eCoeffs_(), + sCoeffs_() +{ + eCoeffs_ = CvCoeffs_.integral(); + sCoeffs_ = CvCoeffs_.integralMinus1(); + + // Offset e poly so that it is relative to the enthalpy at Tstd + eCoeffs_[0] -= eCoeffs_.value(Tstd); + + // Offset s poly so that it is relative to the entropy at Tstd + sCoeffs_[0] -= sCoeffs_.value(Tstd); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::ePolynomialThermo::write +( + Ostream& os +) const +{ + EquationOfState::write(os); + + dictionary dict("thermodynamics"); + dict.add("Hf", Hf_); + dict.add("Sf", Sf_); + dict.add + ( + word("CvCoeffs<" + Foam::name(PolySize) + '>'), + CvCoeffs_ + ); + os << indent << dict.dictName() << dict; +} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const ePolynomialThermo& pt +) +{ + pt.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.H b/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.H new file mode 100644 index 0000000000..9c28dc3a87 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermo.H @@ -0,0 +1,270 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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::ePolynomialThermo + +Description + Thermodynamics package templated on the equation of state, using polynomial + functions for \c cv, \c e and \c s. + + Polynomials for \c e and \c s derived from \c cv. + +Usage + + \table + Property | Description + Hf | Heat of formation + Sf | Standard entropy + CvCoeffs<8> | Specific heat at constant volume polynomial coeffs + \endtable + + Example of the specification of the thermodynamic properties: + \verbatim + thermodynamics + { + Hf 0; + Sf 0; + CvCoeffs<8> ( 1000 -0.05 0.003 0 0 0 0 0 ); + } + \endverbatim + + The polynomial expression is evaluated as so: + + \f[ + Cv = 1000 - 0.05 T + 0.003 T^2 + \f] + +Note + - Specific heat at constant volume polynomial coefficients evaluate to an + expression in [J/kg/K]. + +SourceFiles + ePolynomialThermoI.H + ePolynomialThermo.C + +See also + Foam::Polynomial + +\*---------------------------------------------------------------------------*/ + +#ifndef ePolynomialThermo_H +#define ePolynomialThermo_H + +#include "scalar.H" +#include "Polynomial.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template +class ePolynomialThermo; + +template +inline ePolynomialThermo operator+ +( + const ePolynomialThermo&, + const ePolynomialThermo& +); + +template +inline ePolynomialThermo operator* +( + const scalar, + const ePolynomialThermo& +); + +template +inline ePolynomialThermo operator== +( + const ePolynomialThermo&, + const ePolynomialThermo& +); + +template +Ostream& operator<< +( + Ostream&, + const ePolynomialThermo& +); + + +/*---------------------------------------------------------------------------*\ + Class ePolynomialThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class ePolynomialThermo +: + public EquationOfState +{ + // Private Data + + //- Heat of formation + scalar Hf_; + + //- Standard entropy + scalar Sf_; + + //- Specific heat at constant volume polynomial coeffs [J/kg/K/K^i] + Polynomial CvCoeffs_; + + //- Internal energy polynomial coeffs [J/kg/K^i] + // Derived from Cv coeffs. Relative to Tstd. + typename Polynomial::intPolyType eCoeffs_; + + //- Entropy polynomial coeffs [J/kg/K/K^i] + // Derived from Cv coeffs. Relative to Tstd. + Polynomial sCoeffs_; + + + // Private Member Functions + + //- Construct from components + inline ePolynomialThermo + ( + const EquationOfState& pt, + const scalar Hf, + const scalar Sf, + const Polynomial& CvCoeffs, + const typename Polynomial::intPolyType& eCoeffs, + const Polynomial& sCoeffs + ); + + +public: + + // Constructors + + //- Construct from dictionary + ePolynomialThermo(const dictionary& dict); + + //- Construct as a named copy + inline ePolynomialThermo(const word&, const ePolynomialThermo&); + + + // Member Functions + + //- Return the instantiated type name + static word typeName() + { + return "ePolynomial<" + EquationOfState::typeName() + '>'; + } + + //- Limit the temperature to be in the range Tlow_ to Thigh_ + inline scalar limit(const scalar) 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; + + //- Enthalpy of formation [J/kg] + inline scalar Hf() 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 + + //- 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 ePolynomialThermo&); + inline void operator*=(const scalar); + + + // Friend operators + + friend ePolynomialThermo operator+ + ( + const ePolynomialThermo&, + const ePolynomialThermo& + ); + + friend ePolynomialThermo operator* + ( + const scalar, + const ePolynomialThermo& + ); + + friend ePolynomialThermo operator== + ( + const ePolynomialThermo&, + const ePolynomialThermo& + ); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const ePolynomialThermo& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ePolynomialThermoI.H" + +#ifdef NoRepository + #include "ePolynomialThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermoI.H b/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermoI.H new file mode 100644 index 0000000000..ee79ca2303 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/ePolynomial/ePolynomialThermoI.H @@ -0,0 +1,280 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "ePolynomialThermo.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline Foam::ePolynomialThermo::ePolynomialThermo +( + const EquationOfState& pt, + const scalar Hf, + const scalar Sf, + const Polynomial& CvCoeffs, + const typename Polynomial::intPolyType& eCoeffs, + const Polynomial& sCoeffs +) +: + EquationOfState(pt), + Hf_(Hf), + Sf_(Sf), + CvCoeffs_(CvCoeffs), + eCoeffs_(eCoeffs), + sCoeffs_(sCoeffs) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::ePolynomialThermo::ePolynomialThermo +( + const word& name, + const ePolynomialThermo& pt +) +: + EquationOfState(name, pt), + Hf_(pt.Hf_), + Sf_(pt.Sf_), + CvCoeffs_(pt.CvCoeffs_), + eCoeffs_(pt.eCoeffs_), + sCoeffs_(pt.sCoeffs_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::ePolynomialThermo::limit +( + const scalar T +) const +{ + return T; +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::Cv +( + const scalar p, + const scalar T +) const +{ + return CvCoeffs_.value(T) + EquationOfState::Cv(p, T); +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::Es +( + const scalar p, + const scalar T +) const +{ + return eCoeffs_.value(T) + EquationOfState::E(p, T); +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::Ea +( + const scalar p, + const scalar T +) const +{ + return Es(p, T) + Hf(); +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::Hf() +const +{ + return Hf_; +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::S +( + const scalar p, + const scalar T +) const +{ + return sCoeffs_.value(T) + + EquationOfState::S(p, T); // Requires EquationOfState::S for Cv +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::Gstd +( + const scalar T +) const +{ + return + eCoeffs_.value(T) + Hf() + Pstd/EquationOfState::rho(Pstd, T) + - S(Pstd, T)*T; +} + + +template +inline Foam::scalar Foam::ePolynomialThermo::dCpdT +( + const scalar p, + const scalar T +) const +{ + return CvCoeffs_.derivative(T); // + EquationOfState::dCpdT +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +inline void Foam::ePolynomialThermo::operator+= +( + const ePolynomialThermo& pt +) +{ + scalar Y1 = this->Y(); + + EquationOfState::operator+=(pt); + + if (mag(this->Y()) > small) + { + Y1 /= this->Y(); + const scalar Y2 = pt.Y()/this->Y(); + + Hf_ = Y1*Hf_ + Y2*pt.Hf_; + Sf_ = Y1*Sf_ + Y2*pt.Sf_; + CvCoeffs_ = Y1*CvCoeffs_ + Y2*pt.CvCoeffs_; + eCoeffs_ = Y1*eCoeffs_ + Y2*pt.eCoeffs_; + sCoeffs_ = Y1*sCoeffs_ + Y2*pt.sCoeffs_; + } +} + + +template +inline void Foam::ePolynomialThermo::operator*= +( + const scalar s +) +{ + EquationOfState::operator*=(s); +} + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +template +inline Foam::ePolynomialThermo Foam::operator+ +( + const ePolynomialThermo& pt1, + const ePolynomialThermo& pt2 +) +{ + EquationOfState eofs = pt1; + eofs += pt2; + + if (mag(eofs.Y()) < small) + { + return ePolynomialThermo + ( + eofs, + pt1.Hf_, + pt1.Sf_, + pt1.CvCoeffs_, + pt1.eCoeffs_, + pt1.sCoeffs_ + ); + } + { + const scalar Y1 = pt1.Y()/eofs.Y(); + const scalar Y2 = pt2.Y()/eofs.Y(); + + return ePolynomialThermo + ( + eofs, + Y1*pt1.Hf_ + Y2*pt2.Hf_, + Y1*pt1.Sf_ + Y2*pt2.Sf_, + Y1*pt1.CvCoeffs_ + Y2*pt2.CvCoeffs_, + Y1*pt1.eCoeffs_ + Y2*pt2.eCoeffs_, + Y1*pt1.sCoeffs_ + Y2*pt2.sCoeffs_ + ); + } +} + + +template +inline Foam::ePolynomialThermo Foam::operator* +( + const scalar s, + const ePolynomialThermo& pt +) +{ + return ePolynomialThermo + ( + s*static_cast(pt), + pt.Hf_, + pt.Sf_, + pt.CvCoeffs_, + pt.eCoeffs_, + pt.sCoeffs_ + ); +} + + +template +inline Foam::ePolynomialThermo Foam::operator== +( + const ePolynomialThermo& pt1, + const ePolynomialThermo& pt2 +) +{ + EquationOfState eofs + ( + static_cast(pt1) + == static_cast(pt2) + ); + + const scalar Y1 = pt1.Y()/eofs.Y(); + const scalar Y2 = pt2.Y()/eofs.Y(); + + return ePolynomialThermo + ( + eofs, + Y2*pt2.Hf_ - Y1*pt1.Hf_, + Y2*pt2.Sf_ - Y1*pt1.Sf_, + Y2*pt2.CvCoeffs_ - Y1*pt1.CvCoeffs_, + Y2*pt2.eCoeffs_ - Y1*pt1.eCoeffs_, + Y2*pt2.sCoeffs_ - Y1*pt1.sCoeffs_ + ); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.C b/src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.C new file mode 100644 index 0000000000..e88c683c30 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "ePowerThermo.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ePowerThermo::ePowerThermo +( + const dictionary& dict +) +: + EquationOfState(dict), + c0_(dict.subDict("thermodynamics").lookup("C0")), + n0_(dict.subDict("thermodynamics").lookup("n0")), + Tref_(dict.subDict("thermodynamics").lookup("Tref")), + Hf_(dict.subDict("thermodynamics").lookup("Hf")) +{} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const ePowerThermo& et +) +{ + et.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.H b/src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.H new file mode 100644 index 0000000000..5a1b80a489 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/ePower/ePowerThermo.H @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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::ePowerThermo + +Description + Power-function based thermodynamics package templated on EquationOfState. + + In this thermodynamics package the heat capacity is a simple power of + temperature: + + Cv(T) = c0*(T/Tref)^n0; + + which is particularly suitable for solids. + +SourceFiles + ePowerThermoI.H + ePowerThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ePowerThermo_H +#define ePowerThermo_H + +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template class ePowerThermo; + +template +inline ePowerThermo operator+ +( + const ePowerThermo&, + const ePowerThermo& +); + +template +inline ePowerThermo operator* +( + const scalar, + const ePowerThermo& +); + + +template +inline ePowerThermo operator== +( + const ePowerThermo&, + const ePowerThermo& +); + + +template +Ostream& operator<< +( + Ostream&, + const ePowerThermo& +); + + +/*---------------------------------------------------------------------------*\ + Class ePowerThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class ePowerThermo +: + public EquationOfState +{ + // Private Data + + scalar c0_; + scalar n0_; + scalar Tref_; + scalar Hf_; + + + // Private Member Functions + + //- Check given temperature is within the range of the fitted coeffs + inline void checkT(const scalar T) const; + + //- Construct from components + inline ePowerThermo + ( + const EquationOfState& st, + const scalar c0, + const scalar n0, + const scalar Tref, + const scalar Hf + ); + + +public: + + // Constructors + + //- Construct from dictionary + ePowerThermo(const dictionary&); + + //- Construct as a named copy + inline ePowerThermo + ( + const word&, + const ePowerThermo& + ); + + //- 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 "ePower<" + 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; + + //- Enthalpy of formation [J/kg] + inline scalar Hf() 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 + + //- Temperature derivative of heat capacity at constant pressure + inline scalar dCpdT(const scalar p, const scalar T) const; + + + // Member Operators + + inline void operator+=(const ePowerThermo&); + + + // Friend operators + + friend ePowerThermo operator+ + ( + const ePowerThermo&, + const ePowerThermo& + ); + + friend ePowerThermo operator* + ( + const scalar, + const ePowerThermo& + ); + + + friend ePowerThermo operator== + ( + const ePowerThermo&, + const ePowerThermo& + ); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const ePowerThermo& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "ePowerThermoI.H" + #include "ePowerThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/ePower/ePowerThermoI.H b/src/thermophysicalModels/specie/thermo/ePower/ePowerThermoI.H new file mode 100644 index 0000000000..c768e1a7be --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/ePower/ePowerThermoI.H @@ -0,0 +1,312 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "ePowerThermo.H" +#include "specie.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline void Foam::ePowerThermo::checkT +( + const scalar T +) const +{ + if (T < 0) + { + FatalErrorInFunction + << "attempt to evaluate ePowerThermo" + " for negative temperature " << T + << abort(FatalError); + } +} + + +template +inline Foam::ePowerThermo::ePowerThermo +( + const word& name, + const ePowerThermo& jt +) +: + EquationOfState(name, jt), + c0_(jt.c0_), + n0_(jt.n0_), + Tref_(jt.Tref_), + Hf_(jt.Hf_) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::ePowerThermo::ePowerThermo +( + 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::ePowerThermo::clone() const +{ + return autoPtr> + ( + new ePowerThermo(*this) + ); +} + + +template +inline Foam::autoPtr> +Foam::ePowerThermo::New(const dictionary& dict) +{ + return autoPtr> + ( + new ePowerThermo(dict) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::ePowerThermo::limit +( + const scalar T +) const +{ + return T; +} + + +template +inline Foam::scalar Foam::ePowerThermo::Cv +( + const scalar p, + const scalar T +) const +{ + return c0_*pow(T/Tref_, n0_) + EquationOfState::Cv(p, T); +} + + +template +inline Foam::scalar Foam::ePowerThermo::Es +( + const scalar p, + const scalar T +) const +{ + return + c0_*(pow(T, n0_ + 1) - pow(Tstd, n0_ + 1))/(pow(Tref_, n0_)*(n0_ + 1)) + + EquationOfState::E(p, T); +} + + +template +inline Foam::scalar Foam::ePowerThermo::Ea +( + const scalar p, + const scalar T +) const +{ + return Es(p, T) + Hf(); +} + + +template +inline Foam::scalar Foam::ePowerThermo::Hf() const +{ + return Hf_; +} + + +template +inline Foam::scalar Foam::ePowerThermo::S +( + const scalar p, + const scalar T +) const +{ + return + c0_*(pow(T, n0_) - pow(Tstd, n0_))/(pow(Tref_, n0_)*n0_) + + EquationOfState::S(p, T); // Requires EquationOfState::S for Cv +} + + +template +inline Foam::scalar Foam::ePowerThermo::Gstd +( + const scalar T +) const +{ + return + c0_*(pow(T, n0_ + 1) - pow(Tstd, n0_ + 1))/(pow(Tref_, n0_)*(n0_ + 1)) + + Hf() + Pstd/EquationOfState::rho(Pstd, T) + - S(Pstd, T)*T; +} + + +template +inline Foam::scalar Foam::ePowerThermo::dCpdT +( + const scalar p, + const scalar T +) const +{ + // To be implemented + NotImplemented; + return 0; // + EquationOfState::dCpdT +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +inline void Foam::ePowerThermo::operator+= +( + const ePowerThermo& ct +) +{ + scalar Y1 = this->Y(); + + EquationOfState::operator+=(ct); + + if (mag(this->Y()) > small) + { + Y1 /= this->Y(); + const scalar Y2 = ct.Y()/this->Y(); + + Hf_ = Y1*Hf_ + Y2*ct.Hf_; + c0_ = Y1*c0_ + Y2*ct.c0_; + n0_ = Y1*n0_ + Y2*ct.n0_; + Tref_ = Y1*Tref_ + Y2*ct.Tref_; + } +} + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +template +inline Foam::ePowerThermo Foam::operator+ +( + const ePowerThermo& ct1, + const ePowerThermo& ct2 +) +{ + EquationOfState eofs + ( + static_cast(ct1) + + static_cast(ct2) + ); + + if (mag(eofs.Y()) < small) + { + return ePowerThermo + ( + eofs, + ct1.c0_, + ct1.n0_, + ct1.Tref_, + ct1.Hf_ + ); + } + else + { + return ePowerThermo + ( + eofs, + ct1.Y()/eofs.Y()*ct1.c0_ + + ct2.Y()/eofs.Y()*ct2.c0_, + ct1.Y()/eofs.Y()*ct1.n0_ + + ct2.Y()/eofs.Y()*ct2.n0_, + ct1.Y()/eofs.Y()*ct1.Tref_ + + ct2.Y()/eofs.Y()*ct2.Tref_, + ct1.Y()/eofs.Y()*ct1.Hf_ + + ct2.Y()/eofs.Y()*ct2.Hf_ + ); + } +} + + +template +inline Foam::ePowerThermo Foam::operator* +( + const scalar s, + const ePowerThermo& ct +) +{ + return ePowerThermo + ( + s*static_cast(ct), + ct.c0_, + ct.n0_, + ct.Tref_, + ct.Hf_ + ); +} + + +template +inline Foam::ePowerThermo Foam::operator== +( + const ePowerThermo& ct1, + const ePowerThermo& ct2 +) +{ + EquationOfState eofs + ( + static_cast(ct1) + == static_cast(ct2) + ); + + return ePowerThermo + ( + eofs, + ct2.Y()/eofs.Y()*ct2.c0_ + - ct1.Y()/eofs.Y()*ct1.c0_, + ct2.Y()/eofs.Y()*ct2.n0_ + - ct1.Y()/eofs.Y()*ct1.n0_, + ct2.Y()/eofs.Y()*ct2.Tref_ + - ct1.Y()/eofs.Y()*ct1.Tref_, + ct2.Y()/eofs.Y()*ct2.Hf_ + - ct1.Y()/eofs.Y()*ct1.Hf_ + ); +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/aluminium/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/aluminium/thermophysicalProperties index d46051b9ab..11e771fc76 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/aluminium/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/aluminium/thermophysicalProperties @@ -19,10 +19,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -41,7 +41,7 @@ mixture thermodynamics { Hf 0; - Cp 896; // [J/kg/K] + Cv 896; // [J/kg/K] } equationOfState diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/copper/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/copper/thermophysicalProperties index fb49f36917..b69d68b494 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/copper/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/copper/thermophysicalProperties @@ -19,10 +19,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -41,7 +41,7 @@ mixture thermodynamics { Hf 0; - Cp 385; // [J/kg/K] + Cv 385; // [J/kg/K] } equationOfState diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/system/solid/fvOptions b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/system/solid/fvOptions index bc21d87598..4b92eb10ed 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/system/solid/fvOptions +++ b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/system/solid/fvOptions @@ -37,7 +37,7 @@ fixedPower sources { - h + e { explicit $power; implicit 0; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/fvOptions b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/fvOptions index a19604cfdc..07ba6ea5ab 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/fvOptions +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/fvOptions @@ -24,7 +24,7 @@ porousToair master true; nbrModel airToporous; - fields (h); + fields (e); semiImplicit no; } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/fvOptions b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/fvOptions index 38b9a6aaf8..7125a16203 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/fvOptions +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/fvOptions @@ -28,7 +28,7 @@ options sources { - h + e { explicit 1e7; // W/m^3 == kg/m/s^3 implicit 0; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/thermophysicalProperties index 18782a0bfb..1ef1d72300 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/heater/thermophysicalProperties @@ -20,10 +20,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -45,7 +45,7 @@ mixture thermodynamics { Hf 0; - Cp 450; + Cv 450; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/metal/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/metal/thermophysicalProperties index 1588d050ff..c5c2a308fd 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/metal/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/constant/metal/thermophysicalProperties @@ -20,10 +20,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -45,7 +45,7 @@ mixture thermodynamics { Hf 0; - Cp 900; + Cv 900; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSchemes index 0d88811c16..fe16f26922 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSchemes @@ -33,7 +33,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear corrected; + laplacian(alpha,e) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSolution index 4c4ee62caf..6579e8e679 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/heater/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - h + e { solver GAMG; smoother symGaussSeidel; @@ -25,9 +25,9 @@ solvers relTol 0.1; } - hFinal + eFinal { - $h; + $e; relTol 0; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSchemes index 7835728434..5364564a75 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSchemes @@ -33,7 +33,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear corrected; + laplacian(alpha,e) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSolution index 756910e730..8310d9b602 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatedDuct/system/metal/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - h + e { solver GAMG; smoother symGaussSeidel; @@ -25,9 +25,9 @@ solvers relTol 0.1; } - hFinal + eFinal { - $h; + $e; relTol 0; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/constant/solid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/constant/solid/thermophysicalProperties index 062c89679c..421f3a2e8a 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/constant/solid/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/constant/solid/thermophysicalProperties @@ -19,10 +19,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -38,7 +38,7 @@ mixture thermodynamics { Hf 0; - Cp 450; + Cv 450; } transport { diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSchemes index 50de5dc78e..1ab9ea6d39 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear corrected; + laplacian(alpha,e) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSolution index 29c229853f..7dd58d9e46 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/reverseBurner/system/solid/fvSolution @@ -16,7 +16,7 @@ FoamFile solvers { - h + e { solver PCG; preconditioner DIC; @@ -24,9 +24,9 @@ solvers relTol 0.1; } - hFinal + eFinal { - $h; + $e; tolerance 1e-06; relTol 0; } @@ -41,7 +41,7 @@ relaxationFactors { equations { - h 0.7; + e 0.7; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/constant/solid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/constant/solid/thermophysicalProperties index e36ba36427..4bbffcaf89 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/constant/solid/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/constant/solid/thermophysicalProperties @@ -20,10 +20,10 @@ thermoType type heSolidThermo; mixture pureMixture; transport constIso; - thermo hConst; + thermo eConst; equationOfState rhoConst; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture @@ -45,7 +45,7 @@ mixture thermodynamics { Hf 0; - Cp 900; + Cv 900; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSchemes index 43bfef6f4a..cf86eda031 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSchemes @@ -33,7 +33,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear corrected; + laplacian(alpha,e) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSolution index ff31cc1632..2ed29b4e8e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger/system/solid/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - "h.*" + "e.*" { solver GAMG; smoother symGaussSeidel;