ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / lagrangian / dieselSpray / spray / findInjectorCell.H
blobc50d276b567ef9d9a477bf1dd0bfe3e7267668ff
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 // Due to the disc injection, the injectionPosition
19 // can be moved outside the domain.
20 // try point injection
22 if (!foundCell)
24     injectionPosition = it->position(n);
26     mesh_.findCellFacePt
27     (
28         injectionPosition,
29         injectorCell,
30         injectorTetFaceI,
31         injectorTetPtI
32     );
34     if (injectorCell >= 0)
35     {
36         const vector& C = mesh_.C()[injectorCell];
37         injectionPosition += 1.0e-6*(C - injectionPosition);
39         foundCell = mesh_.pointInCell
40         (
41             injectionPosition,
42             injectorCell
43         );
44     }
45     reduce(foundCell, orOp<bool>());
47     // if point injection also failed then
48     // find nearest cell and try that one
49     // the point is probably on an edge
50     if (!foundCell)
51     {
52         injectorCell =
53             mesh_.findNearestCell(injectionPosition);
55         if (injectorCell >= 0)
56         {
58             const vector& C = mesh_.C()[injectorCell];
59             injectionPosition += 1.0e-9*(C - injectionPosition);
61             foundCell = mesh_.pointInCell
62             (
63                 injectionPosition,
64                 injectorCell
65             );
66         }
67         reduce(foundCell, orOp<bool>());
69         if (!foundCell)
70         {
71             FatalError
72                 << "Cannot find injection position "
73                     << injectionPosition
74                     << abort(FatalError);
75         }
76     }