From 63feb9ad33ba0d6b5ddb8b6eab4dabe612ce1192 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 1 Nov 2022 12:43:25 +0000 Subject: [PATCH] fluidThermophysicalTransportModel: Removed alphaEff from the public interface alphaEff is now an internal field used only for the implicit energy correction term, kappaEff, q and divq are the general and rational interface to thermal transport. XiFoam and PDRFoam now explicitly instantiate a unityLewisEddyDiffusivity fluidThermophysicalTransportModel as the the unity Lewis number approximation is hard-coded into the formulation of the energy/composition system. --- .../solvers/combustion/XiFoam/EaEqn.H | 2 +- .../solvers/combustion/XiFoam/EauEqn.H | 2 +- .../combustion/XiFoam/PDRFoam/PDRFoam.C | 5 +++-- .../combustion/XiFoam/PDRFoam/createFields.H | 20 ++++++++++--------- .../solvers/combustion/XiFoam/XiFoam.C | 5 +++-- applications/solvers/combustion/XiFoam/bEqn.H | 4 ++-- .../solvers/combustion/XiFoam/createFields.H | 15 ++++++++++---- .../solvers/combustion/XiFoam/ftEqn.H | 2 +- .../fluidThermophysicalTransportModel.H | 3 --- .../LESThermophysicalTransportModel.H | 3 --- .../RASThermophysicalTransportModel.H | 3 --- .../eddyDiffusivity/eddyDiffusivity.H | 13 ++++++------ .../unityLewisEddyDiffusivity.C | 5 +++-- .../unityLewisEddyDiffusivity.H | 16 ++++++++------- .../volumeFractionSource.C | 2 +- 15 files changed, 53 insertions(+), 47 deletions(-) diff --git a/applications/solvers/combustion/XiFoam/EaEqn.H b/applications/solvers/combustion/XiFoam/EaEqn.H index 67bfb685c5..6827211f60 100644 --- a/applications/solvers/combustion/XiFoam/EaEqn.H +++ b/applications/solvers/combustion/XiFoam/EaEqn.H @@ -10,7 +10,7 @@ ? mvConvection->fvcDiv(fvc::absolute(phi, rho, U), p/rho) : -dpdt ) - - fvm::laplacian(thermophysicalTransport->alphaEff(), hea) + + thermophysicalTransport.divq(hea) + fvModels.source(rho, hea) ); diff --git a/applications/solvers/combustion/XiFoam/EauEqn.H b/applications/solvers/combustion/XiFoam/EauEqn.H index 4893cca11e..b67022e7a7 100644 --- a/applications/solvers/combustion/XiFoam/EauEqn.H +++ b/applications/solvers/combustion/XiFoam/EauEqn.H @@ -12,7 +12,7 @@ if (ign.ignited()) *rho/thermo.rhou() : -dpdt*rho/thermo.rhou() ) - - fvm::laplacian(thermophysicalTransport->alphaEff(), heau) + + thermophysicalTransport.divq(heau) // These terms cannot be used in partially-premixed combustion due to // the resultant inconsistency between ft and heau transport. diff --git a/applications/solvers/combustion/XiFoam/PDRFoam/PDRFoam.C b/applications/solvers/combustion/XiFoam/PDRFoam/PDRFoam.C index c9bbf49dde..3efbccd20e 100644 --- a/applications/solvers/combustion/XiFoam/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/XiFoam/PDRFoam/PDRFoam.C @@ -70,7 +70,8 @@ Description #include "fvCFD.H" #include "psiuMulticomponentThermo.H" #include "compressibleMomentumTransportModels.H" -#include "fluidThermoThermophysicalTransportModel.H" +#include "RASThermophysicalTransportModel.H" +#include "unityLewisEddyDiffusivity.H" #include "laminarFlameSpeed.H" #include "XiModel.H" #include "PDRDragModel.H" @@ -144,7 +145,7 @@ int main(int argc, char *argv[]) if (pimple.turbCorr()) { turbulence->correct(); - thermophysicalTransport->correct(); + thermophysicalTransport.correct(); } } diff --git a/applications/solvers/combustion/XiFoam/PDRFoam/createFields.H b/applications/solvers/combustion/XiFoam/PDRFoam/createFields.H index 831d5cf8da..0e1ea8225a 100644 --- a/applications/solvers/combustion/XiFoam/PDRFoam/createFields.H +++ b/applications/solvers/combustion/XiFoam/PDRFoam/createFields.H @@ -58,15 +58,17 @@ autoPtr turbulence ); Info<< "Creating thermophysical transport model\n" << endl; -autoPtr -thermophysicalTransport -( - RASFluidThermophysicalTransportModel::New - ( - turbulence(), - thermo - ) -); +turbulenceThermophysicalTransportModels::unityLewisEddyDiffusivity +< + RASThermophysicalTransportModel + < + ThermophysicalTransportModel + < + compressibleMomentumTransportModel, + fluidThermo + > + > +> thermophysicalTransport(turbulence(), thermo, true); Info<< "Creating field dpdt\n" << endl; volScalarField dpdt diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index 4173dc9d88..46e91f8651 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -52,7 +52,8 @@ Description #include "fvCFD.H" #include "psiuMulticomponentThermo.H" #include "compressibleMomentumTransportModels.H" -#include "fluidThermoThermophysicalTransportModel.H" +#include "RASThermophysicalTransportModel.H" +#include "unityLewisEddyDiffusivity.H" #include "laminarFlameSpeed.H" #include "ignition.H" #include "Switch.H" @@ -177,7 +178,7 @@ int main(int argc, char *argv[]) if (pimple.turbCorr()) { turbulence->correct(); - thermophysicalTransport->correct(); + thermophysicalTransport.correct(); } } diff --git a/applications/solvers/combustion/XiFoam/bEqn.H b/applications/solvers/combustion/XiFoam/bEqn.H index b653d36cdd..9e08594cdb 100644 --- a/applications/solvers/combustion/XiFoam/bEqn.H +++ b/applications/solvers/combustion/XiFoam/bEqn.H @@ -52,7 +52,7 @@ if (ign.ignited()) + mvConvection->fvmDiv(phi, b) + fvm::div(phiSt, b) - fvm::Sp(fvc::div(phiSt), b) - - fvm::laplacian(thermophysicalTransport->alphaEff(), b) + - fvm::laplacian(thermophysicalTransport.DEff(b), b) == fvModels.source(rho, b) ); @@ -105,7 +105,7 @@ if (ign.ignited()) phiSt - fvc::interpolate ( - fvc::laplacian(thermophysicalTransport->alphaEff(), b)/mgb + fvc::laplacian(thermophysicalTransport.DEff(b), b)/mgb )*nf + fvc::interpolate(rho)*fvc::interpolate(Su*(1.0/Xi - Xi))*nf ); diff --git a/applications/solvers/combustion/XiFoam/createFields.H b/applications/solvers/combustion/XiFoam/createFields.H index 7f9762d8cc..33f2f51e1c 100644 --- a/applications/solvers/combustion/XiFoam/createFields.H +++ b/applications/solvers/combustion/XiFoam/createFields.H @@ -59,10 +59,17 @@ autoPtr turbulence ); Info<< "Creating thermophysical transport model\n" << endl; -autoPtr thermophysicalTransport -( - fluidThermoThermophysicalTransportModel::New(turbulence(), thermo) -); +turbulenceThermophysicalTransportModels::unityLewisEddyDiffusivity +< + RASThermophysicalTransportModel + < + ThermophysicalTransportModel + < + compressibleMomentumTransportModel, + fluidThermo + > + > +> thermophysicalTransport(turbulence(), thermo, true); Info<< "Creating field dpdt\n" << endl; volScalarField dpdt diff --git a/applications/solvers/combustion/XiFoam/ftEqn.H b/applications/solvers/combustion/XiFoam/ftEqn.H index c8a1e82633..117995c258 100644 --- a/applications/solvers/combustion/XiFoam/ftEqn.H +++ b/applications/solvers/combustion/XiFoam/ftEqn.H @@ -17,7 +17,7 @@ if (composition.contains("ft")) ( fvm::ddt(rho, ft) + mvConvection->fvmDiv(phi, ft) - - fvm::laplacian(thermophysicalTransport->alphaEff(), ft) + - fvm::laplacian(thermophysicalTransport.DEff(ft), ft) == fvModels.source(rho, ft) ); diff --git a/src/ThermophysicalTransportModels/fluid/fluidThermophysicalTransportModel/fluidThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/fluid/fluidThermophysicalTransportModel/fluidThermophysicalTransportModel.H index 0c76f2d488..2150a0311b 100644 --- a/src/ThermophysicalTransportModels/fluid/fluidThermophysicalTransportModel/fluidThermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/fluid/fluidThermophysicalTransportModel/fluidThermophysicalTransportModel.H @@ -87,9 +87,6 @@ public: //- Access function to fluid thermophysical properties virtual const fluidThermo& thermo() const = 0; - //- Effective thermal turbulent diffusivity of mixture [kg/m/s] - virtual tmp alphaEff() const = 0; - //- Effective mass diffusion coefficient // for a given specie mass-fraction [kg/m/s] virtual tmp DEff(const volScalarField& Yi) const = 0; diff --git a/src/ThermophysicalTransportModels/fluid/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/fluid/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H index d40a6c5686..ec110f12d6 100644 --- a/src/ThermophysicalTransportModels/fluid/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/fluid/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.H @@ -154,9 +154,6 @@ public: // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const = 0; - //- Effective thermal turbulent diffusivity of mixture [kg/m/s] - virtual tmp alphaEff() const = 0; - //- Correct the LES transport virtual void correct(); diff --git a/src/ThermophysicalTransportModels/fluid/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H b/src/ThermophysicalTransportModels/fluid/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H index 7761ecd64b..0098e109c9 100644 --- a/src/ThermophysicalTransportModels/fluid/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H +++ b/src/ThermophysicalTransportModels/fluid/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.H @@ -154,9 +154,6 @@ public: // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const = 0; - //- Effective thermal turbulent diffusivity of mixture [kg/m/s] - virtual tmp alphaEff() const = 0; - //- Correct the RAS transport virtual void correct(); diff --git a/src/ThermophysicalTransportModels/fluid/turbulence/eddyDiffusivity/eddyDiffusivity.H b/src/ThermophysicalTransportModels/fluid/turbulence/eddyDiffusivity/eddyDiffusivity.H index f75a27d4b3..f65fed8426 100644 --- a/src/ThermophysicalTransportModels/fluid/turbulence/eddyDiffusivity/eddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/fluid/turbulence/eddyDiffusivity/eddyDiffusivity.H @@ -85,6 +85,13 @@ protected: virtual void correctAlphat(); + //- Effective thermal turbulent diffusivity of mixture [kg/m/s] + // Used for the implicit energy correction on the temperature laplacian + virtual tmp alphaEff() const + { + return this->thermo().kappa()/this->thermo().Cpv() + alphat(); + } + public: @@ -151,12 +158,6 @@ public: + this->thermo().Cp().boundaryField()[patchi]*alphat(patchi); } - //- Effective thermal turbulent diffusivity of mixture [kg/m/s] - virtual tmp alphaEff() const - { - return this->thermo().kappa()/this->thermo().Cpv() + alphat(); - } - //- Effective mass diffusion coefficient // for a given specie mass-fraction [kg/m/s] virtual tmp DEff(const volScalarField& Yi) const; diff --git a/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C b/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C index 64509c12c3..24a55a39db 100644 --- a/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.C @@ -53,7 +53,8 @@ unityLewisEddyDiffusivity:: unityLewisEddyDiffusivity ( const momentumTransportModel& momentumTransport, - const thermoModel& thermo + const thermoModel& thermo, + const bool allowDefaultPrt ) : unityLewisEddyDiffusivity @@ -61,7 +62,7 @@ unityLewisEddyDiffusivity typeName, momentumTransport, thermo, - false + allowDefaultPrt ) { this->printCoeffs(typeName); diff --git a/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H b/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H index 79237729e7..b2e06c46d4 100644 --- a/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/fluid/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H @@ -82,6 +82,13 @@ protected: virtual void correctAlphat(); + //- Effective thermal turbulent diffusivity of mixture [kg/m/s] + // Used for the implicit energy correction on the temperature laplacian + virtual tmp alphaEff() const + { + return this->thermo().kappa()/this->thermo().Cpv() + alphat(); + } + public: @@ -106,7 +113,8 @@ public: unityLewisEddyDiffusivity ( const momentumTransportModel& momentumTransport, - const thermoModel& thermo + const thermoModel& thermo, + const bool allowDefaultPrt = false ); //- Construct from a type name, a momentum transport model and a thermo @@ -159,12 +167,6 @@ public: + this->thermo().Cp().boundaryField()[patchi]*alphat(patchi); } - //- Effective thermal turbulent diffusivity of mixture [kg/m/s] - virtual tmp alphaEff() const - { - return this->thermo().kappa()/this->thermo().Cpv() + alphat(); - } - //- Effective mass diffusion coefficient // for a given specie mass-fraction [kg/m/s] virtual tmp DEff(const volScalarField& Yi) const diff --git a/src/fvModels/derived/volumeFractionSource/volumeFractionSource.C b/src/fvModels/derived/volumeFractionSource/volumeFractionSource.C index ee09ef5709..89934ecade 100644 --- a/src/fvModels/derived/volumeFractionSource/volumeFractionSource.C +++ b/src/fvModels/derived/volumeFractionSource/volumeFractionSource.C @@ -113,7 +113,7 @@ Foam::tmp Foam::fv::volumeFractionSource::D fieldName == ttm.thermo().T().name() ? ttm.kappaEff() : fieldName == ttm.thermo().he().name() - ? ttm.alphaEff() + ? ttm.kappaEff()/ttm.thermo().Cpv() : ttm.momentumTransport().rho()*ttm.momentumTransport().nuEff(); } else