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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 2, 2004, 11: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

Old   August 2, 2004, 19:24
Default Re: udf init random particles positions
  #2
Ryan Zarnitz
Guest
 
Posts: n/a
If you are not good with UDF's (like me), I suggest manually (or with a programming language of your choice) generating a file of the particle initial positions and using the read-from-file injection type. The file format is shown in 21.9.2 of the 6.1 users guide.
  Reply With Quote

Old   August 3, 2004, 04:35
Default Re: udf init random particles positions
  #3
olivia
Guest
 
Posts: n/a
Good idea! I think i will use the gambit mesh file to get some nodes coords and i will use a ramdomization prog to select a part of them.

Thanks a lot, Ryan!!
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 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 06:52
Parallel INIT UDF trouble mil3st3g Fluent UDF and Scheme Programming 2 January 6, 2011 15:07
UDF for sampling particles from multiple injections JaC Fluent UDF and Scheme Programming 0 March 31, 2010 11:43
How to define a parabolic velocity inlet of particles with UDF zumaqiong FLUENT 2 February 22, 2010 10:46
Problem trapping Particles with UDF J. Krick FLUENT 2 November 19, 2008 03:28


All times are GMT -4. The time now is 15:08.