Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-dev-OpenCFD into develop

This commit is contained in:
mattijs
2015-12-01 15:44:15 +00:00
32 changed files with 2365 additions and 703 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,10 +47,14 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
template<class OutputFilter> template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
{ {
// The logic here mimics that of Time itself and uses 0.5*deltaT
// as the tolerance to account for numerical precision errors
// (see e.g. Time::run()) since the current time might be e.g.
// 0.3000000000001 instead of exactly 0.3.
return return
enabled_ enabled_
&& time_.value() >= timeStart_ && time_.value() >= (timeStart_ - 0.5*time_.deltaTValue())
&& time_.value() <= timeEnd_; && time_.value() <= (timeEnd_ + 0.5*time_.deltaTValue());
} }
@ -179,6 +183,13 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
destroyFilter(); destroyFilter();
} }
} }
else if (enabled_ && time_.value() > timeEnd_)
{
// End early if the time is controlled by the user timeEnd entry
end();
enabled_ = false;
}
return true; return true;
} }
@ -196,7 +207,10 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
ptr_->end(); ptr_->end();
if (outputControl_.output()) // Only write if
// - time within timeStart_ and timeEnd_
// - it is an output time
if (active() && outputControl_.output())
{ {
ptr_->write(); ptr_->write();
} }
@ -236,6 +250,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::adjustTimeStep()
const label outputTimeIndex = outputControl_.outputTimeLastDump(); const label outputTimeIndex = outputControl_.outputTimeLastDump();
const scalar writeInterval = outputControl_.writeInterval(); const scalar writeInterval = outputControl_.writeInterval();
// Logic mimics that of Time::adjustDeltaT() except we only allow
// making the time step lower.
scalar timeToNextWrite = max scalar timeToNextWrite = max
( (
0.0, 0.0,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,6 +34,15 @@ Note
writeInterval to be degrees crank angle, but the functionObject writeInterval to be degrees crank angle, but the functionObject
execution \a interval would still be in timestep. execution \a interval would still be in timestep.
The function object can be limited to operate within a time range using
the timeStart and timEnd options. All objects are read (and the
OutputFilter allocated) on construction. However, if a timeEnd is
supplied, the object will call the 'end' function of the filter
at the timeEnd time and destroy the filter.
Any other callback (execute(), write(), timeSet() etc) will only operate
if within the timeStart, timeEnd time range. Note that the time range
uses 0.5 * deltaT as a comparison tolerance to account for precision errors.
SourceFiles SourceFiles
OutputFilterFunctionObject.C OutputFilterFunctionObject.C

View File

@ -129,5 +129,14 @@ makeLESModel(SpalartAllmarasIDDES);
#include "DeardorffDiffStress.H" #include "DeardorffDiffStress.H"
makeLESModel(DeardorffDiffStress); makeLESModel(DeardorffDiffStress);
#include "kOmegaSSTDES.H"
makeLESModel(kOmegaSSTDES);
#include "kOmegaSSTDDES.H"
makeLESModel(kOmegaSSTDDES);
#include "kOmegaSSTIDDES.H"
makeLESModel(kOmegaSSTIDDES);
// ************************************************************************* // // ************************************************************************* //

View File

@ -131,7 +131,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k

View File

@ -156,7 +156,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k

View File

@ -144,7 +144,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k

View File

@ -131,7 +131,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k

View File

@ -237,7 +237,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k

View File

@ -138,7 +138,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the lower allowable limit for q (default: SMALL) //- Return the lower allowable limit for q (default: SMALL)

View File

@ -121,5 +121,14 @@ makeLESModel(SpalartAllmarasIDDES);
#include "DeardorffDiffStress.H" #include "DeardorffDiffStress.H"
makeLESModel(DeardorffDiffStress); makeLESModel(DeardorffDiffStress);
#include "kOmegaSSTDES.H"
makeLESModel(kOmegaSSTDES);
#include "kOmegaSSTDDES.H"
makeLESModel(kOmegaSSTDDES);
#include "kOmegaSSTIDDES.H"
makeLESModel(kOmegaSSTIDDES);
// ************************************************************************* // // ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -88,7 +88,7 @@ tmp<volScalarField> SpalartAllmarasDDES<BasicTurbulenceModel>::dTilda
- fd(mag(gradU)) - fd(mag(gradU))
*max *max
( (
this->y_ - this->CDES_*this->delta(), this->y_ - this->psi(chi, fv1)*this->CDES_*this->delta(),
dimensionedScalar("zero", dimLength, 0) dimensionedScalar("zero", dimLength, 0)
), ),
dimensionedScalar("small", dimLength, SMALL) dimensionedScalar("small", dimLength, SMALL)

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,6 +63,16 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::fv2
} }
template<class BasicTurbulenceModel>
tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::ft2
(
const volScalarField& chi
) const
{
return Ct3_*exp(-Ct4_*sqr(chi));
}
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::S tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::S
( (
@ -148,6 +158,53 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::fw
} }
template<class BasicTurbulenceModel>
tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::psi
(
const volScalarField& chi,
const volScalarField& fv1
) const
{
tmp<volScalarField> tpsi
(
new volScalarField
(
IOobject
(
type() + ":psi",
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("one", dimless, 1)
)
);
if (lowReCorrection_)
{
volScalarField& psi = tpsi();
const volScalarField fv2(this->fv2(chi, fv1));
const volScalarField ft2(this->ft2(chi));
psi =
sqrt
(
min
(
scalar(100),
(1 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*(ft2 + (1 - ft2)*fv2))
/max(SMALL, (fv1*max(1e-10, 1 - ft2)))
)
);
}
return tpsi;
}
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::dTilda tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::dTilda
( (
@ -156,7 +213,7 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::dTilda
const volTensorField& gradU const volTensorField& gradU
) const ) const
{ {
tmp<volScalarField> tdTilda(CDES_*this->delta()); tmp<volScalarField> tdTilda(psi(chi, fv1)*CDES_*this->delta());
min(tdTilda().dimensionedInternalField(), tdTilda(), y_); min(tdTilda().dimensionedInternalField(), tdTilda(), y_);
return tdTilda; return tdTilda;
} }
@ -300,6 +357,42 @@ SpalartAllmarasDES<BasicTurbulenceModel>::SpalartAllmarasDES
0.07 0.07
) )
), ),
lowReCorrection_
(
Switch::lookupOrAddToDict
(
"lowReCorrection",
this->coeffDict_,
true
)
),
Ct3_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Ct3",
this->coeffDict_,
1.2
)
),
Ct4_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Ct4",
this->coeffDict_,
0.5
)
),
fwStar_
(
dimensioned<scalar>::lookupOrAddToDict
(
"fwStar",
this->coeffDict_,
0.424
)
),
nuTilda_ nuTilda_
( (
@ -345,6 +438,11 @@ bool SpalartAllmarasDES<BasicTurbulenceModel>::read()
CDES_.readIfPresent(this->coeffDict()); CDES_.readIfPresent(this->coeffDict());
ck_.readIfPresent(this->coeffDict()); ck_.readIfPresent(this->coeffDict());
lowReCorrection_.readIfPresent("lowReCorrection", this->coeffDict());
Ct3_.readIfPresent(this->coeffDict());
Ct4_.readIfPresent(this->coeffDict());
fwStar_.readIfPresent(this->coeffDict());
return true; return true;
} }
else else
@ -418,6 +516,7 @@ void SpalartAllmarasDES<BasicTurbulenceModel>::correct()
const volScalarField chi(this->chi()); const volScalarField chi(this->chi());
const volScalarField fv1(this->fv1(chi)); const volScalarField fv1(this->fv1(chi));
const volScalarField ft2(this->ft2(chi));
tmp<volTensorField> tgradU = fvc::grad(U); tmp<volTensorField> tgradU = fvc::grad(U);
const volScalarField Omega(this->Omega(tgradU())); const volScalarField Omega(this->Omega(tgradU()));
@ -431,10 +530,11 @@ void SpalartAllmarasDES<BasicTurbulenceModel>::correct()
- fvm::laplacian(alpha*rho*DnuTildaEff(), nuTilda_) - fvm::laplacian(alpha*rho*DnuTildaEff(), nuTilda_)
- Cb2_/sigmaNut_*alpha*rho*magSqr(fvc::grad(nuTilda_)) - Cb2_/sigmaNut_*alpha*rho*magSqr(fvc::grad(nuTilda_))
== ==
Cb1_*alpha*rho*Stilda*nuTilda_ Cb1_*alpha*rho*Stilda*nuTilda_*(scalar(1) - ft2)
- fvm::Sp - fvm::Sp
( (
Cw1_*alpha*rho*fw(Stilda, dTilda)*nuTilda_/sqr(dTilda), (Cw1_*fw(Stilda, dTilda) - Cb1_/sqr(kappa_)*ft2)
*alpha*rho*nuTilda_/sqr(dTilda),
nuTilda_ nuTilda_
) )
); );

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,6 +39,15 @@ Description
Advances in DNS/LES, 1, 4-8. Advances in DNS/LES, 1, 4-8.
\endverbatim \endverbatim
Including the low Reynolds number correction documented in
\verbatim
Spalart, P. R., Deck, S., Shur, M.L., Squires, K.D., Strelets, M.Kh,
Travin, A. (2006).
A new version of detached-eddy simulation, resistant to ambiguous grid
densities.
Theor. Comput. Fluid Dyn., 20, 181-195.
\endverbatim
SourceFiles SourceFiles
SpalartAllmarasDES.C SpalartAllmarasDES.C
@ -91,6 +100,15 @@ protected:
dimensionedScalar CDES_; dimensionedScalar CDES_;
dimensionedScalar ck_; dimensionedScalar ck_;
// Low Reynolds number correction
Switch lowReCorrection_;
dimensionedScalar Ct3_;
dimensionedScalar Ct4_;
dimensionedScalar fwStar_;
// Fields // Fields
volScalarField nuTilda_; volScalarField nuTilda_;
@ -113,6 +131,8 @@ protected:
const volScalarField& fv1 const volScalarField& fv1
) const; ) const;
tmp<volScalarField> ft2(const volScalarField& chi) const;
tmp<volScalarField> S(const volTensorField& gradU) const; tmp<volScalarField> S(const volTensorField& gradU) const;
tmp<volScalarField> Omega(const volTensorField& gradU) const; tmp<volScalarField> Omega(const volTensorField& gradU) const;
@ -138,6 +158,12 @@ protected:
const volScalarField& dTilda const volScalarField& dTilda
) const; ) const;
tmp<volScalarField> psi
(
const volScalarField& chi,
const volScalarField& fv1
) const;
//- Length scale //- Length scale
virtual tmp<volScalarField> dTilda virtual tmp<volScalarField> dTilda
( (
@ -184,7 +210,7 @@ public:
// Member Functions // Member Functions
//- Read LESProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for nuTilda //- Return the effective diffusivity for nuTilda

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,6 +37,7 @@ namespace LESModels
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::alpha() const tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::alpha() const
{ {
// Equation 9 (plus limits)
return max return max
( (
0.25 - this->y_/static_cast<const volScalarField&>(IDDESDelta_.hmax()), 0.25 - this->y_/static_cast<const volScalarField&>(IDDESDelta_.hmax()),
@ -51,6 +52,7 @@ tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::ft
const volScalarField& magGradU const volScalarField& magGradU
) const ) const
{ {
// Equation 13
return tanh(pow3(sqr(ct_)*rd(this->nut_, magGradU))); return tanh(pow3(sqr(ct_)*rd(this->nut_, magGradU)));
} }
@ -61,6 +63,7 @@ tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::fl
const volScalarField& magGradU const volScalarField& magGradU
) const ) const
{ {
// Equation 13
return tanh(pow(sqr(cl_)*rd(this->nu(), magGradU), 10)); return tanh(pow(sqr(cl_)*rd(this->nu(), magGradU), 10));
} }
@ -90,11 +93,12 @@ tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::rd
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::fd tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::fdt
( (
const volScalarField& magGradU const volScalarField& magGradU
) const ) const
{ {
// Related to equation 16
return 1 - tanh(pow3(8*rd(this->nuEff(), magGradU))); return 1 - tanh(pow3(8*rd(this->nuEff(), magGradU)));
} }
@ -111,36 +115,28 @@ tmp<volScalarField> SpalartAllmarasIDDES<BasicTurbulenceModel>::dTilda
const volScalarField expTerm(exp(sqr(alpha))); const volScalarField expTerm(exp(sqr(alpha)));
const volScalarField magGradU(mag(gradU)); const volScalarField magGradU(mag(gradU));
tmp<volScalarField> fHill = // Equation 9
tmp<volScalarField> fB = min(2*pow(expTerm, -9.0), scalar(1));
// Equation 11
tmp<volScalarField> fe1 =
2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0)); 2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0));
tmp<volScalarField> fStep = min(2*pow(expTerm, -9.0), scalar(1)); // Equation 12
const volScalarField fHyb(max(1 - fd(magGradU), fStep)); tmp<volScalarField> fe2 = 1 - max(ft(magGradU), fl(magGradU));
tmp<volScalarField> fAmp = 1 - max(ft(magGradU), fl(magGradU));
tmp<volScalarField> fRestore = max(fHill - 1, scalar(0))*fAmp;
// IGNORING ft2 terms // Equation 10
const volScalarField Psi const volScalarField psi(this->psi(chi, fv1));
( tmp<volScalarField> fe = max(fe1 - 1, scalar(0))*psi*fe2;
sqrt
(
min
(
scalar(100),
(
1
- this->Cb1_*this->fv2(chi, fv1)
/(this->Cw1_*sqr(this->kappa_)*fwStar_)
)/max(SMALL, fv1)
)
)
);
// Equation 16
const volScalarField fdTilda(max(1 - fdt(magGradU), fB));
// Equation 17 (plus limits)
return max return max
( (
dimensionedScalar("SMALL", dimLength, SMALL), fdTilda*(1 + fe)*this->y_ + (1 - fdTilda)*psi*this->CDES_*this->delta(),
fHyb*(1 + fRestore*Psi)*this->y_ dimensionedScalar("SMALL", dimLength, SMALL)
+ (1 - fHyb)*this->CDES_*Psi*this->delta()
); );
} }

View File

@ -92,7 +92,7 @@ class SpalartAllmarasIDDES
) const; ) const;
//- Delay function //- Delay function
tmp<volScalarField> fd(const volScalarField& magGradU) const; tmp<volScalarField> fdt(const volScalarField& magGradU) const;
// Disallow default bitwise copy construct and assignment // Disallow default bitwise copy construct and assignment
SpalartAllmarasIDDES(const SpalartAllmarasIDDES&); SpalartAllmarasIDDES(const SpalartAllmarasIDDES&);
@ -146,7 +146,7 @@ public:
// Member Functions // Member Functions
//- Read LESProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
}; };

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kOmegaSSTDDES.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTDDES<BasicTurbulenceModel>::rd
(
const volScalarField& nur,
const volScalarField& magGradU
) const
{
tmp<volScalarField> tr
(
min
(
nur
/(
max
(
magGradU,
dimensionedScalar("SMALL", magGradU.dimensions(), SMALL)
)
*sqr(this->kappa_*this->y_)
),
scalar(10)
)
);
tr().boundaryField() == 0.0;
return tr;
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTDDES<BasicTurbulenceModel>::fd
(
const volScalarField& magGradU
) const
{
return 1 - tanh(pow(cd1_*rd(this->nuEff(), magGradU), cd2_));
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTDDES<BasicTurbulenceModel>::dTilda
(
const volScalarField& magGradU,
const volScalarField& CDES
) const
{
const volScalarField& k = this->k_;
const volScalarField& omega = this->omega_;
const volScalarField lRAS(sqrt(k)/(this->betaStar_*omega));
const volScalarField lLES(CDES*this->delta());
const dimensionedScalar d0("SMALL", dimLength, SMALL);
return max(lRAS - fd(magGradU)*max(lRAS - lLES, d0), d0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
kOmegaSSTDDES<BasicTurbulenceModel>::kOmegaSSTDDES
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName,
const word& type
)
:
kOmegaSSTDES<BasicTurbulenceModel>
(
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName,
type
),
cd1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"cd1",
this->coeffDict_,
20
)
),
cd2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"cd2",
this->coeffDict_,
3
)
)
{
if (type == typeName)
{
this->printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool kOmegaSSTDDES<BasicTurbulenceModel>::read()
{
if (kOmegaSSTDES<BasicTurbulenceModel>::read())
{
cd1_.readIfPresent(this->coeffDict());
cd2_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::LESModels::kOmegaSSTDDES
Group
grpDESTurbulence
Description
k-omega-SST DDES turbulence model for incompressible and compressible flows
Reference:
\verbatim
Gritskevich, M.S., Garbaruk, A.V., Schuetze, J., Menter, F.R. (2011)
Development of DDES and IDDES Formulations for the k-omega
Shear Stress Transport Model, Flow, Turbulence and Combustion,
pp. 1-19
\endverbatim
SourceFiles
kOmegaSSTDDES.C
\*---------------------------------------------------------------------------*/
#ifndef kOmegaSSTDDES_H
#define kOmegaSSTDDES_H
#include "kOmegaSSTDES.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class kOmegaSSTDDES Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class kOmegaSSTDDES
:
public kOmegaSSTDES<BasicTurbulenceModel>
{
// Private Member Functions
tmp<volScalarField> rd
(
const volScalarField& nur,
const volScalarField& magGradU
) const;
tmp<volScalarField> fd(const volScalarField& magGradU) const;
// Disallow default bitwise copy construct and assignment
kOmegaSSTDDES(const kOmegaSSTDDES&);
kOmegaSSTDDES& operator=(const kOmegaSSTDDES&);
protected:
// Protected data
// Model coefficients
dimensionedScalar cd1_;
dimensionedScalar cd2_;
// Protected Member Functions
//- Length scale
virtual tmp<volScalarField> dTilda
(
const volScalarField& magGradU,
const volScalarField& CDES
) const;
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("kOmegaSSTDDES");
// Constructors
//- Construct from components
kOmegaSSTDDES
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
//- Destructor
virtual ~kOmegaSSTDDES()
{}
// Member Functions
//- Re-read model coefficients if they have changed
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kOmegaSSTDDES.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,290 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kOmegaSSTDES.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
void kOmegaSSTDES<BasicTurbulenceModel>::correctNut(const volScalarField& S2)
{
// Correct the turbulence viscosity
kOmegaSSTBase<DESModel<BasicTurbulenceModel> >::correctNut(S2);
// Correct the turbulence thermal diffusivity
BasicTurbulenceModel::correctNut();
}
template<class BasicTurbulenceModel>
void kOmegaSSTDES<BasicTurbulenceModel>::correctNut()
{
correctNut(2*magSqr(symm(fvc::grad(this->U_))));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTDES<BasicTurbulenceModel>::dTilda
(
const volScalarField& magGradU,
const volScalarField& CDES
) const
{
const volScalarField& k = this->k_;
const volScalarField& omega = this->omega_;
return min(CDES*this->delta(), sqrt(k)/(this->betaStar_*omega));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
kOmegaSSTDES<BasicTurbulenceModel>::kOmegaSSTDES
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName,
const word& type
)
:
kOmegaSSTBase<DESModel<BasicTurbulenceModel> >
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
kappa_
(
dimensioned<scalar>::lookupOrAddToDict
(
"kappa",
this->coeffDict_,
0.41
)
),
CDESkom_
(
dimensioned<scalar>::lookupOrAddToDict
(
"CDESkom",
this->coeffDict_,
0.78
)
),
CDESkeps_
(
dimensioned<scalar>::lookupOrAddToDict
(
"CDESkeps",
this->coeffDict_,
0.61
)
)
{
correctNut();
if (type == typeName)
{
this->printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool kOmegaSSTDES<BasicTurbulenceModel>::read()
{
if (kOmegaSSTBase<DESModel<BasicTurbulenceModel> >::read())
{
kappa_.readIfPresent(this->coeffDict());
CDESkom_.readIfPresent(this->coeffDict());
CDESkeps_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}
template<class BasicTurbulenceModel>
void kOmegaSSTDES<BasicTurbulenceModel>::correct()
{
if (!this->turbulence_)
{
return;
}
// Local references
const alphaField& alpha = this->alpha_;
const rhoField& rho = this->rho_;
const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_;
const volVectorField& U = this->U_;
volScalarField& k = this->k_;
volScalarField& omega = this->omega_;
volScalarField& nut = this->nut_;
DESModel<BasicTurbulenceModel>::correct();
volScalarField divU(fvc::div(fvc::absolute(this->phi(), U)));
tmp<volTensorField> tgradU = fvc::grad(U);
volScalarField magGradU(mag(tgradU()));
volScalarField S2(2*magSqr(symm(tgradU())));
volScalarField GbyNu((tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(this->GName(), nut*GbyNu);
tgradU.clear();
// Update omega and G at the wall
omega.boundaryField().updateCoeffs();
volScalarField CDkOmega
(
(2*this->alphaOmega2_)*(fvc::grad(k) & fvc::grad(omega))/omega
);
volScalarField F1(this->F1(CDkOmega));
{
volScalarField gamma(this->gamma(F1));
volScalarField beta(this->beta(F1));
// Turbulent frequency equation
tmp<fvScalarMatrix> omegaEqn
(
fvm::ddt(alpha, rho, omega)
+ fvm::div(alphaRhoPhi, omega)
- fvm::laplacian(alpha*rho*this->DomegaEff(F1), omega)
==
alpha*rho*gamma*GbyNu // Using unlimited GybNu
- fvm::SuSp((2.0/3.0)*alpha*rho*gamma*divU, omega)
- fvm::Sp(alpha*rho*beta*omega, omega)
- fvm::SuSp(alpha*rho*(F1 - scalar(1))*CDkOmega/omega, omega)
+ this->omegaSource()
);
omegaEqn().relax();
omegaEqn().boundaryManipulate(omega.boundaryField());
solve(omegaEqn);
bound(omega, this->omegaMin_);
}
{
volScalarField CDES(this->CDES(F1));
volScalarField dTilda(this->dTilda(magGradU, CDES));
// Turbulent kinetic energy equation
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(alpha, rho, k)
+ fvm::div(alphaRhoPhi, k)
- fvm::laplacian(alpha*rho*this->DkEff(F1), k)
==
min(alpha*rho*G, (this->c1_*this->betaStar_)*alpha*rho*k*omega)
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k)
- fvm::Sp(alpha*rho*sqrt(k)/dTilda, k) // modified for DES
+ this->kSource()
);
kEqn().relax();
solve(kEqn);
bound(k, this->kMin_);
}
this->correctNut(S2);
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTDES<BasicTurbulenceModel>::LESRegion() const
{
const volScalarField& k = this->k_;
const volScalarField& omega = this->omega_;
const volVectorField& U = this->U_;
const volScalarField CDkOmega
(
(2*this->alphaOmega2_)*(fvc::grad(k) & fvc::grad(omega))/omega
);
const volScalarField F1(this->F1(CDkOmega));
tmp<volScalarField> tLESRegion
(
new volScalarField
(
IOobject
(
"DES::LESRegion",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
neg
(
dTilda
(
mag(fvc::grad(U)),
F1*CDESkom_ + (1 - F1)*CDESkeps_
)
- sqrt(k)/(this->betaStar_*omega)
)
)
);
return tLESRegion;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::LESModels::kOmegaSSTDES
Group
grpDESTurbulence
Description
k-omega-SST DES turbulence model for incompressible and compressible flows
Reference:
\verbatim
Strelets, M. (2001)
Detached Eddy Simulation of Massively Separated Flows,
39th AIAA Aerospace Sciences Meeting and Exhibit, Reno, NV
\endverbatim
SourceFiles
kOmegaSSTDES.C
\*---------------------------------------------------------------------------*/
#ifndef kOmegaSSTDES_H
#define kOmegaSSTDES_H
#include "DESModel.H"
#include "kOmegaSSTBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
class kOmegaSSTDES Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class kOmegaSSTDES
:
public kOmegaSSTBase<DESModel<BasicTurbulenceModel> >
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
kOmegaSSTDES(const kOmegaSSTDES&);
kOmegaSSTDES& operator=(const kOmegaSSTDES&);
protected:
// Protected data
// Model coefficients
dimensionedScalar kappa_;
dimensionedScalar CDESkom_;
dimensionedScalar CDESkeps_;
// Protected Member Functions
//- Blending for CDES parameter
virtual tmp<volScalarField> CDES(const volScalarField& F1) const
{
return this->blend(F1, CDESkom_, CDESkeps_);
}
virtual void correctNut(const volScalarField& S2);
virtual void correctNut();
//- Length scale
virtual tmp<volScalarField> dTilda
(
const volScalarField& magGradU,
const volScalarField& CDES
) const;
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("kOmegaSSTDES");
// Constructors
//- Construct from components
kOmegaSSTDES
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
//- Destructor
virtual ~kOmegaSSTDES()
{}
// Member Functions
//- Re-read model coefficients if they have changed
virtual bool read();
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Return the LES field indicator
virtual tmp<volScalarField> LESRegion() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kOmegaSSTDES.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,250 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kOmegaSSTIDDES.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
const IDDESDelta& kOmegaSSTIDDES<BasicTurbulenceModel>::setDelta() const
{
if (!isA<IDDESDelta>(this->delta_()))
{
FatalErrorIn
(
"const kOmegaSSTIDDES<BasicTurbulenceModel>::setDelta() const"
)
<< "The delta function must be set to a " << IDDESDelta::typeName
<< " -based model" << exit(FatalError);
}
return refCast<const IDDESDelta>(this->delta_());
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::alpha() const
{
return max(0.25 - this->y_/IDDESDelta_.hmax(), scalar(-5));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::ft
(
const volScalarField& magGradU
) const
{
return tanh(pow3(sqr(ct_)*rd(this->nut_, magGradU)));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::fl
(
const volScalarField& magGradU
) const
{
return tanh(pow(sqr(cl_)*rd(this->nu(), magGradU), 10));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::rd
(
const volScalarField& nur,
const volScalarField& magGradU
) const
{
tmp<volScalarField> tr
(
min
(
nur
/(
max
(
magGradU,
dimensionedScalar("SMALL", magGradU.dimensions(), SMALL)
)
*sqr(this->kappa_*this->y_)
),
scalar(10)
)
);
tr().boundaryField() == 0.0;
return tr;
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::fd
(
const volScalarField& magGradU
) const
{
return 1 - tanh(pow(cdt1_*rd(this->nuEff(), magGradU), cdt2_));
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::dTilda
(
const volScalarField& magGradU,
const volScalarField& CDES
) const
{
const volScalarField& k = this->k_;
const volScalarField& omega = this->omega_;
const volScalarField lRAS(sqrt(k)/(this->betaStar_*omega));
const volScalarField lLES(CDES*this->delta());
const dimensionedScalar d0("SMALL", dimLength, SMALL);
const volScalarField alpha(this->alpha());
const volScalarField expTerm(exp(sqr(alpha)));
tmp<volScalarField> fStep = min(2*pow(expTerm, -9.0), scalar(1));
const volScalarField fHyb(max(1 - fd(magGradU), fStep));
// Simplified version where fRestore = 0
// return max(d0, fHyb*lRAS + (1 - fHyb)*lLES);
// Original form
tmp<volScalarField> fHill =
2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0));
tmp<volScalarField> fAmp = 1 - max(ft(magGradU), fl(magGradU));
tmp<volScalarField> fRestore = max(fHill - 1, scalar(0))*fAmp;
return max(d0, fHyb*(1 + fRestore)*lRAS + (1 - fHyb)*lLES);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
kOmegaSSTIDDES<BasicTurbulenceModel>::kOmegaSSTIDDES
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName,
const word& type
)
:
kOmegaSSTDES<BasicTurbulenceModel>
(
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName,
type
),
cdt1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"cdt1",
this->coeffDict_,
20
)
),
cdt2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"cdt2",
this->coeffDict_,
3
)
),
cl_
(
dimensioned<scalar>::lookupOrAddToDict
(
"cl",
this->coeffDict_,
5
)
),
ct_
(
dimensioned<scalar>::lookupOrAddToDict
(
"ct",
this->coeffDict_,
1.87
)
),
IDDESDelta_(setDelta())
{
if (type == typeName)
{
this->printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool kOmegaSSTIDDES<BasicTurbulenceModel>::read()
{
if (kOmegaSSTDES<BasicTurbulenceModel>::read())
{
cdt1_.readIfPresent(this->coeffDict());
cdt2_.readIfPresent(this->coeffDict());
cl_.readIfPresent(this->coeffDict());
ct_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::LESModels::kOmegaSSTIDDES
Group
grpDESTurbulence
Description
k-omega-SST IDDES turbulence model for incompressible and compressible
flows
Reference:
\verbatim
Gritskevich, M.S., Garbaruk, A.V., Schuetze, J., Menter, F.R. (2011)
Development of DDES and IDDES Formulations for the k-omega
Shear Stress Transport Model, Flow, Turbulence and Combustion,
pp. 1-19
\endverbatim
SourceFiles
kOmegaSSTIDDES.C
\*---------------------------------------------------------------------------*/
#ifndef kOmegaSSTIDDES_H
#define kOmegaSSTIDDES_H
#include "kOmegaSSTDES.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
class kOmegaSSTIDDES Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class kOmegaSSTIDDES
:
public kOmegaSSTDES<BasicTurbulenceModel>
{
// Private Member Functions
//- Check that the supplied delta is an IDDESDelta
const IDDESDelta& setDelta() const;
tmp<volScalarField> alpha() const;
tmp<volScalarField> ft(const volScalarField& magGradU) const;
tmp<volScalarField> fl(const volScalarField& magGradU) const;
tmp<volScalarField> rd
(
const volScalarField& nur,
const volScalarField& magGradU
) const;
//- Delay function
tmp<volScalarField> fd(const volScalarField& maggradU) const;
// Disallow default bitwise copy construct and assignment
kOmegaSSTIDDES(const kOmegaSSTIDDES&);
kOmegaSSTIDDES& operator=(const kOmegaSSTIDDES&);
protected:
// Protected data
// Model coefficients
dimensionedScalar cdt1_;
dimensionedScalar cdt2_;
dimensionedScalar cl_;
dimensionedScalar ct_;
// Fields
const IDDESDelta& IDDESDelta_;
//- Length scale
virtual tmp<volScalarField> dTilda
(
const volScalarField& magGradU,
const volScalarField& CDES
) const;
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("kOmegaSSTIDDES");
// Constructors
//- Construct from components
kOmegaSSTIDDES
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
//- Destructor
virtual ~kOmegaSSTIDDES()
{}
// Member Functions
//- Re-read model coefficients if they have changed
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kOmegaSSTIDDES.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -80,6 +80,17 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel
) )
), ),
omegaMin_
(
dimensioned<scalar>::lookupOrAddToDict
(
"omegaMin",
LESDict_,
dimless/dimTime,
SMALL
)
),
delta_ delta_
( (
LESdelta::New LESdelta::New

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,6 +78,9 @@ protected:
//- Lower limit of k //- Lower limit of k
dimensionedScalar kMin_; dimensionedScalar kMin_;
//- Lower limit of omega
dimensionedScalar omegaMin_;
//- Run-time selectable delta model //- Run-time selectable delta model
autoPtr<Foam::LESdelta> delta_; autoPtr<Foam::LESdelta> delta_;

View File

@ -183,7 +183,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for nuTilda //- Return the effective diffusivity for nuTilda

View File

@ -24,8 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "kOmegaSST.H" #include "kOmegaSST.H"
#include "bound.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -34,91 +32,22 @@ namespace Foam
namespace RASModels namespace RASModels
{ {
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSST<BasicTurbulenceModel>::kOmegaSST::F1
(
const volScalarField& CDkOmega
) const
{
tmp<volScalarField> CDkOmegaPlus = max
(
CDkOmega,
dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10)
);
tmp<volScalarField> arg1 = min
(
min
(
max
(
(scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_),
scalar(500)*(this->mu()/this->rho_)/(sqr(y_)*omega_)
),
(4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_))
),
scalar(10)
);
return tanh(pow4(arg1));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSST<BasicTurbulenceModel>::kOmegaSST::F2() const
{
tmp<volScalarField> arg2 = min
(
max
(
(scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_),
scalar(500)*(this->mu()/this->rho_)/(sqr(y_)*omega_)
),
scalar(100)
);
return tanh(sqr(arg2));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSST<BasicTurbulenceModel>::kOmegaSST::F3() const
{
tmp<volScalarField> arg3 = min
(
150*(this->mu()/this->rho_)/(omega_*sqr(y_)),
scalar(10)
);
return 1 - tanh(pow4(arg3));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> kOmegaSST<BasicTurbulenceModel>::kOmegaSST::F23() const
{
tmp<volScalarField> f23(F2());
if (F3_)
{
f23() *= F3();
}
return f23;
}
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
void kOmegaSST<BasicTurbulenceModel>::correctNut(const volScalarField& S2) void kOmegaSST<BasicTurbulenceModel>::correctNut(const volScalarField& S2)
{ {
this->nut_ = a1_*k_/max(a1_*omega_, b1_*F23()*sqrt(S2)); // Correct the turbulence viscosity
this->nut_.correctBoundaryConditions(); kOmegaSSTBase<eddyViscosity<RASModel<BasicTurbulenceModel> > >::correctNut
(
S2
);
// Correct the turbulence thermal diffusivity
BasicTurbulenceModel::correctNut(); BasicTurbulenceModel::correctNut();
} }
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
void kOmegaSST<BasicTurbulenceModel>::correctNut() void kOmegaSST<BasicTurbulenceModel>::correctNut()
{ {
@ -126,53 +55,6 @@ void kOmegaSST<BasicTurbulenceModel>::correctNut()
} }
template<class BasicTurbulenceModel>
tmp<fvScalarMatrix> kOmegaSST<BasicTurbulenceModel>::kSource() const
{
return tmp<fvScalarMatrix>
(
new fvScalarMatrix
(
k_,
dimVolume*this->rho_.dimensions()*k_.dimensions()/dimTime
)
);
}
template<class BasicTurbulenceModel>
tmp<fvScalarMatrix> kOmegaSST<BasicTurbulenceModel>::omegaSource() const
{
return tmp<fvScalarMatrix>
(
new fvScalarMatrix
(
omega_,
dimVolume*this->rho_.dimensions()*omega_.dimensions()/dimTime
)
);
}
template<class BasicTurbulenceModel>
tmp<fvScalarMatrix> kOmegaSST<BasicTurbulenceModel>::Qsas
(
const volScalarField& S2,
const volScalarField& gamma,
const volScalarField& beta
) const
{
return tmp<fvScalarMatrix>
(
new fvScalarMatrix
(
omega_,
dimVolume*this->rho_.dimensions()*omega_.dimensions()/dimTime
)
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
@ -188,7 +70,7 @@ kOmegaSST<BasicTurbulenceModel>::kOmegaSST
const word& type const word& type
) )
: :
eddyViscosity<RASModel<BasicTurbulenceModel> > kOmegaSSTBase<eddyViscosity<RASModel<BasicTurbulenceModel> > >
( (
type, type,
alpha, alpha,
@ -198,156 +80,8 @@ kOmegaSST<BasicTurbulenceModel>::kOmegaSST
phi, phi,
transport, transport,
propertiesName propertiesName
),
alphaK1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaK1",
this->coeffDict_,
0.85
)
),
alphaK2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaK2",
this->coeffDict_,
1.0
)
),
alphaOmega1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaOmega1",
this->coeffDict_,
0.5
)
),
alphaOmega2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaOmega2",
this->coeffDict_,
0.856
)
),
gamma1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"gamma1",
this->coeffDict_,
5.0/9.0
)
),
gamma2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"gamma2",
this->coeffDict_,
0.44
)
),
beta1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"beta1",
this->coeffDict_,
0.075
)
),
beta2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"beta2",
this->coeffDict_,
0.0828
)
),
betaStar_
(
dimensioned<scalar>::lookupOrAddToDict
(
"betaStar",
this->coeffDict_,
0.09
)
),
a1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"a1",
this->coeffDict_,
0.31
)
),
b1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"b1",
this->coeffDict_,
1.0
)
),
c1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"c1",
this->coeffDict_,
10.0
)
),
F3_
(
Switch::lookupOrAddToDict
(
"F3",
this->coeffDict_,
false
)
),
y_(wallDist::New(this->mesh_).y()),
k_
(
IOobject
(
IOobject::groupName("k", U.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
),
omega_
(
IOobject
(
IOobject::groupName("omega", U.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
) )
{ {
bound(k_, this->kMin_);
bound(omega_, this->omegaMin_);
if (type == typeName) if (type == typeName)
{ {
correctNut(); correctNut();
@ -356,128 +90,6 @@ kOmegaSST<BasicTurbulenceModel>::kOmegaSST
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool kOmegaSST<BasicTurbulenceModel>::read()
{
if (eddyViscosity<RASModel<BasicTurbulenceModel> >::read())
{
alphaK1_.readIfPresent(this->coeffDict());
alphaK2_.readIfPresent(this->coeffDict());
alphaOmega1_.readIfPresent(this->coeffDict());
alphaOmega2_.readIfPresent(this->coeffDict());
gamma1_.readIfPresent(this->coeffDict());
gamma2_.readIfPresent(this->coeffDict());
beta1_.readIfPresent(this->coeffDict());
beta2_.readIfPresent(this->coeffDict());
betaStar_.readIfPresent(this->coeffDict());
a1_.readIfPresent(this->coeffDict());
b1_.readIfPresent(this->coeffDict());
c1_.readIfPresent(this->coeffDict());
F3_.readIfPresent("F3", this->coeffDict());
return true;
}
else
{
return false;
}
}
template<class BasicTurbulenceModel>
void kOmegaSST<BasicTurbulenceModel>::correct()
{
if (!this->turbulence_)
{
return;
}
// 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 S2(2*magSqr(symm(tgradU())));
volScalarField GbyNu((tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(this->GName(), nut*GbyNu);
tgradU.clear();
// Update omega and G at the wall
omega_.boundaryField().updateCoeffs();
volScalarField CDkOmega
(
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
);
volScalarField F1(this->F1(CDkOmega));
{
volScalarField gamma(this->gamma(F1));
volScalarField beta(this->beta(F1));
// Turbulent frequency equation
tmp<fvScalarMatrix> omegaEqn
(
fvm::ddt(alpha, rho, omega_)
+ fvm::div(alphaRhoPhi, omega_)
- fvm::laplacian(alpha*rho*DomegaEff(F1), omega_)
==
alpha*rho*gamma
*min
(
GbyNu,
(c1_/a1_)*betaStar_*omega_*max(a1_*omega_, b1_*F23()*sqrt(S2))
)
- fvm::SuSp((2.0/3.0)*alpha*rho*gamma*divU, omega_)
- fvm::Sp(alpha*rho*beta*omega_, omega_)
- fvm::SuSp
(
alpha*rho*(F1 - scalar(1))*CDkOmega/omega_,
omega_
)
+ Qsas(S2, gamma, beta)
+ omegaSource()
);
omegaEqn().relax();
omegaEqn().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn);
bound(omega_, this->omegaMin_);
}
// Turbulent kinetic energy equation
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(alpha, rho, k_)
+ fvm::div(alphaRhoPhi, k_)
- fvm::laplacian(alpha*rho*DkEff(F1), k_)
==
min(alpha*rho*G, (c1_*betaStar_)*alpha*rho*k_*omega_)
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
- fvm::Sp(alpha*rho*betaStar_*omega_, k_)
+ kSource()
);
kEqn().relax();
solve(kEqn);
bound(k_, this->kMin_);
correctNut(S2);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels } // End namespace RASModels

View File

@ -31,6 +31,8 @@ Description
Implementation of the k-omega-SST turbulence model for Implementation of the k-omega-SST turbulence model for
incompressible and compressible flows. incompressible and compressible flows.
Light wrapper around base class.
Turbulence model described in: Turbulence model described in:
\verbatim \verbatim
Menter, F. R. & Esch, T. (2001). Menter, F. R. & Esch, T. (2001).
@ -98,11 +100,15 @@ Description
SourceFiles SourceFiles
kOmegaSST.C kOmegaSST.C
SeeAlso
kOmegaSSTBase.H
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef kOmegaSST_H #ifndef kOmegaSST_H
#define kOmegaSST_H #define kOmegaSST_H
#include "kOmegaSSTBase.H"
#include "RASModel.H" #include "RASModel.H"
#include "eddyViscosity.H" #include "eddyViscosity.H"
@ -114,110 +120,21 @@ namespace RASModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class kOmegaSST Declaration Class kOmegaSST Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
class kOmegaSST class kOmegaSST
: :
public eddyViscosity<RASModel<BasicTurbulenceModel> > public kOmegaSSTBase<eddyViscosity<RASModel<BasicTurbulenceModel> > >
{ {
// Private Member Functions
// Disallow default bitwise copy construct and assignment
kOmegaSST(const kOmegaSST&);
kOmegaSST& operator=(const kOmegaSST&);
protected: protected:
// Protected data // Protecetd Member Functions
// Model coefficients
dimensionedScalar alphaK1_;
dimensionedScalar alphaK2_;
dimensionedScalar alphaOmega1_;
dimensionedScalar alphaOmega2_;
dimensionedScalar gamma1_;
dimensionedScalar gamma2_;
dimensionedScalar beta1_;
dimensionedScalar beta2_;
dimensionedScalar betaStar_;
dimensionedScalar a1_;
dimensionedScalar b1_;
dimensionedScalar c1_;
Switch F3_;
// Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField k_;
volScalarField omega_;
// Private Member Functions
tmp<volScalarField> F1(const volScalarField& CDkOmega) const;
tmp<volScalarField> F2() const;
tmp<volScalarField> F3() const;
tmp<volScalarField> F23() const;
tmp<volScalarField> blend
(
const volScalarField& F1,
const dimensionedScalar& psi1,
const dimensionedScalar& psi2
) const
{
return F1*(psi1 - psi2) + psi2;
}
tmp<volScalarField> alphaK(const volScalarField& F1) const
{
return blend(F1, alphaK1_, alphaK2_);
}
tmp<volScalarField> alphaOmega(const volScalarField& F1) const
{
return blend(F1, alphaOmega1_, alphaOmega2_);
}
tmp<volScalarField> beta(const volScalarField& F1) const
{
return blend(F1, beta1_, beta2_);
}
tmp<volScalarField> gamma(const volScalarField& F1) const
{
return blend(F1, gamma1_, gamma2_);
}
void correctNut(const volScalarField& S2);
// Protected Member Functions
virtual void correctNut(const volScalarField& S2);
virtual void correctNut(); virtual void correctNut();
virtual tmp<fvScalarMatrix> kSource() const;
virtual tmp<fvScalarMatrix> omegaSource() const;
virtual tmp<fvScalarMatrix> Qsas
(
const volScalarField& S2,
const volScalarField& gamma,
const volScalarField& beta
) const;
public: public:
@ -250,68 +167,6 @@ public:
//- Destructor //- Destructor
virtual ~kOmegaSST() virtual ~kOmegaSST()
{} {}
// Member Functions
//- Re-read model coefficients if they have changed
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff(const volScalarField& F1) const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", alphaK(F1)*this->nut_ + this->nu())
);
}
//- Return the effective diffusivity for omega
tmp<volScalarField> DomegaEff(const volScalarField& F1) const
{
return tmp<volScalarField>
(
new volScalarField
(
"DomegaEff",
alphaOmega(F1)*this->nut_ + this->nu()
)
);
}
//- Return the turbulence kinetic energy
virtual tmp<volScalarField> k() const
{
return k_;
}
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> epsilon() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"epsilon",
this->mesh_.time().timeName(),
this->mesh_
),
betaStar_*k_*omega_,
omega_.boundaryField().types()
)
);
}
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> omega() const
{
return omega_;
}
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
}; };

View File

@ -0,0 +1,480 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kOmegaSSTBase.H"
#include "bound.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicEddyViscosityModel>
tmp<volScalarField> kOmegaSSTBase<BasicEddyViscosityModel>::F1
(
const volScalarField& CDkOmega
) const
{
tmp<volScalarField> CDkOmegaPlus = max
(
CDkOmega,
dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10)
);
tmp<volScalarField> arg1 = min
(
min
(
max
(
(scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_),
scalar(500)*(this->mu()/this->rho_)/(sqr(y_)*omega_)
),
(4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_))
),
scalar(10)
);
return tanh(pow4(arg1));
}
template<class BasicEddyViscosityModel>
tmp<volScalarField> kOmegaSSTBase<BasicEddyViscosityModel>::F2() const
{
tmp<volScalarField> arg2 = min
(
max
(
(scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_),
scalar(500)*(this->mu()/this->rho_)/(sqr(y_)*omega_)
),
scalar(100)
);
return tanh(sqr(arg2));
}
template<class BasicEddyViscosityModel>
tmp<volScalarField> kOmegaSSTBase<BasicEddyViscosityModel>::F3() const
{
tmp<volScalarField> arg3 = min
(
150*(this->mu()/this->rho_)/(omega_*sqr(y_)),
scalar(10)
);
return 1 - tanh(pow4(arg3));
}
template<class BasicEddyViscosityModel>
tmp<volScalarField> kOmegaSSTBase<BasicEddyViscosityModel>::F23() const
{
tmp<volScalarField> f23(F2());
if (F3_)
{
f23() *= F3();
}
return f23;
}
template<class BasicEddyViscosityModel>
void kOmegaSSTBase<BasicEddyViscosityModel>::correctNut
(
const volScalarField& S2
)
{
// Correct the turbulence viscosity
this->nut_ = a1_*k_/max(a1_*omega_, b1_*F23()*sqrt(S2));
this->nut_.correctBoundaryConditions();
}
template<class BasicEddyViscosityModel>
void kOmegaSSTBase<BasicEddyViscosityModel>::correctNut()
{
correctNut(2*magSqr(symm(fvc::grad(this->U_))));
}
template<class BasicEddyViscosityModel>
tmp<fvScalarMatrix> kOmegaSSTBase<BasicEddyViscosityModel>::kSource() const
{
return tmp<fvScalarMatrix>
(
new fvScalarMatrix
(
k_,
dimVolume*this->rho_.dimensions()*k_.dimensions()/dimTime
)
);
}
template<class BasicEddyViscosityModel>
tmp<fvScalarMatrix> kOmegaSSTBase<BasicEddyViscosityModel>::omegaSource() const
{
return tmp<fvScalarMatrix>
(
new fvScalarMatrix
(
omega_,
dimVolume*this->rho_.dimensions()*omega_.dimensions()/dimTime
)
);
}
template<class BasicEddyViscosityModel>
tmp<fvScalarMatrix> kOmegaSSTBase<BasicEddyViscosityModel>::Qsas
(
const volScalarField& S2,
const volScalarField& gamma,
const volScalarField& beta
) const
{
return tmp<fvScalarMatrix>
(
new fvScalarMatrix
(
omega_,
dimVolume*this->rho_.dimensions()*omega_.dimensions()/dimTime
)
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicEddyViscosityModel>
kOmegaSSTBase<BasicEddyViscosityModel>::kOmegaSSTBase
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
BasicEddyViscosityModel
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
alphaK1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaK1",
this->coeffDict_,
0.85
)
),
alphaK2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaK2",
this->coeffDict_,
1.0
)
),
alphaOmega1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaOmega1",
this->coeffDict_,
0.5
)
),
alphaOmega2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaOmega2",
this->coeffDict_,
0.856
)
),
gamma1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"gamma1",
this->coeffDict_,
5.0/9.0
)
),
gamma2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"gamma2",
this->coeffDict_,
0.44
)
),
beta1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"beta1",
this->coeffDict_,
0.075
)
),
beta2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"beta2",
this->coeffDict_,
0.0828
)
),
betaStar_
(
dimensioned<scalar>::lookupOrAddToDict
(
"betaStar",
this->coeffDict_,
0.09
)
),
a1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"a1",
this->coeffDict_,
0.31
)
),
b1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"b1",
this->coeffDict_,
1.0
)
),
c1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"c1",
this->coeffDict_,
10.0
)
),
F3_
(
Switch::lookupOrAddToDict
(
"F3",
this->coeffDict_,
false
)
),
y_(wallDist::New(this->mesh_).y()),
k_
(
IOobject
(
IOobject::groupName("k", U.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
),
omega_
(
IOobject
(
IOobject::groupName("omega", U.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
)
{
bound(k_, this->kMin_);
bound(omega_, this->omegaMin_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicEddyViscosityModel>
bool kOmegaSSTBase<BasicEddyViscosityModel>::read()
{
if (BasicEddyViscosityModel::read())
{
alphaK1_.readIfPresent(this->coeffDict());
alphaK2_.readIfPresent(this->coeffDict());
alphaOmega1_.readIfPresent(this->coeffDict());
alphaOmega2_.readIfPresent(this->coeffDict());
gamma1_.readIfPresent(this->coeffDict());
gamma2_.readIfPresent(this->coeffDict());
beta1_.readIfPresent(this->coeffDict());
beta2_.readIfPresent(this->coeffDict());
betaStar_.readIfPresent(this->coeffDict());
a1_.readIfPresent(this->coeffDict());
b1_.readIfPresent(this->coeffDict());
c1_.readIfPresent(this->coeffDict());
F3_.readIfPresent("F3", this->coeffDict());
return true;
}
else
{
return false;
}
}
template<class BasicEddyViscosityModel>
void kOmegaSSTBase<BasicEddyViscosityModel>::correct()
{
if (!this->turbulence_)
{
return;
}
// 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_;
BasicEddyViscosityModel::correct();
volScalarField divU(fvc::div(fvc::absolute(this->phi(), U)));
tmp<volTensorField> tgradU = fvc::grad(U);
volScalarField S2(2*magSqr(symm(tgradU())));
volScalarField GbyNu((tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(this->GName(), nut*GbyNu);
tgradU.clear();
// Update omega and G at the wall
omega_.boundaryField().updateCoeffs();
volScalarField CDkOmega
(
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
);
volScalarField F1(this->F1(CDkOmega));
{
volScalarField gamma(this->gamma(F1));
volScalarField beta(this->beta(F1));
// Turbulent frequency equation
tmp<fvScalarMatrix> omegaEqn
(
fvm::ddt(alpha, rho, omega_)
+ fvm::div(alphaRhoPhi, omega_)
- fvm::laplacian(alpha*rho*DomegaEff(F1), omega_)
==
alpha*rho*gamma
*min
(
GbyNu,
(c1_/a1_)*betaStar_*omega_*max(a1_*omega_, b1_*F23()*sqrt(S2))
)
- fvm::SuSp((2.0/3.0)*alpha*rho*gamma*divU, omega_)
- fvm::Sp(alpha*rho*beta*omega_, omega_)
- fvm::SuSp
(
alpha*rho*(F1 - scalar(1))*CDkOmega/omega_,
omega_
)
+ Qsas(S2, gamma, beta)
+ omegaSource()
);
omegaEqn().relax();
omegaEqn().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn);
bound(omega_, this->omegaMin_);
}
// Turbulent kinetic energy equation
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(alpha, rho, k_)
+ fvm::div(alphaRhoPhi, k_)
- fvm::laplacian(alpha*rho*DkEff(F1), k_)
==
min(alpha*rho*G, (c1_*betaStar_)*alpha*rho*k_*omega_)
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
- fvm::Sp(alpha*rho*betaStar_*omega_, k_)
+ kSource()
);
kEqn().relax();
solve(kEqn);
bound(k_, this->kMin_);
correctNut(S2);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,320 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::kOmegaSSTBase
Description
Base class implementation of the k-omega-SST turbulence model for
incompressible and compressible flows.
Turbulence model described in:
\verbatim
Menter, F. R. & Esch, T. (2001).
Elements of Industrial Heat Transfer Prediction.
16th Brazilian Congress of Mechanical Engineering (COBEM).
\endverbatim
with updated coefficients from
\verbatim
Menter, F. R., Kuntz, M., and Langtry, R. (2003).
Ten Years of Industrial Experience with the SST Turbulence Model.
Turbulence, Heat and Mass Transfer 4, ed: K. Hanjalic, Y. Nagano,
& M. Tummers, Begell House, Inc., 625 - 632.
\endverbatim
but with the consistent production terms from the 2001 paper as form in the
2003 paper is a typo, see
\verbatim
http://turbmodels.larc.nasa.gov/sst.html
\endverbatim
and the addition of the optional F3 term for rough walls from
\verbatim
Hellsten, A. (1998).
"Some Improvements in Menters k-omega-SST turbulence model"
29th AIAA Fluid Dynamics Conference, AIAA-98-2554.
\endverbatim
Note that this implementation is written in terms of alpha diffusion
coefficients rather than the more traditional sigma (alpha = 1/sigma) so
that the blending can be applied to all coefficuients in a consistent
manner. The paper suggests that sigma is blended but this would not be
consistent with the blending of the k-epsilon and k-omega models.
Also note that the error in the last term of equation (2) relating to
sigma has been corrected.
Wall-functions are applied in this implementation by using equations (14)
to specify the near-wall omega as appropriate.
The blending functions (15) and (16) are not currently used because of the
uncertainty in their origin, range of applicability and that if y+ becomes
sufficiently small blending u_tau in this manner clearly becomes nonsense.
The default model coefficients are
\verbatim
kOmegaSSTBaseCoeffs
{
alphaK1 0.85;
alphaK2 1.0;
alphaOmega1 0.5;
alphaOmega2 0.856;
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
gamma1 5/9;
gamma2 0.44;
a1 0.31;
b1 1.0;
c1 10.0;
F3 no;
}
\endverbatim
SourceFiles
kOmegaSSTBase.C
\*---------------------------------------------------------------------------*/
#ifndef kOmegaSSTBase_H
#define kOmegaSSTBase_H
#include "RASModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class kOmegaSSTBase Declaration
\*---------------------------------------------------------------------------*/
template<class BasicEddyViscosityModel>
class kOmegaSSTBase
:
public BasicEddyViscosityModel
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
kOmegaSSTBase(const kOmegaSSTBase&);
kOmegaSSTBase& operator=(const kOmegaSSTBase&);
protected:
// Protected data
// Model coefficients
dimensionedScalar alphaK1_;
dimensionedScalar alphaK2_;
dimensionedScalar alphaOmega1_;
dimensionedScalar alphaOmega2_;
dimensionedScalar gamma1_;
dimensionedScalar gamma2_;
dimensionedScalar beta1_;
dimensionedScalar beta2_;
dimensionedScalar betaStar_;
dimensionedScalar a1_;
dimensionedScalar b1_;
dimensionedScalar c1_;
Switch F3_;
// Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField k_;
volScalarField omega_;
// Protected Member Functions
tmp<volScalarField> F1(const volScalarField& CDkOmega) const;
tmp<volScalarField> F2() const;
tmp<volScalarField> F3() const;
tmp<volScalarField> F23() const;
tmp<volScalarField> blend
(
const volScalarField& F1,
const dimensionedScalar& psi1,
const dimensionedScalar& psi2
) const
{
return F1*(psi1 - psi2) + psi2;
}
tmp<volScalarField> alphaK(const volScalarField& F1) const
{
return blend(F1, alphaK1_, alphaK2_);
}
tmp<volScalarField> alphaOmega(const volScalarField& F1) const
{
return blend(F1, alphaOmega1_, alphaOmega2_);
}
tmp<volScalarField> beta(const volScalarField& F1) const
{
return blend(F1, beta1_, beta2_);
}
tmp<volScalarField> gamma(const volScalarField& F1) const
{
return blend(F1, gamma1_, gamma2_);
}
virtual void correctNut(const volScalarField& S2);
virtual void correctNut();
virtual tmp<fvScalarMatrix> kSource() const;
virtual tmp<fvScalarMatrix> omegaSource() const;
virtual tmp<fvScalarMatrix> Qsas
(
const volScalarField& S2,
const volScalarField& gamma,
const volScalarField& beta
) const;
public:
typedef typename BasicEddyViscosityModel::alphaField alphaField;
typedef typename BasicEddyViscosityModel::rhoField rhoField;
typedef typename BasicEddyViscosityModel::transportModel transportModel;
// Constructors
//- Construct from components
kOmegaSSTBase
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~kOmegaSSTBase()
{}
// Member Functions
//- Re-read model coefficients if they have changed
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff(const volScalarField& F1) const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", alphaK(F1)*this->nut_ + this->nu())
);
}
//- Return the effective diffusivity for omega
tmp<volScalarField> DomegaEff(const volScalarField& F1) const
{
return tmp<volScalarField>
(
new volScalarField
(
"DomegaEff",
alphaOmega(F1)*this->nut_ + this->nu()
)
);
}
//- Return the turbulence kinetic energy
virtual tmp<volScalarField> k() const
{
return k_;
}
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> epsilon() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"epsilon",
this->mesh_.time().timeName(),
this->mesh_
),
betaStar_*k_*omega_,
omega_.boundaryField().types()
)
);
}
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> omega() const
{
return omega_;
}
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kOmegaSSTBase.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -175,6 +175,7 @@ kOmegaSSTSAS<BasicTurbulenceModel>::kOmegaSSTSAS
{ {
if (type == typeName) if (type == typeName)
{ {
this->correctNut();
this->printCoeffs(type); this->printCoeffs(type);
} }
} }

View File

@ -208,7 +208,7 @@ public:
// Member Functions // Member Functions
//- Read RASProperties dictionary //- Re-read model coefficients if they have changed
virtual bool read(); virtual bool read();
//- Return the effective diffusivity for k //- Return the effective diffusivity for k

View File

@ -677,120 +677,138 @@ Foam::fluxSummary::~fluxSummary()
void Foam::fluxSummary::read(const dictionary& dict) void Foam::fluxSummary::read(const dictionary& dict)
{ {
if (active_) if (!active_)
{ {
functionObjectFile::read(dict); return;
}
log_ = dict.lookupOrDefault<Switch>("log", true); functionObjectFile::read(dict);
mode_ = modeTypeNames_.read(dict.lookup("mode")); log_ = dict.lookupOrDefault<Switch>("log", true);
phiName_= dict.lookupOrDefault<word>("phiName", "phi");
dict.readIfPresent("scaleFactor", scaleFactor_);
dict.readIfPresent("tolerance", tolerance_);
// initialise with capacity of 10 faceZones mode_ = modeTypeNames_.read(dict.lookup("mode"));
DynamicList<vector> refDir(10); phiName_= dict.lookupOrDefault<word>("phiName", "phi");
DynamicList<word> faceZoneName(refDir.size()); dict.readIfPresent("scaleFactor", scaleFactor_);
DynamicList<List<label> > faceID(refDir.size()); dict.readIfPresent("tolerance", tolerance_);
DynamicList<List<label> > facePatchID(refDir.size());
DynamicList<List<scalar> > faceSign(refDir.size());
switch (mode_) // initialise with capacity of 10 faceZones
DynamicList<vector> refDir(10);
DynamicList<word> faceZoneName(refDir.size());
DynamicList<List<label> > faceID(refDir.size());
DynamicList<List<label> > facePatchID(refDir.size());
DynamicList<List<scalar> > faceSign(refDir.size());
switch (mode_)
{
case mdFaceZone:
{ {
case mdFaceZone: List<word> zones(dict.lookup("faceZones"));
{
List<word> zones(dict.lookup("faceZones"));
forAll(zones, i) forAll(zones, i)
{
initialiseFaceZone
(
zones[i],
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
case mdFaceZoneAndDirection:
{ {
List<Tuple2<word, vector> > initialiseFaceZone
zoneAndDirection(dict.lookup("faceZoneAndDirection"));
forAll(zoneAndDirection, i)
{
initialiseFaceZoneAndDirection
(
zoneAndDirection[i].first(),
zoneAndDirection[i].second(),
refDir,
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
case mdCellZoneAndDirection:
{
List<Tuple2<word, vector> >
zoneAndDirection(dict.lookup("cellZoneAndDirection"));
forAll(zoneAndDirection, i)
{
initialiseCellZoneAndDirection
(
zoneAndDirection[i].first(),
zoneAndDirection[i].second(),
refDir,
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
default:
{
FatalIOErrorIn
( (
"void Foam::fluxSummary::read(const dictionary&)", zones[i],
dict faceZoneName,
) faceID,
<< "unhandled enumeration " << modeTypeNames_[mode_] facePatchID,
<< abort(FatalIOError); faceSign
}
}
faceZoneName_.transfer(faceZoneName);
refDir_.transfer(refDir);
faceID_.transfer(faceID);
facePatchID_.transfer(facePatchID);
faceSign_.transfer(faceSign);
initialiseFaceArea();
if (writeToFile())
{
filePtrs_.setSize(faceZoneName_.size());
forAll(filePtrs_, fileI)
{
const word& fzName = faceZoneName_[fileI];
filePtrs_.set(fileI, createFile(fzName));
writeFileHeader
(
fzName,
faceArea_[fileI],
refDir_[fileI],
filePtrs_[fileI]
); );
} }
break;
} }
case mdFaceZoneAndDirection:
{
List<Tuple2<word, vector> >
zoneAndDirection(dict.lookup("faceZoneAndDirection"));
forAll(zoneAndDirection, i)
{
initialiseFaceZoneAndDirection
(
zoneAndDirection[i].first(),
zoneAndDirection[i].second(),
refDir,
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
case mdCellZoneAndDirection:
{
List<Tuple2<word, vector> >
zoneAndDirection(dict.lookup("cellZoneAndDirection"));
forAll(zoneAndDirection, i)
{
initialiseCellZoneAndDirection
(
zoneAndDirection[i].first(),
zoneAndDirection[i].second(),
refDir,
faceZoneName,
faceID,
facePatchID,
faceSign
);
}
break;
}
default:
{
FatalIOErrorIn
(
"void Foam::fluxSummary::read(const dictionary&)",
dict
)
<< "unhandled enumeration " << modeTypeNames_[mode_]
<< abort(FatalIOError);
}
}
faceZoneName_.transfer(faceZoneName);
refDir_.transfer(refDir);
faceID_.transfer(faceID);
facePatchID_.transfer(facePatchID);
faceSign_.transfer(faceSign);
initialiseFaceArea();
if (writeToFile())
{
filePtrs_.setSize(faceZoneName_.size());
forAll(filePtrs_, fileI)
{
const word& fzName = faceZoneName_[fileI];
filePtrs_.set(fileI, createFile(fzName));
writeFileHeader
(
fzName,
faceArea_[fileI],
refDir_[fileI],
filePtrs_[fileI]
);
}
}
// Provide some output
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl;
forAll(faceZoneName_, zoneI)
{
const word& zoneName = faceZoneName_[zoneI];
scalar zoneArea = faceArea_[zoneI];
Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl;
}
Info<< endl;
} }
} }