CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   linear temperature profile + convection heat transfer (https://www.cfd-online.com/Forums/fluent-udf/148272-linear-temperature-profile-convection-heat-transfer.html)

adi.ptb February 8, 2015 06:29

linear temperature profile + convection heat transfer
 
hello,I have a problem that I hope someone would help me,I'm simulating a 2D duct that has 15 parallel solid stacks in it,the horizontal walls in the stack section are given a constant temperature with a gradient from 700k down to 300k over a distance of 10 mm utilizing udf,the heat transfer coefficient between the stack walls and the fluid is 50 W/m^2.k, I have problem to model the convection heat transfer,I have written a udf for linear temperature profile but have difficulties to write a udf for convection heat transfer,my approach was to enter the convection heat transfer as a source term in energy equation but I'm not sure whether this is a right approach or not,this is my udf i hope that i can get some help,thanks
*************************************************
DEFINE_PROFILE(linear_temp,thread,i)
{
real x[ND_ND];
real Th=700.0,Tc=300.0;
real xh=30e-3,xc=40e-3;
real dT=(Tc-Th)/(xc-xh);
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
F_PROFILE(f,thread,i)=Th+(x[0]-xh)*dT;
}
end_f_loop(f,thread)
}
************************************************** *
DEFINE_SOURCE(SRCE_solid_heat,cell,thread,dS,eqn)
{
real h,Ts,Tf,source;
h=50.0;
Ts=????????????????????????(I dont know how to access the solid temperature);
Tf=C_T(cell,thread);
source=-h*(Ts-Tf);
dS[eqn]=-h;
return source;
}

adi.ptb February 8, 2015 23:56

I'v managed a udf for fluid energy source term since i dont have any solid zone in my geometry,but i dont know whether this code is right or not,can anyone tell me????please,
DEFINE_SOURCE(SRCE_fluid_heat,cell,t,dS,eqn)
{
real Tf,source;
int ID=8 ; /* stack walls ID*/
face_t f;
cell_t c;
Domain*d;
d=Get_Domain(1);
t=Lookup_Thread(d,ID);
Tf=C_T(cell,t);
begin_f_loop(f,t)
{
source=50.0*(F_T(f,t)-Tf);
}
end_f_loop(f,t)
dS[eqn]=-50.0;
return source;
}


All times are GMT -4. The time now is 23:29.