I tried to re-launch Fluent many times but always got the same error message after excuting the UDF. I tried also another UDF example in the same user manual (pp. 4-12) DEFINE_RW_FILE, the compilation and calculation work well but when I try to write the dat file, I got the same error message. I cannot figure out what's wrong there. Can someone give me some hints? I am running Fluent 6.0.20 on Linux Redhat 7.2.

Sorry about give you the wrong advice, you must to use this form in fluent 6.0

DEFINE_ON_DEMAND(my_udf1) { Domain *domain=Get_Domain(1);

Now, the segmentation problem that you are getting is generated because you have not initialize the used define memory. As a result,

If you have not iterate your flow field Initialize the variable in the solver Initialize-Initialize.

If you have already iterate your flow field, Open the contours plot, select User define memory, select one surface, and then display. In this way, you will initialize indirectly the UDM without changing the data in other field. Unfortunately, I have not found a better way to do it. However, It works!!

I found out today the problem is from the UDM, I should first reserve User Defined Memory before excuting the on-demande UDF. Another problem may be from the string length in the "printf": in Fluent 6.0.12 linux version, when the string length in the printf is more than 31, it will cause a segmentation error. It is said that this problem was fixed in the 6.0.20 version but I am working on the 6.0.20 version, the problem still exists.