Commit 7668f381 authored by Kutalmis Bercin's avatar Kutalmis Bercin Committed by Andrew Heather
Browse files

ENH: prevent natural-logarithm domain errors in nut wall functions (#1730)

parent d576ab6e
......@@ -66,7 +66,8 @@ Foam::nutUWallFunctionFvPatchScalarField::calcNut() const
// Inertial sublayer contribution
const scalar nutLog =
nuw[facei]*(yPlus[facei]*kappa_/log(E_*yPlus[facei]) - 1.0);
nuw[facei]
*(yPlus[facei]*kappa_/log(max(E_*yPlus[facei], 1 + 1e-4)) - 1.0);
nutw[facei] = blend(nutVis, nutLog, yPlus[facei]);
}
......
......@@ -180,8 +180,11 @@ Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
),
UName_(dict.getOrDefault<word>("U", word::null)),
Cmu_(dict.getOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.getOrDefault<scalar>("kappa", 0.41)),
E_(dict.getOrDefault<scalar>("E", 9.8)),
kappa_
(
dict.getCheckOrDefault<scalar>("kappa", 0.41, scalarMinMax::ge(SMALL))
),
E_(dict.getCheckOrDefault<scalar>("E", 9.8, scalarMinMax::ge(SMALL))),
yPlusLam_(yPlusLam(kappa_, E_))
{
checkType();
......
......@@ -71,7 +71,8 @@ calcNut() const
const scalar nutVis = 0.0;
// Inertial sublayer contribution
const scalar nutLog = nuw[facei]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
const scalar nutLog =
nuw[facei]*(yPlus*kappa_/log(max(E_*yPlus, 1 + 1e-4)) - 1.0);
nutw[facei] = blend(nutVis, nutLog, yPlus);
}
......
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