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

udf init random particles positions

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   August 2, 2004, 10:37
Default udf init random particles positions
  #1
olivia
Guest
 
Posts: n/a
Hello everyone! Hope somebody can give me a helping hand: i m currently trying to create a udf to set the initial positions of particles that will be tracked. I want them to be random, so i try to get the coords of random cell centers and apply them to the particles. But there is somehting wrong in my udf. I get a segmentation violation message; can someone help me, please? I m not a udf power user and it is the first time that i wrote something in C...

Thank you very much.

here is my prog: #include "udf.h" #include <stdio.h> #include <stdlib.h> #include <time.h>

DEFINE_DPM_INJECTION_INIT(random_pos,I) { real x[ND_ND]; cell_t c; Thread *t; Tracked_Particle *p; int i,j,k,nb; nb=RP_Get_Real("nb_particles"); int m[nb];

for (j=0;j=nb-1;j++) { srand( time(NULL) ); A: c=rand()%nb; m[j]=c; if (j!=0) { for (k=0;k=j-1;k++)

{

if (m[k]=m[j])

{

goto A;

}

} } C_CENTROID(x,c,t); }

for (i=0;i=2;i++) { P_INIT_POS(p)[i]=x[i]; } }

  Reply With Quote

 


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DPM: UDF - loop over all particles chris Fluent UDF and Scheme Programming 31 June 17, 2020 05:52
Parallel INIT UDF trouble mil3st3g Fluent UDF and Scheme Programming 2 January 6, 2011 14:07
UDF for sampling particles from multiple injections JaC Fluent UDF and Scheme Programming 0 March 31, 2010 10:43
How to define a parabolic velocity inlet of particles with UDF zumaqiong FLUENT 2 February 22, 2010 09:46
Problem trapping Particles with UDF J. Krick FLUENT 2 November 19, 2008 02:28


All times are GMT -4. The time now is 14:17.