FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

findInjectorCell.H

Go to the documentation of this file.
00001 {
00002 
00003 bool foundCell = false;
00004 if (injectorCell >= 0)
00005 {
00006     const vector& C = mesh_.C()[injectorCell];
00007     injectionPosition += 1.0e-9*(C - injectionPosition);
00008     
00009     foundCell = mesh_.pointInCell
00010     (
00011         injectionPosition,
00012         injectorCell
00013     );
00014 }
00015 
00016 reduce(foundCell, orOp<bool>());
00017 
00018 // NN.
00019 // Due to the disc injection, the injectionPosition
00020 // can be moved outside the domain.
00021 // try point injection
00022 
00023 if (!foundCell)
00024 {
00025     injectionPosition = it->position(n);
00026     injectorCell = mesh_.findCell(injectionPosition);
00027     
00028     if (injectorCell >= 0)
00029     {
00030         const vector& C = mesh_.C()[injectorCell];
00031         injectionPosition += 1.0e-6*(C - injectionPosition);
00032 
00033         foundCell = mesh_.pointInCell
00034         (
00035             injectionPosition,
00036             injectorCell
00037         );
00038     }
00039     reduce(foundCell, orOp<bool>());
00040 
00041     // if point injection also failed then
00042     // find nearest cell and try that one
00043     // the point is probably on an edge
00044     if (!foundCell)
00045     {
00046         injectorCell =
00047             mesh_.findNearestCell(injectionPosition);
00048         
00049         if (injectorCell >= 0)
00050         {
00051             
00052             const vector& C = mesh_.C()[injectorCell];
00053             injectionPosition += 1.0e-9*(C - injectionPosition);
00054             
00055             foundCell = mesh_.pointInCell
00056             (
00057                 injectionPosition,
00058                 injectorCell
00059             );
00060         }
00061         reduce(foundCell, orOp<bool>());
00062         
00063         if (!foundCell)
00064         {
00065             FatalError 
00066                 << "Cannot find injection position " 
00067                     << injectionPosition
00068                     << abort(FatalError);
00069         }
00070     }
00071 }
00072 
00073 }
00074 
00075 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines