39Foam::nutURoughWallFunctionFvPatchScalarField::calcNut()
const
41 const label patchi =
patch().index();
48 internalField().
group()
56 const tmp<scalarField> tnuw = turbModel.nu(patchi);
64 tmp<scalarField> tyPlus = calcYPlus(
magUp);
68 auto&
nutw = tnutw.ref();
72 if (yPlusLam <
yPlus[facei])
74 const scalar
Re =
magUp[facei]*
y[facei]/nuw[facei] + ROOTVSMALL;
84Foam::nutURoughWallFunctionFvPatchScalarField::calcYPlus
89 const label patchi =
patch().index();
96 internalField().
group()
102 const tmp<scalarField> tnuw = turbModel.nu(patchi);
105 const scalar
kappa = wallCoeffs_.kappa();
106 const scalar E = wallCoeffs_.E();
107 const scalar yPlusLam = wallCoeffs_.yPlusLam();
110 auto&
yPlus = tyPlus.ref();
112 if (roughnessHeight_ > 0.0)
115 const scalar c_1 = 1.0/(90.0 - 2.25) + roughnessConstant_;
116 static const scalar c_2 = 2.25/(90.0 - 2.25);
117 static const scalar c_3 = 2.0*
atan(1.0)/
log(90.0/2.25);
118 static const scalar c_4 = c_3*
log(2.25);
125 const scalar magUpara =
magUp[facei];
126 const scalar
Re = magUpara*
y[facei]/nuw[facei];
127 const scalar kappaRe =
kappa*
Re;
129 scalar yp = yPlusLam;
130 const scalar ryPlusLam = 1.0/yp;
133 scalar yPlusLast = 0.0;
134 scalar dKsPlusdYPlus = roughnessHeight_/
y[facei];
137 dKsPlusdYPlus *= roughnessFactor_;
144 const scalar KsPlus = yp*dKsPlusdYPlus;
149 scalar yPlusGPrime = 0;
153 const scalar t_1 = 1 + roughnessConstant_*KsPlus;
155 yPlusGPrime = roughnessConstant_*KsPlus/t_1;
157 else if (KsPlus > 2.25)
159 const scalar t_1 = c_1*KsPlus - c_2;
160 const scalar t_2 = c_3*
log(KsPlus) - c_4;
161 const scalar sint_2 =
sin(t_2);
162 const scalar logt_1 =
log(t_1);
165 (c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*
cos(t_2));
168 const scalar denom = 1.0 +
log(E*yp) -
G - yPlusGPrime;
169 if (
mag(denom) > VSMALL)
171 yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
175 mag(ryPlusLam*(yp - yPlusLast)) > tolerance_
189 const scalar magUpara =
magUp[facei];
190 const scalar
Re = magUpara*
y[facei]/nuw[facei];
191 const scalar kappaRe =
kappa*
Re;
193 scalar yp = yPlusLam;
194 const scalar ryPlusLam = 1.0/yp;
197 scalar yPlusLast = 0;
202 yp = (kappaRe + yp)/(1.0 +
log(E*yp));
207 mag(ryPlusLam*(yp - yPlusLast)) > tolerance_
219void Foam::nutURoughWallFunctionFvPatchScalarField::writeLocalEntries
234Foam::nutURoughWallFunctionFvPatchScalarField::
235nutURoughWallFunctionFvPatchScalarField
242 roughnessHeight_(
Zero),
243 roughnessConstant_(
Zero),
244 roughnessFactor_(
Zero),
250Foam::nutURoughWallFunctionFvPatchScalarField::
251nutURoughWallFunctionFvPatchScalarField
260 roughnessHeight_(ptf.roughnessHeight_),
261 roughnessConstant_(ptf.roughnessConstant_),
262 roughnessFactor_(ptf.roughnessFactor_),
263 maxIter_(ptf.maxIter_),
264 tolerance_(ptf.tolerance_)
268Foam::nutURoughWallFunctionFvPatchScalarField::
269nutURoughWallFunctionFvPatchScalarField
277 roughnessHeight_(
dict.get<scalar>(
"roughnessHeight")),
278 roughnessConstant_(
dict.get<scalar>(
"roughnessConstant")),
279 roughnessFactor_(
dict.get<scalar>(
"roughnessFactor")),
280 maxIter_(
dict.getOrDefault<label>(
"maxIter", 10)),
281 tolerance_(
dict.getOrDefault<scalar>(
"tolerance", 0.0001))
285Foam::nutURoughWallFunctionFvPatchScalarField::
286nutURoughWallFunctionFvPatchScalarField
292 roughnessHeight_(rwfpsf.roughnessHeight_),
293 roughnessConstant_(rwfpsf.roughnessConstant_),
294 roughnessFactor_(rwfpsf.roughnessFactor_),
295 maxIter_(rwfpsf.maxIter_),
296 tolerance_(rwfpsf.tolerance_)
300Foam::nutURoughWallFunctionFvPatchScalarField::
301nutURoughWallFunctionFvPatchScalarField
308 roughnessHeight_(rwfpsf.roughnessHeight_),
309 roughnessConstant_(rwfpsf.roughnessConstant_),
310 roughnessFactor_(rwfpsf.roughnessFactor_),
311 maxIter_(rwfpsf.maxIter_),
312 tolerance_(rwfpsf.tolerance_)
321 const label patchi = patch().index();
328 internalField().group()
335 return calcYPlus(
magUp());
345 writeLocalEntries(
os);
346 writeEntry(
"value",
os);
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
This boundary condition provides a wall function on the turbulent viscosity (i.e. nut) based on veloc...
virtual tmp< scalarField > yPlus() const
Calculate and return the yPlus at the boundary.
The class nutWallFunction is an abstract base class that hosts calculation methods and common functi...
static const nutWallFunctionFvPatchScalarField & nutw(const turbulenceModel &turbModel, const label patchi)
Return the nut patchField for the given wall patch.
wallFunctionCoefficients wallCoeffs_
Wall-function coefficients.
A class for managing temporary objects.
Abstract base class for turbulence models (RAS, LES and laminar).
static const word propertiesName
Default name of the turbulence properties dictionary.
scalar yPlusLam() const noexcept
Return the object: yPlusLam.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
constexpr const char *const group
Group name for atomic constants.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
const dimensionedScalar G
Newtonian constant of gravitation.
const std::string patch
OpenFOAM patch number as a std::string.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
scalarField Re(const UList< complex > &cf)
Extract real component.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sin(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)
dimensionedScalar atan(const dimensionedScalar &ds)
fvPatchField< vector > fvPatchVectorField
dimensionedScalar cos(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.