How can I get the values of flow variables, for example, pressure, at one point in the flow field by udf? This point may not be at the centroid of some cell. The most direct method is to search the whole domain for the cell where this point is. It is obviously time-consuming and not feasible if you have many points to know. Any suggestion from you is highly appreciated.
I can't think of anyway to find which cell a point is in other than searching through the domain. However if you have a large number of points to find, (and perhaps have some knowledge about the mesh that is being used) you could optomise the process.
For example, if you sort your list of points by their x-coordinate (say), then when you run through all the cell-centroids, you can reject a particular cell without having to compare it to *all* the points. You could try to do a binary search through you points, or you could just go through them in order until you find one that has an x-coordinate beyond the cell-centroid.
if your points don't cover the entire domain, then find the min&max x,y,z coordinates you interested in first, and then you can easily reject centroids that you aren't interested in.
Taken to an extreme, you could probably make the whole process pretty much independant of the number of points.
btw, it wouldn't hurt to have a look through the udf header files for something that isn't documented but that could be useful.
e.g. dpm.h has:
FLUENT_EXPORT int SV_locate_point (real , real , CX_Cell_Id *);
FLUENT_EXPORT int SV_locate_point_in_thread (real , real , Thread *, CX_Cell_Id *);
FLUENT_EXPORT boolean SV_is_point_in_cell (CX_Cell_Id *, cell_t, Thread *, real );
(obviously I don't know how the actually work, but the *sound* useful ;-) )
|All times are GMT -4. The time now is 05:50.|