The major difference between interpreted and compiled UDFs is that interpreted UDFs cannot access
ANSYS FLUENT solver data using direct structure references; they can only indirectly access data through the use of
ANSYS 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
4 and
5 for details on interpreting and compiling UDFs, respectively, in
ANSYS FLUENT.
Interpreted UDFs
are portable to other platforms.
can all be run as compiled UDFs.
do not require a C compiler.
are slower than compiled UDFs.
are restricted in the use of the C programming language.
cannot be linked to compiled system or user libraries.
can access data stored in an
ANSYS FLUENT structure
only using a predefined macro (see Chapters
3).
Compiled UDFs
execute faster than interpreted UDFs.
are
not restricted in the use of the C programming language.
can call functions written in other languages (specifics are system- and compiler-dependent).
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
ANSYS FLUENT model
use interpreted UDFs for small, straightforward functions.
use compiled UDFs for complex functions that
have a significant CPU requirement (e.g., a property UDF that is called on a per-cell basis every iteration).