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

初学UDF编的程序不能加载,是否是编程问题

[复制链接]
发表于 2014-10-30 19:58:15 | 显示全部楼层 |阅读模式

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

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

x
/*迭代时间不同,入口速度也不同*/

#include "udf.h"
int kount=0;
DEFINE_ADJUST(demo_calc,domain)
{
kount++;
printf("kount=%d\n",kount);
}
DEFINE_PROFILE(x_velocity,thread,nv)
{
real temp;
real temp_1;
real e,e_1;
real r=350.;
real kp=0.01;
real ki=0.01;
  real x[2];
  real y;
  face_t f;
  Thread *d;
  Thread *t;
  cell_t c;
if (kount<=50)
{
F_PROFILE(f,thread,nv)=1;
begin_f_loop(f,thread)
{
  y=x[1];
  temp_1=C_T_M1(c,t);
  temp=C_T(c,t);       
   e_1=r-temp_1;
   e=r-temp;
   F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)
}
else if(kount<=100.&&kount>=50.)
{
        F_PROFILE(f,thread,nv)=2.;

begin_f_loop(f,thread)
{
  y=x[1];
  temp_1=C_T_M1(c,t);
  temp=C_T(c,t);       
   e_1=r-temp_1;
   e=r-temp;
   F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)
}



else if(kount<=150.&&kount>=100.)
{
        F_PROFILE(f,thread,nv)=4.;
begin_f_loop(f,thread)
{
  y=x[1];
  temp_1=C_T_M1(c,t);
  temp=C_T(c,t);       
   e_1=r-temp_1;
   e=r-temp;
   F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)

}
else
{
        F_PROFILE(f,thread,nv)=6.;
begin_f_loop(f,thread)
{
  y=x[1];
  temp_1=C_T_M1(c,t);
  temp=C_T(c,t);       
   e_1=r-temp_1;
   e=r-temp;
   F_PROFILE(f,thread,nv)+=kp*(e-e_1)+ki*e;
}
end_f_loop(f,thread)

}

}

二维,想得到某点温度,然后与期望值比较,经过一个控制器计算然后将值返回给入口
 楼主| 发表于 2014-10-30 20:05:06 | 显示全部楼层
在solve-initialize-initialize时就出错了,
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()
发表于 2014-12-6 22:40:09 | 显示全部楼层
可以检查一下VC++和Fluent是否连接在一起,用一个make命令,网上有现成的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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