CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   September 16, 2007, 16:16
Default UDF
  #1
Ash
Guest
 
Posts: n/a
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");

}
  Reply With Quote

Old   September 16, 2007, 17:46
Default Re: UDF
  #2
jasond
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   September 16, 2007, 18:12
Default Re: UDF
  #3
Ash
Guest
 
Posts: n/a
thanks,

I am a mechanical engineer.

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

thanks in advance
  Reply With Quote

Old   September 17, 2007, 13:10
Default Re: UDF
  #4
jasond
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   September 17, 2007, 16:38
Default Re: UDF
  #5
Ash
Guest
 
Posts: n/a
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???
  Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 21:46.