24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 574  |  回复: 0

zqgeo

新虫 (初入文坛)

[求助] 求教一个UDF中源项设置的问题

各位大牛:
        我现在想要做的是向气液两相模型中添加相间径向力,在UDF中设置的是:
CODE:
DEFINE_ADJUST(adj_uds0,mixturedomain)
{
        Thread *thread;
        cell_t cell;
        Domain *gasdomain;

        gasdomain = DOMAIN_SUB_DOMAIN(mixturedomain,1);
        thread_loop_c(thread, gasdomain)
        {
                begin_c_loop(cell, thread)
                {
                        C_UDSI(cell, thread, 0)=C_VOF(cell, thread);                               
                }
                end_c_loop (cell, thread)
        }
}
先是通过这个获得一个全流场的气含率信息。
然后:
DEFINE_SOURCE(lateralforce_cfd1,cell,thread,dS,eqn)
{
        Thread *mix_thread, *thread_gas, *thread_liq;
        float kl,  vof_gas, y_vel_liq, y_vel_gas, vel_slip;
        float x_vel_liq, x_vel_gas, y_vel_slip, x_vel_slip, klg;
        float FTD=0, CWi=0.1, source=0,sign=0;       
        float delta_gas_a=0, CTD=0.7, Cvm=0.5;
        float x[ND_ND];
        float Re, CD, Eo, FCL, CL, FEo;
        float Eo2, FTD2, FTD3, vf_ratio, VF_TRANS=0.14;
        FILE *fp_gas;
        float current_time=1;
            
        mix_thread= THREAD_SUPER_THREAD(thread);
        thread_gas= THREAD_SUB_THREAD(mix_thread, 1);
           thread_liq= THREAD_SUB_THREAD(mix_thread, 0);
            x_vel_liq=C_U(cell, thread_liq);
        x_vel_gas=C_U(cell, thread_gas);
        y_vel_liq=C_V(cell, thread_liq);
        y_vel_gas=C_V(cell, thread_gas);
        y_vel_slip=fabs(y_vel_gas-y_vel_liq);
        x_vel_slip=fabs(x_vel_gas-x_vel_liq);
        vel_slip=sqrt(y_vel_slip*y_vel_slip+x_vel_slip*x_vel_slip);       
        vof_gas=C_VOF(cell, thread_gas);
       

            kl=C_K(cell,thread_liq);
        klg=0.5*vof_gas*Cvm*vel_slip*vel_slip;
        delta_gas_a=C_UDSI_G(cell, thread_gas, 0)[1];
        FTD=-CTD*roul*delta_gas_a*(kl+klg);       

   
           if (thread==thread_liq)
           sign=-1.0;       
        else if (thread==thread_gas)
           sign=1.0;       
        else Message("error in lift force");

        source=(FTD)*sign;
        dS[eqn]=0;
        fp_gas=fopen("gas_holdup.dat","a");
        fprintf(fp_gas,"%f\t",current_time);
    return source;
}

但是运行的时候就会出现如下的错误:
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()

我查了很多网上的资料都没有解决这个问题。有些提到了UDM的问题,各位如果知道的话请不吝赐教。这个问题折磨我很久了,多谢啦!

[ Last edited by xiegangmai on 2012-3-21 at 17:43 ]
回复此楼

» 猜你喜欢

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

智能机器人

Robot (super robot)

我们都爱小木虫

相关版块跳转 我要订阅楼主 zqgeo 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 304求调剂 +7 c297914 2026-04-05 8/400 2026-04-05 22:13 by hemengdong
[考研] 化学357分,考研调剂 +10 .Starry. 2026-04-04 11/550 2026-04-05 10:57 by cql1109
[考研] 一志愿华中农业大学0710(A)初试329分 求调剂 +4 一名26考研生 2026-04-04 4/200 2026-04-05 10:01 by barlinike
[考研] 一志愿电子科技大学085600材料与化工 329分求调剂 +10 Naiko 2026-04-04 10/500 2026-04-05 09:40 by sam3303
[考研] 283求调剂 +10 A child 2026-04-04 10/500 2026-04-05 08:22 by qlm5820
[考研] 302求调剂一志愿华中师范大学 +8 小江小江江江 2026-04-02 8/400 2026-04-04 19:50 by 蓝云思雨
[考研] 调剂 +4 是可乐不是可乐 2026-04-04 4/200 2026-04-04 19:41 by 唐沐儿
[考研] 368求调剂 +5 今华习 2026-04-03 7/350 2026-04-04 18:47 by imissbao
[考研] 一志愿华南师范361分,化学求调剂 +7 Nicole88888 2026-04-01 7/350 2026-04-04 18:28 by macy2011
[论文投稿] 求文献 5+3 ys879651$ 2026-04-02 3/150 2026-04-04 17:22 by bobvan
[考研] 复试调剂 +6 范根培 2026-04-04 6/300 2026-04-04 14:27 by 土木硕士招生
[考研] 0856调剂 +8 曲听筠 2026-03-30 8/400 2026-04-04 08:46 by tianyyysss
[考研] 302求调剂 +9 zyx上岸! 2026-04-02 9/450 2026-04-02 23:07 by 马儿快快地跑
[考研] 279求调剂 +5 傅文秋 2026-04-02 5/250 2026-04-02 18:10 by 笔落锦州
[考研] 266求调剂 +4 学员97LZgn 2026-04-02 4/200 2026-04-02 13:03 by yulian1987
[考研] 298求B区调剂 +4 zzz,,r 2026-04-02 5/250 2026-04-02 12:17 by 土木硕士招生
[考研] 08工科,295,接受跨专业调剂 +6 lmnlzy 2026-03-31 6/300 2026-04-01 11:02 by 逆水乘风
[考研] 318求调剂 +8 七忆77 2026-04-01 8/400 2026-04-01 10:37 by Jaylen.
[考研] 358求调剂 +3 王向阳花 2026-03-31 3/150 2026-04-01 09:56 by zzchen2000
[考研] 求调剂 生物学 377分 +6 zzll03 2026-03-31 6/300 2026-03-31 17:33 by 唐沐儿
信息提示
请填处理意见