![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
UDFs are defined using ANSYS FLUENT-supplied function declarations. These function declarations are implemented in the code as macros , and are referred to in this document as DEFINE (all capitals) macros. Definitions for DEFINE macros are contained in the udf.h header file (see Appendix B for a listing). For a complete description of each DEFINE macro and an example of its usage, refer to Chapter 2.
The general format of a DEFINE macro is
DEFINE_MACRONAME(udf_name, passed-in variables) |
For example, the macro
DEFINE_PROFILE(inlet_x_velocity, thread, index) |
defines a boundary profile function named inlet_x_velocity with two variables, thread and index, that are passed into the function from ANSYS FLUENT. These passed-in variables are the boundary condition zone ID (as a pointer to the thread) and the index identifying the variable that is to be stored. After the UDF has been interpreted or compiled, its name (e.g., inlet_x_velocity) will become visible and selectable in drop-down lists in the appropriate boundary condition dialog box (e.g., Velocity Inlet) in ANSYS FLUENT.
|
Note that all of the arguments to a
DEFINE macro need to be placed on the same line in your source code. Splitting the
DEFINE statement onto several lines will result in a compilation error
.
|
|
Make sure that there are no spaces between the macro (e.g.,
DEFINE_PROFILE) and the first parenthesis of the arguments, as this will cause an error in Windows.
|
|
Do not include a
DEFINE macro statement (e.g.,
DEFINE_PROFILE) within a comment in your source code. This will cause a compilation error
.
|