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.
Here is a summary of the differences between interpreted and compiled UDFs:
Interpreted UDFs:
Are portable to other platforms
Can all be run as compiled UDFs
Do not require a C complier
Are slower than compiled UDFs
Are restricted in the use of the C programming language.
Cannot be written in C++
Cannot be linked to compiled system or user libraries
Can access data stored in an ANSYS Fluent structure only using a predefined macro (see Additional Macros for Writing UDFs).
See Interpreting UDFs for details on interpreting UDFs in ANSYS Fluent.
Compiled UDFs:
Execute faster than interpreted UDFs
Are not restricted in their use of the C or C++ programming languages
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
See Compiling UDFs for details on compiling UDFs in ANSYS Fluent.
Thus, 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 (for example, a property UDF that is called on a per-cell basis every iteration)
Require access to a shared library.