24小时热门版块排行榜    

查看: 552  |  回复: 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 的主题更新
信息提示
请填处理意见