CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   help for UDF (https://www.cfd-online.com/Forums/fluent/47269-help-udf.html)

Clementine February 7, 2008 18:49

help for UDF
 
Hi everybody, I have a problem with my UDF program, if someone could help me, I would really appreciate. I am trying to set up a velocity which is egal to a constant(1.6) plus a random number (r). When I load this program on fluent, it tells me that "srand: undeclared variable". I don't know how to declare srand.

#include "udf.h"

DEFINE_PROFILE(random_velocity,thread,position) {

face_t f;

int seed;

double r;

seed=1000;

srand(seed);

begin_f_loop(f,thread)

{ r=( (double)rand()/((double)(RAND_MAX)+(double)(1))); F_PROFILE(f,thread,position)=1.6 +r;

} end_f_loop(f,thread)

}

PKN February 8, 2008 11:24

Re: help for UDF
 
even all the functions of "stdlib.h" like abs(),exit() dosen't work & will show the same error as shown in your case.

Actually I was advised to load VC++ compiler into the system.....really don't know whether it works.


All times are GMT -4. The time now is 19:22.