TurbulenceModels: Templated kOmega and instantiated both incompressible and compressible forms

This commit is contained in:
Henry
2015-01-28 09:18:06 +00:00
parent 62261c9822
commit 96ab642efc
7 changed files with 115 additions and 88 deletions

View File

@ -69,6 +69,9 @@ makeRASModel(buoyantKEpsilon);
#include "LaunderSharmaKE.H"
makeRASModel(LaunderSharmaKE);
#include "kOmega.H"
makeRASModel(kOmega);
#include "kOmegaSST.H"
makeRASModel(kOmegaSST);

View File

@ -1,7 +1,6 @@
incompressibleTurbulenceModel.C
turbulentTransportModels/turbulentTransportModels.C
turbulentTransportModels/RAS/kOmega/kOmega.C
turbulentTransportModels/RAS/qZeta/qZeta.C
turbulentTransportModels/RAS/kkLOmega/kkLOmega.C
turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C

View File

@ -64,6 +64,9 @@ makeRASModel(realizableKE);
#include "LaunderSharmaKE.H"
makeRASModel(LaunderSharmaKE);
#include "kOmega.H"
makeRASModel(kOmega);
#include "kOmegaSST.H"
makeRASModel(kOmegaSST);

View File

@ -25,37 +25,32 @@ License
#include "kOmega.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(kOmega, 0);
addToRunTimeSelectionTable(RASModel, kOmega, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void kOmega::correctNut()
template<class BasicTurbulenceModel>
void kOmega<BasicTurbulenceModel>::correctNut()
{
nut_ = k_/omega_;
nut_.correctBoundaryConditions();
this->nut_ = k_/omega_;
this->nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
kOmega::kOmega
template<class BasicTurbulenceModel>
kOmega<BasicTurbulenceModel>::kOmega
(
const geometricOneField& alpha,
const geometricOneField& rho,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
@ -64,7 +59,7 @@ kOmega::kOmega
const word& type
)
:
eddyViscosity<incompressible::RASModel>
eddyViscosity<RASModel<BasicTurbulenceModel> >
(
type,
alpha,
@ -81,7 +76,7 @@ kOmega::kOmega
dimensioned<scalar>::lookupOrAddToDict
(
"betaStar",
coeffDict_,
this->coeffDict_,
0.09
)
),
@ -90,16 +85,16 @@ kOmega::kOmega
dimensioned<scalar>::lookupOrAddToDict
(
"beta",
coeffDict_,
this->coeffDict_,
0.072
)
),
alpha_
gamma_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alpha",
coeffDict_,
"gamma",
this->coeffDict_,
0.52
)
),
@ -108,7 +103,7 @@ kOmega::kOmega
dimensioned<scalar>::lookupOrAddToDict
(
"alphaK",
coeffDict_,
this->coeffDict_,
0.5
)
),
@ -117,7 +112,7 @@ kOmega::kOmega
dimensioned<scalar>::lookupOrAddToDict
(
"alphaOmega",
coeffDict_,
this->coeffDict_,
0.5
)
),
@ -127,47 +122,49 @@ kOmega::kOmega
IOobject
(
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
this->mesh_
),
omega_
(
IOobject
(
IOobject::groupName("omega", U.group()),
runTime_.timeName(),
mesh_,
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
this->mesh_
)
{
bound(k_, kMin_);
bound(omega_, omegaMin_);
bound(k_, this->kMin_);
bound(omega_, this->omegaMin_);
if (type == typeName)
{
correctNut();
printCoeffs(type);
this->printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool kOmega::read()
template<class BasicTurbulenceModel>
bool kOmega<BasicTurbulenceModel>::read()
{
if (eddyViscosity<incompressible::RASModel>::read())
if (eddyViscosity<RASModel<BasicTurbulenceModel> >::read())
{
Cmu_.readIfPresent(coeffDict());
beta_.readIfPresent(coeffDict());
alphaK_.readIfPresent(coeffDict());
alphaOmega_.readIfPresent(coeffDict());
Cmu_.readIfPresent(this->coeffDict());
beta_.readIfPresent(this->coeffDict());
gamma_.readIfPresent(this->coeffDict());
alphaK_.readIfPresent(this->coeffDict());
alphaOmega_.readIfPresent(this->coeffDict());
return true;
}
@ -178,16 +175,32 @@ bool kOmega::read()
}
void kOmega::correct()
template<class BasicTurbulenceModel>
void kOmega<BasicTurbulenceModel>::correct()
{
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
if (!this->turbulence_)
{
return;
}
volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));
// Local references
const alphaField& alpha = this->alpha_;
const rhoField& rho = this->rho_;
const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_;
const volVectorField& U = this->U_;
volScalarField& nut = this->nut_;
eddyViscosity<RASModel<BasicTurbulenceModel> >::correct();
volScalarField divU(fvc::div(fvc::absolute(this->phi(), U)));
tmp<volTensorField> tgradU = fvc::grad(U);
volScalarField G
(
this->GName(),
nut*(tgradU() && dev(twoSymm(tgradU())))
);
tgradU.clear();
// Update omega and G at the wall
omega_.boundaryField().updateCoeffs();
@ -195,12 +208,13 @@ void kOmega::correct()
// Turbulence specific dissipation rate equation
tmp<fvScalarMatrix> omegaEqn
(
fvm::ddt(omega_)
+ fvm::div(phi_, omega_)
- fvm::laplacian(DomegaEff(), omega_)
fvm::ddt(alpha, rho, omega_)
+ fvm::div(alphaRhoPhi, omega_)
- fvm::laplacian(alpha*rho*DomegaEff(), omega_)
==
alpha_*G*omega_/k_
- fvm::Sp(beta_*omega_, omega_)
gamma_*alpha*rho*G*omega_/k_
- fvm::SuSp(((2.0/3.0)*gamma_)*alpha*rho*divU, omega_)
- fvm::Sp(beta_*alpha*rho*omega_, omega_)
);
omegaEqn().relax();
@ -208,23 +222,24 @@ void kOmega::correct()
omegaEqn().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn);
bound(omega_, omegaMin_);
bound(omega_, this->omegaMin_);
// Turbulent kinetic energy equation
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(k_)
+ fvm::div(phi_, k_)
- fvm::laplacian(DkEff(), k_)
fvm::ddt(alpha, rho, k_)
+ fvm::div(alphaRhoPhi, k_)
- fvm::laplacian(alpha*rho*DkEff(), k_)
==
G
- fvm::Sp(Cmu_*omega_, k_)
alpha*rho*G
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
- fvm::Sp(Cmu_*alpha*rho*omega_, k_)
);
kEqn().relax();
solve(kEqn);
bound(k_, kMin_);
bound(k_, this->kMin_);
correctNut();
}
@ -233,7 +248,6 @@ void kOmega::correct()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -22,14 +22,14 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::kOmega
Foam::RASModels::kOmega
Group
grpIcoRASTurbulence
grpRASTurbulence
Description
Standard high Reynolds-number k-omega turbulence model for
incompressible flows.
incompressible and compressible flows.
References:
\verbatim
@ -58,15 +58,13 @@ SourceFiles
#ifndef kOmega_H
#define kOmega_H
#include "turbulentTransportModel.H"
#include "RASModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
@ -74,9 +72,10 @@ namespace RASModels
Class kOmega Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class kOmega
:
public eddyViscosity<incompressible::RASModel>
public eddyViscosity<RASModel<BasicTurbulenceModel> >
{
protected:
@ -87,7 +86,7 @@ protected:
dimensionedScalar Cmu_;
dimensionedScalar beta_;
dimensionedScalar alpha_;
dimensionedScalar gamma_;
dimensionedScalar alphaK_;
dimensionedScalar alphaOmega_;
@ -105,6 +104,11 @@ protected:
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("kOmega");
@ -114,8 +118,8 @@ public:
//- Construct from components
kOmega
(
const geometricOneField& alpha,
const geometricOneField& rho,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
@ -140,7 +144,11 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("DkEff", alphaK_*nut_ + nu())
new volScalarField
(
"DkEff",
alphaK_*this->nut_ + this->nu()
)
);
}
@ -149,7 +157,11 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("DomegaEff", alphaOmega_*nut_ + nu())
new volScalarField
(
"DomegaEff",
alphaOmega_*this->nut_ + this->nu()
)
);
}
@ -175,8 +187,8 @@ public:
IOobject
(
"epsilon",
mesh_.time().timeName(),
mesh_
this->mesh_.time().timeName(),
this->mesh_
),
Cmu_*k_*omega_,
omega_.boundaryField().types()
@ -192,9 +204,13 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kOmega.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -328,20 +328,14 @@ kOmegaSST<BasicTurbulenceModel>::kOmegaSST
this->mesh_
)
{
bound(k_, this->kMin_);
bound(omega_, this->omegaMin_);
this->nut_ =
(
a1_*k_
/max
(
a1_*omega_,
b1_*F23()*sqrt(2.0)*mag(symm(fvc::grad(this->U_)))
)
);
this->nut_.correctBoundaryConditions();
if (type == typeName)
{
correctNut();
this->printCoeffs(type);
}
}
@ -396,8 +390,8 @@ void kOmegaSST<BasicTurbulenceModel>::correct()
tmp<volTensorField> tgradU = fvc::grad(U);
volScalarField S2(2*magSqr(symm(tgradU())));
volScalarField GbyMu((tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(this->GName(), nut*GbyMu);
volScalarField GbyNu((tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(this->GName(), nut*GbyNu);
tgradU.clear();
// Update omega and G at the wall
@ -416,10 +410,9 @@ void kOmegaSST<BasicTurbulenceModel>::correct()
(
fvm::ddt(alpha, rho, omega_)
+ fvm::div(alphaRhoPhi, omega_)
- fvm::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaRhoPhi), omega_)
- fvm::laplacian(alpha*rho*DomegaEff(F1), omega_)
==
alpha*rhoGammaF1*GbyMu
alpha*rhoGammaF1*GbyNu
- fvm::SuSp((2.0/3.0)*alpha*rhoGammaF1*divU, omega_)
- fvm::Sp(alpha*rho*beta(F1)*omega_, omega_)
- fvm::SuSp
@ -442,7 +435,6 @@ void kOmegaSST<BasicTurbulenceModel>::correct()
(
fvm::ddt(alpha, rho, k_)
+ fvm::div(alphaRhoPhi, k_)
- fvm::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaRhoPhi), k_)
- fvm::laplacian(alpha*rho*DkEff(F1), k_)
==
min(alpha*rho*G, (c1_*betaStar_)*alpha*rho*k_*omega_)

View File

@ -28,7 +28,8 @@ Group
grpRASTurbulence
Description
Implementation of the k-omega-SST turbulence model for compressible flows.
Implementation of the k-omega-SST turbulence model for
incompressible and compressible flows.
Turbulence model described in:
\verbatim
@ -96,7 +97,6 @@ SourceFiles
#include "RASModel.H"
#include "eddyViscosity.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //