CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   find Cell Index via geometry coordinates (https://www.cfd-online.com/Forums/openfoam-programming-development/171453-find-cell-index-via-geometry-coordinates.html)

McCharles May 9, 2016 04:38

find Cell Index via geometry coordinates
 
Hello everyone,

I know the xyz coordinates of a certain point in my model geometry and want to use these coordinates to get the nearest Cell Index in Open Foam. I looked through the Documentation in order to find an existing OF utility able to resolve my problem but found nothing.

I know that there is a function in OF called 'findCell' that extracts the index of a cell in a mesh. Unfortunately, I'm quite new to OpenFoam and have no Idea how to implement 'findCell' in an utility.

Does anyone have have an idea?


Charles

kmooney May 9, 2016 22:10

Heya,

Check out this thread and see if it helps you get started:
http://www.cfd-online.com/Forums/ope...-parallel.html

Cheers!
Kyle

McCharles May 10, 2016 05:12

Hello Kyle and thanks for your answer and the link!

As a first step, i would like to know how utilities are created and executed in OFl, i've never done it before. Do I simply have to write the content of my own utility in a new text file, make the file executable and run it over the specific OF case?

Thanks for your help,

Charles

kmooney May 10, 2016 14:14

Hi Charles,

It really drastically depends on what it is you're trying to do...

A good place to start might be to go through the /applications/utilities folder and see if you find something that is already doing something roughly similar to what you're trying to accomplish. Try to understand whats its doing then try and adapt it from there.

Tarak September 17, 2016 16:15

findNearestCell() tolerance
 
Hi Kyle,

As you suggested, I have been using the function findNearestCell() (which belongs to the meshSearch class, http://openfoamcfd.sourceforge.net/d...eshSearch.html) inside my script to get the nearest cells to a series of points inside the boundary layer for flow over an airfoil. It seems the tolerance (tol_, which is a public variable of the class) is hard-coded to a value of 1e-3, which may not be sufficient for regions of very fine mesh. That is why I'm getting wrong results out of the function findNearestCell(). Have you ever faced this issue, and Is there any way to change this tolerance without recompiling?

Thanks


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