initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / solvers / multiphase / twoPhaseEulerFoam / packingLimiter.H
blob457e476b2897786048ad3f7fdf3c60e7d9088c4d
1     if (packingLimiter)
2     {
3         // Calculating exceeding volume fractions
4         volScalarField alphaEx = max(alpha - alphaMax, scalar(0));
6         // Finding neighbouring cells of the whole domain
7         labelListList neighbour = mesh.cellCells();
8         scalarField cellVolumes = mesh.cellVolumes();
10         forAll (alphaEx, celli)
11         {
12             // Finding the labels of the neighbouring cells
13             labelList neighbourCell = neighbour[celli];
15             // Initializing neighbouring cells contribution
16             scalar neighboursEx = 0.0;
17            
18             forAll (neighbourCell, cellj)
19             {
20                 labelList neighboursNeighbour = neighbour[neighbourCell[cellj]];
21                 scalar neighboursNeighbourCellVolumes = 0.0;
22         
23                 forAll (neighboursNeighbour, cellk)
24                 {
25                     neighboursNeighbourCellVolumes +=
26                         cellVolumes[neighboursNeighbour[cellk]];
27                 }
29                 neighboursEx +=
30                     alphaEx[neighbourCell[cellj]]*cellVolumes[celli]
31                    /neighboursNeighbourCellVolumes;
32             }
34             alpha[celli] += neighboursEx - alphaEx[celli];
35         }
36     }