|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
最近用linux计算问题时总是报如下错误
C:\Documents and Settings\dy\桌面\错误\段错误.bmp
以下是我的UDF
include <udf.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#define particle_diameter 1e-05
#define max 100
int count_bottom_num;
int kh1;
int kh2;
int coalesce_num;
int collision_num;
int random;
int count_0,count_1;
int i;
real distance_0,distance_1;
real distance_2,distance_3;
real dis[3];
DEFINE_ON_DEMAND(initial)
{
count_bottom_num=0;
kh1=0;
kh2=0;
coalesce_num=0;
collision_num=0;
for(i=0;i<ND_ND;i++)
{
dis=0.0;
}
count_1=0;
}
DEFINE_DPM_SPRAY_COLLIDE(random_spray_collide,tp,p)
{
/* get the cell and Thread that the particle is currently in */
cell_t c = RP_CELL(&(tp->cCell));
Thread *t = RP_THREAD(&(tp->cCell));
Particle *pi;
/*count particle number in the cell */
count_0=0;
random=0;
begin_particle_cell_loop(pi,c,t)
{
count_0 = count_0+1;
}
end_particle_cell_loop(pi,c,t);
//Message("\n particle number in the cell is: %d\n",num);
if(P_DIAM(tp)<=(1.01*particle_diameter) && P_DIAM(tp)>=(0.99*particle_diameter))
{
distance_0=pow(dis[0]-P_POS(tp)[0],2)+pow(dis[1]-P_POS(tp)[1],2)+pow(dis[2]-P_POS(tp)[2],2);
distance_1=sqrt(distance_0);
if(distance_1>=(0.99*particle_diameter) && count_1!=0)
{
for(i=0;i<ND_ND;i++)
{
dis=P_POS(tp);
}
begin_particle_cell_loop(pi,c,t)
{
if(P_DIAM(pi)<=(1.01*particle_diameter) && P_DIAM(pi)>=(0.99*particle_diameter))
{
distance_2=pow(P_POS(pi)[0]-P_POS(tp)[0],2)+pow(P_POS(pi)[1]-P_POS(tp)[1],2)+pow(P_POS(pi)[2]-P_POS(tp)[2],2);
distance_3=sqrt(distance_2);
//Message("\n distance_1=%e \n",distance_1);
if(distance_3<=(1.01*particle_diameter) && distance_3>=(0.99*particle_diameter))
{
/* define random number */
srand((unsigned)time(NULL));
random=rand()%max;
/* define particle random coalesce */
if(random<20)
{
coalesce_num = coalesce_num+1;
for(i=0;i<ND_ND;i++)
{
P_VEL(tp)=0.5*(P_VEL(tp)+P_VEL(pi));
}
P_MASS(tp)=2*P_MASS(tp);
P_DIAM(tp)=pow(2,0.3333)*P_DIAM(tp);
P_MASS(pi)=P_MASS(pi)/100000;
P_DIAM(pi)=P_DIAM(pi)/100000;
return PATH_ACTIVE;
Message("\n coalesce_num is:%d \n",coalesce_num);
Message("\n P_MASS=%e ,P_DIAM=%e \n",P_MASS(tp),P_DIAM(tp));
}
else if(random>=20)
{
collision_num=collision_num+1;
Message("\n totle_collision_num=%d \n",collision_num);
}
}
}
}
end_particle_cell_loop(pi,c,t);
}
}
count_1=count_1+1;
}
此算例在windows下可以运行,但在linux下不行。不知道这是什么的地方出的错误,求高人指教!不甚感激! |
|