CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   problem with Define_on_demand (

rr123 April 15, 2009 08:44

problem with Define_on_demand
dear all,

this is my code:

int num_injection = 4;

Domain *d=Get_Domain(1);
Thread *tc;
cell_t c;
int injno = 0;

/* Init UDM */
if(injno < num_injection)

when i use this code for initializing the User defined memories (i already put the UDM limit to 10); i get segmentation violation.

why is this so ?
can you help me to avoid this problem.


O.D.Y. April 16, 2009 05:35


unfortunately I can not help you with your problem, but I'm experiencing exactly the same problem. I'm using DEFINE_ON_DEMAND and the UDM brings up a segmentation violation. I'm using FLUENT under Linux AMD 64, what are you using?


O.D.Y. April 16, 2009 05:48

Hi again,

I found the solution in this thread:

I don't know why it works this way, but it works.... So You have to display the UDM in the contours before executing the UDF!


rr123 April 16, 2009 07:58

dear sir,

thank you for this very important message and for letting me know the work-around.


rr123 April 17, 2009 08:03

i still have problems with the UDF.
the initialization works.
however, the simulation crashes with:
Error: > (greater-than): invalid argument [2]: wrong type [not a number]
Error Object: nan

the UDF is related to the discrete model.
can anyone give some clue what is wrong ?

best wishes.

O.D.Y. May 1, 2009 14:10

Hi there, I have the same problem now.... same error, did you find any solution?


rr123 May 1, 2009 15:36

dear sir,

i had since then modfied the code.
the nan however when something in denominator goes 0 or you have a negative exponent.
if you look into those areas, may be it can solve your problem.
i will look of i can help you with this any further if you can paste the code snippet.

good luck.

All times are GMT -4. The time now is 04:52.