CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Plotting coordinates of face centroids (http://www.cfd-online.com/Forums/fluent-udf/64331-plotting-coordinates-face-centroids.html)

O.D.Y. May 7, 2009 08:19

Plotting coordinates of face centroids
 
Hi @all,

I'm trying to display the coordinates of the face centroids of a wall zone via UDM in contur plot panel. I'm using the following UDF to determine the coordinates and to put them into UDMs:

#include "udf.h"

DEFINE_ON_DEMAND(face_centrs)
{
Domain *d;
Thread *t;
face_t f;
real x[ND_ND];

int domain_id, blade_id;

domain_id = 1;
blade_id = 17;

/* get the domain pointer to the flow_domain */
d = Get_Domain(domain_id);

/* get the thread pointer to the bladethread */
t = Lookup_Thread(d,blade_id);

begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
F_UDMI(f,t,0)=x[0];
F_UDMI(f,t,1)=x[1];
F_UDMI(f,t,2)=x[2];

Message("y-coord: %f \n", F_UDMI(f,t,1));

}
end_f_loop(f,t);

}

As you can see, I print the y-coordinate to the screen which works perfectly. But when I want to display the UDMs in the contour plot panel, all the values are zero. Can anyone tell where my mistake is?

I'd really appreciate any help.

cheers

Daniel Tanner May 7, 2009 09:21

This is a bit painful. Basically the contour plot in fluent only displays cell-centered data, i.e., it interpolates the cell-centre value to the face and then displays it. If you are using F_UDMI you are not storing the values at the cell centre - hence, it will be zero!

You could use C_UDMI instead but I am not sure if the value you save needs to be adjusted to account for the interpolation. See this link for details on using the C_UDMI for displaying face variables:

http://www.cfd-online.com/Forums/flu...cent-wall.html
http://www.cfd-online.com/Forums/flu...-gradient.html

O.D.Y. May 7, 2009 09:47

Hey Daniel,

that was exactly the hint I needed, thanks a lot!!!!!

cheers


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