diff --git a/applications/solvers/combustion/PDRFoam/EaEqn.H b/applications/solvers/combustion/PDRFoam/EaEqn.H index 03d13f2693..1baaa7180f 100644 --- a/applications/solvers/combustion/PDRFoam/EaEqn.H +++ b/applications/solvers/combustion/PDRFoam/EaEqn.H @@ -7,7 +7,12 @@ + betav*fvc::ddt(rho, K) + fvc::div(phi, K) + ( hea.name() == "ea" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + phi/fvc::interpolate(rho), + p, + "div(phiv,p)" + ) : -betav*dpdt ) - fvm::laplacian(Db, hea) diff --git a/applications/solvers/combustion/PDRFoam/EauEqn.H b/applications/solvers/combustion/PDRFoam/EauEqn.H index 96412cc3c3..f031d90732 100644 --- a/applications/solvers/combustion/PDRFoam/EauEqn.H +++ b/applications/solvers/combustion/PDRFoam/EauEqn.H @@ -8,7 +8,12 @@ if (ign.ignited()) + (betav*fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou() + ( heau.name() == "eau" - ? fvc::div(phi, volScalarField("Ep", p/rho))*rho/thermo.rhou() + ? fvc::div + ( + phi/fvc::interpolate(rho), + p, + "div(phiv,p)" + )*rho/thermo.rhou() : -betav*dpdt*rho/thermo.rhou() ) - fvm::laplacian(Db, heau) diff --git a/applications/solvers/combustion/XiFoam/EaEqn.H b/applications/solvers/combustion/XiFoam/EaEqn.H index a9e72b4627..6840c4eb6d 100644 --- a/applications/solvers/combustion/XiFoam/EaEqn.H +++ b/applications/solvers/combustion/XiFoam/EaEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( hea.name() == "ea" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), hea) diff --git a/applications/solvers/combustion/XiFoam/EauEqn.H b/applications/solvers/combustion/XiFoam/EauEqn.H index 0d81bd6e60..b13a63bb60 100644 --- a/applications/solvers/combustion/XiFoam/EauEqn.H +++ b/applications/solvers/combustion/XiFoam/EauEqn.H @@ -8,7 +8,12 @@ if (ign.ignited()) + (fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou() + ( heau.name() == "eau" - ? fvc::div(phi, volScalarField("Ep", p/rho))*rho/thermo.rhou() + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + )*rho/thermo.rhou() : -dpdt*rho/thermo.rhou() ) - fvm::laplacian(turbulence->alphaEff(), heau) diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index d66cdd8130..7b005cc311 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -66,5 +66,5 @@ K = 0.5*magSqr(U); if (thermo.dpdt()) { - dpdt = fvc::ddt(p); + dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p); } diff --git a/applications/solvers/combustion/fireFoam/YEEqn.H b/applications/solvers/combustion/fireFoam/YEEqn.H index 340cfc63b1..f979d3bb7d 100644 --- a/applications/solvers/combustion/fireFoam/YEEqn.H +++ b/applications/solvers/combustion/fireFoam/YEEqn.H @@ -55,7 +55,12 @@ tmp > mvConvection + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/combustion/reactingFoam/EEqn.H b/applications/solvers/combustion/reactingFoam/EEqn.H index 33dbc46287..e1bf055604 100644 --- a/applications/solvers/combustion/reactingFoam/EEqn.H +++ b/applications/solvers/combustion/reactingFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H index 3ad3c0f03e..6288b8a0af 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/compressible/sonicFoam/EEqn.H b/applications/solvers/compressible/sonicFoam/EEqn.H index 15979381a9..f10474c587 100644 --- a/applications/solvers/compressible/sonicFoam/EEqn.H +++ b/applications/solvers/compressible/sonicFoam/EEqn.H @@ -2,7 +2,8 @@ solve ( fvm::ddt(rho, e) + fvm::div(phi, e) - + fvc::ddt(rho, K) + fvc::div(phi, volScalarField("Ekp", K + p/rho)) + + fvc::ddt(rho, K) + fvc::div(phi, K) + + fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)") - fvm::laplacian(turbulence->alphaEff(), e) ); diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H deleted file mode 100644 index 994c2862b8..0000000000 --- a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H +++ /dev/null @@ -1,11 +0,0 @@ -{ - solve - ( - fvm::ddt(rho, e) + fvm::div(phi, e) - + fvc::ddt(rho, K) + fvc::div(phi, K) - + fvc::div(phi/fvc::interpolate(rho) + mesh.phi(), p, "div(phiv,p)") - - fvm::laplacian(turbulence->alphaEff(), e) - ); - - thermo.correct(); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H index c5680e7777..9f41c9eb37 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turb.alphaEff(), he) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H index 006d2231f4..92219b9879 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H index cdc475d42f..f5a909a9dd 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H index 14996cfdf5..c8ef9bf84e 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H @@ -7,7 +7,12 @@ + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" - ? fvc::div(phi, volScalarField("Ep", p/rho)) + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H index 475077d317..0301fba2ea 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H @@ -79,5 +79,5 @@ K = 0.5*magSqr(U); if (thermo.dpdt()) { - dpdt = fvc::ddt(p); + dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p); } diff --git a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C index 7adb5f1688..3b5e98aae3 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,4 +148,39 @@ void Foam::fvc::makeAbsolute } +Foam::tmp Foam::fvc::absolute +( + const tmp& tphi, + const volVectorField& U +) +{ + if (tphi().mesh().moving()) + { + return tphi + fvc::meshPhi(U); + } + else + { + return tphi; + } +} + + +Foam::tmp Foam::fvc::absolute +( + const tmp& tphi, + const volScalarField& rho, + const volVectorField& U +) +{ + if (tphi().mesh().moving()) + { + return tphi + fvc::meshPhi(rho, U); + } + else + { + return tphi; + } +} + + // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H index 9dd4d4fad8..4f47c381e3 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,6 +116,22 @@ namespace fvc const volScalarField& rho, const volVectorField& U ); + + + //- Return the given relative flux in absolute form + tmp absolute + ( + const tmp& tphi, + const volVectorField& U + ); + + //- Return the given relative flux in absolute form + tmp absolute + ( + const tmp& tphi, + const volScalarField& rho, + const volVectorField& U + ); } diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermos.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermos.C index 517a74c79b..49c462d383 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermos.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermos.C @@ -33,11 +33,13 @@ License #include "perfectGas.H" #include "hConstThermo.H" #include "janafThermo.H" -#include "absoluteEnthalpy.H" #include "thermo.H" #include "constTransport.H" #include "sutherlandTransport.H" +#include "absoluteEnthalpy.H" +#include "absoluteInternalEnergy.H" + #include "homogeneousMixture.H" #include "inhomogeneousMixture.H" #include "veryInhomogeneousMixture.H" @@ -91,6 +93,20 @@ makeReactionThermo specie ); +makeReactionThermo +( + psiThermo, + psiuReactionThermo, + heheuPsiThermo, + egrMixture, + constTransport, + absoluteEnthalpy, + hConstThermo, + perfectGas, + specie +); + + makeReactionThermo ( psiThermo, @@ -136,9 +152,49 @@ makeReactionThermo psiuReactionThermo, heheuPsiThermo, egrMixture, - constTransport, + sutherlandTransport, absoluteEnthalpy, - hConstThermo, + janafThermo, + perfectGas, + specie +); + + +makeReactionThermo +( + psiThermo, + psiuReactionThermo, + heheuPsiThermo, + homogeneousMixture, + sutherlandTransport, + absoluteInternalEnergy, + janafThermo, + perfectGas, + specie +); + +makeReactionThermo +( + psiThermo, + psiuReactionThermo, + heheuPsiThermo, + inhomogeneousMixture, + sutherlandTransport, + absoluteInternalEnergy, + janafThermo, + perfectGas, + specie +); + +makeReactionThermo +( + psiThermo, + psiuReactionThermo, + heheuPsiThermo, + veryInhomogeneousMixture, + sutherlandTransport, + absoluteInternalEnergy, + janafThermo, perfectGas, specie ); @@ -150,7 +206,7 @@ makeReactionThermo heheuPsiThermo, egrMixture, sutherlandTransport, - absoluteEnthalpy, + absoluteInternalEnergy, janafThermo, perfectGas, specie diff --git a/src/thermophysicalModels/specie/thermo/absoluteInternalEnergy/absoluteInternalEnergy.H b/src/thermophysicalModels/specie/thermo/absoluteInternalEnergy/absoluteInternalEnergy.H new file mode 100644 index 0000000000..6ea5df7dc2 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/absoluteInternalEnergy/absoluteInternalEnergy.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::absoluteInternalEnergy + +Description + Thermodynamics mapping class to expose the absolute internal energy function + as the standard internal energy function e(T). + +\*---------------------------------------------------------------------------*/ + +#ifndef absoluteInternalEnergy_H +#define absoluteInternalEnergy_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class absoluteInternalEnergy Declaration +\*---------------------------------------------------------------------------*/ + +template +class absoluteInternalEnergy +{ + +public: + + // Constructors + + //- Construct + absoluteInternalEnergy() + {} + + + // Member Functions + + //- Return the instantiated type name + static word typeName() + { + return "absoluteInternalEnergy"; + } + + // Fundamental properties + + static word name() + { + return "ea"; + } + + // Absolute internal energy [J/kmol] + scalar he + ( + const Thermo& thermo, + const scalar p, + const scalar T + ) const + { + return thermo.ea(p, T); + } + + // Heat capacity at constant volume [J/(kmol K)] + scalar cpv + ( + const Thermo& thermo, + const scalar p, + const scalar T + ) const + { + return thermo.cv(p, T); + } + + //- cp/cv [] + scalar cpBycpv + ( + const Thermo& thermo, + const scalar p, + const scalar T + ) const + { + return thermo.gamma(p, T); + } + + // Absolute internal energy [J/kg] + scalar HE + ( + const Thermo& thermo, + const scalar p, + const scalar T + ) const + { + return thermo.Ea(p, T); + } + + //- Temperature from absolute internal energy + // given an initial temperature T0 + scalar THE + ( + const Thermo& thermo, + const scalar e, + const scalar p, + const scalar T0 + ) const + { + return thermo.TEa(e, p, T0); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/sensibleInternalEnergy/sensibleInternalEnergy.H b/src/thermophysicalModels/specie/thermo/sensibleInternalEnergy/sensibleInternalEnergy.H index 7adf3e34d7..b6b5889ff5 100644 --- a/src/thermophysicalModels/specie/thermo/sensibleInternalEnergy/sensibleInternalEnergy.H +++ b/src/thermophysicalModels/specie/thermo/sensibleInternalEnergy/sensibleInternalEnergy.H @@ -102,7 +102,7 @@ public: return thermo.gamma(p, T); } - //- Sensible enthalpy [J/kg] + //- Sensible internal energy [J/kg] scalar HE ( const Thermo& thermo, diff --git a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H index 21a58ec779..27bb855c43 100644 --- a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H +++ b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H @@ -413,14 +413,14 @@ inline Foam::scalar Foam::species::thermo::THs template class Type> inline Foam::scalar Foam::species::thermo::THa ( - const scalar ht, + const scalar ha, const scalar p, const scalar T0 ) const { return T ( - ht, + ha, p, T0, &thermo::Ha, @@ -453,7 +453,7 @@ inline Foam::scalar Foam::species::thermo::TEs template class Type> inline Foam::scalar Foam::species::thermo::TEa ( - const scalar e, + const scalar ea, const scalar p, const scalar T0 ) const diff --git a/tutorials/combustion/engineFoam/kivaTest/constant/thermophysicalProperties b/tutorials/combustion/engineFoam/kivaTest/constant/thermophysicalProperties index 12d72f931e..b7c4847d5b 100644 --- a/tutorials/combustion/engineFoam/kivaTest/constant/thermophysicalProperties +++ b/tutorials/combustion/engineFoam/kivaTest/constant/thermophysicalProperties @@ -24,6 +24,7 @@ thermoType equationOfState perfectGas; specie specie; energy absoluteEnthalpy; + //energy absoluteInternalEnergy; } stoichiometricAirFuelMassRatio stoichiometricAirFuelMassRatio [ 0 0 0 0 0 0 0 ] 15.0336; diff --git a/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes b/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes index 3c1bc03aee..9bfa83ecf5 100644 --- a/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes +++ b/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes @@ -31,6 +31,8 @@ divSchemes div(phi,U) Gauss upwind; div(phi,K) Gauss upwind; div(phid,p) Gauss upwind; + div(meshPhi,p) Gauss upwind; + div(phiv,p) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; @@ -45,6 +47,8 @@ divSchemes b limitedLinear01 1; ha limitedLinear 1; hau limitedLinear 1; + ea limitedLinear 1; + eau limitedLinear 1; }; div(U) Gauss linear; div((Su*grad(b))) Gauss linear; @@ -54,17 +58,7 @@ divSchemes laplacianSchemes { - default none; - laplacian(muEff,U) Gauss linear corrected; - laplacian(DkEff,k) Gauss linear limited 0.5; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.5; - laplacian(DREff,R) Gauss linear limited 0.5; - laplacian((rho*(1|A(U))),p) Gauss linear limited 0.5; - laplacian(alphaEff,b) Gauss linear limited 0.5; - laplacian(muEff,ft) Gauss linear limited 0.5; - laplacian(alphaEff,ha) Gauss linear limited 0.5; - laplacian(alphaEff,hau) Gauss linear limited 0.5; - laplacian(alphaEff,ft) Gauss linear limited 0.5; + default Gauss linear limited 0.5; } interpolationSchemes diff --git a/tutorials/combustion/engineFoam/kivaTest/system/fvSolution b/tutorials/combustion/engineFoam/kivaTest/system/fvSolution index f020df3d4e..b164746874 100644 --- a/tutorials/combustion/engineFoam/kivaTest/system/fvSolution +++ b/tutorials/combustion/engineFoam/kivaTest/system/fvSolution @@ -47,14 +47,14 @@ solvers relTol 0; } - "(U|Xi|hau|ft|b|ha|k|epsilon)" + "(U|Xi|hau|eau|ft|b|ha|ea|k|epsilon)" { solver PBiCG; preconditioner DILU; tolerance 1e-05; relTol 0.1; } - "(U|ft|Xi|hau|b|ha|k|epsilon)Final" + "(U|ft|Xi|hau|eau|b|ha|ea|k|epsilon)Final" { $U; tolerance 1e-05;