From 3b2c4abd574b49077e9ff95ff340769c1ec6db2c Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 12:07:15 +0000 Subject: [PATCH] Updates to the compressible LES/RAS api - removed repeated declaration of pure abstract functions - added function to return the turbulence effective thermal diffusivity for a patch --- .../LES/GenEddyVisc/GenEddyVisc.H | 9 ----- .../LES/GenSGSStress/GenSGSStress.H | 9 ----- .../compressible/LES/LESModel/LESModel.H | 28 +++++++++------ .../LES/SpalartAllmaras/SpalartAllmaras.H | 9 ----- .../compressible/RAS/LRR/LRR.H | 9 ++--- .../RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H | 9 ++--- .../RAS/LaunderSharmaKE/LaunderSharmaKE.H | 9 ++--- .../compressible/RAS/RASModel/RASModel.H | 36 +++++++++---------- .../RAS/RNGkEpsilon/RNGkEpsilon.H | 9 ++--- .../RAS/SpalartAllmaras/SpalartAllmaras.H | 9 ++--- .../compressible/RAS/kEpsilon/kEpsilon.H | 9 ++--- .../compressible/RAS/kOmegaSST/kOmegaSST.H | 9 ++--- .../compressible/RAS/laminar/laminar.C | 21 +++++++++++ .../compressible/RAS/laminar/laminar.H | 3 ++ .../RAS/realizableKE/realizableKE.H | 9 ++--- .../turbulenceModel/laminar/laminar.H | 10 ++++++ .../turbulenceModel/turbulenceModel.H | 8 ++++- 17 files changed, 99 insertions(+), 106 deletions(-) diff --git a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H index 440ec71c5c..7f2d3f1f85 100644 --- a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H +++ b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H @@ -126,15 +126,6 @@ public: return alphaSgs_; } - //- Return thermal diffusivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphaSgs_ + alpha()) - ); - } - //- Return the sub-grid stress tensor. virtual tmp B() const; diff --git a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H index ff71c80b79..e65495225c 100644 --- a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H +++ b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H @@ -127,15 +127,6 @@ public: return alphaSgs_; } - //- Return thermal conductivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphaSgs_ + alpha()) - ); - } - //- Return the sub-grid stress tensor virtual tmp B() const { diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H index cf019ea9a8..2cdde6c61e 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H @@ -189,12 +189,6 @@ public: } - //- Return the SGS turbulent kinetic energy. - virtual tmp k() const = 0; - - //- Return the SGS turbulent dissipation. - virtual tmp epsilon() const = 0; - //- Return the SGS turbulent viscosity virtual tmp muSgs() const = 0; @@ -210,8 +204,22 @@ public: //- Return the SGS turbulent thermal diffusivity virtual tmp alphaSgs() const = 0; - //- Return the SGS thermal conductivity. - virtual tmp alphaEff() const = 0; + //- Return the effective thermal diffusivity + virtual tmp alphaEff() const + { + return tmp + ( + new volScalarField("alphaEff", alphaSgs() + alpha()) + ); + } + + //- Return the effective turbulence thermal diffusivity for a patch + virtual tmp alphaEff(const label patchI) const + { + return + alphaSgs()().boundaryField()[patchI] + + alpha().boundaryField()[patchI]; + } //- Return the sub-grid stress tensor. virtual tmp B() const = 0; @@ -261,13 +269,13 @@ public: //- Correct Eddy-Viscosity and related properties. // This calls correct(const tmp& gradU) by supplying // gradU calculated locally. - void correct(); + virtual void correct(); //- Correct Eddy-Viscosity and related properties virtual void correct(const tmp& gradU); //- Read LESProperties dictionary - virtual bool read() = 0; + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H index e6239ec91b..29d53267a2 100644 --- a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H @@ -149,15 +149,6 @@ public: return alphaSgs_; } - //- Return thermal conductivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphaSgs_ + alpha()) - ); - } - //- Return the sub-grid stress tensor. virtual tmp B() const; diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.H b/src/turbulenceModels/compressible/RAS/LRR/LRR.H index 445faebd39..9ce0eef7bb 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.H +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.H @@ -153,13 +153,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H index 00db2c304f..e8c5a331b2 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H @@ -162,13 +162,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H index b7c972a662..f9c878607d 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H @@ -146,13 +146,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index cc189f24c8..883fa0825a 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H @@ -265,9 +265,6 @@ public: } - //- Return the turbulence viscosity - virtual tmp mut() const = 0; - //- Return the effective viscosity virtual tmp muEff() const { @@ -278,22 +275,21 @@ public: } //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const = 0; + virtual tmp alphaEff() const + { + return tmp + ( + new volScalarField("alphaEff", alphat() + alpha()) + ); + } - //- Return the turbulence kinetic energy - virtual tmp k() const = 0; - - //- Return the turbulence kinetic energy dissipation rate - virtual tmp epsilon() const = 0; - - //- Return the Reynolds stress tensor - virtual tmp R() const = 0; - - //- Return the effective stress tensor including the laminar stress - virtual tmp devRhoReff() const = 0; - - //- Return the source term for the momentum equation - virtual tmp divDevRhoReff(volVectorField& U) const = 0; + //- Return the effective turbulent thermal diffusivity for a patch + virtual tmp alphaEff(const label patchI) const + { + return + alphat()().boundaryField()[patchI] + + alpha().boundaryField()[patchI]; + } //- Return yPlus for the given patch virtual tmp yPlus @@ -303,10 +299,10 @@ public: ) const; //- Solve the turbulence equations and correct the turbulence viscosity - virtual void correct() = 0; + virtual void correct(); //- Read RASProperties dictionary - virtual bool read() = 0; + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H index 1e4301adcd..9d9601eee7 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H @@ -142,13 +142,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H index 94e736b9f8..fdb0c675ee 100644 --- a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -178,13 +178,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H index 865120d8c6..11d8f75a05 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H @@ -138,13 +138,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H index a563557f76..9806d32493 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H @@ -222,13 +222,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/laminar/laminar.C b/src/turbulenceModels/compressible/RAS/laminar/laminar.C index 415dedee72..cc5666eb6c 100644 --- a/src/turbulenceModels/compressible/RAS/laminar/laminar.C +++ b/src/turbulenceModels/compressible/RAS/laminar/laminar.C @@ -78,6 +78,27 @@ tmp laminar::mut() const } +tmp laminar::alphat() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "alphat", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("alphat", alpha().dimensions(), 0.0) + ) + ); +} + + tmp laminar::k() const { return tmp diff --git a/src/turbulenceModels/compressible/RAS/laminar/laminar.H b/src/turbulenceModels/compressible/RAS/laminar/laminar.H index af1f5e2bb2..506799ec98 100644 --- a/src/turbulenceModels/compressible/RAS/laminar/laminar.H +++ b/src/turbulenceModels/compressible/RAS/laminar/laminar.H @@ -89,6 +89,9 @@ public: return tmp(new volScalarField("muEff", mu())); } + //- Return the turbulence thermal diffusivity, i.e. 0 for laminar flow + virtual tmp alphat() const; + //- Return the effective turbulent thermal diffusivity, // i.e. the laminar thermal diffusivity virtual tmp alphaEff() const diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H index 222ee733a3..1b7d51a9a9 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H @@ -159,13 +159,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H index d4379bfb2e..7645e67379 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H @@ -99,6 +99,9 @@ public: return tmp(new volScalarField("muEff", mu())); } + //- Return the turbulence thermal diffusivity, i.e. 0 for laminar flow + virtual tmp alphat() const; + //- Return the effective turbulent thermal diffusivity, // i.e. the laminar thermal diffusivity virtual tmp alphaEff() const @@ -106,6 +109,13 @@ public: return tmp(new volScalarField("alphaEff", alpha())); } + //- Return the effective turbulent thermal diffusivity for a patch, + // i.e. the laminar thermal diffusivity + virtual tmp alphaEff(const label patchI) const + { + return alpha().boundaryField()[patchI]; + } + //- Return the turbulence kinetic energy, i.e. 0 for laminar flow virtual tmp k() const; diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H index 97638e5e49..9a84c01bb8 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H @@ -192,9 +192,15 @@ public: //- Return the effective viscosity virtual tmp muEff() const = 0; - //- Return the effective turbulent thermal diffusivity + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const = 0; + + //- Return the effective turbulence thermal diffusivity virtual tmp alphaEff() const = 0; + //- Return the effective turbulence thermal diffusivity for a patch + virtual tmp alphaEff(const label patchI) const = 0; + //- Return the turbulence kinetic energy virtual tmp k() const = 0;