CFD Online Logo CFD Online URL
Home > Forums > FLUENT

UDF and random functions

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

LinkBack Thread Tools Display Modes
Old   June 28, 2005, 03:11
Default UDF and random functions
gino briganti
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) );



ran = rand()/float(RAND_MAX) ;


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
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
gino briganti
Posts: n/a
thanks so much Luca, you are right, now it works! ciao gino
  Reply With Quote


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
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 04:26
Random function UDF for boundary condition Chris FLUENT 4 March 28, 2003 16:38

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