|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
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)
} |
|