Commit 3b840040 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: epsilonWallFunction - enable low-Re mode to be [de]activated on a

switch

The new lowReCorrection entry can be used to ensure that the low-Re
mode is only applied when its value is on/true, e.g.

    lowReCorrection      on;

When active, the low-Re mode is active when the local y+ is less than
the calculated y+_laminar.  When inactive, the high-Re form is employed
irrespectively of the local y+.

It has a defaulrt value of off/false for backwards compatibility with
OpenFOAM v1706
parent 59caad90
......@@ -238,21 +238,24 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
const scalar w = cornerWeights[facei];
if (yPlus > yPlusLam_)
// Default high-Re form
scalar epsilonc = w*Cmu75*pow(k[celli], 1.5)/(kappa_*y[facei]);
scalar Gc =
w
*(nutw[facei] + nuw[facei])
*magGradUw[facei]
*Cmu25*sqrt(k[celli])
/(kappa_*y[facei]);
if (lowReCorrection_ && yPlus < yPlusLam_)
{
epsilon0[celli] += w*Cmu75*pow(k[celli], 1.5)/(kappa_*y[facei]);
G0[celli] +=
w
*(nutw[facei] + nuw[facei])
*magGradUw[facei]
*Cmu25*sqrt(k[celli])
/(kappa_*y[facei]);
}
else
{
epsilon0[celli] += w*2.0*k[celli]*nuw[facei]/sqr(y[facei]);
epsilonc = w*2.0*k[celli]*nuw[facei]/sqr(y[facei]);
Gc = 0;
}
epsilon0[celli] += epsilonc;
G0[celli] += Gc;
}
}
......@@ -273,6 +276,7 @@ epsilonWallFunctionFvPatchScalarField
yPlusLam_(nutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)),
G_(),
epsilon_(),
lowReCorrection_(false),
initialised_(false),
master_(-1),
cornerWeights_()
......@@ -297,6 +301,7 @@ epsilonWallFunctionFvPatchScalarField
yPlusLam_(ptf.yPlusLam_),
G_(),
epsilon_(),
lowReCorrection_(ptf.lowReCorrection_),
initialised_(false),
master_(-1),
cornerWeights_()
......@@ -320,6 +325,7 @@ epsilonWallFunctionFvPatchScalarField
yPlusLam_(nutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)),
G_(),
epsilon_(),
lowReCorrection_(dict.lookupOrDefault("lowReCorrection", false)),
initialised_(false),
master_(-1),
cornerWeights_()
......@@ -344,6 +350,7 @@ epsilonWallFunctionFvPatchScalarField
yPlusLam_(ewfpsf.yPlusLam_),
G_(),
epsilon_(),
lowReCorrection_(ewfpsf.lowReCorrection_),
initialised_(false),
master_(-1),
cornerWeights_()
......@@ -366,6 +373,7 @@ epsilonWallFunctionFvPatchScalarField
yPlusLam_(ewfpsf.yPlusLam_),
G_(),
epsilon_(),
lowReCorrection_(ewfpsf.lowReCorrection_),
initialised_(false),
master_(-1),
cornerWeights_()
......@@ -492,11 +500,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::updateWeightedCoeffs
typedef DimensionedField<scalar, volMesh> FieldType;
FieldType& G =
const_cast<FieldType&>
(
db().lookupObject<FieldType>(turbModel.GName())
);
FieldType& G = db().lookupObjectRef<FieldType>(turbModel.GName());
FieldType& epsilon = const_cast<FieldType&>(internalField());
......@@ -560,7 +564,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::manipulateMatrix
forAll(weights, facei)
{
// Anly set the values if the weights are > tolerance
// Only set the values if the weights are > tolerance
if (weights[facei] > tolerance_)
{
nConstrainedCells++;
......@@ -594,6 +598,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
{
writeLocalEntries(os);
fixedValueFvPatchField<scalar>::write(os);
os.writeEntry("lowReCorrection", lowReCorrection_);
}
......
......@@ -42,15 +42,19 @@ Description
G | turblence generation field
\endvartable
The model switches between laminar and turbulent functions based on the
laminar-to-turbulent y+ value derived from kappa and E.
The low-Re correction is activated by setting the entry
\c lowReCorrection to 'on'; in this mode the model switches between
laminar and turbulent functions based on the laminar-to-turbulent y+ value
derived from kappa and E. When the \c lowReCorrection is inactive, the
wall function operates in high-Re mode.
Usage
\table
Property | Description | Required | Default value
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
Property | Description | Required | Default value
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
lowReCorrection | Low-Re correction active | no | off
\endtable
Example of the boundary condition specification:
......@@ -115,6 +119,9 @@ protected:
//- Local copy of turbulence epsilon field
scalarField epsilon_;
//- Apply low-Re correction term; default = no
bool lowReCorrection_;
//- Initialised flag
bool initialised_;
......
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