Professional Documents
Culture Documents
CHAPTER 6
AN OVERVIEW OF UDF
6.1 INTRODUCTION TO UDF
A user-defined function, or UDF, is a function that you program that can be dynamically
loaded with the FLUENT solver to enhance the standard features of the code .UDFs are written
in the C programming language. They are defined using DEFINE macros that are supplied by
Fluent Inc. They access data from the FLUENT solver using predefined macros and functions
also supplied by Fluent Inc .Every UDF contains the udf.h file inclusion directive(#include
“udf.h”) at the beginning of the source code file, which allows definition for DEFINE macros and
other Fluent-provided macros and functions to be included during the compilation process
.UDFs are executed as either interpreted or compiled functions in FLUENT .Values that are
passed to the solver by a UDF or returned by the solver to a UDF must be specified in SI units.
6.1.1 Use of UDF
UDF allows us to customize FLUENT to fit our particular modeling needs. UDFs
can be used for a variety of applications, some of which are listed below:
Customization of boundary conditions, material property definitions, surface and volume
reaction rates, source terms in FLUENT transport equations, source terms in user
defined scalar (UDF) transport equations, diffusivity functions, etc.
Adjustment of computed values on a once-per-iteration basis.
Initialization of a solution
Asynchronous execution of a UDF (on demand).
Post-processing enhancement
Enhancement of existing FLUENT models
6.1.2 Limitations
Although the UDF capability in FLUENT can address a wide range of application,
it is not possible to address every application using UDFs. Not all solution variables or
20
AN OVERVIEW OF UDF CHAPTER 6
FLUENT models can be accessed by UDFs. Specific heat values, for example, cannot
be modified; this would require additional solver capabilities.
21
AN OVERVIEW OF UDF CHAPTER 6
22