24小时热门版块排行榜    

查看: 1823  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 投票:  有多少人是今天查系统知道结果的? +15 爱看书的可乐 2026-08-26 17/850 2026-08-27 05:22 by xxniao123
[基金申请] 国自然面上复盘~欢迎讨论 +5 晴天加油 2026-08-26 6/300 2026-08-27 04:49 by littlezl
[教师之家] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +3 LIbGuocjEEYw 2026-08-26 4/200 2026-08-27 04:33 by Ie9AyIAvGbvs
[硕博家园] 售SCI一区T0P文章,我:8.O.55.1.O.54,科目齐全,可+急 +3 LIbGuocjEEYw 2026-08-26 4/200 2026-08-27 02:01 by Ie9AyIAvGbvs
[基金申请] 我不理解! +15 Edward_pc 2026-08-26 23/1150 2026-08-26 20:34 by zzuzxg
[基金申请] 2026年的国家社科基金项目通讯评审的新规则与新动向、新挑战 +7 process2012 2026-08-23 10/500 2026-08-26 19:23 by hmhminy
[基金申请] 怎么查啊 +5 huang1991js 2026-08-26 5/250 2026-08-26 16:09 by Equinoxhua
[基金申请] 2026年8月25日国自然放榜前突然收到列入评审专家邮件,有关系吗? +25 木水思豆 2026-08-25 28/1400 2026-08-26 14:53 by draco1987
[基金申请] 哪位高人中了,把查询到的截图贴出来让我看看,让我长长见识 +4 yuleib84 2026-08-26 5/250 2026-08-26 13:40 by yuleib84
[基金申请] 科研孤儿太难了 +21 我4大白菜 2026-08-20 22/1100 2026-08-26 11:29 by nlgza
[基金申请] 国合里面能看到了 +7 一怀馨秋 2026-08-26 7/350 2026-08-26 11:23 by zhaosm1982
[基金申请] 怎么看青基中了没有啊 +4 叶九微 2026-08-26 4/200 2026-08-26 10:52 by xiacongxu
[基金申请] 国合可查了 +3 paperzjh 2026-08-26 3/150 2026-08-26 10:41 by LemmonTr
[基金申请] 国合现在查不到了吗? +10 chengyan1220 2026-08-24 20/1000 2026-08-26 08:57 by peasantsprig
[基金申请] 牛来!米来!面来! +8 beefly 2026-08-26 8/400 2026-08-26 08:37 by xuzhipiao
[基金申请] 明天应该可查了!? +6 chengyan1220 2026-08-23 6/300 2026-08-25 19:45 by zfd97
[基金申请] 今日不放榜?网传国自然预计 8 月 27 日可查结果 +17 医学老男孩 2026-08-20 22/1100 2026-08-25 15:36 by 医学老男孩
[基金申请] 我面上完蛋了 +13 且听虎啸 2026-08-20 14/700 2026-08-25 09:10 by mrkang
[教师之家] 跳槽后在研项目怎么办? +5 简单化xn 2026-08-22 10/500 2026-08-23 12:38 by 简单化xn
[基金申请] 应该是下周三26日公布了吧? +4 哈哈蛤? 2026-08-21 4/200 2026-08-21 10:58 by Vivilian
信息提示
请填处理意见