Ansys Learning Forum › Forums › Discuss Simulation › Fluids › UDF in Fluent for heat treatment in porous media, packed bed › Reply To: UDF in Fluent for heat treatment in porous media, packed bed
July 29, 2021 at 7:29 pm
jkhalesi
Subscriber
Hi DrAmine
I have written a UDF to calculate heat transfer coefficient using the built-in non-eq approach in Fleunt. I have run this UDF in Fluent 2020R2 but It does not work. If I use a constant value for heat transfer coefficient, the module is working. I have also run the UDF in older version and it works. It means that something wrong is in UDF. Would please look at the UDF and see what's wrong with it.
Thank you
Javad
#include "udf.h"
DEFINE_PROFILE(htc,t,i)
{
cell_t c;
real Nu,Re,Pr;
real dens, visc; /*Fluid*/
real cond, cp; /* Fluid*/
real d_p;
real por;/*Porosity of the bed*/
d_p=0.02;
por=1.0;
begin_c_loop(c,t)
{
dens = C_R(c,t); /*Density of fluid*/
visc = C_MU_L(c,t); /*Viscosity fluid*/
cond = C_K_L(c,t); /*Conductivity fluid*/
cp = C_CP(c,t); /*Specific heat fluid*/
Re = ND_MAG(C_U(c,t),C_V(c,t),C_W(c,t))*d_p*dens*por/visc ;
/*Reynolds number has been calculated based on pore velocity*/
Pr = cp*visc/cond ;
Nu = 2.+ 1.1 * pow(Re,0.6) * pow(Pr,1./3.);
F_PROFILE(c,t,i) = Nu*cond/d_p ;
}
end_c_loop(c,t)
}
I have written a UDF to calculate heat transfer coefficient using the built-in non-eq approach in Fleunt. I have run this UDF in Fluent 2020R2 but It does not work. If I use a constant value for heat transfer coefficient, the module is working. I have also run the UDF in older version and it works. It means that something wrong is in UDF. Would please look at the UDF and see what's wrong with it.
Thank you
Javad
#include "udf.h"
DEFINE_PROFILE(htc,t,i)
{
cell_t c;
real Nu,Re,Pr;
real dens, visc; /*Fluid*/
real cond, cp; /* Fluid*/
real d_p;
real por;/*Porosity of the bed*/
d_p=0.02;
por=1.0;
begin_c_loop(c,t)
{
dens = C_R(c,t); /*Density of fluid*/
visc = C_MU_L(c,t); /*Viscosity fluid*/
cond = C_K_L(c,t); /*Conductivity fluid*/
cp = C_CP(c,t); /*Specific heat fluid*/
Re = ND_MAG(C_U(c,t),C_V(c,t),C_W(c,t))*d_p*dens*por/visc ;
/*Reynolds number has been calculated based on pore velocity*/
Pr = cp*visc/cond ;
Nu = 2.+ 1.1 * pow(Re,0.6) * pow(Pr,1./3.);
F_PROFILE(c,t,i) = Nu*cond/d_p ;
}
end_c_loop(c,t)
}