24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1117  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 白白的大萝卜 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 085701求调剂初试286分 +3 secret0328 2026-03-28 3/150 2026-03-28 20:44 by ahhshq
[考研] 289求调剂 +11 新时代材料 2026-03-27 11/550 2026-03-28 18:09 by YK。。
[考研] 复试调剂 +3 raojunqi0129 2026-03-28 3/150 2026-03-28 15:27 by 落睿可思
[考研] 317求调剂 +6 十闲wx 2026-03-24 6/300 2026-03-28 13:27 by Iveryant
[考研] 求调剂 +6 芦lty 2026-03-25 7/350 2026-03-28 13:13 by 唐沐儿
[考研] 266分,求材料冶金能源化工等调剂 +7 哇呼哼呼哼 2026-03-27 9/450 2026-03-28 12:22 by zllcz
[考研] 331环境科学与工程求调剂 +3 熠然好运气 2026-03-27 3/150 2026-03-28 04:11 by fmesaito
[考研] 352分 化工与材料 +5 海纳百川Ly 2026-03-27 5/250 2026-03-28 03:39 by fmesaito
[考研] 308求调剂 +7 墨墨漠 2026-03-25 7/350 2026-03-27 14:47 by 狂炫麦当当
[考研] 求调剂 +3 刘柯@ 2026-03-24 4/200 2026-03-27 11:28 by shangxh
[考研] 一志愿郑大085600,310分求调剂 +5 李潇可 2026-03-26 5/250 2026-03-27 11:14 by 不吃魚的貓
[考研] 359求调剂 +4 王了个楠 2026-03-25 4/200 2026-03-27 08:43 by 不吃魚的貓
[考研] 325求调剂 +5 李嘉图·S·路 2026-03-23 5/250 2026-03-27 00:42 by wxiongid
[考研] 343求调剂 +4 赠我一本书 2026-03-23 4/200 2026-03-27 00:40 by wxiongid
[考研] 材料科学与工程 317求调剂 +4 JKSOIID 2026-03-26 4/200 2026-03-26 15:58 by 不吃魚的貓
[考研] 303求调剂 +6 蓝山月 2026-03-25 6/300 2026-03-25 22:47 by 418490947
[考研] 材料与化工328分调剂 +6 。,。,。,。i 2026-03-23 6/300 2026-03-25 22:30 by 418490947
[考研] 318求调剂 +5 plum李子 2026-03-21 8/400 2026-03-25 09:26 by aa331100
[考博] 26申博自荐 +3 whh869393 2026-03-24 3/150 2026-03-24 09:55 by 21018060
[考研] 269求调剂 +4 我想读研11 2026-03-23 4/200 2026-03-23 21:25 by pswait
信息提示
请填处理意见