diff --git a/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C b/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C index 14b1b6ee6..2f7bdb161 100644 --- a/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C +++ b/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C @@ -116,7 +116,18 @@ template tmp buoyantKEpsilon::kSource() const { - return -fvm::SuSp(Gcoef(), this->k_); + const uniformDimensionedVectorField& g = + this->mesh_.objectRegistry::template + lookupObject("g"); + + if (mag(g.value()) > SMALL) + { + return -fvm::SuSp(Gcoef(), this->k_); + } + else + { + return kEpsilon::kSource(); + } } @@ -128,15 +139,23 @@ buoyantKEpsilon::epsilonSource() const this->mesh_.objectRegistry::template lookupObject("g"); - vector gHat(g.value()/mag(g.value())); + if (mag(g.value()) > SMALL) + { + vector gHat(g.value()/mag(g.value())); - volScalarField v(gHat & this->U_); - volScalarField u - ( - mag(this->U_ - gHat*v) + dimensionedScalar("SMALL", dimVelocity, SMALL) - ); + volScalarField v(gHat & this->U_); + volScalarField u + ( + mag(this->U_ - gHat*v) + + dimensionedScalar("SMALL", dimVelocity, SMALL) + ); - return -fvm::SuSp(this->C1_*tanh(mag(v)/u)*Gcoef(), this->epsilon_); + return -fvm::SuSp(this->C1_*tanh(mag(v)/u)*Gcoef(), this->epsilon_); + } + else + { + return kEpsilon::epsilonSource(); + } }