cell_t c from point coorfdinates UDF
Dear all I'm new of this forum.
Could you help me? I was written a UDF(FLUENT), I should obtain the cell_t c that contain a point of known coordinate (x,y,z). I'm going to better explain. From UDF manual I know there is the macro C_CENTROID(x,c,t) that from the knoledge of c and t give x,y,z coordinate of the cell centre. I would like to know if there is a macro that could do the opposite, know the point x,y,z that could return the number of cell that contain that point. Thank you very much 
Use Find_bounding_cell
Greetings,
You can use the function: cell_t Find_bounding_cell(Domain *domain, real *x, Thread **t) You provide the domain pointer, the coordinates of the point, and it returns the cell_t index and the thread pointer. Include dpm_tools.h before using it. Regards, Bocliff Sutter 
Make sure you do not call this from some cell loop as you will end up with n^2 algorithm...
Bocliff Sutter "May your Yak live long" 
cell_t c from point coorfdinates UDF Reply to Thread
Thank you very much Bocliff
It works. You saved me from an nervous breakdown :) thnk you again 
Hi!
I see the communication in this topic was ended in 2009, but could somebody type an example of the use of this function? Is it also possible in 3D and give coordinates of x,y and z to the function? Thank you in advance, Kind regards, Ian 
Mhd
hello my dear!
I have a magnetic field in my flow and I read a lot of MHD tutorials but I am not able that in which format I should write this in c/c++ ....please if you have a similar c program me help. regards 
Quote:
I have same problem , can you solve it my friends ? 
Please share your equation. It's easy to write UDF for any equation.

Lets say I first loop over the entire domain and store cell_t c and thread *t for every cell.
Can I later access a cell using these c and t? For eg i store cell_t c and thread *t of some cell in global variables c_global and t_global. Then in some other function I do C_CENTROID ( xc , c_global, t_global ); Will xc hold the centroid of that original cell? Thanks a lot garvit goel Imperial college 
Quote:

All times are GMT 4. The time now is 12:39. 