CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to accelerate findCell?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By fst-student
  • 1 Post By fst-student

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 4, 2015, 06:01
Default How to accelerate findCell?
  #1
New Member
 
Join Date: Jul 2015
Posts: 9
Rep Power: 10
fst-student is on a distinguished road
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
fst-student is offline   Reply With Quote

Old   September 6, 2015, 09:06
Default
  #2
Member
 
Bruno Blais
Join Date: Sep 2013
Location: Canada
Posts: 64
Rep Power: 12
blais.bruno is on a distinguished road
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:
Originally Posted by fst-student View Post
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
blais.bruno is offline   Reply With Quote

Old   September 6, 2015, 11:23
Default
  #3
New Member
 
Join Date: Jul 2015
Posts: 9
Rep Power: 10
fst-student is on a distinguished road
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
fst-student is offline   Reply With Quote

Old   September 6, 2015, 11:33
Default
  #4
Member
 
Bruno Blais
Join Date: Sep 2013
Location: Canada
Posts: 64
Rep Power: 12
blais.bruno is on a distinguished road
Sure,

the class is meshSearch

Then if you intiate your meshSearch engine using something like:

Code:
meshSearch searchEngine_;
searchEngine_(particleCloud_.mesh(),polyMesh::FACE_PLANES);
You can search using the .findCell() routine of meshSearch.



Quote:
Originally Posted by fst-student View Post
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
blais.bruno is offline   Reply With Quote

Old   September 7, 2015, 10:25
Default
  #5
New Member
 
Join Date: Jul 2015
Posts: 9
Rep Power: 10
fst-student is on a distinguished road
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:
Code:
findCell (const point &location, const label seedCellI=-1, const bool useTreeSearch=true)
. Do I have to set the variables in brakets to use the tree search?

Sorry I'm new to openfoam.

Thank you very much.
fst-student is offline   Reply With Quote

Old   September 8, 2015, 12:17
Default
  #6
New Member
 
Join Date: Jul 2015
Posts: 9
Rep Power: 10
fst-student is on a distinguished road
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);
label cellNumber=ms.findCell(Point,-1,true)
EDIT2: The code is runnig and is about 8 times faster than the conventional findCell.

Thank you very much!
kk415 and anhkenyt like this.

Last edited by fst-student; September 17, 2015 at 10:25.
fst-student is offline   Reply With Quote

Old   September 25, 2015, 06:57
Default
  #7
New Member
 
Join Date: Jul 2015
Posts: 9
Rep Power: 10
fst-student is on a distinguished road
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 zero disables the seeding which slows the search down. Using this configuration the search is very fast.

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)
kk415 likes this.
fst-student is offline   Reply With Quote

Old   November 12, 2015, 13:17
Default
  #8
Senior Member
 
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13
pbachant is on a distinguished road
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.
__________________
Home | Twitter | GitHub
pbachant is offline   Reply With Quote

Old   November 12, 2015, 17:00
Default
  #9
Senior Member
 
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13
pbachant is on a distinguished road
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.
__________________
Home | Twitter | GitHub
pbachant is offline   Reply With Quote

Old   July 20, 2016, 02:30
Default
  #10
New Member
 
Flo
Join Date: Jun 2015
Posts: 1
Rep Power: 0
FlowingTech is on a distinguished road
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.
FlowingTech is offline   Reply With Quote

Old   July 20, 2016, 08:24
Default
  #11
Member
 
Bruno Blais
Join Date: Sep 2013
Location: Canada
Posts: 64
Rep Power: 12
blais.bruno is on a distinguished road
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:
Originally Posted by FlowingTech View Post
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.
blais.bruno is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
accelerate the convergence entropie OpenFOAM Running, Solving & CFD 2 October 10, 2014 18:58
Is it possible to accelerate the ode solver of reactingFoam? pajofego OpenFOAM Running, Solving & CFD 2 August 10, 2014 05:38
Problems with accelerate flow. Underwater Vehicle AntonioG Main CFD Forum 0 March 18, 2014 04:36
Accelerate the assembling of 3D convection matrix Isabel Main CFD Forum 6 December 22, 2005 12:22
Accelerate convergence in coupled solver Balaji FLUENT 3 June 23, 2005 18:16


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