![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
The UDF interpreter supports C preprocessor directives including #define and #include.
Macro Substitution Directive Using
#define
When you use the #define macro substitution directive, the C preprocessor (e.g., cpp) performs a simple substitution and expands the occurrence of each argument in macro using the replacement-text.
#define
macro
replacement-text
For example, the macro substitution directive given by
#define RAD 1.2345 |
In another example
#define AREA_RECTANGLE(X,Y) ((X)*(Y)) |
all of the references to AREA_RECTANGLE(X,Y) in you UDF are replaced by the product of (X) and (Y).
File Inclusion Directive Using
#include
When you use the #include file inclusion directive, the C preprocessor replaces the line #include filename with the contents of the named file.
#include
"
filename
"
The file you name must reside in your current folder. The only exception to this rule is the udf.h file, which is read automatically by the ANSYS FLUENT solver.
For example, the file inclusion directive given by
#include "udf.h" |
will cause the udf.h file to be included with your source code.
The ANSYS FLUENT solver automatically reads the udf.h file from the following folder:
where
path is the folder in which you have installed
ANSYS FLUENT (by default, the
path is
C:
Program Files), and
is replaced by the appropriate number for the release (e.g.,
9 for
fluent12.0.9). .