32 #include "turbulenceModel.H"
33 #include "fvPatchFieldMapper.H"
34 #include "volFields.H"
35 #include "addToRunTimeSelectionTable.H"
46 const label patchi = patch().index();
48 const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>(
50 turbulenceModel::propertiesName,
51 internalField().group()));
52 const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
53 const scalarField magGradU(mag(Uw.snGrad()));
54 const tmp<scalarField> tnuw = turbModel.nu(patchi);
55 const scalarField& nuw = tnuw();
58 tmp<scalarField> tnutw(
61 sqr(
calcUTau(magGradU)) / (magGradU + ROOTVSMALL) - nuw));
70 tmp<scalarField> UTau(
calcUTau(magGradU, 1, err));
75 scalarField& nutw = tnutw.ref();
80 nutw[facei] = this->operator[](facei);
88 const scalarField& magGradU)
const
95 const scalarField& magGradU,
97 scalarField& err)
const
99 const label patchi = patch().index();
101 const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>(
103 turbulenceModel::propertiesName,
104 internalField().group()));
105 const scalarField& y = turbModel.y()[patchi];
107 const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
108 const scalarField magUp(mag(Uw.patchInternalField() - Uw));
110 const tmp<scalarField> tnuw = turbModel.nu(patchi);
111 const scalarField& nuw = tnuw();
113 const scalarField& nutw = *
this;
115 tmp<scalarField> tuTau(
new scalarField(patch().size(), pTraits<scalar>::zero));
116 scalarField& uTau = tuTau.ref();
118 err.setSize(uTau.size());
123 scalar ut = sqrt((nutw[facei] + nuw[facei]) * magGradU[facei]);
133 scalar kUu = min(kappa_ * magUp[facei] / ut, 50);
134 scalar fkUu = exp(kUu) - 1 - kUu * (1 + 0.5 * kUu);
137 -ut * y[facei] / nuw[facei]
139 + 1 / E_ * (fkUu - 1.0 / 6.0 * kUu * sqr(kUu));
142 y[facei] / nuw[facei]
143 + magUp[facei] / sqr(ut)
144 + 1 / E_ * kUu * fkUu / ut;
146 scalar uTauNew = ut + f / df;
147 err[facei] = mag((ut - uTauNew) / ut);
155 && ++iter < maxIter);
157 uTau[facei] = max(0.0, ut);
167 nutWallFunctionFvPatchScalarField::writeLocalEntries(os);
169 os.writeEntryIfDifferent<label>(
"maxIter", 1000, maxIter_);
170 os.writeEntryIfDifferent<scalar>(
"tolerance", 1.e-14, tolerance_);
178 const DimensionedField<scalar, volMesh>& iF)
179 : nutWallFunctionFvPatchScalarField(
p, iF),
189 const DimensionedField<scalar, volMesh>& iF,
190 const fvPatchFieldMapper& mapper)
191 : nutWallFunctionFvPatchScalarField(ptf,
p, iF, mapper),
192 maxIter_(ptf.maxIter_),
193 tolerance_(ptf.tolerance_)
200 const DimensionedField<scalar, volMesh>& iF,
201 const dictionary& dict)
202 : nutWallFunctionFvPatchScalarField(
p, iF, dict),
203 maxIter_(dict.lookupOrDefault<label>(
"maxIter", 1000)),
204 tolerance_(dict.lookupOrDefault<scalar>(
"tolerance", 1.e-14))
211 : nutWallFunctionFvPatchScalarField(wfpsf),
212 maxIter_(wfpsf.maxIter_),
213 tolerance_(wfpsf.tolerance_)
220 const DimensionedField<scalar, volMesh>& iF)
221 : nutWallFunctionFvPatchScalarField(wfpsf, iF),
222 maxIter_(wfpsf.maxIter_),
223 tolerance_(wfpsf.tolerance_)
231 const label patchi = patch().index();
233 const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>(
235 turbulenceModel::propertiesName,
236 internalField().group()));
237 const scalarField& y = turbModel.y()[patchi];
238 const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
239 const tmp<scalarField> tnuw = turbModel.nu(patchi);
240 const scalarField& nuw = tnuw();
242 return y *
calcUTau(mag(Uw.snGrad())) / nuw;
247 fvPatchField<scalar>::write(os);
249 writeEntry(
"value", os);