36 namespace incompressible
44 nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcNut()
const
46 const label patchI = patch().index();
51 const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
56 tmp<scalarField> tyPlus = calcYPlus(magUp);
59 tmp<scalarField> tnutw(
new scalarField(patch().size(), 0.0));
66 const scalar
Re = magUp[facei]*y[facei]/nuw[facei];
67 nutw[facei] = nuw[facei]*(
sqr(yPlus[facei])/Re - 1);
76 nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcYPlus
81 const label patchI = patch().index();
85 const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
87 tmp<scalarField> tyPlus(
new scalarField(patch().size(), 0.0));
90 if (roughnessHeight_ > 0.0)
93 const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_;
94 static const scalar c_2 = 2.25/(90 - 2.25);
95 static const scalar c_3 = 2.0*
atan(1.0)/
log(90/2.25);
96 static const scalar c_4 = c_3*
log(2.25);
104 const scalar magUpara = magUp[facei];
105 const scalar
Re = magUpara*y[facei]/nuw[facei];
109 const scalar ryPlusLam = 1.0/yp;
112 scalar yPlusLast = 0.0;
113 scalar dKsPlusdYPlus = roughnessHeight_/y[facei];
117 if (dKsPlusdYPlus > 1)
123 dKsPlusdYPlus *= roughnessFudgeFactor_;
130 scalar KsPlus = yp*dKsPlusdYPlus;
135 scalar yPlusGPrime = 0.0;
139 const scalar t_1 = 1 + roughnessConstant_*KsPlus;
141 yPlusGPrime = roughnessConstant_*KsPlus/t_1;
143 else if (KsPlus > 2.25)
145 const scalar t_1 = c_1*KsPlus - c_2;
146 const scalar t_2 = c_3*
log(KsPlus) - c_4;
147 const scalar sint_2 =
sin(t_2);
148 const scalar logt_1 =
log(t_1);
151 (c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*
cos(t_2));
154 scalar denom = 1.0 +
log(
E_*yp) - G - yPlusGPrime;
155 if (
mag(denom) > VSMALL)
157 yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
161 mag(ryPlusLam*(yp - yPlusLast)) > 0.0001
166 yPlus[facei] =
max(0.0, yp);
175 const scalar magUpara = magUp[facei];
176 const scalar Re = magUpara*y[facei]/nuw[facei];
180 const scalar ryPlusLam = 1.0/yp;
183 scalar yPlusLast = 0.0;
188 yp = (kappaRe + yp)/(1.0 +
log(
E_*yp));
190 }
while(
mag(ryPlusLam*(yp - yPlusLast)) > 0.0001 && ++iter < 10);
192 yPlus[facei] =
max(0.0, yp);
226 roughnessHeight_(ptf.roughnessHeight_),
227 roughnessConstant_(ptf.roughnessConstant_),
228 roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
254 roughnessHeight_(rwfpsf.roughnessHeight_),
255 roughnessConstant_(rwfpsf.roughnessConstant_),
256 roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
268 roughnessHeight_(rwfpsf.roughnessHeight_),
269 roughnessConstant_(rwfpsf.roughnessConstant_),
270 roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
279 const label patchI = patch().index();
285 return calcYPlus(magUp);
295 writeLocalEntries(os);
302 writeEntry(
"value", os);