2 labelList cellBoundaryFaceCount(epsilon.size(), 0);
4 scalar Cmu25 = ::pow(Cmu, 0.25);
5 scalar Cmu75 = ::pow(Cmu, 0.75);
7 const fvPatchList& patches = mesh.boundary();
9 //- Initialise the near-wall P field to zero
10 forAll(patches, patchi)
12 const fvPatch& currPatch = patches[patchi];
14 if (isType<wallFvPatch>(currPatch))
16 forAll(currPatch, facei)
18 label faceCelli = currPatch.faceCells()[facei];
20 epsilon[faceCelli] = 0.0;
26 //- Accumulate the wall face contributions to epsilon and G
27 // Increment cellBoundaryFaceCount for each face for averaging
28 forAll(patches, patchi)
30 const fvPatch& currPatch = patches[patchi];
32 if (isType<wallFvPatch>(currPatch))
34 const scalarField& nuw = nutb.boundaryField()[patchi];
36 scalarField magFaceGradU = mag(U.boundaryField()[patchi].snGrad());
38 forAll(currPatch, facei)
40 label faceCelli = currPatch.faceCells()[facei];
43 Cmu25*y[patchi][facei]
48 // For corner cells (with two boundary or more faces),
49 // epsilon and G in the near-wall cell are calculated
52 cellBoundaryFaceCount[faceCelli]++;
55 Cmu75*::pow(k[faceCelli], 1.5)
56 /(kappa*y[patchi][facei]);
61 nuw[facei]*magFaceGradU[facei]
62 *Cmu25*::sqrt(k[faceCelli])
63 /(kappa*y[patchi][facei]);
70 // perform the averaging
72 forAll(patches, patchi)
74 const fvPatch& curPatch = patches[patchi];
76 if (isType<wallFvPatch>(curPatch))
78 forAll(curPatch, facei)
80 label faceCelli = curPatch.faceCells()[facei];
82 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
83 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];