CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF - Interpreted works and compiled doesn't (http://www.cfd-online.com/Forums/fluent/42151-udf-interpreted-works-compiled-doesnt.html)

AlwaysLearning August 27, 2006 13:54

UDF - Interpreted works and compiled doesn't
 
I am writing some UDF's so that I can get at some of the flow data - not relevant right now.

To allow me to see how my UDF's are performing, I wanted to sprinkle the code with some printf statements.

Unfortuntaley the Printf doesn't seem to do anything.

I have now stripped the UDF right down to simply a few lines of Printf.

This works OK when interpreted but not when compiled. When I compile the UDF I don't seem to get any errors and it loads alright.

Anyone got any ideas?


RoM August 28, 2006 02:25

Re: UDF - Interpreted works and compiled doesn't
 
Use "Message" or "CX_Message" (same syntax as printf) instead of "printf" for compiled udfs.

RoM

AlwaysLearning August 28, 2006 05:44

Re: UDF - Interpreted works and compiled doesn't
 
Thank you for this. Very helpful. I have also located some text in the fluent help file that refers to 'Message'. Strange thing is that it seems as though it should work (printf), in both interpreted and compiled mode.


RoM August 28, 2006 06:32

Re: UDF - Interpreted works and compiled doesn't
 
I had a discussion with fluent suuport about this problem. The output from the fluent solver (written in c) to the cortex (scheme) is buffered and the message buffer needs to be fluhed bevor you will see the output in the cortex gui. The standard printf function wont do this, so fluent provides the Message macro. As far as i know, Message will work only in compiled udfs and not in interpreted mode.

RoM

PAD August 30, 2006 01:36

Re: UDF - Interpreted works and compiled doesn't
 
On windows clients "printf" only works in interpreted mode. "Message" should work for both modes regardless of operating system.

RoM August 30, 2006 05:44

Re: UDF - Interpreted works and compiled doesn't
 
The good old hello-world-udf will not run in interpreted mode on my WinXP machine.

#include "udf.h"

DEFINE_ON_DEMAND(hello)
{
Message("Hello world!\n");
}

The interpreter quits with
Error: C:\hello.c: line 7: function "CX_Message" not found (pc=5).

Compiling works fine though.

RoM


All times are GMT -4. The time now is 14:03.