# calculate dimensionless temperature using udf

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 10, 2015, 23:12 calculate dimensionless temperature using udf #1 New Member   Dantong Shi Join Date: Nov 2015 Posts: 6 Rep Power: 9 I wrote a udf to calculate dimensionless temperature for post processing for a 3D problem. The followings are my udf code. It can be interpreted and executed on demand. However, when I look into the contour, it seems not right. After some trials, I guess it should be the ''if'' language went wrong. The results seems like the if () language doesn't work. Can someone tell me what's wrong with my udf? Especially the parts with ''if ()''. #include "udf.h" DEFINE_ON_DEMAND(dimensionless_temperature1) { Domain *d; real dimensionless_t; real twall = 400; real temp; real xmin = 0; real xmax = 0.2667; real deltax = 0.01; real tbulk[27]; real integral_tuv[27]; real integral_uv[27]; Thread *t; cell_t c; real x[ND_ND]; int i; d = Get_Domain(1); /* Get the domain using ANSYS Fluent utility */ thread_loop_c(t,d) { begin_c_loop(c,t) { C_CENTROID(x,c,t); } end_c_loop(c,t) for(i=0; i<=0; i++) { integral_tuv[i]=0; integral_uv[i]=0; begin_c_loop(c,t) { if ((x[0]>=xmin+i*deltax) && (x[0]<=xmin+(i+1)*deltax)) { integral_tuv[i] += C_T(c,t)*C_U(c,t)*C_VOLUME(c,t); integral_uv[i] += C_U(c,t)*C_VOLUME(c,t); } } end_c_loop(c,t) tbulk[i] = integral_tuv[i]/integral_uv[i]; begin_c_loop(c,t) { if ((x[0]>=xmin+i*deltax) && (x[0]<=xmin+(i+1)*deltax)) { temp = C_T(c,t); dimensionless_t = (temp-twall)/(tbulk[i]-twall); C_UDMI(c,t,0) = dimensionless_t; } } end_c_loop(c,t) } } } Thanks!

 Tags dimensionless temperature, fluent, udf