|
300韶华币
本帖最后由 三大鬼王 于 2019-10-15 14:02 编辑
fluent不用udf可以一直计算,加载udf计算一段时间提示floating point exception,udf程序如下,求马友指导下问题出在哪里?谢谢。
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
#include "math.h"
#define g 9.81
#define dp 0.003
#define vslip 8.613231122
define_exchange_property(custom_drag, cell, mix_thread, s_col, f_col)
{
thread *thread_f, *thread_s;
real x_vel_f, x_vel_s, y_vel_f, y_vel_s, z_vel_f, z_vel_s, slip_x, slip_y, slip_z,taup,
rho_f, rho_s, mu_f, mu_s, void_s, void_f, cd, vslip, k_g_s,reyp,fdrgs,abs_v;
thread_f = thread_sub_thread(mix_thread, s_col);
thread_s = thread_sub_thread(mix_thread, f_col);
x_vel_f = c_u(cell, thread_f);
y_vel_f = c_v(cell, thread_f);
z_vel_f = c_w(cell, thread_f);
x_vel_s = c_u(cell, thread_s);
y_vel_s = c_v(cell, thread_s);
z_vel_s = c_w(cell, thread_s);
slip_x = x_vel_s - x_vel_f;
slip_y = y_vel_s - y_vel_f;
slip_z = z_vel_s - z_vel_f;
abs_v=sqrt(slip_x*slip_x+slip_y*slip_y+slip_z*slip_z);
rho_f = c_r(cell, thread_f);
rho_s = c_r(cell, thread_s);
mu_f = c_mu_l(cell, thread_f);
mu_s = c_mu_l(cell, thread_s);
void_f= c_vof(cell,thread_f);
void_s = c_vof(cell,thread_s);
taup=rho_s*dp*dp/18/mu_f;
reyp=dp*rho_f*abs_v/mu_f;
cd=4.0/3.0*(rho_f-rho_s)/rho_f*g*dp/pow(vslip,2);
fdrgs=cd*reyp/24.0;
k_g_s=rho_s*fdrgs*void_s*void_f/taup;
return k_g_s;
} |
|
|