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

UDF and random functions

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2005, 03:11
Default UDF and random functions
  #1
gino briganti
Guest
 
Posts: n/a
Can anybody tell us why Fluent does not interpret UDF with random functions calls (srand, rand)? The error message says that srand and rand are "undeclared variables"... thanks gino

----------------------------------- #include "udf.h" #define RAND_MAX 32767

DEFINE_PROFILE(temp_face,t,i) { real x[ND_ND]; face_t f;

float ran ;

srand( (unsigned) time (NULL) );

begin_f_loop(f,t)

{

ran = rand()/float(RAND_MAX) ;

F_CENTROID(x,f,t);

F_PROFILE(f,t,i) = 310.+2.*(ran-0.5);

} end_f_loop(f,t) void srand( unsigned int seed ); } -------------------------------------
  Reply With Quote

Old   June 28, 2005, 03:14
Default Re: UDF and random functions
  #2
Luca
Guest
 
Posts: n/a
Ciao Gino, try to compile your UDF. The problem should disappear.Luca
  Reply With Quote

Old   June 28, 2005, 04:55
Default Re: UDF and random functions
  #3
gino briganti
Guest
 
Posts: n/a
thanks so much Luca, you are right, now it works! ciao gino
  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
Fluent UDF - Random Noise Tanner FLUENT 2 May 29, 2014 03:27
Random Function in UDF per DPM adriano FLUENT 1 May 18, 2006 06:19
udf init random particles positions olivia FLUENT 2 August 3, 2004 03:35
Urgent: Random number in UDF hedonists FLUENT 1 March 4, 2004 03:26
Random function UDF for boundary condition Chris FLUENT 4 March 28, 2003 15:38


All times are GMT -4. The time now is 20:51.