FLUENT V6 - Computing wall shear stress using a User-Defined Function


Is it possible to calculate wall shear stress within a User-Defined Function (UDF)?
The UDF below (to be used with FLUENT 6.3.26) shows a strategy to compute and use wall shear stresses. It loops over all the faces of the wall boundary on which the wall shear stress has to be obtained. The wall shear stress is stored inside a UDM at the cell next to the wall.

/* ************************************************** */
/* Please make sure that at least 1 UDM is define */
#include "udf.h"

DEFINE_ON_DEMAND(wall_shear_calc)
{
Domain *d;
real wall_shear_force, area;
face_t f;
real A[ND_ND];
cell_t c, c0;
Thread *t,*t0, *c_thread;
int Zone_ID=6; /* Zone ID of the wall on which shear stress has to be calculated */
/* It can be obtained from the boundary condition panel.*/
d=Get_Domain(1);

/* Initialize the UDM value to zero in complete domain */
thread_loop_c(c_thread,d)
{
begin_c_loop(c, c_thread)
{
C_UDMI(c,c_thread,0)= 0;
}
end_c_loop(c, c_thread)
}

/* Calculate wall shear stress and store them in UDM */

t=Lookup_Thread(d,Zone_ID);
begin_f_loop(f, t)
{
F_AREA(A,f,t);
area = NV_MAG(A);
wall_shear_force = NV_MAG(F_STORAGE_R_N3V(f,t, SV_WALL_SHEAR));
c0 = F_C0(f,t);
t0 = THREAD_T0(t);
C_UDMI(c0,t0,0)= wall_shear_force/area;
}
end_f_loop(f, t)
}
/* *********************************************** */





Show Form
No comments yet. Be the first to add a comment!