CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

A strange mistake

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 14, 2011, 04:53
Default A strange mistake
  #1
New Member
 
duyu
Join Date: Jan 2011
Posts: 4
Rep Power: 6
redsnow is on a distinguished road
I met the mistake recently.
This case went well under windows, but always go wrong under linux.

This is my 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[i]=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[i]=P_POS(tp)[i];
}
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)[i]=0.5*(P_VEL(tp)[i]+P_VEL(pi)[i]);
}
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;
}


I would appreciate it very much if anyone can correct this mistake for me.
redsnow is offline   Reply With Quote

Old   February 14, 2011, 09:25
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 10
DoHander is on a distinguished road
Before using the source file on Linux have you tried to convert the end of line characters to Unix format ? If your C file is named my_file.c do this in a terminal:

dos2unix my_file.c

Try again with the file after this transformation.

Do
DoHander is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Flamelet Generation Problem tar FLUENT 11 March 22, 2014 11:52
A Strange Problem in making Parallel (Ansys/CFX 12) a.sarami CFX 13 October 7, 2010 01:33
Strange Problem With updating the library farhagim OpenFOAM 0 August 10, 2010 12:34
FLUENT Solver i strange BastiL FLUENT 1 July 14, 2008 16:27
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 09:57.