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

风场模拟中UDF出现错误

[复制链接]
发表于 2012-5-22 03:15:46 | 显示全部楼层 |阅读模式

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

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

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:

麻烦各位给看看,先谢过了。
 楼主| 发表于 2012-5-27 01:18:22 | 显示全部楼层
怎么就没人回呢。。。
发表于 2013-3-1 10:01:00 | 显示全部楼层
看程序没有什么问题,只是在k_profile那里发现少了一个分号
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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