CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   What's a UDF? (

Farooq December 9, 2003 05:25

What's a UDF?
can anyone tell me what's a udf it like a case file that defines the initial conditions for the FLUENT solver...

i have made my 3D mesh and am going to use Fluent to solve it now...why and where will i need the udf file?



Andrew Garrard December 9, 2003 05:41

Re: What's a UDF?
This really is a case of RTFM

Farooq December 9, 2003 05:59

Re: What's a UDF?
thanks for the reply...could u just summarize the content in that webpage...i cannot access the forum because i am a student in NUS...and the authorization to the user support is only for our SVU (Supercomputing) administrator...



Andrew Garrard December 9, 2003 06:57

Re: What's a UDF?
I have copied and pasted the page into this forum for you. However, in my opinion, everyone who works with fluent NEEDS access to the manuals. If you are a student I would suggest you recomend that your library obtains a copy for student use. Also, fluent are pretty good about proving student support. I am a student myself and they have provied me with access to the User support centre.

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 definitions 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.

In summary, UDFs:

are written in the C programming language. (Chapter 2)

must have an include statement for the udf.h file. (Section 1.5)

must be defined using DEFINE macros supplied by Fluent Inc. (Section 1.4)

access FLUENT solver data using predefined macros and functions supplied by Fluent Inc. (Chapters 5 and 6)

are executed as interpreted or compiled functions. (Chapter 7)

must have all values returned to the FLUENT solver specified in SI units. User-defined functions can perform a variety of tasks in FLUENT. They can return a value unless they are defined as void in the udf.h file. If they do not return a value, they can modify an argument, modify a variable not passed as an argument, or perform I/O tasks with case and data files. In summary, UDFs can:

return a value.

modify an argument.

return a value and modify an argument.

modify a FLUENT variable (not passed as an argument).

write information to (or read information from) a case or data file. UDFs are written in C using any text editor and the source file is saved with a .c file extension. Source files typically contain a single UDF, but they can contain multiple, concatenated functions. Source files can be either interpreted or compiled in FLUENT. For interpreted UDFs, source files (e.g., pressure_profile.c) are interpreted and loaded directly at runtime, in a single-step process. For compiled UDFs, the process involves two separate steps. A shared object code library is first built and then it is loaded into FLUENT. Once interpreted or compiled, UDFs will become visible and selectable in FLUENT graphics panels, and can be hooked to a solver by choosing the function name in the appropriate panel (see Chapter 8).

Rahul December 9, 2003 07:19

Re: What's a UDF?
Hi Even in Fluent manual main page you can see link for UDF manual. If you have Fluent with you then just go to help page yuu can get info about UDF Rahul

mateus December 9, 2003 07:52

Re: What's a UDF?

If you are solving some basic problem you will probabilly not need to use an UDF. So don`t wory about it... You can find Fluent documentation at

and read all about udfs



All times are GMT -4. The time now is 20:40.