Commit fa47947f authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: return the bounded volScalarField from Foam::bound()

- this allows the bounded field to be used immediately in another
  operation (eg, within a constructor).

ENH: use bounded epsilon_ instead of (epsilon_ + epsilonMin_) in calculations.
parent cec4b184
......@@ -30,7 +30,8 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound)
Foam::volScalarField&
Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound)
{
const scalar minVsf = min(vsf).value();
......@@ -55,6 +56,8 @@ void Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound)
vsf.boundaryField() = max(vsf.boundaryField(), lowerBound.value());
}
return vsf;
}
......
......@@ -50,8 +50,9 @@ namespace Foam
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
//- Bound the given scalar field if it has gone unbounded.
// Return the bounded field.
// Used extensively in RAS and LES turbulence models.
void bound(volScalarField&, const dimensionedScalar& lowerBound);
volScalarField& bound(volScalarField&, const dimensionedScalar& lowerBound);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -119,7 +119,7 @@ LamBremhorstKE::LamBremhorstKE
y_(mesh_),
Rt_(sqr(k_)/(nu()*epsilon_)),
Rt_(sqr(k_)/(nu()*bound(epsilon_, epsilonMin_))),
fMu_
(
......@@ -141,7 +141,7 @@ LamBremhorstKE::LamBremhorstKE
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
// already bounded: bound(epsilon_, epsilonMin_);
nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
......
......@@ -173,12 +173,12 @@ LienCubicKE::LienCubicKE
gradU_(fvc::grad(U)),
eta_
(
k_/(epsilon_ + epsilonMin_)
k_/bound(epsilon_, epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
),
ksi_
(
k_/(epsilon_ + epsilonMin_)
k_/epsilon_
*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
......@@ -235,7 +235,7 @@ LienCubicKE::LienCubicKE
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
// already bounded: bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_ + C5viscosity_;
nut_.correctBoundaryConditions();
......
......@@ -222,12 +222,12 @@ LienCubicKELowRe::LienCubicKELowRe
gradU_(fvc::grad(U)),
eta_
(
k_/(epsilon_ + epsilonMin_)
k_/bound(epsilon_, epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
),
ksi_
(
k_/(epsilon_ + epsilonMin_)
k_/epsilon_
*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
......@@ -235,7 +235,7 @@ LienCubicKELowRe::LienCubicKELowRe
C5viscosity_
(
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_ + epsilonMin_)
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
*(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T()))
),
......@@ -260,7 +260,7 @@ LienCubicKELowRe::LienCubicKELowRe
symm
(
// quadratic terms
pow3(k_)/sqr(epsilon_ + epsilonMin_)
pow3(k_)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
......@@ -271,7 +271,7 @@ LienCubicKELowRe::LienCubicKELowRe
+ Ctau3_/fEta_*(gradU_.T() & gradU_)
)
// cubic term C4
- 20.0*pow4(k_)/pow3(epsilon_ + epsilonMin_)
- 20.0*pow4(k_)/pow3(epsilon_)
*pow3(Cmu_)
*(
((gradU_ & gradU_) & gradU_.T())
......@@ -289,7 +289,7 @@ LienCubicKELowRe::LienCubicKELowRe
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
// already bounded: bound(epsilon_, epsilonMin_);
nut_ = Cmu_
* (scalar(1) - exp(-Am_*yStar_))
......
......@@ -192,25 +192,25 @@ NonlinearKEShih::NonlinearKEShih
gradU_(fvc::grad(U)),
eta_
(
k_/(epsilon_ + epsilonMin_)
k_/bound(epsilon_, epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
),
ksi_
(
k_/(epsilon_+ epsilonMin_)
k_/epsilon_
*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
fEta_(A2_ + pow(eta_, 3.0)),
nut_("nut", Cmu_*sqr(k_)/(epsilon_ + epsilonMin_)),
nut_("nut", Cmu_*sqr(k_)/epsilon_),
nonlinearStress_
(
"nonlinearStress",
symm
(
pow3(k_)/sqr(epsilon_ + epsilonMin_)
pow3(k_)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
......@@ -224,7 +224,7 @@ NonlinearKEShih::NonlinearKEShih
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
// already bounded: bound(epsilon_, epsilonMin_);
#include "wallNonlinearViscosityI.H"
......
......@@ -179,7 +179,7 @@ qZeta::qZeta
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
epsilon_/(2.0*q_),
epsilon_/(2.0*bound(q_, qMin_)),
epsilon_.boundaryField().types()
),
......@@ -198,7 +198,7 @@ qZeta::qZeta
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
bound(q_, qMin_);
// already bounded: bound(q_, qMin_);
bound(zeta_, zetaMin_);
nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
......
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