CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Interepreted Vs. Compiled UDFs (

Antonis August 31, 2006 15:34

Interepreted Vs. Compiled UDFs
Hi all.

I have created a UDF using a DEFINE_ADJUST routine, and I don't know if it's supposed to be an interpreted or a compiled one.

Is there a general rule for how to tell when a UDF is compiled or interpreted?

Thanks in advance for your answers!

Reginaldo Cotto August 31, 2006 17:26

Re: Interepreted Vs. Compiled UDFs
Interpreting a UDF source file (example.c)

The UDF source file (example.c) must be in the same directory that contains your case (e.g., example.msh). After start FLUENT and read your case file (example.msh): Define " User-Defined " Functions " Interpreted In the Interpreted UDFs panel select the UDF source file (example.c) The next step is to set the Use Contributed CPP and click Interpret.

Fluent diplay a message of the interpreted UDF source file.

Close the Interpreted UDFs panel when the interpreter has finished

The proceder to Interpreted UDF is the same in the Windows and LINUX, but to compile in the Windows system it is necessary the C+ sotfware and service pack 2.

In FLUENT user guide chapter 8.2 you can see the steps TO compile UDF source file. In my opinion Interpreted UDF it is easier than Compiled UDF, however the Compiled UDF runs faster.

Antonis August 31, 2006 19:46

Re: Interepreted Vs. Compiled UDFs
Thanks for your reply!

I'm a bit confused though, because in the udf manual i read an example for DEFINE_ADJUST that can be used as interpreted OR compiled, and another example again for DEFINE_ADJUST that can be ONLY used as compiled?

I was wondering if there is a rule to know this difference

Mark Russell September 1, 2006 05:19

Re: Interepreted Vs. Compiled UDFs
for more advice take a look at

I suspect it is not the 'name' or 'type' of the macro that creates the intepret or compile issue but rather the code that is contained 'within' the macro / UDF.

Compare the UDF's you are referring to and you will probably find the line(s) that the interprter cannot handle hence the need to compile.

Hope this helps

Antonis September 1, 2006 09:28

Re: Interepreted Vs. Compiled UDFs
Thanks for your reply.

Unfortunately I don't have acces to the fluent support website as I am a student...

Is it possible to give an example?

Mark Russell September 1, 2006 12:35

Re: Interepreted Vs. Compiled UDFs
Which examples were you initially referring to that prompted this question?

Antonis September 1, 2006 13:11

Re: Interepreted Vs. Compiled UDFs
I was going through the UDF manual, and for the DEFINE_ADJUST there are two examples. For the first one it's mentioned that is used as an interpreted, and the second one only as compiled (the second one uses UDS, maybe that's why)

I want to define a von Neumann condition with a DEFINE_ADJUST function.

suvash September 6, 2006 04:18

Re: Interepreted Vs. Compiled UDFs
Differences Between Interpreted and Compiled UDFs

The major difference between interpreted and compiled UDFs is that interpreted UDFs cannot access FLUENT solver data using direct structure references; they can only indirectly access data through the use of Fluent-supplied macros. This can be significant if, for example, you want to introduce new data structures in your UDF.

A summary of the differences between interpreted and compiled UDFs is presented below. See Chapters 7 and 8 for details on interpreting and compiling UDFs, respectively, in FLUENT.

* Interpreted UDFs

o are portable to other platforms.

o can all be run as compiled UDFs.

o do not require a C compiler.

o are slower than compiled UDFs.

o are restricted in the use of the C programming language.

o cannot be linked to compiled system or user libraries.

o can access data stored in a FLUENT structure only using a predefined macro (see Chapters 5 and 6).

* Compiled UDFs

o execute faster than interpreted UDFs.

o are not restricted in the use of the C programming language.

o can call functions written in other languages (specifics are system- and compiler-dependent).

o cannot necessarily be run as interpreted UDFs if they contain certain elements of the C language that the interpreter cannot handle.

In summary, when deciding which type of UDF to use for your FLUENT model

* use interpreted UDFs for small, straightforward functions.

* use compiled UDFs for complex functions that

o have a significant CPU requirement (e.g., a property UDF that is called on a per-cell basis every iteration).

o require access to a shared library.

Antonis September 6, 2006 05:50

Re: Interepreted Vs. Compiled UDFs

That cleared things a lot!


nadesan October 18, 2012 00:08

von neumann
Hi antonis, could you please let me know that the von neumann boundary condition i created is correct. The boundary condition is created for a 2D serial fluent code on the top wall.

#include "udf.h"
face_t f;
cell_t c;
Thread *t;

When i am trying to hook the udf to the wall, it is asking for the shear stress, how should i define the boundary in order to hook the udf. Your help is much appreciated.

Thank you

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