CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

calculate dimensionless temperature using udf

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 11, 2015, 00:12
Default calculate dimensionless temperature using udf
  #1
New Member
 
Dantong Shi
Join Date: Nov 2015
Posts: 4
Rep Power: 2
lion1990 is on a distinguished road
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!
lion1990 is offline   Reply With Quote

Reply

Tags
dimensionless temperature, fluent, udf

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for Back-flow Temperature G340 Fluent UDF and Scheme Programming 3 August 21, 2013 04:56
Please Help! Temperature profile UDF for 3D geometry subhankar_bhandari FLUENT 2 April 16, 2011 05:30
Please Help! Temperature profile UDF for 3D geometry subhankar_bhandari FLUENT 0 August 16, 2010 08:40
Help please! UDF for Temperature profile in 3D subhankar_bhandari Fluent UDF and Scheme Programming 2 August 16, 2010 08:37
UDF: Repatching part temperature Mcgregor FLUENT 1 June 2, 2003 08:51


All times are GMT -4. The time now is 14:42.