24小时热门版块排行榜    

查看: 3119  |  回复: 9
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

高歌旅客Les

银虫 (小有名气)

[求助] udf编写多孔介质气固换热系数遇到问题,求助~~~ 已有4人参与

在做多孔介质局部非热平衡模型,设置系数h时用udf编程,udf可以编译,但是初始化的时候总是报错,求助大神,到底怎么回事呢????
#include "udf.h"
#include "metric.h"
#include "sg.h"
#include "mem.h"
#include "math.h"

#define Dp 0.00006
#define zeta 0.6
DEFINE_PROFILE(Velocity_inlet,thread,position)
{
        real u;
        real t;
        face_t f;
        begin_f_loop(f,thread)
        {
                t=RP_Get_Real("flow-time";
                F_PROFILE(f,thread,position)=5*sin(188.5*t);
        }
        end_f_loop(f,thread)
}
DEFINE_PROFILE(Pressure_outlet,thread,position)
{
        real p;
        real t;
        face_t f;
        begin_f_loop(f,thread)
        {
                t=RP_Get_Real("flow-time";
                F_PROFILE(f,thread,position)=4500000+1170000*sin(188.5*t);
        }
        end_f_loop(f,thread)
}
/*3.
This module calculates the Heat transfer coefficient h(loc) for both the solid
and the fluid phase based on the particle Reynolds Number Rep.

*/

double heat_t_coeff(cell_t c,Thread *t)
{
        //FILE *t;
        //*HTC = (kf*(2+1.1Pr^0.333*Re^0.6))/dp;*/
        double Pr,Re,HTC,U,dv,Rep,Area,Ux;
        //Interstial area between the solid and the Fluid
        Area=4.0*(1-zeta)/Dp;
        //void diameter
        dv=(4.0*zeta)/Area;
        //Average velocity
        U=sqrt(pow(C_U(c,t),2.)+pow(C_V(c,t),2.));
        // modified Reynolds Number based on the void diameter
        Re=(U*dv*C_R(c,t))/C_MU_EFF(c,t);
        //Particle Reynolds Number based on Diamter of the particle(Dp).
//        Rep = (U*Dp*C_R(c,t))/C_MU_EFF(c,t);
        Rep=(U*Dp*C_R(c,t))/C_MU_L(c,t);

        //Fluid Prandtl Number
//        Pr = (C_MU_EFF(c,t)*C_CP(c,t))/C_K_L(c,t);
//        Pr = (C_MU_L(c,t)*C_CP(c,t))/therm_conduct(C_T(c,t)) ;
        Pr=(C_MU_L(c,t)*C_CP(c,t))/C_K_L(c,t) ;


//        C_UDMI(c,t,1)=therm_conduct(C_T(c,t));  
       
        /*Use this part of the code for E2 model of HTC*/
//    printf("hello";
//        HTC = (C_K_L(c,t)*(2.0 +(1.1*pow(Pr,0.333)*pow(Rep,0.6))))/Dp;
//        HTC = (therm_conduct(C_T(c,t)) *(2.0 +(1.1*pow(Pr,0.333)*pow(Rep,0.6))))/Dp;
//        HTC = (C_K_L(c,t)*(2.0 +(1.1*pow(Pr,0.333)*pow(Rep,0.6))))/Dp;
        HTC=(C_K_L(c,t)*(2.0 +(1.1*pow(Pr,0.333)*pow(Rep,0.6))))/Dp;
        /*Use this part of code for E2 model of HTC

if(Rep < 100)
                HTC=0.004*(C_K_EFF(c,t)/dv)*pow(Pr,0.3333)*pow(Re,1.35);
        else
                HTC =0.0156*(C_K_EFF(c,t)/dv)*pow(Pr,0.3333)*pow(Re,1.04);
        */
        return HTC;
}

初始化的时候报错如下:
Error:  received a fatal signal (Segmentation fault).
Error Object: #f
chip-exec: heat_t_coeff: wrong return type: void udf function expected
Error:  received a fatal signal (Segmentation fault).

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

高歌旅客Les

银虫 (小有名气)

送红花一朵
引用回帖:
8楼: Originally posted by dai26520 at 2016-09-08 08:38:10
DEFINE-PROFILE宏...

感谢您的帮助~~~
我有个问题,profile不是定义边界条件的宏么?为什么可以用profile呢???
麻烦啦~
9楼2016-09-08 09:25:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 10 个回答

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

感谢参与,应助指数 +1
http://www.cfd-online.com/Forums ... entation-fault.html
The segmentation fault means that you try to access a variable, which is not saved.
2楼2016-09-06 22:13:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

mycc

专家顾问 (正式写手)

【答案】应助回帖

★ ★ ★ ★ ★
感谢参与,应助指数 +1
高歌旅客Les: 金币+5, ★★★很有帮助 2016-09-07 10:31:06
你这个宏都没有用到嘛,double heat_t_coeff(cell_t c,Thread *t)
初始化错误的话,可以尝试一个个加载宏,看哪个宏加载之后出现错误,那么问题就出现在那个宏之中
项目汇总:http://www.cfluid.com/forum.php?mod=viewthread&amp;tid=114340&amp;extra=
3楼2016-09-07 08:09:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dai26520

专家顾问 (著名写手)

【答案】应助回帖

感谢参与,应助指数 +1
heat_t_coeff(cell_t c,Thread *t)我觉得这个地方直接用一个DEFINE-PROFILE宏就行,直接定义气固对流换热系数,然后在GUI里面设置对流换热系数时加载DEFINE-PROFILE宏就行了。另外你这个可能还需要一个DEFINE-ADJUST宏。
个性只是一个代号,做好自己就行
4楼2016-09-07 08:35:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[文学芳草园] 梦想 +6 myrtle 2026-08-26 9/450 2026-09-02 20:03 by 大飞鱼鱼鱼
[基金申请] 为什么资助数各大高校都创新高,自己申请怎么就这么难 +14 Kittylucky 2026-08-27 15/750 2026-09-02 19:35 by liumei0601
[基金申请] 科研人应该花精力去思考如何解决问题,而不是去凝练问题 +7 瞬息宇宙 2026-09-01 14/700 2026-09-02 17:33 by ma0526
[基金申请] 要骂人了,新模版改版就是要淡化问题凝练这种虚的东西,结果有个评委还在说凝练得不够 +9 瞬息宇宙 2026-08-31 17/850 2026-09-02 14:04 by anjeeshine
[基金申请] 基金系统什么内容也没有 30+4 winsaint 2026-08-27 10/500 2026-09-02 11:35 by 大不刘6
[基金申请] 学科评审组评审是指会评吗? +5 瞬息宇宙 2026-08-31 5/250 2026-09-02 10:13 by 雨冰共舞
[基金申请] 面上合作单位盖章 +6 ssyjh 2026-08-27 9/450 2026-09-01 20:01 by huagongfeihu
[基金申请] 面上函评意见出来了,像什么等级? 20+4 Tsingking1 2026-08-27 17/850 2026-09-01 19:51 by 超级无敌华子
[论文投稿] 小白求助 投论文要求的highlights应该如何写 5+3 l1963982152 2026-08-29 4/200 2026-09-01 09:04 by 北京莱茵编辑
[基金申请] 麻烦专家们看看评委们的意见(F口面上) +7 gdd2018 2026-08-28 12/600 2026-09-01 08:32 by 尼古拉斯小虫
[基金申请] 国社科又开始会评了,不知道这次命运如何 +7 雨打竹帘 2026-08-30 11/550 2026-08-31 23:16 by hittle2008
[基金申请] 面上意见出来了 +12 黄鸟于飞Chao 2026-08-29 23/1150 2026-08-31 18:57 by 黄鸟于飞Chao
[基金申请] 能否申诉? +7 echo8914667 2026-08-30 8/400 2026-08-31 17:00 by yihongxu
[基金申请] 29号明天会评吗 +4 笨笨唐 2026-08-28 4/200 2026-08-31 09:30 by huixian257
[基金申请] 为什么到现在没收到通知? +5 tannykie 2026-08-29 5/250 2026-08-30 21:05 by purplejack
[基金申请] 有没有仍没收到信息的 +7 德尚中行 2026-08-27 8/400 2026-08-30 20:52 by purplejack
[考博] 找导师 +6 yuanjiabao 2026-08-29 7/350 2026-08-30 14:40 by 生科新手
[基金申请] 我就是申请一个面上项目而已,这评审意见是按照杰青的条件评的吧? +6 gouxfjh 2026-08-28 11/550 2026-08-30 07:57 by gouxfjh
[基金申请] 国自然评审意见 +13 wangmingqi 2026-08-28 19/950 2026-08-29 10:22 by Poppy1104
[基金申请] 看板上这么多中的,有点像50人群里49个人都是骗子的那种感觉…… +5 a089 2026-08-26 6/300 2026-08-27 14:05 by jonewore
信息提示
请填处理意见