Commit 08c51ae0 authored by henry's avatar henry
Browse files

Added support for DDES and IDDES SGS models for incompressible LES in to the SA base class.

parent 7544110b
......@@ -8,6 +8,9 @@ GenSGSStress/GenSGSStress.C
laminar/laminar.C
SpalartAllmaras/SpalartAllmaras.C
SpalartAllmarasDDES/SpalartAllmarasDDES.C
SpalartAllmarasIDDES/SpalartAllmarasIDDES.C
SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C
oneEqEddy/oneEqEddy.C
dynOneEqEddy/dynOneEqEddy.C
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -42,8 +42,7 @@ namespace LESModels
defineTypeNameAndDebug(SpalartAllmaras, 0);
addToRunTimeSelectionTable(LESModel, SpalartAllmaras, dictionary);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<volScalarField> SpalartAllmaras::fv1() const
{
......@@ -55,7 +54,6 @@ tmp<volScalarField> SpalartAllmaras::fv1() const
tmp<volScalarField> SpalartAllmaras::fv2() const
{
volScalarField chi = nuTilda_/nu();
//return scalar(1) - chi/(scalar(1) + chi*fv1());
return 1.0/pow3(scalar(1) + chi/Cv2_);
}
......@@ -73,18 +71,57 @@ tmp<volScalarField> SpalartAllmaras::fv3() const
}
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
tmp<volScalarField> SpalartAllmaras::calcS(const volTensorField& gradU)
{
return ::sqrt(2.0)*mag(skew(gradU));
}
tmp<volScalarField> SpalartAllmaras::calcSTilda(const volTensorField& gradU)
{
return fv3()*calcS(gradU) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
}
tmp<volScalarField> SpalartAllmaras::r
(
const volScalarField& visc,
const volScalarField& S
) const
{
volScalarField r = min
tmp<volScalarField> tr
(
nuTilda_
/(
max(Stilda, dimensionedScalar("SMALL", Stilda.dimensions(), SMALL))
*sqr(kappa_*dTilda_)
),
scalar(10.0)
new volScalarField
(
min
(
visc
/(
max
(
S,
dimensionedScalar("SMALL", S.dimensions(), SMALL)
)
*sqr(kappa_*dTilda_)
+ dimensionedScalar
(
"ROOTVSMALL",
dimensionSet(0, 2 , -1, 0, 0),
ROOTVSMALL
)
),
scalar(10.0)
)
)
);
r.boundaryField() == 0.0;
return tr;
}
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& S) const
{
volScalarField r = this->r(nuTilda_, S);
volScalarField g = r + Cw2_*(pow6(r) - r);
......@@ -92,17 +129,26 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
}
void SpalartAllmaras::dTildaUpdate(const volScalarField&)
{
if (mesh_.changing())
{
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
SpalartAllmaras::SpalartAllmaras
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& modelName
)
:
LESModel(typeName, U, phi, transport),
LESModel(modelName, U, phi, transport),
alphaNut_
(
......@@ -113,6 +159,15 @@ SpalartAllmaras::SpalartAllmaras
1.5
)
),
kappa_
(
dimensioned<scalar>::lookupOrAddToDict
(
"kappa",
*this,
0.4187
)
),
Cb1_
(
dimensioned<scalar>::lookupOrAddToDict
......@@ -167,15 +222,6 @@ SpalartAllmaras::SpalartAllmaras
0.07
)
),
kappa_
(
dimensioned<scalar>::lookupOrAddToDict
(
"kappa",
*this,
0.4187
)
),
Cw1_(Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_)),
Cw2_
(
......@@ -223,10 +269,7 @@ SpalartAllmaras::SpalartAllmaras
),
mesh_
)
{
printCoeffs();
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......@@ -234,13 +277,11 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
{
LESModel::correct(gradU);
if (mesh_.changing())
{
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
}
const volScalarField STilda = calcSTilda(gradU);
volScalarField Stilda =
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
const volScalarField S = calcS(gradU);
dTildaUpdate(S);
solve
(
......@@ -254,8 +295,8 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
)
- alphaNut_*Cb2_*magSqr(fvc::grad(nuTilda_))
==
Cb1_*Stilda*nuTilda_
- fvm::Sp(Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_)
Cb1_*STilda*nuTilda_
- fvm::Sp(Cw1_*fw(STilda)*nuTilda_/sqr(dTilda_), nuTilda_)
);
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
......@@ -268,7 +309,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
tmp<volScalarField> SpalartAllmaras::epsilon() const
{
return 2*nuEff()*magSqr(symm(fvc::grad(U())));
return 2.0*nuEff()*magSqr(symm(fvc::grad(U())));
}
......@@ -298,16 +339,16 @@ bool SpalartAllmaras::read()
if (LESModel::read())
{
alphaNut_.readIfPresent(coeffDict());
kappa_.readIfPresent(*this);
Cb1_.readIfPresent(coeffDict());
Cb2_.readIfPresent(coeffDict());
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
Cw2_.readIfPresent(coeffDict());
Cw3_.readIfPresent(coeffDict());
Cv1_.readIfPresent(coeffDict());
Cv2_.readIfPresent(coeffDict());
CDES_.readIfPresent(coeffDict());
ck_.readIfPresent(coeffDict());
kappa_.readIfPresent(*this);
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
Cw2_.readIfPresent(coeffDict());
Cw3_.readIfPresent(coeffDict());
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -23,10 +23,10 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::incompressible::LESModels::SpalartAllmaras
Foam::LESmodels::SpalartAllmaras
Description
SpalartAllmaras for incompressible flows
SpalartAllmaras DES (SA + LES) turbulence model for incompressible flows
SourceFiles
SpalartAllmaras.C
......@@ -49,43 +49,67 @@ namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class SpalartAllmaras Declaration
Class SpalartAllmaras Declaration
\*---------------------------------------------------------------------------*/
class SpalartAllmaras
:
public LESModel
{
// Private data
// Private member functions
dimensionedScalar alphaNut_;
// Disallow default bitwise copy construct and assignment
SpalartAllmaras(const SpalartAllmaras&);
SpalartAllmaras& operator=(const SpalartAllmaras&);
dimensionedScalar Cb1_;
dimensionedScalar Cb2_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
dimensionedScalar CDES_;
dimensionedScalar ck_;
protected:
// Protected data
dimensionedScalar alphaNut_;
dimensionedScalar kappa_;
dimensionedScalar Cw1_;
dimensionedScalar Cw2_;
dimensionedScalar Cw3_;
// Private member functions
// Model constants
tmp<volScalarField> fv1() const;
tmp<volScalarField> fv2() const;
tmp<volScalarField> fv3() const;
tmp<volScalarField> fw(const volScalarField& Stilda) const;
dimensionedScalar Cb1_;
dimensionedScalar Cb2_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
dimensionedScalar CDES_;
dimensionedScalar ck_;
dimensionedScalar Cw1_;
dimensionedScalar Cw2_;
dimensionedScalar Cw3_;
// Disallow default bitwise copy construct and assignment
SpalartAllmaras(const SpalartAllmaras&);
SpalartAllmaras& operator=(const SpalartAllmaras&);
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField nuSgs_;
// Fields
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField nuSgs_;
// Protected member functions
// Helper functions
virtual tmp<volScalarField> fv1() const;
virtual tmp<volScalarField> fv2() const;
virtual tmp<volScalarField> fv3() const;
//-
virtual tmp<volScalarField> calcS(const volTensorField& gradU);
virtual tmp<volScalarField> calcSTilda(const volTensorField& gradU);
virtual tmp<volScalarField> r
(
const volScalarField& visc,
const volScalarField& S
) const;
virtual tmp<volScalarField> fw(const volScalarField& S) const;
//- Length scale calculation
virtual void dTildaUpdate(const volScalarField& S);
public:
......@@ -101,13 +125,14 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& modelName = typeName
);
// Destructor
~SpalartAllmaras()
virtual ~SpalartAllmaras()
{}
......@@ -145,10 +170,10 @@ public:
tmp<fvVectorMatrix> divDevBeff(volVectorField& U) const;
//- Correct nuTilda and related properties
void correct(const tmp<volTensorField>& gradU);
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
bool read();
virtual bool read();
};
......
Markdown is supported
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