24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1116  |  回复: 0

白白的大萝卜

新虫 (小有名气)

[求助] fluent 中UDF报错求助!!

#include "udf.h"
/*Define which user-defined scalars to use.*/
enum
{
   p,ads,d_ads,q_ads
};
DEFINE_ADJUST(p_absolute,domain)
{
        Thread*t;
        cell_t c;
        real p_operating;
        real p_static;
        /*solve the absolute pressure.*/
        thread_loop_c(t,domain)
        {
        if(NULL!=THREAD_STORAGE(t,SV_UDS_I(p)))
          {
                begin_c_loop(c,t)
                {
                p_static=C_P(c,t);
                p_operating=RP_Get_Real("operating-pressure";
                C_UDSI(c,t,p)=p_static+p_operating;
                }
            end_c_loop(c,t)
      }
        }
}
DEFINE_ADJUST(adsorption,domain)
{
        Thread*t;
        cell_t c;
        real n_o;
        real E_t;
        real x_p;
        real A;
        real x_b;
        real n;
        /*solve the adsorption equation.*/
        thread_loop_c(t,domain)
        {
                if(NULL!=THREAD_STORAGE(t,SV_UDS_I(ads))&&NULL!=T_STORAGE_R_NV(t,SV_UDSI_M1(ads)))
         {
          begin_c_loop(c,t)
            {
        real tem=C_T(c,t);
        n_o=71.6;
        E_t=3080+18.9*tem;
        x_p=1.47E9/C_UDSI(c,t,p);
        A=8.31429*tem*log(x_p);
        x_b=-A*A/(E_t*E_t);
        C_UDSI(c,t,ads)=n_o*exp(x_b);
        }
        end_c_loop(c,t)
     }
    }
}

DEFINE_ADJUST(q_adsorption,domain)
{
        Thread*t;
        cell_t c;
        /*solve the absolute pressure.*/
        thread_loop_c(t,domain)
        {
                if(NULL!=THREAD_STORAGE(t,SV_UDS_I(q_ads))&&NULL!=T_STORAGE_R_NV(t,SV_UDSI_M1(q_ads)))
                {
                        begin_c_loop(c,t)
                        {
                real physical_dt;
                physical_dt=RP_Get_Real("physical-time-step";
                C_UDSI(c,t,q_ads)=C_UDSI_M1(c,t,q_ads)+0.001*physical_dt*(C_UDSI_M1(c,t,ads)-C_UDSI_M1(c,t,q_ads));
                        }
                        end_c_loop(c,t)
                }
        }
}
DEFINE_ADJUST(d_adsorption,domain)
{
        Thread*t;
        cell_t c;
        /*solve the energy source.*/
        thread_loop_c(t,domain)
        {
           if(NULL!=THREAD_STORAGE(t,SV_UDS_I(d_ads))&&NULL!=T_STORAGE_R_NV(t,SV_UDSI_M1(d_ads)))
           {
                   begin_c_loop(c,t)
            {
           C_UDSI(c,t,d_ads)=-0.5422633*0.001*(C_UDSI(c,t,ads)-C_UDSI(c,t,q_ads));
        }   
        end_c_loop(c,t)
       }
    }
}
DEFINE_SOURCE(mass_source,c,t,dS,eqn)
{
        real m_source;
        m_source=C_UDSI_M1(c,t,d_ads);
        dS[eqn]=0.0;
        return m_source;
}
DEFINE_SOURCE(enery_source,c,t,dS,eqn)
{
        real e_source;
        e_source=-C_UDSI_M1(c,t,d_ads)*4*1.58E6;
        dS[eqn]=0.0;
        return e_source;
}


Fluent里报错:
error  C2223:“->storage”的左侧必须指向结构/联合
error  C2296:  "*":非法,左操作数包含“Thread*”类型


刚开始用UDF,出现这些问题,请求大佬们的帮助!不胜感激!
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 白白的大萝卜 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 275求调剂 +10 Micky11223 2026-03-25 14/700 2026-03-28 15:48 by Micky11223
[考研] 311(085601)求调剂 +3 liziyeyeye 2026-03-28 3/150 2026-03-28 15:29 by 1018329917
[考研] 320分,材料与化工专业,求调剂 +9 一定上岸aaa 2026-03-27 13/650 2026-03-28 15:00 by 神马都不懂
[考研] 085701环境工程,267求调剂 +16 minht 2026-03-26 16/800 2026-03-28 12:16 by zllcz
[考研] 一志愿哈尔滨工业大学材料与化工方向336分 +8 辰沐5211314 2026-03-26 8/400 2026-03-28 11:25 by xuxiang
[考研] 一志愿南京航空航天大学材料学硕求调剂 +3 @taotao 2026-03-28 3/150 2026-03-28 10:26 by JourneyLucky
[考研] 331环境科学与工程求调剂 +3 熠然好运气 2026-03-27 3/150 2026-03-28 04:11 by fmesaito
[考研] 0703化学求调剂,各位老师看看我!!! +5 祁祺祺 2026-03-25 5/250 2026-03-27 21:44 by 东方猪猪
[考研] 307求调剂 +8 超级伊昂大王 2026-03-24 9/450 2026-03-27 15:34 by 超级伊昂大王
[考研] 考研调剂 +9 小蜡新笔 2026-03-26 9/450 2026-03-27 11:10 by 不吃魚的貓
[考研] 一志愿吉大071010,316分求调剂 +3 xgbiknn 2026-03-27 3/150 2026-03-27 10:36 by guoweigw
[考研] 【双一流院校新能源、环境材料,材料加工与模拟招收大量调剂】 +4 Higraduate 2026-03-22 8/400 2026-03-26 20:34 by Higraduate
[考研] 085601求调剂总分293英一数二 +4 钢铁大炮 2026-03-24 4/200 2026-03-26 16:28 by dick_runner
[考研] 材料科学与工程 317求调剂 +4 JKSOIID 2026-03-26 4/200 2026-03-26 15:58 by 不吃魚的貓
[考研] 309求调剂 +4 gajsj 2026-03-25 5/250 2026-03-26 00:27 by Dyhoer
[考研] 0854人工智能方向招收调剂 +4 章小鱼567 2026-03-24 4/200 2026-03-25 13:29 by 2177681040
[考研] 284求调剂 +15 Zhao anqi 2026-03-22 15/750 2026-03-25 12:51 by wht0531
[考研] 285求调剂 +3 AZMK 2026-03-24 3/150 2026-03-25 12:23 by userper
[考研] 调剂 +4 13853210211 2026-03-24 4/200 2026-03-24 19:44 by ms629
[考研] 一志愿070300浙大化学358分,求调剂! +4 酥酥鱼.. 2026-03-21 4/200 2026-03-23 08:12 by Iveryant
信息提示
请填处理意见