 ## Fluids

• Imam Tantowi
Subscriber

Hello every one.

Sorry take your time. here, I want to request your help to solving my simulation problem.
Now, I am simulating cooling process of grain. the fluid medium of cooling is moist air. because I want to know temperatur and moisture content of grain, I initiate to model this problem with eulerian multhiphase in ANSYS Fluent. I model the moist air as mixture of air and water vapor, and grain as mixture of dry grain dan water liquid. Because of that, mass transfer UDF has build to describe a moisture transfer phenomena. this is my UDF.

#include "udf.h"
#include "mem.h"
#include "sg_mphase.h"
#include "math.h"

static real EMC(cell_t c, Thread *tu, int v) /*this function to know Equilibrium moisture content*/
{
real MMwl, R_bar;
MMwl=18.02; /*Molecular weight of water*/
R_bar=8314.47;
real pv;
pv=C_R(c,tu)*C_YI(c,tu,v)*R_bar*C_T(c,tu)/MMwl;
real RH,emc,pg;
pg=610.78*exp(17.296*(C_T(c,tu)-273.15)/(237.3+C_T(c,tu)-273.15));
RH=pv/pg;
emc=pow(-1*log(1-RH)/(8.654*pow(10,-5)*(C_T(c,tu)-273.15+49.81)),1/1.8634);
emc=emc/100;
return emc;
}
{
real h,Sh;
real Dv=2.6*pow(10,-5); /*mass diffusivity of air*/
real bul=0.6; /*roundness of grain */
real d=C_PHASE_DIAMETER(c,tj); /*grain's diameter*/
real NV_VEC(v), vel, Re, Sc,Ai,vof;
NV_DD(v,=,C_U(c,tj),C_V(c,tj),C_W(c,tj),-,C_U(c,tu),C_V(c,tu),C_W(c,tu));
vel=NV_MAG(v);
vof=C_VOF(c,tj);
Ai=6*vof/(d*bul);
Re=C_R(c,tu)*vel/(C_MU_L(c,tu)*Ai*bul);
Sc=C_MU_L(c,tu)/(C_R(c,tu)*Dv);
Sh=2+0.552*pow(Re,0.5)*pow(Sc,1/3);
h=Sh*Dv/d;
return h;
}
DEFINE_MASS_TRANSFER(pengeringan_source,c,t,j,l,u,v)
{
real mdot=0;
real X,Xeq,h;
X=C_YI(c,jg,l)/(1-C_YI(c,jg,l));
real bul=0.6; /*kebulatan*/
real d=C_PHASE_DIAMETER(c,jg); /*Grain diameter*/
real vof=C_VOF(c,jg); /*volume fraction of grain*/
real Ai,A;
Ai=6*vof/(d*bul); /*interfacial area*/
h=masstf_coeff(c,jg,udr);
Xeq=EMC(c,udr,v);
mdot=h*Ai*(X-Xeq);

return mdot;
}

the compiling procces of code is success. but when I run the calculation. Floating point is happen. there is any one know what the problem?.

• DrAmine
Ansys Employee

Even if UDF are compiled succesfully this does not mean that the Solver won't crash. It will crash if you try accessing data which is not valid, which is not availalable or you want to access data but in the wrong place. Actually I do not debug UDF's but please start to check if the specfication of the thread index and threads in your mass transfer routine are correct.

• Imam Tantowi
Subscriber

Thanks for your answer sir. Actually, I am newbie for using udf. I dont understand about what's the problem make crash happen. I have check the thread index, and I think it is OK. So, I write the message to detect this code, and yes this UDF is the main problem that make floating point. When starting to run the calculation, the program try to compute again and again, but divergen. I have no idea to solve this. I really dont know.
Do DrAmine have some suggestion to me for solving this problem?

• Imam Tantowi
Subscriber

before using udf, I have tried using rault's law model for species mass tranfer, and it's working. So, I wanna try to set actual model that I need by using udf for my last undergraduated project . 