24小时热门版块排行榜    

查看: 1068  |  回复: 0

jjtyly

新虫 (初入文坛)

[求助] 编译UDF显示命名错误

FLUENT编译UDF提示错误,无效的UDF命名,求助大神们下面的程序中命名哪里出现错误
Error: Set_Property: null user-defined-function name

Error: Set_Property: null user-defined-function name
Error Object: #f

程序:
#include "udf.h"
#include "sg.h"
#include "sg_mphase.h"
/*#include "flow.h" */
#include "mem.h"
#include "metric.h"
#include "math.h"

/* USER INPUTS */
     
#define relax 0.05     /* underrelaxation factor equal to 0.01-0.05 */
#define threshold 1e-7     /* error tolerance*/
#define Tsub_min 3.     /* minimum liquid subcooling, K*/
#define Ctd 1.0        /* turbulent diffusion coefficient  */
#define sigma 23.82e-3 /*surface tension coefficient of vapor-liquid
system, N/m*/
#define gravity 9.8    /* gravity, m/sec2 */
#define L 2500e3  /* latent heat at system pressure, J/kg */

#define Ks 16.27        /*thermal conductivity of adjacent solid material (copper) */
#define Ros 8030.0       /*density of adjacent solid material (copper) */
#define Cps 502.48         /*heat capacity of adjacent solid material (copper)*/


#define Ks_aluminum 16.27        /*thermal conductivity of adjacent solid material (aluminum) */
#define Ros_aluminum 8030.0       /*density of adjacent solid material (aluminum) */
#define Cps_aluminum 502.48         /*heat capacity of adjacent solid material (aluminum)*/


#define P_sys 1.0e5   /*system pressure, Pa */

#define T_sat 273.15  /*saturated temperature*/

#define domain_index_gas 0 /*domain indexes of phases*/
#define domain_index_vap 1




/* END OF USER INPUTS */





/* this macro is hooked up as a source term for vapor  */
/* continuity equation    */                             

DEFINE_MASS_TRANSFER(vaporisation_condensation, c, mixture_thread,primary_phase_index,second_phase_index)
{
        Thread *pt = DOMAIN_SUPER_DOMAIN(mixture_thread);
        Thread **moist_air=DOMAIN_SUB_DOMAIN(pt, primary_phase_index); /* primary_phase is the moist_air*/
        Thread **frost=DOMAIN_SUB_DOMAIN(pt, second_phase_index);
        real vof_vapor,vof_liquid,total_mass_exchange;
        real dbub,Tsat;
        real reb,urel,Tl, urelx,urely,urelz,Pr,Ai,Nu,H;
    Ai = Interfacial_area(vof_vapor, dbub);
        vof_vapor = C_VOF(c,moist_air);
        dens=C_R(c,moist_air);/*the air mixture  density*/
        vof_liquid = 1.-vof_vapor;
        Tair = C_T(c,moist_air); /*the temperature of the moist_air*/
        P_air=C_P(c,moist_air);   /*the pressrue of the moist_air*/
        /*the saturated pressure of the water vapor at the air temperature 有待确定*/
        if (Tair<=T_sat)
        {
                P_sat=exp(-5674.5359/Tair+6.3925247-(0.9677843e-2)*Tair+(0.62215701e-6)*pow(Tair,2)+pow(0.20747825,-18)*pow(Tair,3)+pow(-0.9484024,-12)*pow(Tair,4)+4.1635019*log(Tair));
        }
        else
        {
                P_sat=exp(-5800.2206/Tair+1.3914993-0.04860239*Tair+(0.41764768e-4)*pow(Tair,2)+pow(-0.14452093,-7)*pow(Tair,3)+6.5459673*log(Tair));
        }
       
        /*the water vapor mass fraction in the saturated moist_air corresponding to temperature*/
        xs=0.62198*p_sat/(P_sys-P_sat);
        wav_s=xs/(1+xs);
        /*the water vapor mass fraction in the moist_air corresponding to temperature*/
        wav_yi=C_YI(c,moist_air,1);
       
       
        total_mass_exchange=10*vof_vapor*dens*(wav_yi-wav_s)*Ai;
        C_UDMI(c,mixture_thread,15) = total_mass_exchange;

       
        return total_mass_exchange;
}



DEFINE_SOURCE(energy_vapor,cell, primary_phase_index,second_phase_index,dS,eqn)
{
        Thread *pri_th,sec_th;
        real h_vapor;
        pri_th=THREAD_SUB_THREAD(mixture_thread,0);
        sec_th=THREAD_SUB_THREAD(mixture_thread,1);
        t=C_T(c,pri_th)/1000;
        h_vapor=2.003216+1.79*t+0.0535*pow(t,2)+0.1953*pow(t,3)-0.05*pow(t,4);
        source=-C_UDMI(cell,mixture,15)*h_vapor;
        dS(eqn)=0;
        return source;
}
       
DEFINE_SOURCE(energy_ice,cell, primary_phase_index,second_phase_index,dS,eqn)
{
        Thread *pri_th,sec_th;
        real h_vapor;
        pri_th=THREAD_SUB_THREAD(mixture_thread,0);
        sec_th=THREAD_SUB_THREAD(mixture_thread,1);
        t=C_T(c,pri_th)/1000;
        h_vapor=2.003216+1.79*t+0.0535*pow(t,2)+0.1953*pow(t,3)-0.05*pow(t,4);
        source=C_UDMI(cell,mixture,15)*(h_vapor+L);
        dS(eqn)=0;
        return source;

}

       
DEFINE_SOURCE(x_moen_vapor,cell, primary_phase_index,dS,eqn)
{
        Thread *pri_th;
        real ux;
        pri_th=THREAD_SUB_THREAD(mixture_thread,0);
    ux=C_U(c,pri_th);
        source=-C_UDMI(cell,mixture,15)*ux;
        dS(eqn)=0;
        return source;
}


DEFINE_SOURCE(y_moen_vapor,cell, primary_phase_index,dS,eqn)
{
        Thread *pri_th;
        real uy;
        pri_th=THREAD_SUB_THREAD(mixture_thread,0);
    uy=C_V(c,pri_th);
        source=-C_UDMI(cell,mixture,15)*uy;
        dS(eqn)=0;
        return source;
}

DEFINE_SOURCE(z_moen_vapor,cell, primary_phase_index,dS,eqn)
{
        Thread *pri_th;
        real uz;
        pri_th=THREAD_SUB_THREAD(mixture_thread,0);
    uz=C_W(c,pri_th);
        source=-C_UDMI(cell,mixture,15)*uz;
        dS(eqn)=0;
        return source;
}
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 jjtyly 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 为什么国自然不能直接公布 +5 bjdxyxy 2026-08-26 5/250 2026-09-01 17:54 by 小伟大博士
[文学芳草园] 梦想 +5 myrtle 2026-08-26 7/350 2026-09-01 15:18 by myrtle
[基金申请] 学科评审组评审是指会评吗? +4 瞬息宇宙 2026-08-31 4/200 2026-09-01 14:58 by jiaoxg
[论文投稿] 小白求助 投论文要求的highlights应该如何写 5+3 l1963982152 2026-08-29 4/200 2026-09-01 09:04 by 北京莱茵编辑
[基金申请] 怎么看青基中了没有啊 +6 叶九微 2026-08-26 6/300 2026-08-31 23:54 by yudaoqian88
[基金申请] 国社科又开始会评了,不知道这次命运如何 +7 雨打竹帘 2026-08-30 11/550 2026-08-31 23:16 by hittle2008
[基金申请] 基金未中,这种答复是模板吗? +6 zhaosm1982 2026-08-27 7/350 2026-08-31 21:18 by qdxxmc
[基金申请] 哪位高人中了,把查询到的截图贴出来让我看看,让我长长见识 +6 yuleib84 2026-08-26 7/350 2026-08-31 19:46 by 鱼翔浅底1
[基金申请] 能否申诉? +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
[基金申请] 基金不中,共勉 +12 eulota 2026-08-26 12/600 2026-08-31 08:42 by ZJTJZ
[基金申请] 为什么到现在没收到通知? +5 tannykie 2026-08-29 5/250 2026-08-30 21:05 by purplejack
[基金申请] 系统查不到 +11 董八千 2026-08-26 11/550 2026-08-28 18:06 by Leogzhya
[基金申请] 2026年8月25日国自然放榜前突然收到列入评审专家邮件,有关系吗? +25 木水思豆 2026-08-25 28/1400 2026-08-26 14:53 by draco1987
[基金申请] 出来了 +9 trojank 2026-08-26 9/450 2026-08-26 14:25 by 宝贝虫子
[基金申请] 国合里面能看到了 +7 一怀馨秋 2026-08-26 7/350 2026-08-26 11:23 by zhaosm1982
[基金申请] 国际合作可查了,中了面上 (EPI+1)(金币+50) +18 Ldrop2023 2026-08-26 18/900 2026-08-26 11:15 by cmrandy
[基金申请] 系统进不去 +4 yanglien 2026-08-26 5/250 2026-08-26 11:10 by wenfengw83
[基金申请] 项目信息和经费信息在系统里都可以看到了 +6 wittyboy 2026-08-26 14/700 2026-08-26 10:55 by wittyboy
[基金申请] 牛来!米来!面来! +8 beefly 2026-08-26 8/400 2026-08-26 08:37 by xuzhipiao
信息提示
请填处理意见