This is a code block from nutWallFunction library in OpenFOAM where in, effective kinematic viscosity ($\nut_w$) at the wall is calculated using resolved field(in case of LES)/ mean field(in case of RANS) and $y^+_p$ (wall normal distance of the first cell center). this allows to set a new viscosity value as boundary condition at the wall using log law. Considering the first cell center is in the logarithmic layer of the universal velocity profile.

Now, in this code block of member function defined as nutUWallFunctionFvPatchScalarField::calcYPlus()

There has been iterations done for the yPlus value to reach convergence with maximum of 10 iterations. Why are these iterations needed? and why is the maximum number of iterations 10. I have given a reference of the code below;

tmp nutUWallFunctionFvPatchScalarField::calcYPlus

(

const scalarField& magUp

) const

{

const label patchi = patch().index();

const turbulenceModel& turbModel = db().lookupObject

(

IOobject::groupName

(

turbulenceModel::propertiesName,

internalField().group()

)

);

const scalarField& y = turbModel.y()[patchi];

const tmp tnuw = turbModel.nu(patchi);

const scalarField& nuw = tnuw();

tmp tyPlus(new scalarField(patch().size(), 0.0));

scalarField& yPlus = tyPlus.ref();

forAll(yPlus, facei)

{

scalar kappaRe = kappa_*magUp[facei]*y[facei]/nuw[facei];

scalar yp = yPlusLam_;

scalar ryPlusLam = 1.0/yp;

int iter = 0;

scalar yPlusLast = 0.0;

do

{

yPlusLast = yp;

yp = (kappaRe + yp)/(1.0 + log(E_*yp));

} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10 );

yPlus[facei] = max(0.0, yp);

}

return tyPlus;

}

My doubt is concerning the do-while loop at the end for yPlus iteration.

More Nishidh Shailesh Naik Burye's questions See All
Similar questions and discussions