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

UDF - Interpreted works and compiled doesn't

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

Like Tree1Likes
  • 1 Post By RoM

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2006, 13:54
Default UDF - Interpreted works and compiled doesn't
  #1
AlwaysLearning
Guest
 
Posts: n/a
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?

  Reply With Quote

Old   August 28, 2006, 02:25
Default Re: UDF - Interpreted works and compiled doesn't
  #2
RoM
Guest
 
Posts: n/a
Use "Message" or "CX_Message" (same syntax as printf) instead of "printf" for compiled udfs.

RoM
shakib likes this.
  Reply With Quote

Old   August 28, 2006, 05:44
Default Re: UDF - Interpreted works and compiled doesn't
  #3
AlwaysLearning
Guest
 
Posts: n/a
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.

  Reply With Quote

Old   August 28, 2006, 06:32
Default Re: UDF - Interpreted works and compiled doesn't
  #4
RoM
Guest
 
Posts: n/a
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
  Reply With Quote

Old   August 30, 2006, 01:36
Default Re: UDF - Interpreted works and compiled doesn't
  #5
PAD
Guest
 
Posts: n/a
On windows clients "printf" only works in interpreted mode. "Message" should work for both modes regardless of operating system.
  Reply With Quote

Old   August 30, 2006, 05:44
Default Re: UDF - Interpreted works and compiled doesn't
  #6
RoM
Guest
 
Posts: n/a
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
  Reply With Quote

Old   October 29, 2018, 18:13
Default
  #7
New Member
 
Chunrong Zhao
Join Date: Oct 2018
Posts: 3
Rep Power: 7
Chunrong is on a distinguished road
Quote:
Originally Posted by RoM
;135315
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
Hi RoM,

I got "Error code 126" when I used COMPLIED but okay for INTERPRETED. Do you know why it happened ? I tried to fix it by referring https://www.cfd-online.com/Forums/fluent/174350-udf-compilation-error-code-126-a.html but didn't work.

many thanks
Chunrong is offline   Reply With Quote

Old   October 29, 2018, 20:40
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
reason of error code 126 is version mismatch

best regards
AlexanderZ is offline   Reply With Quote

Old   October 29, 2018, 20:54
Default
  #9
New Member
 
Chunrong Zhao
Join Date: Oct 2018
Posts: 3
Rep Power: 7
Chunrong is on a distinguished road
Hi AlexanderZ,

Very appreciate your reply. Since I don't own much knowledge about CS, can you explain it in details and what should I do to fix this error?

thanks and regards
Chunrong is offline   Reply With Quote

Old   October 30, 2018, 00:52
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
in other thread you've mentioned, that you have both v19.0 and v.18.2 version of fluent.

Most likely you are compiling your UDF using one version, but run it with another.
Or you are not compiling library, because of some problems with compiler or code) and than try to read "bad" library, which was compiled long time ago for other fluent version

best regards
AlexanderZ is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
compiled and interpreted udf mateus FLUENT 1 May 11, 2011 06:09
Difference between interpreted and compiled for DEFINE_ADJUST? KatyaM Fluent UDF and Scheme Programming 1 November 3, 2009 09:30
PROBLEM WItH COMPILED UDF. Nia FLUENT 5 November 6, 2007 11:53
.F compiled on Winnt works, but on AIX doesn't Daiga CFX 11 May 9, 2006 07:44
Use of F_UDMI(f,t,i) for compiled UDF Damien FLUENT 8 June 18, 2002 08:55


All times are GMT -4. The time now is 20:12.