2.1. Introduction

DEFINE macros are predefined macros provided by Ansys, Inc. that must be used to define your UDF. A listing and discussion of each DEFINE macro is presented below. (Refer to Defining Your UDF Using DEFINE Macros for general information about DEFINE macros.) Definitions for DEFINE macros are contained within the udf.h file. For your convenience, they are provided in Appendix B: DEFINE Macro Definitions.

For each of the DEFINE macros listed in this chapter, a source code example of a UDF that utilizes it is provided, where available. Many of the examples make extensive use of other macros presented in Additional Macros for Writing UDFs. Note that not all of the examples in the chapter are complete functions that can be executed as stand-alone UDFs in Ansys Fluent. Examples are intended to demonstrate DEFINE macro usage only.

Special care must be taken for some UDFs that will be run in serial or parallel Ansys Fluent. See Parallel Considerations for details.


Important:
  • You must place all of the arguments to a DEFINE macro 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 (such as DEFINE_PROFILE) and the first parenthesis of the arguments, as this will cause an error in Windows.

  • Do not include a DEFINE macro statement (such as DEFINE_PROFILE) within a comment in your source code. This will cause a compilation error.