From 6d563efec1b6f3a8aed410998d05e2567335600b Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 7 Sep 2022 18:31:04 +0100 Subject: [PATCH] fluidThermo: Moved kappaEff and alphaEff into ThermophysicalTransportModels This completes the separation between thermodynamics and thermophysical transport modelling and all models and boundary conditions involving heat transfer now obtain the transport coefficients from the appropriate ThermophysicalTransportModels rather than from fluidThermo. --- .../compressibleInterPhaseTransportModel.C | 55 +++++++------- .../compressibleInterPhaseTransportModel.H | 1 + .../compressibleMultiphaseInterFoam/TEqn.H | 2 +- .../compressibleMultiphaseMixture.C | 18 ++++- .../compressibleMultiphaseMixture.H | 5 +- ...ayatillekeWallFunctionFvPatchScalarField.C | 2 +- .../temperatureCoupledBase.C | 35 +++------ .../eddyDiffusivity/eddyDiffusivity.H | 20 ++---- .../nonUnityLewisEddyDiffusivity.C | 12 +++- .../nonUnityLewisEddyDiffusivity.H | 14 ++-- .../unityLewisEddyDiffusivity.H | 18 ++--- .../basic/fluidThermo/fluidThermo.H | 33 --------- .../basic/heThermo/heThermo.C | 72 ------------------- .../basic/heThermo/heThermo.H | 29 -------- 14 files changed, 84 insertions(+), 232 deletions(-) diff --git a/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C index 8b0aeb2951..aef53a550a 100644 --- a/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C @@ -138,44 +138,37 @@ Foam::compressibleInterPhaseTransportModel::compressibleInterPhaseTransportModel Foam::tmp Foam::compressibleInterPhaseTransportModel::alphaEff() const { - /* ***HGW if (twoPhaseTransport_) { return - mixture_.alpha1()*mixture_.thermo1().alphaEff - ( - turbulence1_->alphat() - ) - + mixture_.alpha2()*mixture_.thermo2().alphaEff - ( - turbulence2_->alphat() - ); + mixture_.alpha1() + *( + mixture_.thermo1().kappa() + + mixture_.thermo1().rho()*mixture_.thermo1().Cp() + *turbulence1_->nut() + )/mixture_.thermo1().Cv() + + mixture_.alpha2() + *( + mixture_.thermo2().kappa() + + mixture_.thermo2().rho()*mixture_.thermo2().Cp() + *turbulence2_->nut() + )/mixture_.thermo2().Cv(); } else - { - return mixture_.alphaEff(turbulence_->alphat()); - } - */ - - if (twoPhaseTransport_) { return - mixture_.alpha1()*mixture_.thermo1().alphaEff - ( - mixture_.thermo1().rho()*turbulence1_->nut() - ) - + mixture_.alpha2()*mixture_.thermo2().alphaEff - ( - mixture_.thermo2().rho()*turbulence2_->nut() - ); - } - else - { - const volScalarField alphat(mixture_.rho()*turbulence_->nut()); - - return - mixture_.alpha1()*mixture_.thermo1().alphaEff(alphat) - + mixture_.alpha2()*mixture_.thermo2().alphaEff(alphat); + mixture_.alpha1() + *( + mixture_.thermo1().kappa() + + mixture_.thermo1().rho()*mixture_.thermo1().Cp() + *turbulence_->nut() + )/mixture_.thermo1().Cv() + + mixture_.alpha2() + *( + mixture_.thermo2().kappa() + + mixture_.thermo2().rho()*mixture_.thermo2().Cp() + *turbulence_->nut() + )/mixture_.thermo2().Cv(); } } diff --git a/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H index 6ee5bf48cb..c3bc547a83 100644 --- a/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H @@ -115,6 +115,7 @@ public: // Member Functions //- Return the effective temperature transport coefficient + // derived from the phase internal energy equations i.e. tmp alphaEff() const; //- Return the effective momentum stress divergence diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/TEqn.H index 0c42e7404f..30bddd01a7 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/TEqn.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/TEqn.H @@ -2,7 +2,7 @@ fvScalarMatrix TEqn ( fvm::ddt(rho, T) + fvm::div(mixture.rhoPhi(), T) - fvm::Sp(contErr, T) - - fvm::laplacian(mixture.alphaEff(rho*turbulence->nut()), T) + - fvm::laplacian(mixture.alphaEff(turbulence->nut()), T) + ( fvc::div(fvc::absolute(phi, U), p)()() // - contErr/rho*p + (fvc::ddt(rho, K) + fvc::div(mixture.rhoPhi(), K))()() diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.C index 0d93c5be8f..9e5b31f59f 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.C @@ -247,16 +247,28 @@ Foam::tmp Foam::compressibleMultiphaseMixture::nu Foam::tmp Foam::compressibleMultiphaseMixture::alphaEff ( - const volScalarField& alphat + const volScalarField& nut ) const { PtrDictionary::const_iterator phasei = phases_.begin(); - tmp talphaEff(phasei()*phasei().thermo().alphaEff(alphat)); + tmp talphaEff + ( + phasei() + *( + phasei().thermo().kappa() + + phasei().thermo().rho()*phasei().thermo().Cp()*nut + )/phasei().thermo().Cv() + ); for (++phasei; phasei != phases_.end(); ++phasei) { - talphaEff.ref() += phasei()*phasei().thermo().alphaEff(alphat); + talphaEff.ref() += + phasei() + *( + phasei().thermo().kappa() + + phasei().thermo().rho()*phasei().thermo().Cp()*nut + )/phasei().thermo().Cv(); } return talphaEff; diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.H index 4943936016..eae0a737b1 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseMixture/compressibleMultiphaseMixture.H @@ -263,10 +263,11 @@ public: //- Kinematic viscosity of mixture for patch [m^2/s] virtual tmp nu(const label patchi) const; - //- Effective thermal diffusivity of mixture [W/m/K] + //- Return the effective temperature transport coefficient + // derived from the phase internal energy equations i.e. virtual tmp alphaEff ( - const volScalarField& alphat + const volScalarField& nut ) const; //- Return the phase-averaged reciprocal Cv diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/ThermophysicalTransportModels/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index 170cae2268..e48524ae32 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -191,7 +191,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() const fvPatchScalarField& hew = ttm.thermo().he().boundaryField()[patchi]; // Heat flux [W/m^2] - lagging alphatw - const scalarField qDot(ttm.thermo().alphaEff(alphatw, patchi)*hew.snGrad()); + const scalarField qDot(ttm.alphaEff(patchi)*hew.snGrad()); // Populate boundary values forAll(alphatw, facei) diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C index b9f36f71c8..a61fd077dc 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C @@ -71,36 +71,21 @@ Foam::tmp Foam::temperatureCoupledBase::kappa const word& phase(Tp.internalField().group()); - const word fluidThermoName + const word ttmName ( - IOobject::groupName(physicalProperties::typeName, phase) + IOobject::groupName + ( + thermophysicalTransportModel::typeName, + phase + ) ); - if (mesh.foundObject(fluidThermoName)) + if (mesh.foundObject(ttmName)) { - static word ttmName - ( - IOobject::groupName - ( - thermophysicalTransportModel::typeName, - phase - ) - ); + const thermophysicalTransportModel& ttm = + mesh.lookupObject(ttmName); - if (mesh.foundObject(ttmName)) - { - const thermophysicalTransportModel& ttm = - mesh.lookupObject(ttmName); - - return ttm.kappaEff(patchi); - } - else - { - const fluidThermo& thermo = - mesh.lookupObject(fluidThermoName); - - return thermo.kappa().boundaryField()[patchi]; - } + return ttm.kappaEff(patchi); } else if (mesh.foundObject(physicalProperties::typeName)) { diff --git a/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H index 54fdfc29b6..d5a7826665 100644 --- a/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/eddyDiffusivity/eddyDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -139,35 +139,29 @@ public: // of mixture [W/m/K] virtual tmp kappaEff() const { - return this->thermo().kappaEff(alphat()); + return this->thermo().kappa() + this->thermo().Cp()*alphat(); } //- Effective thermal turbulent diffusivity for temperature // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const { - return this->thermo().kappaEff - ( - alphat(patchi), - patchi - ); + return + this->thermo().kappa().boundaryField()[patchi] + + this->thermo().Cp().boundaryField()[patchi]*alphat(patchi); } //- Effective thermal turbulent diffusivity of mixture [kg/m/s] virtual tmp alphaEff() const { - return this->thermo().alphaEff(alphat()); + return this->thermo().alphahe() + alphat(); } //- Effective thermal turbulent diffusivity of mixture // for patch [kg/m/s] virtual tmp alphaEff(const label patchi) const { - return this->thermo().alphaEff - ( - alphat(patchi), - patchi - ); + return this->thermo().alphahe(patchi) + alphat(patchi); } //- Effective mass diffusion coefficient diff --git a/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C b/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C index 47805e10a4..7f25e52b64 100644 --- a/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,7 +129,10 @@ nonUnityLewisEddyDiffusivity::q() const fvc::interpolate ( this->alpha() - *this->thermo().alphaEff((this->Prt_/Sct_)*this->alphat()) + *( + this->thermo().kappa()/this->thermo().Cp() + + (this->Prt_/Sct_)*this->alphat() + ) )*hGradY; } @@ -185,7 +188,10 @@ nonUnityLewisEddyDiffusivity::divq fvc::interpolate ( this->alpha() - *this->thermo().alphaEff((this->Prt_/Sct_)*this->alphat()) + *( + this->thermo().kappa()/this->thermo().Cp() + + (this->Prt_/Sct_)*this->alphat() + ) )*hGradY*he.mesh().magSf() ); diff --git a/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.H index 6c87bb5bf6..6a1f162b49 100644 --- a/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,7 +125,8 @@ public: return volScalarField::New ( "DEff", - this->thermo().alphaEff((this->Prt_/Sct_)*this->alphat()) + this->thermo().kappa()/this->thermo().Cp() + + (this->Prt_/Sct_)*this->alphat() ); } @@ -137,11 +138,10 @@ public: const label patchi ) const { - return this->thermo().alphaEff - ( - this->Prt_.value()/Sct_.value()*this->alphat(patchi), - patchi - ); + return + this->thermo().kappa().boundaryField()[patchi] + /this->thermo().Cp().boundaryField()[patchi] + + this->Prt_.value()/Sct_.value()*this->alphat(patchi); } //- Return the heat flux [W/m^2] diff --git a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H index a67deed171..a46488a38d 100644 --- a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H @@ -147,35 +147,29 @@ public: // of mixture [W/m/K] virtual tmp kappaEff() const { - return this->thermo().kappaEff(alphat()); + return this->thermo().kappa() + this->thermo().Cp()*alphat(); } //- Effective thermal turbulent diffusivity for temperature // of mixture for patch [W/m/K] virtual tmp kappaEff(const label patchi) const { - return this->thermo().kappaEff - ( - alphat(patchi), - patchi - ); + return + this->thermo().kappa().boundaryField()[patchi] + + this->thermo().Cp().boundaryField()[patchi]*alphat(patchi); } //- Effective thermal turbulent diffusivity of mixture [kg/m/s] virtual tmp alphaEff() const { - return this->thermo().alphaEff(alphat()); + return this->thermo().alphahe() + alphat(); } //- Effective thermal turbulent diffusivity of mixture // for patch [kg/m/s] virtual tmp alphaEff(const label patchi) const { - return this->thermo().alphaEff - ( - alphat(patchi), - patchi - ); + return this->thermo().alphahe(patchi) + alphat(patchi); } //- Effective mass diffusion coefficient diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H index c67751617c..20647d8de9 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H @@ -144,39 +144,6 @@ public: //- Kinematic viscosity of mixture for patch [m^2/s] virtual tmp nu(const label patchi) const; - - - // Fields derived from transport state variables - - //- Effective thermal turbulent conductivity of mixture - // for patch [W/m/K] - virtual tmp kappaEff - ( - const volScalarField& - ) const = 0; - - //- Effective thermal turbulent conductivity of mixture - // for patch [W/m/K] - virtual tmp kappaEff - ( - const scalarField& alphat, - const label patchi - ) const = 0; - - //- Effective turbulent thermal diffusivity of energy - // of mixture [kg/m/s] - virtual tmp alphaEff - ( - const volScalarField& alphat - ) const = 0; - - //- Effective turbulent thermal diffusivity of energy - // of mixture for patch [kg/m/s] - virtual tmp alphaEff - ( - const scalarField& alphat, - const label patchi - ) const = 0; }; diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index 961c310e25..d7697b0ee1 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -700,78 +700,6 @@ Foam::heThermo::alphahe(const label patchi) const } -template -Foam::tmp -Foam::heThermo::kappaEff -( - const volScalarField& alphat -) const -{ - return volScalarField::New("kappaEff", this->kappa_ + Cp_*alphat); -} - - -template -Foam::tmp -Foam::heThermo::kappaEff -( - const scalarField& alphat, - const label patchi -) const -{ - return - this->kappa_.boundaryField()[patchi] - + Cp(this->T_.boundaryField()[patchi], patchi)*alphat; -} - - -template -Foam::tmp -Foam::heThermo::alphaEff -( - const volScalarField& alphat -) const -{ - if (MixtureType::thermoType::enthalpy()) - { - return volScalarField::New("alphaEff", this->kappa_/Cp_ + alphat); - } - else - { - return volScalarField::New - ( - "alphaEff", - (this->kappa_ + Cp_*alphat)/Cv_ - ); - } -} - - -template -Foam::tmp -Foam::heThermo::alphaEff -( - const scalarField& alphat, - const label patchi -) const -{ - if (MixtureType::thermoType::enthalpy()) - { - return - this->kappa_.boundaryField()[patchi]/Cp_.boundaryField()[patchi] - + alphat; - } - else - { - return - ( - this->kappa_.boundaryField()[patchi] - + Cp_.boundaryField()[patchi]*alphat - )/Cv_.boundaryField()[patchi]; - } -} - - template bool Foam::heThermo::read() { diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index b5682060a4..3b75b43357 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -360,35 +360,6 @@ public: //- Thermal diffusivity of energy of mixture for patch [kg/m/s] virtual tmp alphahe(const label patchi) const; - //- Effective thermal turbulent conductivity of mixture [W/m/K] - virtual tmp kappaEff - ( - const volScalarField& - ) const; - - //- Effective thermal turbulent conductivity of mixture - // for patch [W/m/K] - virtual tmp kappaEff - ( - const scalarField& alphat, - const label patchi - ) const; - - //- Effective turbulent thermal diffusivity of energy - // of mixture [kg/m/s] - virtual tmp alphaEff - ( - const volScalarField& alphat - ) const; - - //- Effective turbulent thermal diffusivity of energy - // of mixture for patch [kg/m/s] - virtual tmp alphaEff - ( - const scalarField& alphat, - const label patchi - ) const; - //- Read thermophysical properties dictionary virtual bool read();