How to accelerate findCell?
Hello,
I have the coordinates of a large amount of points and have to find the cooresponding points inside the mesh. For this I'm using the findCell command. I expect that this search has the longest duration in my code. Is there a possibilty to accelerate this command? Thank you very much Jens |
I think it depends on the search method you use.
There is a way to use a tree-based search which is significantly faster than the generic find cell. This is what is used within the CFDEM framework and its relatively fast. Quote:
|
Thanks for the answer. Do you have some more information about it or a hint, webside or documentation where I can read more about it?
Thank you |
Sure,
the class is meshSearch Then if you intiate your meshSearch engine using something like: Code:
meshSearch searchEngine_; Quote:
|
Thank you very much. It is not completly clear for me.
I have to define the meshSearch engine right? I don't know which parameter I have to set for the definition of the search engine. Obviously I have to change the variable particleCloud_.mesh() but I don't know how it is called in my chase. What is this variable exactly and how can I find it? Can I use the second part (polyMesh::FACE_PLANES) or do I have to change it to? If I have defined it I can use the mesh.findCell[cellnumber] command to find the cell and openfoam uses the tree search. I have found the following command: . Do I have to set the variables in brakets to use the tree search? Sorry I'm new to openfoam. Thank you very much. |
Ok, I have tried something but I don't get it work.
Here is what I tried: First of all I copied the meshSearch.H and used the #include command to make it accessable in my code. Edit: I integrated this code Code:
meshSearch ms(mesh); Thank you very much! |
I have tested the perfomance of the findCell using several parameters.
The fastest way was this command: Code:
meshSearch ms(mesh); label cellNumber=ms.findCell(Point,0,true) The speed of search can also be improved by using the findNearestCell command. It is used in the same way: Code:
meshSearch ms(mesh); label cellNumber=ms.findNearestCell(Point,0,true) |
Have you tested this in parallel? I am profiling some code and it seems findCell and reduce are gobbling up lots of CPU when run in parallel.
|
I just tried this out and got a ~20X speedup on a case that should not even be parallel (20k cells). The speed in serial using meshSearch::findNearestCell(point, 0, true) is about the same as polyMesh::findCell.
|
Could anybody explain the differences between the two available options of the meshSearch class:
polyMesh::FACE_PLANES and polyMesh::FACE_DIAGTETS ? Furthermore, we discovered that implementations of the meshSearch::findCell() algorithm differ between ESI-OpenFOAM and foam-extend-3.2. Could anybody comment on this and explain which algorithm is used in foam-extend-3.2 ? Cheeers. |
The two should be different search options. The first one I guess uses the face positions, the other one might decompose cells into tetahedron to search? I am not sure?
I cannot comment on the foam-extend vs ESI-OpenFOAM. Honestly, it is too hard to track the différences between these codes... Quote:
|
All times are GMT -4. The time now is 16:23. |