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& curPatch = patches[patchi];
14 if (isType<wallFvPatch>(curPatch))
16 forAll(curPatch, facei)
18 label faceCelli = curPatch.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& curPatch = patches[patchi];
32 if (isType<wallFvPatch>(curPatch))
34 const scalarField& rhow = rho.boundaryField()[patchi];
36 const scalarField muw = mul.boundaryField()[patchi];
37 const scalarField& mutw = mut.boundaryField()[patchi];
39 scalarField magFaceGradU =
40 mag(U.boundaryField()[patchi].snGrad());
42 forAll(curPatch, facei)
44 label faceCelli = curPatch.faceCells()[facei];
47 Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])
48 /(muw[facei]/rhow[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*rho[faceCelli]*::pow(k[faceCelli], 1.5)
58 /(kappa*y[patchi][facei]);
63 mutw[facei]*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 (isType<wallFvPatch>(curPatch))
80 forAll(curPatch, facei)
82 label faceCelli = curPatch.faceCells()[facei];
84 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
85 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];