24小时热门版块排行榜    

查看: 645  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 让我中一个面上吧! +12 大萍1987 2026-08-20 15/750 2026-08-23 20:44 by 大萍1987
[教师之家] 跳槽后在研项目怎么办? +5 简单化xn 2026-08-22 10/500 2026-08-23 12:38 by 简单化xn
[基金申请] 什么时候开奖? +9 CrisMessi 2026-08-18 10/500 2026-08-23 12:03 by 丶昵称占用
[基金申请] 今天放榜吗? +15 布布和一二 2026-08-19 16/800 2026-08-23 09:55 by 张春生
[基金申请] 93BebMhtakh前后11位开头都是大写 +7 且听虎啸 2026-08-17 8/400 2026-08-22 21:55 by 医学老男孩
[基金申请] 范进中举一文的中心思想 +3 炎黄贵胄 2026-08-22 4/200 2026-08-22 20:02 by mycsru
[基金申请] 只有每年这种时候来逛逛小木虫 +24 yaoyewhu2008 2026-08-20 26/1300 2026-08-22 17:43 by kammury
[基金申请] 人气不行了 +8 fansofjerry 2026-08-21 8/400 2026-08-22 16:30 by zyqchem
[基金申请] 今天基金会出结果吗?20260819 +16 kkkl_v 2026-08-19 17/850 2026-08-22 16:12 by 阿布Abu
[基金申请] 放榜前的不淡定 40+4 snowwithsea 2026-08-19 14/700 2026-08-21 23:51 by cratir
[基金申请] 时间戳又变了 +13 wuchongjun 2026-08-20 19/950 2026-08-21 17:21 by 紫杉醇
[基金申请] 我面上完蛋了 +7 且听虎啸 2026-08-20 8/400 2026-08-21 12:31 by 酷酷墨镜
[基金申请] 应该是下周三26日公布了吧? +4 哈哈蛤? 2026-08-21 4/200 2026-08-21 10:58 by Vivilian
[论文投稿] 投稿咨询 +5 wwm09 2026-08-17 7/350 2026-08-21 10:11 by 期刊论文帮手
[基金申请] 今天放榜没戏了吧 +9 yuleib84 2026-08-19 11/550 2026-08-21 10:06 by gltch
[基金申请] 基金啊基金 +4 longfie172 2026-08-20 4/200 2026-08-21 08:58 by mark mao
[基金申请] 估计是周四 +3 archvillain 2026-08-18 3/150 2026-08-21 01:48 by jnhyjjm
[基金申请] 时间戳变了,能看出什么问题? +18 基诺咪客 2026-08-17 23/1150 2026-08-20 17:19 by Godzela
[基金申请] 明天放榜? +5 Shxjjxjkx 2026-08-18 5/250 2026-08-18 18:14 by -大大大大大-
[基金申请] 今天维护系统维护 祝所有人 高中 +8 gjjjzhong 2026-08-18 9/450 2026-08-18 13:01 by 家与远方
信息提示
请填处理意见