CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   read rake in UDF (http://www.cfd-online.com/Forums/fluent/48538-read-rake-udf.html)

Tomasz Bednarz June 18, 2008 19:35

read rake in UDF
 
g'day, enclosed please find the excerpt of the code which reads the rake points in UDF, You need to use surface_id (surf_id) to get acces to a specific rake in your case file, Anyway, later there are two loops: first one goes through all rake points and the second one which is based on my personal experiments (not documented anywhere in fluent manuals or forums) calculates the coordinates of the rake point in a specific cell (as 2d vector) which is later used for some mathematical operations with grads to get to a specific and reqired value, The example here, extracts U and V along the rake, hope it helps to somebody, kindest regards, Tomasz

surf_id = get_surface_id_by_name(surfname);

if (surf_id > 0) {

surf = &SurfaceList[surf_id];

Message0 ("surface %s of id %d with no of points %d\n",surfname,surf_id,surf->np);

for (i=0; i<surf->np; i++)

{

c = surf->points[i].cell;

cell = RP_CELL(&c);

t = RP_THREAD(&c);

C_CENTROID(centroid,cell,t);

x=0; y=0;

for (j=0; j<surf->points[i].nc; j++)

{

node = C_NODE(cell,t,surf->points[i].ip[j].nid);

x += node->x[0]*surf->points[i].ip[j].wt;

y += node->x[1]*surf->points[i].ip[j].wt;

}

xy[0]=x;

xy[1]=y;

z0 = 0.0f;

NV_VV(dz, =, xy, -, centroid);

NV_V (gradz, =, C_T_G(cell,t));

z0 = C_T(cell,t);

z = z0 + NV_DOT(gradz, dz);

tt[i] = z;

NV_V (gradu, =, C_U_G(cell,t));

u0 = C_U(cell,t);

u = u0 + NV_DOT(gradu, dz);

NV_V (gradv, =, C_V_G(cell,t));

v0 = C_V(cell,t);

v = v0 + NV_DOT(gradv, dz);

/* your velocity components are in u and v */

}



All times are GMT -4. The time now is 21:34.