24小时热门版块排行榜    

Znn3bq.jpeg
查看: 1145  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 白白的大萝卜 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 你们遇到过吗 +9 小lee同学 2026-06-02 9/450 2026-06-07 16:58 by qingdao001
[公派出国] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +5 c8fjyc45my 2026-06-05 7/350 2026-06-07 16:45 by g8w2gvow2h
[博后之家] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 c8fjyc45my 2026-06-05 5/250 2026-06-07 12:30 by rcch43i39g
[硕博家园] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 c8fjyc45my 2026-06-05 6/300 2026-06-07 12:25 by rcch43i39g
[硕博家园] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 c8fjyc45my 2026-06-05 5/250 2026-06-07 12:20 by rcch43i39g
[考博] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 c8fjyc45my 2026-06-05 5/250 2026-06-07 10:44 by rcch43i39g
[公派出国] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 c8fjyc45my 2026-06-05 7/350 2026-06-07 10:26 by rcch43i39g
[考博] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 c8fjyc45my 2026-06-05 7/350 2026-06-07 10:26 by rcch43i39g
[博后之家] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 c8fjyc45my 2026-06-05 8/400 2026-06-07 10:20 by rcch43i39g
[找工作] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 c8fjyc45my 2026-06-05 7/350 2026-06-07 10:20 by rcch43i39g
[教师之家] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 c8fjyc45my 2026-06-05 7/350 2026-06-07 10:09 by rcch43i39g
[考博] 材料博士申请 +3 张城斐 2026-06-04 4/200 2026-06-07 08:43 by bstormlong
[考博] 不知道还有没有招博士的学校了 +3 冻雨天 2026-06-04 4/200 2026-06-07 06:44 by oooqiao
[考研] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 oko5baaf5j 2026-06-05 6/300 2026-06-07 05:25 by rcch43i39g
[教师之家] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 c8fjyc45my 2026-06-05 6/300 2026-06-07 05:04 by rcch43i39g
[考研] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 c8fjyc45my 2026-06-05 5/250 2026-06-07 04:31 by rcch43i39g
[考研] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 c8fjyc45my 2026-06-05 5/250 2026-06-07 04:04 by rcch43i39g
[文学芳草园] 困死了 +4 myrtle 2026-06-05 5/250 2026-06-06 11:33 by angelyueyi
[论文投稿] 关于水星近日点进动成因的质疑 与实证分析 +4 yjqwhwc3159 2026-06-04 9/450 2026-06-04 23:41 by yjqwhwc3159
[基金申请] 山东省优青 青B通知了???? +3 jerry681 2026-06-02 3/150 2026-06-02 15:56 by sdtawz1
信息提示
请填处理意见