Merge /u/wyldckat/foam-extend32/ branch master into master
[foam-extend-3.2.git] / src / lagrangian / dieselSpray / spray / findInjectorCell.H
blob82420b7521aadff7df1bf76522d1ac7bc1a0e77c
3 bool foundCell = false;
4 if (injectorCell >= 0)
6     const vector& C = mesh_.C()[injectorCell];
7     injectionPosition += 1.0e-9*(C - injectionPosition);
9     foundCell = mesh_.pointInCell
10     (
11         injectionPosition,
12         injectorCell
13     );
16 reduce(foundCell, orOp<bool>());
18 // NN.
19 // Due to the disc injection, the injectionPosition
20 // can be moved outside the domain.
21 // try point injection
23 if (!foundCell)
25     injectionPosition = it->position(n);
26     injectorCell = mesh_.findCell(injectionPosition);
28     if (injectorCell >= 0)
29     {
30         const vector& C = mesh_.C()[injectorCell];
31         injectionPosition += 1.0e-6*(C - injectionPosition);
33         foundCell = mesh_.pointInCell
34         (
35             injectionPosition,
36             injectorCell
37         );
38     }
39     reduce(foundCell, orOp<bool>());
41     // if point injection also failed then
42     // find nearest cell and try that one
43     // the point is probably on an edge
44     if (!foundCell)
45     {
46         injectorCell =
47             mesh_.findNearestCell(injectionPosition);
49         if (injectorCell >= 0)
50         {
52             const vector& C = mesh_.C()[injectorCell];
53             injectionPosition += 1.0e-9*(C - injectionPosition);
55             foundCell = mesh_.pointInCell
56             (
57                 injectionPosition,
58                 injectorCell
59             );
60         }
61         reduce(foundCell, orOp<bool>());
63         if (!foundCell)
64         {
65             FatalError
66                 << "Cannot find injection position "
67                     << injectionPosition
68                     << abort(FatalError);
69         }
70     }