initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / solvers / multiphase / bubbleFoam / wallFunctions.H
blob38b7297b10b0eb66430b768f66b2b71952913cbd
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)
12     {
13         const fvPatch& currPatch = patches[patchi];
15         if (isType<wallFvPatch>(currPatch))
16         {
17             forAll(currPatch, facei)
18             {
19                 label faceCelli = currPatch.faceCells()[facei];
21                 epsilon[faceCelli] = 0.0;
22                 G[faceCelli] = 0.0;
23             }
24         }
25     }
27     //- Accumulate the wall face contributions to epsilon and G
28     //  Increment cellBoundaryFaceCount for each face for averaging
29     forAll(patches, patchi)
30     {
31         const fvPatch& currPatch = patches[patchi];
33         if (isType<wallFvPatch>(currPatch))
34         {
35             const scalarField& nuw = nutb.boundaryField()[patchi];
37             scalarField magFaceGradU = mag(U.boundaryField()[patchi].snGrad());
39             forAll(currPatch, facei)
40             {
41                 label faceCelli = currPatch.faceCells()[facei];
43                 scalar yPlus =
44                     Cmu25*y[patchi][facei]
45                     *::sqrt(k[faceCelli])
46                     /nub.value();
49                 // For corner cells (with two boundary or more faces),
50                 // epsilon and G in the near-wall cell are calculated
51                 // as an average
53                 cellBoundaryFaceCount[faceCelli]++;
55                 epsilon[faceCelli] +=
56                      Cmu75*::pow(k[faceCelli], 1.5)
57                     /(kappa_*y[patchi][facei]);
59                 if (yPlus > 11.6)
60                 {
61                     G[faceCelli] +=
62                         nuw[facei]*magFaceGradU[facei]
63                         *Cmu25*::sqrt(k[faceCelli])
64                         /(kappa_*y[patchi][facei]);
65                 }
66             }
67         }
68     }
71     // perform the averaging
73     forAll(patches, patchi)
74     {
75         const fvPatch& curPatch = patches[patchi];
77         if (isType<wallFvPatch>(curPatch))
78         {
79             forAll(curPatch, facei)
80             {
81                 label faceCelli = curPatch.faceCells()[facei];
83                 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
84                 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
85             }
86         }
87     }