CFD Online Discussion Forums

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

Ash September 16, 2007 16:16

UDF
 
HI,

I have writtena simple UDF which I have pasted below.

When I compile it as interpreted UDF , I can see the message in the printf line in the console window while iterating.

However if I comlpile it as compiled UDF and even after hooking it I cannot see the message in the console window while iterating.

Does anyone have an idea why this is so? Any sort of help will be appreciated!!!!!

#include "udf.h" DEFINE_ADJUST(my_adjust,d)

{

Thread *t;

cell_t c;

printf("I am here");

}

jasond September 16, 2007 17:46

Re: UDF
 
Assuming that all else is well, it is possible that IO buffering is the problem. Use "Message" instead of "printf" or explicitly flush stdout.

Jason D.

Ash September 16, 2007 18:12

Re: UDF
 
thanks,

I am a mechanical engineer.

Can u be more precise regarding "explicitly flush stdout"???

thanks in advance

jasond September 17, 2007 13:10

Re: UDF
 
Well, I am also a mechanical engineer, so I don't know what that is about. To answer the question: "Message" acts pretty much like "printf", so all you have to do is replace printf with Message (see section 3.7 of the 6.3 UDF manual). I strongly urge you to use Message, as explicitly flushing stdout is a pain in the neck when you forget to do it (done that). My output eventually showed up - if I recall correctly it appeared when I reloaded my UDF's. After that I have always used Message. However, should you wish to go the flush route, to explicitly flush stdout you'll need to add

fflush(stdout);

after your printf to see it properly. As far as I know what I have said is valid under Windows and Linux.

Jason D.

Ash September 17, 2007 16:38

Re: UDF
 
Hi Jasond.

Thanks man. It really works. Gr8. I am damn happy.

Well just wanted to inroduce my self to u.

I am a student in SWEDEN, doing my thesis on UDF. I am trying to write a UDF for adopting 4 transport equations for a new turbulence model. I have written the code, but I was unable to debug some errors in the code because of the above problem. Now that its solved I am very happy. Thanks again.....

What about u? where r u from???? and what do u do???


All times are GMT -4. The time now is 15:10.