找回密码
 注册
查看: 3103|回复: 2

吸附UDF初始化出错,求助啊。。

[复制链接]
发表于 2013-1-2 12:44:10 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
自己摸爬滚打乱弄出来的,载入解释正确,初始化提示出错,提示如下:

chip-exec: p_absolute: wrong return type: double udf function expectedchip-exec: p_absolute: argument 1: incorrect type (38): int expected

是函数使用错误还是,请高手指点,UDF如下:

#include"udf.h"
/*Define which user-defined scalars to use*/
enum
{
  p,ads,d_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 a;
  real b;
  real E_a;
  real F_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);
a=40;
b=0.5;
E_a =20*C_UDSI(c,t,p);
F_b=1+0.5*C_UDSI(c,t,p);
C_UDSI(c,t,ads)= E_a/F_b;
       }
          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)
       {
real physical_dt;
physical_dt=RP_Get_Real("physical-time-step");
C_UDSI(c,t,d_ads)=-3.851632*(C_UDSI(c,t,ads)-C_UDSI_M1(c,t,ads))/physical_dt;
       }
          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(energy_source,c,t,dS,eqn)
{
  real e_source;
  e_source=-C_UDSI_M1(c,t,d_ads)*1.58E6;
  dS[eqn]=0.0;
  return e_source;
}

DEFINE_PROFILE(inlet_x_velocity, thread, position)   
{
    real x[ND_ND];
    real y;
    face_t f;

    begin_f_loop(f, thread)
        {
            F_CENTROID(x,f,thread);
            y=x[1];
            F_PROFILE(f,thread,position)=1.0-y*y/(0.020*0.020);
        }
    end_f_loop(f, thread)
}
 楼主| 发表于 2013-1-3 23:17:23 | 显示全部楼层
自己顶一个。求高手帮助。程序学的不好实在有点搞不定锕。
发表于 2014-3-11 09:44:30 | 显示全部楼层

回复 1# marytnt 的帖子

你研究吸附过程吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表