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 (isA<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 (isA<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
42 mag(U.boundaryField()[patchi].snGrad())
45 forAll(curPatch, facei)
47 label faceCelli = curPatch.faceCells()[facei];
50 Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])
51 /(muw[facei]/rhow[facei]);
53 // For corner cells (with two boundary or more faces),
54 // epsilon and G in the near-wall cell are calculated
57 cellBoundaryFaceCount[faceCelli]++;
60 Cmu75*rho[faceCelli]*::pow(k[faceCelli], 1.5)
61 /(kappa_*y[patchi][facei]);
66 mutw[facei]*magFaceGradU[facei]
67 *Cmu25*::sqrt(k[faceCelli])
68 /(kappa_*y[patchi][facei]);
75 // perform the averaging
77 forAll(patches, patchi)
79 const fvPatch& curPatch = patches[patchi];
81 if (isA<wallFvPatch>(curPatch))
83 forAll(curPatch, facei)
85 label faceCelli = curPatch.faceCells()[facei];
87 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
88 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];