24小时热门版块排行榜    

查看: 1531  |  回复: 5

xuwenhua625

银虫 (小有名气)

[求助] 【fluent 并行 UDF 求助】为啥fluent 并行这么慢?

fluent版本19.2,算的是二维运动机翼,用define cg motion 宏,重叠网格,25万网格
电脑8核i7,主频3.6 ghz
与starccm相比,fluent的并行好慢,迭代一个要2s,每一时间步迭代30次左右达到收敛。
而且每个时间步内,前面的迭代速度快,后面越来越慢。
请帮忙看看我的并行udf的设置是否有问题?
CODE:
#include <stdio.h>
#include "udf.h"
#include "math.h"
#include "mem.h"
#include "dynamesh_tools.h"
#define pi 3.141592654
#define rou 998.2
#define cord 0.2
#define h0 0.12
#define st 0.3
#define u 1.0
#define n_points 7 // number of pressure sample points
#define foil_id 3 // fluent_id of the foil
double theta0 = 28.0*pi/180.0;
double w = pi*st*u/h0;
double t = 2*h0/(st*u);
double eps = -100*pi/180 ; // -180 ~ 180
file *fc_up, *fp_up; // upstream
file *fc_dn, *fp_dn; // downstream
file *prs_foil_up, *prs_foil_dn, *fpresult; // pressure output
/**********************************************************************************************/
define_cg_motion(foil_upstream,dt,vel,omega,time,dtime)
{
real pressure = 0.0;
real f1, f3, f5;
real pl, pt, p;
real x[nd_nd] = {0.0};
real f_cg[nd_nd], m_cg[nd_nd], x_cg[nd_nd];
int n;
int i = 0;
int j = 0;
//-------------------------------------------------------------------------
#if !rp_host
face_t face ;
cell_t cell ;
domain *domain = get_domain(1);
thread *thread = dt_thread(dt);
//-------------------------------------------------------------------------
vel[0] = 0.0;
vel[1] = -h0*(cos(w*(time + dtime)) - cos(w*time)) / dtime;
omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = -theta0*(sin(w*(time + dtime)) - sin(w*time)) / dtime;
//-------------------------------------------------------------------------
if (n_time % 20 == 1)
{
prs_foil_up = fopen("pressure_up.dat", "a+");
fprintf(prs_foil_up, " %.4f
", time*w / (2 * pi));
begin_f_loop(face, thread)
{
   f_centroid(x, face, thread);
   pressure = f_p(face, thread) + rp_get_float("operating-pressure"); // + absolute pressure
   fprintf(prs_foil_up, " %d %.4f %.4f %.2f
", i + 1, x[0], x[1], pressure);
    i++; }
end_f_loop(face, thread)
fclose(prs_foil_up);
}
#endif
//-------------------------------------------------------------------------
#if !rp_host if(time>8*dtime)
{
// f1 f3 f5 output
x_cg[0] = 0.0;
x_cg[1] = -h0*cos(w*time);
compute_force_and_moment (domain, thread, x_cg, f_cg, m_cg, false);
f1 = f_cg[0]/(0.5*rou*cord*u*u);
f3 = f_cg[1]/(0.5*rou*cord*u*u);
f5 = m_cg[2]/(0.25*rou*cord*cord*u*u);
pl = f_cg[1] * vel[1];
pt = m_cg[2] * omega[2];
p = pl + pt;
fc_up = fopen("force_upstream.dat", "a+");
fp_up = fopen("power_upstream.dat", "a+");
fprintf(fc_up, "%.3f %10.3f %10.3f %10.3f
", time*w / (2 * pi), f1, f3, f5);
fprintf(fp_up, "%.3f %10.3f %10.3f %10.3f
", time*w / (2 * pi), pl, pt, p );
fclose(fc_up);
fclose(fp_up);
}
#endif
return;
}

@wuming524
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuwenhua625

银虫 (小有名气)

2楼2019-04-21 20:15:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuwenhua625

银虫 (小有名气)

3楼2019-04-21 20:26:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuwenhua625

银虫 (小有名气)

@mycc
4楼2019-04-21 20:34:03
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuwenhua625

银虫 (小有名气)

5楼2019-04-21 20:50:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xuwenhua625

银虫 (小有名气)

6楼2019-04-21 20:52:15
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 xuwenhua625 的主题更新
信息提示
请填处理意见