24小时热门版块排行榜    

查看: 1728  |  回复: 1

姜家木木

铜虫 (初入文坛)

[求助] FLUENT计算节点数据汇总(MPI)

小弟用FLUENT进行并行计算,打算实现将计算节点的某个数据汇总到计算节点0,并输出,就是计算节点间的数据汇总。udf程序可编译,可hook,没什么问题,但是一计算就出现下面的错误,网上也找不到解答,希望有了解fluent并行计算MPI这块的大佬给些指点,下面是我的udf和报错信息。
udf:
DEFINE_ADJUST(Mon,domain)
{
#if !RP_HOST
        Thread *t,**pt;
real temp,time,r,rj,zc;
cell_t c;
real x[ND_ND];
int num_c,total_c,mark_c,ci,ci1,cj1,ci2,cj2,node_i,i;
real (*xc_array)[3],(*yc_array)[3];
time=CURRENT_TIME;
rj=0.001;
if(current_ts!=N_TIME)
{
current_ts=N_TIME;
mp_thread_loop_c(t,domain,pt)
if(FLUID_THREAD_P(t))       
{Thread *p_phase=pt[1];
        begin_c_loop_int(c,t)
                {   
                        C_CENTROID(x,c,t);
                        if(C_VOF(c,p_phase)>0.5&&C_VOF(c,p_phase)<1&&sqrt(pow(x[0]-csped*time+dla-x0,2)+x[1]*x[1])<=rj)
                        {
                                num_c++;
                        }
                }
                end_c_loop_int(c,t)

                xc_array=(real (*)[3])calloc(3*num_c,sizeof(real));
                ci=0;
                begin_c_loop_int(c,t)
                {
                        C_CENTROID(x,c,t);
                        if(C_VOF(c,p_phase)>0.5&&C_VOF(c,p_phase)<1&&sqrt(pow(x[0]-csped*time+dla-x0,2)+x[1]*x[1])<=rj)
                        {
                                xc_array[ci][0]=x[0];
                                xc_array[ci][1]=x[1];
                                xc_array[ci][2]=x[2];
                                ci++;
                        }
               
                }
                end_c_loop_int(c,t)       

#if RP_NODE
                total_c=PRF_GISUM1(num_c);
#endif
#if !PARALLEL
                total_c=num_c;
#endif
                yc_array=(real (*)[3])calloc(3*total_c,sizeof(real));
               
#if RP_NODE
       
                if(!I_AM_NODE_ZERO_P)
                {
                        PRF_CSEND_INT(node_zero,&num_c,1,myid);
                        PRF_CSEND_REAL(node_zero,xc_array[0],3*num_c,myid);
                }
               
                if( I_AM_NODE_ZERO_P)
                {         
                        for(ci1=0;ci1<num_c;ci1++)
                        {
                                for(cj1=0;cj1<3;cj1++)
                                {
                                        yc_array[ci1][cj1]=xc_array[ci1][cj1];

                                }
                        }
                        mark_c=num_c;
                        compute_node_loop_not_zero(node_i)
                        {
                                PRF_CRECV_INT(node_i,&num_c,1,node_i);
                                xc_array=(real (*)[3])realloc(xc_array,3*num_c*sizeof(real));
                                PRF_CRECV_REAL(node_i,xc_array[0],3*num_c,node_i);
                                for(ci2=0;ci2<num_c;ci2++)
                                {
                                for(cj2=0;cj2<3;cj2++)
                                {
                                        yc_array[ci2+mark_c][cj2]=xc_array[ci2][cj2];
                                }
                                }
                                mark_c=mark_c+num_c;
                        }

                        compute_node_loop_not_zero(node_i)
                        {
                                PRF_CSEND_REAL(node_i,yc_array[0],3*total_c,node_zero);
                        }
                }

                free(xc_array);

                if(!I_AM_NODE_ZERO_P)
                {  
                        PRF_CRECV_REAL(node_zero,yc_array[0],3*total_c,node_zero);                                                                                                                                               
                }
#endif

begin_c_loop(c,t)
{
    C_CENTROID(x,c,t);
    temp=C_T(c,t);

        for(i=0;i<total_c;i++)
                {
                        if(x[0]==yc_array[0]&&x[1]==yc_array[1]&&x[2]==yc_array[2])
                        {
       
                                C_UDMI(c,t,10)=1;
                                break;
                        }
                        else
                        C_UDMI(c,t,10)=0;       
                }
}
end_c_loop(c,t)
}
}
free(yc_array);
#endif
}
报错:
==============================================================================

Node 0: Process 12088: Received signal SIGSEGV.

==============================================================================
MPI Application rank 0 exited before MPI_Finalize() with status 2

Interrupting at the end of timestep. If you want to interrupt at the end of iteration, press Ctrl+C once again.
The fl process could not be started.
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

姜家木木

铜虫 (初入文坛)

自顶一个
2楼2019-07-22 22:02:49
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 姜家木木 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 我不理解! +14 Edward_pc 2026-08-26 22/1100 2026-08-26 20:19 by Edward_pc
[基金申请] 国自然面上复盘~欢迎讨论 +3 晴天加油 2026-08-26 4/200 2026-08-26 17:59 by Tide man
[基金申请] 基金不中,共勉 +3 eulota 2026-08-26 3/150 2026-08-26 16:17 by 路yyyy
[基金申请] 怎么查啊 +5 huang1991js 2026-08-26 5/250 2026-08-26 16:09 by Equinoxhua
[基金申请] 2026国自然函评费到账 +22 羊腰板 2026-08-21 25/1250 2026-08-26 15:00 by zuocuiping
[基金申请] 能否退出参与的面上项目解除限项 +23 koalala 2026-08-24 26/1300 2026-08-26 14:29 by 宝贝虫子
[基金申请] 哪位高人中了,把查询到的截图贴出来让我看看,让我长长见识 +4 yuleib84 2026-08-26 5/250 2026-08-26 13:40 by yuleib84
[基金申请] 为什么国自然不能直接公布 +4 bjdxyxy 2026-08-26 4/200 2026-08-26 13:12 by qingmu1201
[基金申请] 科研孤儿太难了 +21 我4大白菜 2026-08-20 22/1100 2026-08-26 11:29 by nlgza
[基金申请] 国际合作可查了,中了面上 +18 Ldrop2023 2026-08-26 18/900 2026-08-26 11:15 by cmrandy
[基金申请] 项目信息和经费信息在系统里都可以看到了 +6 wittyboy 2026-08-26 14/700 2026-08-26 10:55 by wittyboy
[基金申请] 国合可查了 +3 paperzjh 2026-08-26 3/150 2026-08-26 10:41 by LemmonTr
[基金申请] 今天务委会开完了,明天出结果吗 +19 angus9576 2026-08-25 23/1150 2026-08-26 10:03 by zp519
[基金申请] 国合现在查不到了吗? +10 chengyan1220 2026-08-24 20/1000 2026-08-26 08:57 by peasantsprig
[基金申请] 没有任何消息-是不是就凉了 +9 图啦图啦 2026-08-24 10/500 2026-08-25 11:59 by 南海小哥
[基金申请] 人气不行了 +11 fansofjerry 2026-08-21 11/550 2026-08-25 11:04 by 孤独的英雄6
[教师之家] 导师吐槽:我怎么摊上了这么个极品研究生! +3 苏东坡二世 2026-08-23 3/150 2026-08-25 10:35 by shisan1313
[基金申请] 让我中一个面上吧! +13 大萍1987 2026-08-20 16/800 2026-08-24 10:23 by 太傻了
[基金申请] 看来今天不会放榜了? +8 chengyan1220 2026-08-21 11/550 2026-08-21 17:52 by dcqxinyang
[基金申请] 基金啊基金 +4 longfie172 2026-08-20 4/200 2026-08-21 08:58 by mark mao
信息提示
请填处理意见