Help! Why C_T_G does not work in my DEFINE_ADJUST udf
Hello,
Can some Fluent experts here please help me find out why C_T_G does not work in this DEFINE_ADJUST function? I have enabled the "Keep temporary memory from being freed" option. The code compiles fine, but the computation iteration would collapse. I know it is the problem with C_T_G because I have tested by replacing C_T_G by another term, and everything works out fine. I would highly appreciate your help! CZ #include "udf.h" #include "mem.h" #include "math.h" DEFINE_ADJUST(Disperions_before_Del,d) { real vel, Re, cosalfa,sinalfa, Pr,kXX, kYY,Tgrad_x,Tgrad_r; real poros=0.93; real fila_d=0.0006; Thread *t; cell_t c; if (!Data_Valid_P()) return; thread_loop_c(t,d) {if (FLUID_THREAD_P(t)) { begin_c_loop_int(c,t) { vel=sqrt(C_U(c,t)*C_U(c,t)+C_V(c,t)*C_V(c,t)); if (vel==0) { cosalfa=1; sinalfa=0; } else { cosalfa=C_U(c,t)/vel; sinalfa=C_V(c,t)/vel; } Re=C_R(c,t)*vel*fila_d/C_MU_L(c,t); Pr=C_CP(c,t)*C_MU_L(c,t)/C_K_L(c,t); if (Re*Pr<10) { kXX=C_K_L(c,t)*0.022*Re*Pr*Re*Pr/(1-poros); kYY=C_K_L(c,t)*0.022*pow(Re*Pr,1.7)/pow((1-poros),0.25); } else { kXX=C_K_L(c,t)*2.7*Re*Pr/sqrt(poros); kYY=C_K_L(c,t)*0.052*sqrt(1-poros)*Re*Pr; } if (!Data_Valid_P()) return; Tgrad_x=C_T_G(c,t)[0]; Tgrad_r=C_T_G(c,t)[1]; C_UDSI(c,t,1)=kXX*cosalfa*Tgrad_x + kXX*sinalfa*Tgrad_r; C_UDSI(c,t,2)=-kYY*sinalfa*Tgrad_x + kYY*cosalfa*Tgrad_r; /* just for testing purpose, which shows the problem is with C_T_G C_UDSI(c,t,1)=kXX*cosalfa + kXX*sinalfa; C_UDSI(c,t,2)=-kYY*sinalfa + kYY*cosalfa;*/ } end_c_loop_int(c,t) } } } |
|
All times are GMT -4. The time now is 08:13. |