24小时热门版块排行榜    

CyRhmU.jpeg
查看: 1072  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 白白的大萝卜 的主题更新
信息提示
请填处理意见