# calculate dimensionless temperature using udf

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

 November 11, 2015, 00:12 calculate dimensionless temperature using udf #1 New Member   Dantong Shi Join Date: Nov 2015 Posts: 6 Rep Power: 3 Sponsored Links 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

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post G340 Fluent UDF and Scheme Programming 3 August 21, 2013 04:56 subhankar_bhandari FLUENT 2 April 16, 2011 05:30 subhankar_bhandari FLUENT 0 August 16, 2010 08:40 subhankar_bhandari Fluent UDF and Scheme Programming 2 August 16, 2010 08:37 Mcgregor FLUENT 1 June 2, 2003 08:51