diff --git a/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C b/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C index 5f4379d8c..6d3696ccc 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C +++ b/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,46 @@ namespace Foam namespace LESModels { +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +tmp Smagorinsky::k +( + const tmp& gradU +) const +{ + volSymmTensorField D(symm(gradU)); + + volScalarField a(this->Ce_/this->delta()); + volScalarField b((2.0/3.0)*tr(D)); + volScalarField c(2*Ck_*this->delta()*(dev(D) && D)); + + return tmp + ( + new volScalarField + ( + IOobject + ( + IOobject::groupName("k", this->U_.group()), + this->runTime_.timeName(), + this->mesh_ + ), + sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a)) + ) + ); +} + + +template +void Smagorinsky::correctNut() +{ + volScalarField k(this->k(fvc::grad(this->U_))); + + this->nut_ = Ck_*this->delta()*sqrt(k); + this->nut_.correctBoundaryConditions(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -95,25 +135,11 @@ bool Smagorinsky::read() } -template -tmp Smagorinsky::k -( - const tmp& gradU -) const -{ - volSymmTensorField D(symm(gradU)); - - volScalarField a(this->Ce_/this->delta()); - volScalarField b((2.0/3.0)*tr(D)); - volScalarField c(2*Ck_*this->delta()*(dev(D) && D)); - - return sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a)); -} - - template tmp Smagorinsky::epsilon() const { + volScalarField k(this->k(fvc::grad(this->U_))); + return tmp ( new volScalarField @@ -122,26 +148,14 @@ tmp Smagorinsky::epsilon() const ( IOobject::groupName("epsilon", this->U_.group()), this->runTime_.timeName(), - this->mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE + this->mesh_ ), - this->Ce_*k()*sqrt(k())/this->delta() + this->Ce_*k*sqrt(k)/this->delta() ) ); } -template -void Smagorinsky::correctNut() -{ - volScalarField k(this->k(fvc::grad(this->U_))); - - this->nut_ = Ck_*this->delta()*sqrt(k); - this->nut_.correctBoundaryConditions(); -} - - template void Smagorinsky::correct() { diff --git a/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.H b/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.H index 0c052170f..7d9eae3f0 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.H +++ b/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.H @@ -100,6 +100,7 @@ protected: // calculated from the given velocity gradient tmp k(const tmp& gradU) const; + //- Update the SGS eddy viscosity virtual void correctNut(); diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C index 9dfd900c6..75a076d6a 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C @@ -174,13 +174,6 @@ Foam::RASModel::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::RASModel::correct() -{ - BasicTurbulenceModel::correct(); -} - - template bool Foam::RASModel::read() { @@ -207,4 +200,11 @@ bool Foam::RASModel::read() } +template +void Foam::RASModel::correct() +{ + BasicTurbulenceModel::correct(); +} + + // ************************************************************************* //