Commit 26a718ac authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Further to commit 0c8fb634 - turbulence models developments

- use of xxxMin_ values and code clean-up
parent a8c630eb
......@@ -106,7 +106,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
volScalarField K = 0.5*tr(B_);
solve
tmp<fvSymmTensorMatrix> BEqn
(
fvm::ddt(rho(), B_)
+ fvm::div(phi(), B_)
......@@ -118,6 +118,8 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
- (2*ce_ - 0.667*cm_)*I*rho()*epsilon()
);
BEqn().relax();
BEqn().solve();
// Bounding the component kinetic energies
......
......@@ -108,7 +108,9 @@ GenEddyVisc::GenEddyVisc
),
mesh_
)
{}
{
bound(k_, kMin_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
......@@ -79,7 +79,7 @@ LESModel::LESModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
kMin_("kMin", dimVelocity*dimVelocity, SMALL),
kMin_("kMin", sqr(dimVelocity), SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this))
{
......@@ -131,8 +131,12 @@ autoPtr<LESModel> LESModel::New
{
FatalErrorIn
(
"LESModel::New(const volVectorField& U, const "
"surfaceScalarField& phi, const basicThermo&)"
"LESModel::New"
"("
"const volVectorField&, "
"const surfaceScalarField&, "
"const basicThermo&"
")"
) << "Unknown LESModel type " << modelName
<< endl << endl
<< "Valid LESModel types are :" << endl
......@@ -167,7 +171,7 @@ bool LESModel::read()
coeffDict_ <<= *dictPtr;
}
readIfPresent("kMin", kMin_);
kMin_.readIfPresent(*this);
delta_().read(*this);
......
......@@ -302,7 +302,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
volScalarField Stilda =
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
solve
tmp<fvScalarMatrix> nuTildaEqn
(
fvm::ddt(rho(), nuTilda_)
+ fvm::div(phi(), nuTilda_)
......@@ -318,6 +318,9 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(rho()*Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_)
);
nuTildaEqn().relax();
nuTildaEqn().solve();
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions();
......
......@@ -118,7 +118,7 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && D);
solve
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_)
......@@ -129,9 +129,8 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce_(D)*rho()*sqrt(k_)/delta(), k_)
);
//FIXME: why not this?
// kEqn.relax();
// kEqn.solve();
kEqn().relax();
kEqn().solve();
bound(k_, kMin_);
......
......@@ -106,7 +106,7 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
solve
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_)
......@@ -117,6 +117,9 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
);
kEqn().relax();
kEqn().solve();
bound(k_, kMin_);
updateSubGridScaleFields();
......
......@@ -93,7 +93,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
fvScalarMatrix kEqn
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_)
......@@ -104,8 +104,8 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
);
kEqn.relax();
kEqn.solve();
kEqn().relax();
kEqn().solve();
bound(k_, kMin_);
......
......@@ -229,6 +229,7 @@ LRR::LRR
<< exit(FatalError);
}
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
......
......@@ -258,6 +258,7 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
<< exit(FatalError);
}
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
......
......@@ -187,6 +187,7 @@ LaunderSharmaKE::LaunderSharmaKE
autoCreateAlphat("alphat", mesh_)
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = rho_*Cmu_*fMu()*sqr(k_)/epsilon_;
......
......@@ -81,7 +81,7 @@ RASModel::RASModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
kMin_("kMin", dimVelocity*dimVelocity, SMALL),
kMin_("kMin", sqr(dimVelocity), SMALL),
epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
omegaMin_("omegaMin", dimless/dimTime, SMALL),
......@@ -133,9 +133,13 @@ autoPtr<RASModel> RASModel::New
{
FatalErrorIn
(
"RASModel::New(const volScalarField&, "
"const volVectorField&, const surfaceScalarField&, "
"basicThermo&)"
"RASModel::New"
"("
"const volScalarField&, "
"const volVectorField&, "
"const surfaceScalarField&, "
"basicThermo&"
")"
) << "Unknown RASModel type " << modelName
<< endl << endl
<< "Valid RASModel types are :" << endl
......
......@@ -186,6 +186,7 @@ RNGkEpsilon::RNGkEpsilon
autoCreateAlphat("alphat", mesh_)
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
......
......@@ -168,6 +168,7 @@ kEpsilon::kEpsilon
autoCreateAlphat("alphat", mesh_)
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
......
......@@ -258,6 +258,7 @@ kOmegaSST::kOmegaSST
autoCreateAlphat("alphat", mesh_)
)
{
bound(k_, kMin_);
bound(omega_, omegaMin_);
mut_ =
......
......@@ -102,7 +102,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
volScalarField K = 0.5*tr(B_);
volScalarField Epsilon = 2*nuEff()*magSqr(D);
fvSymmTensorMatrix BEqn
tmp<fvSymmTensorMatrix> BEqn
(
fvm::ddt(B_)
+ fvm::div(phi(), B_)
......@@ -114,8 +114,8 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
- (2*ce_ - 0.667*cm_)*I*Epsilon
);
BEqn.relax();
BEqn.solve();
BEqn().relax();
BEqn().solve();
// Bounding the component kinetic energies
......
......@@ -78,7 +78,7 @@ LESModel::LESModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
kMin_("kMin", dimVelocity*dimVelocity, SMALL),
kMin_("kMin", sqr(dimVelocity), SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this))
{
readIfPresent("kMin", kMin_);
......@@ -128,8 +128,12 @@ autoPtr<LESModel> LESModel::New
{
FatalErrorIn
(
"LESModel::New(const volVectorField& U, const "
"surfaceScalarField& phi, transportModel&)"
"LESModel::New"
"("
"const volVectorField&, "
"const surfaceScalarField& ,"
"transportModel&"
")"
) << "Unknown LESModel type " << modelName
<< endl << endl
<< "Valid LESModel types are :" << endl
......@@ -167,7 +171,7 @@ bool LESModel::read()
delta_().read(*this);
readIfPresent("kMin", kMin_);
kMin_.readIfPresent(*this);
return true;
}
......
......@@ -90,7 +90,10 @@ LRRDiffStress::LRRDiffStress
)
)
{
updateSubGridScaleFields(0.5*tr(B_));
volScalarField K = 0.5*tr(B_);
bound(K, kMin_);
updateSubGridScaleFields(K);
printCoeffs();
}
......@@ -111,7 +114,7 @@ void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
volScalarField K = 0.5*tr(B_);
volScalarField Epsilon = 2*nuEff()*magSqr(D);
fvSymmTensorMatrix BEqn
tmp<fvSymmTensorMatrix> BEqn
(
fvm::ddt(B_)
+ fvm::div(phi(), B_)
......@@ -124,8 +127,8 @@ void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
- (0.667 - 2*c1_)*I*pow(K, 1.5)/delta()
);
BEqn.relax();
BEqn.solve();
BEqn().relax();
BEqn().solve();
// Bounding the component kinetic energies
......
......@@ -295,7 +295,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
const volScalarField dTilda = this->dTilda(S);
const volScalarField STilda = this->STilda(S, dTilda);
fvScalarMatrix nuTildaEqn
tmp<fvScalarMatrix> nuTildaEqn
(
fvm::ddt(nuTilda_)
+ fvm::div(phi(), nuTilda_)
......@@ -311,8 +311,8 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
- fvm::Sp(Cw1_*fw(STilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_)
);
nuTildaEqn.relax();
nuTildaEqn.solve();
nuTildaEqn().relax();
nuTildaEqn().solve();
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions();
......
......@@ -176,7 +176,6 @@ SpalartAllmarasIDDES::SpalartAllmarasIDDES
1.63
)
)
{}
......
......@@ -127,6 +127,8 @@ dynOneEqEddy::dynOneEqEddy
filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
filter_(filterPtr_())
{
bound(k_, kMin_);
updateSubGridScaleFields(symm(fvc::grad(U)));
printCoeffs();
......@@ -145,7 +147,7 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField P = 2.0*nuSgs_*magSqr(D);
fvScalarMatrix kEqn
tmp<fvScalarMatrix> kEqn
(
fvm::ddt(k_)
+ fvm::div(phi(), k_)
......@@ -155,8 +157,8 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce(D)*sqrt(k_)/delta(), k_)
);
kEqn.relax();
kEqn.solve();
kEqn().relax();
kEqn().solve();
bound(k_, kMin_);
......
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