40 const label patchi =
patch().index();
51 internalField().
group()
66 const auto nutLog = [&](
const label facei) -> scalar
68 const scalar yPlusFace =
yPlus[facei];
71 nutVis[facei]*yPlusFace*
kappa/
log(
max(E*yPlusFace, 1 + 1
e-4))
76 auto&
nutw = tnutw.ref();
80 case blenderType::STEPWISE:
84 if (
yPlus[facei] > yPlusLam)
86 nutw[facei] = nutLog(facei);
90 nutw[facei] = nutVis[facei];
96 case blenderType::MAX:
101 nutw[facei] =
max(nutVis[facei], nutLog(facei));
106 case blenderType::BINOMIAL:
114 pow(nutVis[facei],
n_) +
pow(nutLog(facei),
n_),
121 case blenderType::EXPONENTIAL:
128 const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
131 nutVis[facei]*
exp(-Gamma) + nutLog(facei)*
exp(-invGamma);
136 case blenderType::TANH:
141 const scalar nutLogFace = nutLog(facei);
142 const scalar b1 = nutVis[facei] + nutLogFace;
146 pow(nutVis[facei], 1.2) +
pow(nutLogFace, 1.2),
151 nutw[facei] = phiTanh*b1 + (1 - phiTanh)*b2;
169 const label patchi =
patch().index();
176 internalField().
group()
185 const scalar
kappa = wallCoeffs_.kappa();
186 const scalar E = wallCoeffs_.E();
187 const scalar yPlusLam = wallCoeffs_.yPlusLam();
190 auto&
yPlus = tyPlus.ref();
194 const scalar kappaRe =
kappa*
magUp[facei]*
y[facei]/nuw[facei];
196 scalar yp = yPlusLam;
197 const scalar ryPlusLam = 1.0/yp;
200 scalar yPlusLast = 0.0;
205 yp = (kappaRe + yp)/(1.0 +
log(E*yp));
207 }
while (
mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10 );
289 const label patchi =
patch().index();
296 internalField().
group()
312 const scalar yPlusLam = wallCoeffs_.yPlusLam();
319 if (yPlusLam >
yPlus[facei])
323 y[facei]*
sqrt(nuEff[facei]*magGradUw[facei])/nuw[facei];
337 writeLocalEntries(
os);
349 nutUWallFunctionFvPatchScalarField
scalar n_
Binomial blending exponent being used when blenderType is blenderType::BINOMIAL.
dimensionedScalar tanh(const dimensionedScalar &ds)
scalar yPlusLam() const noexcept
Return the object: yPlusLam.
virtual const volVectorField & U(const turbulenceModel &turb) const
Helper to return the velocity field either from the turbulence model (default) or the mesh database...
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
dimensionedScalar log(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
This boundary condition provides a wall function for the turbulent viscosity (i.e. nut) based on velocity (i.e. U) for low- and high-Reynolds number applications.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar sqrt(const dimensionedScalar &ds)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Abstract base class for turbulence models (RAS, LES and laminar).
The class wallFunctionBlenders is a base class that hosts common entries for various derived wall-fun...
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
constexpr const char *const group
Group name for atomic constants.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
The class nutWallFunction is an abstract base class that hosts calculation methods and common functi...
const dimensionedScalar e
Elementary charge.
dimensionedScalar exp(const dimensionedScalar &ds)
fvPatchField< scalar > fvPatchScalarField
static const word propertiesName
Default name of the turbulence properties dictionary.
tmp< scalarField > calcYPlus(const scalarField &magUp) const
Calculate yPlus.
A FieldMapper for finite-volume patch fields.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch.
nutUWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
OBJstream os(runTime.globalPath()/outputName)
virtual tmp< scalarField > yPlus() const
Calculate and return the yPlus at the boundary.
virtual void write(Ostream &os) const
Write.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeEntries(Ostream &) const
Write wall-function blending data as dictionary entries.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensionedScalar pow4(const dimensionedScalar &ds)
const std::string patch
OpenFOAM patch number as a std::string.
scalar E() const noexcept
Return the object: E.
enum blenderType blender_
Blending treatment.
wallFunctionCoefficients wallCoeffs_
Wall-function coefficients.
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
scalar kappa() const noexcept
Return the object: kappa.
A class for managing temporary objects.
static const nutWallFunctionFvPatchScalarField & nutw(const turbulenceModel &turbModel, const label patchi)
Return the nut patchField for the given wall patch.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
blenderType
Options for the blending treatment of viscous and inertial sublayers.
void writeLocalEntries(Ostream &) const
Write local wall function variables.
static constexpr const zero Zero
Global zero (0)