求助:单机双核运算想改并行计算,udf怎么改呢?
这是我单机双核计算时的代码:#include "udf.h"
#define pi 4.*atan(1.)
#define diam2 2.5e-4
#define smallnumber 1.e-15
DEFINE_EXCHANGE_PROPERTY(custom_drag1, cell, mix_thread, s_col, f_col)
{
Thread *thread_g, *thread_s;
real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y, rho_g, rho_s, mu_g,
reyp, void_g, void_s, tmp1, tmp2, Cd_Cd, k_g_s;
/* find the threads for the gas (primary) and solids (secondary phases) */
thread_g = THREAD_SUB_THREAD(mix_thread, s_col); /* gas phase */
thread_s = THREAD_SUB_THREAD(mix_thread, f_col); /* solid phase*/
/* find phase velocities and properties*/
x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);
x_vel_s = C_U(cell, thread_s);
y_vel_s = C_V(cell, thread_s);
slip_x = x_vel_g - x_vel_s;
slip_y = y_vel_g - y_vel_s;
rho_g = C_R(cell, thread_g);
rho_s = C_R(cell, thread_s);
mu_g = C_MU_L(cell, thread_g);
/*compute slip*/
abs_v = sqrt(slip_x*slip_x + slip_y*slip_y);
/*compute reynolds number*/
/* compute particle relaxation time */
void_g = C_VOF(cell, thread_g); /* gas vol frac*/
void_s = C_VOF(cell, thread_s); /* solid vol frac*/
reyp = void_g*abs_v*diam2*rho_g/mu_g;
if(reyp<1000.0)
Cd_Cd = (24.0/reyp)*(1.0+0.15* pow(reyp,0.687));
else
Cd_Cd = 0.44;
/*compute drag and return drag coeff, k_g_s*/
if(void_g<0.8)
{
tmp1=150*mu_g*pow(void_s,2)/pow(void_g,2)/pow(diam2,2);
tmp2=1.75*rho_g*void_s/void_g/diam2*abs_v;
k_g_s =tmp1+tmp2;
}
else
k_g_s =3*Cd_Cd*void_s*void_g*rho_g*abs_v*pow(void_g,-2.65)/(4*diam2);
return k_g_s;
}
现在想到服务器上并行计算,udf加载失败,需要进行修改,但是我不知道该怎么改哪位知道帮忙改一下啊?非常感谢! 原来是单机一个cpu双核计算,现在并行是采用多个cpu计算 回复 2 # 潇叶飞扬 的帖子
楼主的UDF是单CPU的,没有并行处理的部分。你确定在双核CPU上你的模型是并行计算的?是不是只用了一个核呢? 回复 3 # Seventy721 的帖子
我传上的代码是单cpu的,计算用了两个核,现在想在多个cpu的服务器上计算,那么该怎么修改呢 回复 4 # 潇叶飞扬 的帖子
你需要增加一些数据传输的语句。但是首先你得搞清楚并行计算的逻辑结构。看Fluent User's Guide 第31章:
http://hpce.iitm.ac.in/website/Manuals/Fluent_6.3/Fluent.Inc/fluent6.3/help/html/ug/node1224.htm
回复 5 # Seventy721 的帖子
然后再看Fluent UDF Manual 第7章:
http://hpce.iitm.ac.in/website/Manuals/Fluent_6.3/Fluent.Inc/fluent6.3/help/html/udf/node200.htm 回复 6 # Seventy721 的帖子
好的,我去看一下,非常感谢 不知道lz单机多核的时候是怎样实现的,求教
页:
[1]