initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / solvers / multiphase / bubbleFoam / wallFunctions.H
blob8650460bc11772ab72ad15e4b089ed5244cfd0ab
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)
11     {
12         const fvPatch& currPatch = patches[patchi];
14         if (isType<wallFvPatch>(currPatch))
15         {
16             forAll(currPatch, facei)
17             {
18                 label faceCelli = currPatch.faceCells()[facei];
20                 epsilon[faceCelli] = 0.0;
21                 G[faceCelli] = 0.0;
22             }
23         }
24     }
26     //- Accumulate the wall face contributions to epsilon and G
27     //  Increment cellBoundaryFaceCount for each face for averaging
28     forAll(patches, patchi)
29     {
30         const fvPatch& currPatch = patches[patchi];
32         if (isType<wallFvPatch>(currPatch))
33         {
34             const scalarField& nuw = nutb.boundaryField()[patchi];
36             scalarField magFaceGradU = mag(U.boundaryField()[patchi].snGrad());
38             forAll(currPatch, facei)
39             {
40                 label faceCelli = currPatch.faceCells()[facei];
42                 scalar yPlus =
43                     Cmu25*y[patchi][facei]
44                     *::sqrt(k[faceCelli])
45                     /nub.value();
48                 // For corner cells (with two boundary or more faces),
49                 // epsilon and G in the near-wall cell are calculated
50                 // as an average
52                 cellBoundaryFaceCount[faceCelli]++;
54                 epsilon[faceCelli] +=
55                      Cmu75*::pow(k[faceCelli], 1.5)
56                     /(kappa*y[patchi][facei]);
58                 if (yPlus > 11.6)
59                 {
60                     G[faceCelli] +=
61                         nuw[facei]*magFaceGradU[facei]
62                         *Cmu25*::sqrt(k[faceCelli])
63                         /(kappa*y[patchi][facei]);
64                 }
65             }
66         }
67     }
70     // perform the averaging
72     forAll(patches, patchi)
73     {
74         const fvPatch& curPatch = patches[patchi];
76         if (isType<wallFvPatch>(curPatch))
77         {
78             forAll(curPatch, facei)
79             {
80                 label faceCelli = curPatch.faceCells()[facei];
82                 epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
83                 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
84             }
85         }
86     }