新学UDF,编了一个自定义壁面热通量变化的UDF,完成后解释不报错但是编译会报错,说指针变量没有初始化,但是看了UDF的帮助文件里面的例子,例子里面的指针变量也没有初始化啊。搞不懂到底是什么问题。而且把UDF关连到FLUENT之后(就是在BOUNDARY CONDITIONS那个界面上选中UDF),迭代初始化也报错。
UDF如下,请高手指点:
#include "udf.h"
#define U 0.07
#define epsilon 0.4
#define C0 0.367
#define L 1.0
#define qm 0.23
#define Kfav 3.52e4
DEFINE_PROFILE(heat_source,t,i)
{
Domain *domain;
cell_t c; /*LINE 10*/
face_t f;
Thread *t_cordinat,*c_thread,*t_heat_flux;
real VA,f_t,LA,y_cordinate,x[ND_ND];
LA=4*sqrt(L*U/Kfav); /*caculate the length of the mass transfer zone*/
VA=U*C0/(epsilon/(1-epsilon)*qm); /*caculate the velocity of the mass transfer zone*/
f_t=RP_Get_Real("flow-time" /*get the flow time,LINE 15*/
thread_loop_c(c_thread,domain)
{
begin_c_loop(c,c_thread)
{
C_CENTROID(x,c,t_cordinat);
if (((VA*f_t-LA)<=x[1])&&(x[1]<=(VA*f_t))) /*LINE 20*/
C_PROFILE(f,t_heat_flux,i)=(15.4*4.18*0.21*5)/(22.4*1.8*(6*(1-epsilon)/2e-3));
else
C_PROFILE(f,t_heat_flux,i)=0;
}
end_c_loop(c,c_thread)
}
}
迭代初始化是报如下错误:
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: ()
烦请高手帮忙看下哦,否则实在没有信心继续做下去了,不胜感激。
另外补充下,编译不是在C语言编译器里编译的,是在FLUENT中编译,C语言编译没有问题。
[ Last edited by sogoodaaa on 2013-5-30 at 23:38 ] |