找回密码
 注册
查看: 1681|回复: 0

单cpu改多个cpu并行计算,udf怎么改呢

[复制链接]
发表于 2012-3-29 14:28:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
这是我单cpu双核计算时的代码:
#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;
}

现在想到服务器上即多个cpu并行计算,udf加载失败,需要进行修改,但是我不知道该怎么改哪位知道帮忙改一下啊?非常感谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表