|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
模拟建筑风场,入口为速度入口,出口为outflow。
UDF如下:
#include"udf.h"
DEFINE_PROFILE(x_velocity,thread,index)
{
real x[ND_ND];
real z;
face_t f;
begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
z = x[2];
F_PROFILE(f, thread, index)
= 28.55*pow(z/10,0.12);
}
end_f_loop(f, thread)
}
DEFINE_PROFILE(k_profile,thread,index)
{
real z;
real v;
real x[ND_ND];
real I;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z=x[2];
if (z<=5.0){
I=0.23;
}
else{
I=0.1*pow(z/350,-0.17);
}
v=28.55*pow(z/10,0.12)
F_PROFILE(f,thread,index)=1.5*(v*v*I*I);
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(dissip_profile,thread,index)
{
real z,k;
real v;
real x[ND_ND];
real I;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z=x[2];
if (z<=5.0){
I=0.23;
}
else{
I=0.1*pow(z/350,-0.17);
}
v=28.55*pow(z/10,0.12);
k=1.5*(v*v*I*I);
F_PROFILE(f,thread,index)=pow(0.09,0.75)*pow(k,1.5)/37;
}
end_f_loop(f,thread)
}
可以编译,运行后出现错误。
chip-exec: k_profile: wrong return type: float udf function expectedchip-exec: k_profile: argument 1: incorrect type (38): int expectedchip-exec: k_profile: argument 2: incorrect type (5): pointer expectedchip-exec: dissip_profile: wrong return type: float udf function expectedchip-exec: dissip_profile: argument 1: incorrect type (38): int expectedchip-exec: dissip_profile: argument 2: incorrect type (5): pointer expected
Error:
麻烦各位给看看,先谢过了。 |
|