Commit 26e95863 authored by Henry's avatar Henry
Browse files

turbulenceModels: minor function reorganization

parent 1f7b7442
......@@ -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<class BasicTurbulenceModel>
tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::k
(
const tmp<volTensorField>& 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<volScalarField>
(
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<class BasicTurbulenceModel>
void Smagorinsky<BasicTurbulenceModel>::correctNut()
{
volScalarField k(this->k(fvc::grad(this->U_)));
this->nut_ = Ck_*this->delta()*sqrt(k);
this->nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
......@@ -95,25 +135,11 @@ bool Smagorinsky<BasicTurbulenceModel>::read()
}
template<class BasicTurbulenceModel>
tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::k
(
const tmp<volTensorField>& 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<class BasicTurbulenceModel>
tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::epsilon() const
{
volScalarField k(this->k(fvc::grad(this->U_)));
return tmp<volScalarField>
(
new volScalarField
......@@ -122,26 +148,14 @@ tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::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<class BasicTurbulenceModel>
void Smagorinsky<BasicTurbulenceModel>::correctNut()
{
volScalarField k(this->k(fvc::grad(this->U_)));
this->nut_ = Ck_*this->delta()*sqrt(k);
this->nut_.correctBoundaryConditions();
}
template<class BasicTurbulenceModel>
void Smagorinsky<BasicTurbulenceModel>::correct()
{
......
......@@ -100,6 +100,7 @@ protected:
// calculated from the given velocity gradient
tmp<volScalarField> k(const tmp<volTensorField>& gradU) const;
//- Update the SGS eddy viscosity
virtual void correctNut();
......
......@@ -174,13 +174,6 @@ Foam::RASModel<BasicTurbulenceModel>::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
void Foam::RASModel<BasicTurbulenceModel>::correct()
{
BasicTurbulenceModel::correct();
}
template<class BasicTurbulenceModel>
bool Foam::RASModel<BasicTurbulenceModel>::read()
{
......@@ -207,4 +200,11 @@ bool Foam::RASModel<BasicTurbulenceModel>::read()
}
template<class BasicTurbulenceModel>
void Foam::RASModel<BasicTurbulenceModel>::correct()
{
BasicTurbulenceModel::correct();
}
// ************************************************************************* //
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment