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();
8 const fvPatchList& patches = mesh.boundary();
10 //- Initialise the near-wall P field to zero
11 forAll(patches, patchi)
13 const fvPatch& curPatch = patches[patchi];
15 if (isType<wallFvPatch>(curPatch))
17 forAll(curPatch, facei)
19 label faceCelli = curPatch.faceCells()[facei];
21 epsilon[faceCelli] = 0.0;
27 //- Accumulate the wall face contributions to epsilon and G
28 // Increment cellBoundaryFaceCount for each face for averaging
29 forAll(patches, patchi)
31 const fvPatch& curPatch = patches[patchi];
33 if (isType<wallFvPatch>(curPatch))
35 const scalarField& rhow = rho.boundaryField()[patchi];
37 const scalarField muw = mul.boundaryField()[patchi];
38 const scalarField& mutw = mut.boundaryField()[patchi];
40 scalarField magFaceGradU =
41 mag(U.boundaryField()[patchi].snGrad());
43 forAll(curPatch, facei)
45 label faceCelli = curPatch.faceCells()[facei];
48 Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])
49 /(muw[facei]/rhow[facei]);
51 // For corner cells (with two boundary or more faces),
52 // epsilon and G in the near-wall cell are calculated
55 cellBoundaryFaceCount[faceCelli]++;
58 Cmu75*rho[faceCelli]*::pow(k[faceCelli], 1.5)
59 /(kappa_*y[patchi][facei]);
64 mutw[facei]*magFaceGradU[facei]
65 *Cmu25*::sqrt(k[faceCelli])
66 /(kappa_*y[patchi][facei]);
73 // perform the averaging
75 forAll(patches, patchi)
77 const fvPatch& curPatch = patches[patchi];
79 if (isType<wallFvPatch>(curPatch))
81 forAll(curPatch, facei)
83 label faceCelli = curPatch.faceCells()[facei];
85 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
86 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];