3.3. Looping Macros

Many UDF tasks require repeated operations to be performed on nodes, cells, and threads in a computational domain. For your convenience, ANSYS Fluent has provided you with a set of predefined macros to accomplish looping tasks. For example, to define a custom boundary profile function you will need to loop over all the faces in a face thread using begin..end_f_loop looping macros. For operations where you want to loop over all the faces or cells in a domain, you will need to nest a begin..end_f_loop or begin..end_c_loop inside a thread_loop_f or thread_loop_c, respectively.

The following general looping macros can be used for UDFs in single-phase or multiphase models in ANSYS Fluent. Definitions for these macros are contained in the mem.h header file.


Important:  You should not access a scheme variable using any of the RP_GET_... functions from inside a cell or face looping macro (c_loop or f_loop). This type of communication between the solver and cortex is very time consuming and therefore should be done outside of loops.


For more information, see the following sections:


Release 18.2 - © ANSYS, Inc. All rights reserved.