找回密码
 注册
查看: 1575|回复: 0

竖直管内气液两相环状流,编译的两个UDF总出错,求教啊

[复制链接]
发表于 2014-8-20 10:55:19 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
最近在做竖直管内气液两相环状流。编了这样一个adjust的UDF,目的是定义一个UDS。把这个adjust function compile到fluent中,先把case初始化计算两步,然后再加载adjust function,它可以计算运行,可是我再把我编的一个关于UDS方程的扩散率的diffusivity再compile到fluent中之后,就报错了:
Error:  received a fatal signal (Segmentation fault).

Error:  received a fatal signal (Segmentation fault).
Error Object: #f

下面是我的程序。出错原因在哪里呢?找了很久没有找到,请大家指点一下,非常感谢啊!

#include "udf.h"

/* Define which user-defined scalars to use. */
enum
{
        MF=0,
        N_REQUIRED_UDS
};

DEFINE_ADJUST(adjust_droplet_mass_fraction, mixture_domain)
{      
        cell_t c;
        Thread **pt;
        Thread *cell_threads;
        /* Domain *mixture_domain;      /* t is mixture_thread according to the definition of the ADJUST Macro   */  
        mixture_domain = Get_Domain(1);
        
        /* Make sure there are enough user defined-scalars. */
        if (n_uds < N_REQUIRED_UDS)
                Internal_Error("not enough user-defined scalars allocated";

        /* Fill UDS with the variable. */
        mp_thread_loop_c(cell_threads, mixture_domain, pt)
        {
                begin_c_loop (c,cell_threads)
                {
                        C_UDSI(c,cell_threads,MF)= C_VOF(c,pt[1])*C_VOLUME(c,cell_threads)*C_R(c,pt[1])/(C_VOF(c,pt[1])*C_VOLUME(c,cell_threads)*C_R(c,pt[1])+C_VOF(c,pt[0])*C_VOLUME(c,cell_threads)*C_R(c,pt[0]));     /*DEFINE the mass fraction of the droplet, the scalar*/
                }
                end_c_loop (c,cell_threads)
        }
}



#include "udf.h"

DEFINE_DIFFUSIVITY(my_uds_diffusivity,c,t,i)
{
         /*int phase_domain_index=0;*/
     Thread **primary_t=THREAD_SUB_THREADS(t); /* primary phase pointer*/
         return C_R(c,primary_t[0])*C_MU_EFF(c,primary_t[0])*C_R(c,primary_t[0])*C_K(c,t)*C_K(c,t)/C_D(c,t);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表