24小时热门版块排行榜    

查看: 990  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 求调剂 +3 芦lty 2026-03-25 4/200 2026-03-25 23:25 by 芦lty
[考研] 一志愿河工大 081700 276求调剂 +3 地球绕着太阳转 2026-03-23 3/150 2026-03-25 19:10 by 雾散后相遇lc
[考研] 材料与化工304求B区调剂 +3 邱gl 2026-03-25 3/150 2026-03-25 19:03 by Ainin_
[考研] 生物技术与工程 +3 1294608413 2026-03-25 4/200 2026-03-25 18:02 by 1294608413
[考研] 296求调剂 +4 汪!?! 2026-03-25 7/350 2026-03-25 16:41 by 汪!?!
[考研] 求调剂一志愿武汉理工大学材料工程(085601) +5 WW.' 2026-03-23 7/350 2026-03-24 14:50 by sprinining
[考研] 一志愿河北工业大学0817化工278分求调剂 +7 jhybd 2026-03-23 12/600 2026-03-24 09:03 by jhybd
[考研] 276求调剂。有半年电池和半年高分子实习经历 +9 材料学257求调剂 2026-03-23 10/500 2026-03-24 07:36 by wangy0907
[考研] 335求调剂 +4 yuyu宇 2026-03-23 5/250 2026-03-23 23:49 by Txy@872106
[考研] 环境学硕288求调剂 +8 皮皮皮123456 2026-03-22 8/400 2026-03-23 23:47 by 热情沙漠
[考研] 一志愿武理材料工程348求调剂 +6  ̄^ ̄゜汗 2026-03-19 9/450 2026-03-23 19:53 by pswait
[考研] 生物学调剂 +5 Surekei 2026-03-21 5/250 2026-03-22 14:39 by tcx007
[基金申请] 山东省面上项目限额评审 +4 石瑞0426 2026-03-19 4/200 2026-03-22 08:50 by Wei_ren
[考研] 085600材料与化工306 +4 z1z2z3879 2026-03-21 4/200 2026-03-21 23:44 by ms629
[考研] 考研调剂 +3 呼呼?~+123456 2026-03-21 3/150 2026-03-21 20:04 by 无际的草原
[考研] 0703化学297求调剂 +3 Daisy☆ 2026-03-20 3/150 2026-03-21 17:45 by ColorlessPI
[考研] 266求调剂 +3 哇呼哼呼哼 2026-03-20 3/150 2026-03-21 16:46 by barlinike
[考研] 317求调剂 +5 申子申申 2026-03-19 9/450 2026-03-20 22:26 by JourneyLucky
[考研] 一志愿 南京航空航天大学大学 ,080500材料科学与工程学硕 +5 @taotao 2026-03-20 5/250 2026-03-20 20:16 by JourneyLucky
[考研] 一志愿南理工085701环境302求调剂院校 +3 葵梓卫队 2026-03-20 3/150 2026-03-20 19:28 by zhukairuo
信息提示
请填处理意见