CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   findCell() in parallel: not working if location is outside the domain (https://www.cfd-online.com/Forums/openfoam/197602-findcell-parallel-not-working-if-location-outside-domain.html)

TobiWol January 10, 2018 14:33

findCell() in parallel: not working if location is outside the domain
 
Hi everyone,

I try to use findCell() to find cellIDs of points calculated from vectors from a starting cell. To do this in parallel, when starting cell and points might be located in domains of different processors I use following code:

meshSearch mSearch(mesh);
labelList localCellID(Pstream::nProcs(),0);
localCellID[Pstream::myProcNo()] = mSearch.findCell(point, -1, true);
reduce(localCellID, maxOp<labelList>());

Usually, if the point is inside of a considered domain findCell() returns the cell ID, if not it returns -1. This is the description in meshSearch.H. In my case findCell() works fine if point and starting cell are in the same domain, but if the location is outside the domain the simulation hang-up when findCell() is called or is in an endless loop, so not returning -1 as expected. I also tested the reduce() command to check if at least there is everything is working, but also there the same problem.
I don't no why it's not working. I think it's not because of the use on different processors.
It would be really great if one of you has any idea what is going wrong here. Without this my code is not working.

Thank you very much in advance!
Tobias


All times are GMT -4. The time now is 19:19.