2 labelList cellBoundaryFaceCount(epsilon.size(), 0);
4 scalar Cmu25 = ::pow(Cmu.value(), 0.25);
5 scalar Cmu75 = ::pow(Cmu.value(), 0.75);
6 scalar kappa_ = kappa.value();
7 scalar nub_ = nub.value();
9 const fvPatchList& patches = mesh.boundary();
11 //- Initialise the near-wall P field to zero
12 forAll(patches, patchi)
14 const fvPatch& currPatch = patches[patchi];
16 if (isA<wallFvPatch>(currPatch))
18 forAll(currPatch, facei)
20 label faceCelli = currPatch.faceCells()[facei];
22 epsilon[faceCelli] = 0.0;
28 //- Accumulate the wall face contributions to epsilon and G
29 // Increment cellBoundaryFaceCount for each face for averaging
30 forAll(patches, patchi)
32 const fvPatch& currPatch = patches[patchi];
34 if (isA<wallFvPatch>(currPatch))
36 const scalarField& nutbw = nutb.boundaryField()[patchi];
38 scalarField magFaceGradU(mag(Ub.boundaryField()[patchi].snGrad()));
40 forAll(currPatch, facei)
42 label faceCelli = currPatch.faceCells()[facei];
45 Cmu25*y[patchi][facei]
50 // For corner cells (with two boundary or more faces),
51 // epsilon and G in the near-wall cell are calculated
54 cellBoundaryFaceCount[faceCelli]++;
57 Cmu75*::pow(k[faceCelli], 1.5)
58 /(kappa_*y[patchi][facei]);
63 (nutbw[facei] + nub_)*magFaceGradU[facei]
64 *Cmu25*::sqrt(k[faceCelli])
65 /(kappa_*y[patchi][facei]);
72 // perform the averaging
74 forAll(patches, patchi)
76 const fvPatch& curPatch = patches[patchi];
78 if (isA<wallFvPatch>(curPatch))
80 forAll(curPatch, facei)
82 label faceCelli = curPatch.faceCells()[facei];
84 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
85 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];