CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Is there a limitation of memory size for UDFs? (https://www.cfd-online.com/Forums/fluent/31982-there-limitation-memory-size-udfs.html)

Chen Fangzhi August 17, 2003 08:51

Is there a limitation of memory size for UDFs?
 
I defined a UDF, which requires a large portion of memory. static int randn_1[100000] static int randn_2[100000] static int randn_2[100000]

Can I define three integer arraies like this? I think the needed memory size may be too large?

kim August 18, 2003 04:36

Re: Is there a limitation of memory size for UDFs?
 
hi,

If this is a normal variable in C programming, you should refer to the stack size the C compiler permit. Anyway, such a large array definitaion will ocuppy a lot of memory. Why should you do like this?

Chen Fangzhi August 18, 2003 04:42

Re: Is there a limitation of memory size for UDFs?
 
I need a list of Gaussian random numbers. I don't want to generate them by my UDF scheme as it may spend long time. I use MatLab to create 100,000 random numbers and read them into memory.

I know this method is awful. FLUENT provides a macro "gauss_random()", but I don't how to use it.

Greg Perkins August 19, 2003 02:46

Re: Is there a limitation of memory size for UDFs?
 
For large arrays it makes more sense to allocate it on the heap by using a malloc or calloc call.

is do

real *mydata;

mydata = malloc(size_of_data);

mydata[0] = x

Greg


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