Turbulent Dispersion Model (Burns et al)
Is my UDF for Burns et al model right or wrong ?
# include "udf.h" DEFINE_VECTOR_EXCHANGE_PROPERTY(burnetal,cell,mixt ure,liquid,solid,Ftdvector) { Thread *thread_l, *thread_s; real rho_l,rho_s,Sigmapq,alpha_l,alpha_s,term,Ftd,Ctd,K pq; real px,py,pz,sx,sy,sz; thread_l=THREAD_SUB_THREAD(mixture,liquid); thread_s=THREAD_SUB_THREAD(mixture,solid); /* Calculation of Gradients */ alpha_l=C_VOF(cell, thread_l); /* liquid phase volume fraction */ alpha_s=C_VOF(cell, thread_s); /* Solid Phase Volume fraction */ rho_l=C_R(cell,thread_l); rho_s=C_R(cell,thread_s); Kpq=alpha_l*rho_l*C_K(cell, thread_l)+alpha_s*rho_s*C_K(cell, thread_s); Ctd=1; Sigmapq=.9; term=Ctd*Kpq*C_MU_T(cell,thread_l)/(rho_l*Sigmapq); px=C_VOF_G(cell,thread_l)[0]/alpha_l; py=C_VOF_G(cell,thread_l)[1]/alpha_l; pz=C_VOF_G(cell,thread_l)[2]/alpha_l; sx=C_VOF_G(cell,thread_s)[0]/alpha_s; sy=C_VOF_G(cell,thread_s)[1]/alpha_s; sz=C_VOF_G(cell,thread_s)[2]/alpha_s; /* Calculation of the Final Expression */ Ftdvector[0]=term*(px-sx); Ftdvector[1]=term*(py-sy); Ftdvector[2]=term*(pz-sz); printf("\n%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t %f\t%f\t%f\t%f\t%f\t%f\t%f\t",Ftdvector[0],Ftdvector[1],Ftdvector[2],Ctd,term,px,py,pz,sx,sy,sz,alpha_l,alpha_s,Kpq,C_ MU_T(cell,thread_l),C_K(cell, thread_l),C_K(cell, thread_s)); } |
Code:
# include "udf.h" |
Floating Point Exception
Getting Error at Node 0: floating point exception error.
Divergence detected in AMG solver: pressure correction Stabilizing k to enhance linear solver robustness. Stabilizing epsilon to enhance linear solver robustness. Stabilizing vof-1 to enhance linear solver robustness. Divergence detected in AMG solver: vof-1 Error at host: floating point exception Error at Node 0: floating point exception Error: floating point exception Error Object: #f while using this UDF |
you are printing most variables into console, check their values.
if the values are wrong, fix it |
In general: a UDF is correct if I it does what you want. So if you want to know if it is correct: try it. If it works, be happy, if it does not, fix it.
I don't understand the tendency to put code on a forum and ask other people if it is correct... Just try it! And if, like in your case, you get errors: mention that! |
All times are GMT -4. The time now is 16:43. |