top of page
Silesian University of Technology

User-Defined Functions
programming in Ansys Fluent

Courses for users and free guidebook


User-Defined Functions (Fluent UDF) programming courses in Ansys Fluent

The course programme was prepared based on the guidebook by Jacek Smołka about 
User-Defined Functions (Fluent UDF) programming and numerical modelling aspects
on the example of thermal processes in electric devices and machines.

Basic course

Intermediate course

Advanced course

  • basic information about the structure and compilation procedure

  • presentation of the complete code for a simple function

  • explanation of User-Defined Function related to model customisation and for the general use

  • overview of User-Defined Functions with examples related to cell nodes, cell faces and cells

  • overview of macros with examples related to variables that describe surface and cell values 

  • User-Defined Functions for transient computations

  • User-Defined Function to define the User-Defined Memory

  • User-Defined Functions to print messages on the programme console screen

  • User-Defined Functions for printing messages on the program console screen in the serial solver

  • method of partitioning the numerical grid

  • principles of communication between computing nodes

  • cell areas and cell faces after grid partitioning

  • presentation of the User-Defined Function of compiler directives

  • macros for communicating host processes with compute node processes and compute node-0 process with the host process

  • statement and global reduction macros

  • User-Defined Functions for loop programming in the parallel solver

  • User-Defined Functions for printing messages on the program console screen in the parallel solver

  • data transfer macros and reading/writing data from files and to files in the parallel solver

  • an example of a User-Defined Function with the instructions of the Scheme programming language

  • defining and implementing your own transport equation for a UDS scalar quantity (User-Defined Scalar)

  • User-Defined Function (Fluent UDF) to describe all terms of your own transport equation

  • content agreed upon individually with participants 


Research field

The offered courses and free-to-download guidebook about UDF aspects will allow you to effectively prepare User-Defined Functions (Fluent UDFs), automate and perform thermal and flow simulations (CFD).

The experience of the authors of courses and the guidebook results from implementation of numerous research projects that concerned the modelling of thermal and flow phenomena (CFD) and electromagnetic processes (EMAG) coupled with them. The wide scope of projects included:

  • heating and cooling of low- and high-power electric devices and machines, such as switchgears, chokes, transformers, generators and motors with their cooling systems,

  • flow of natural refrigerants such as R744 (CO2) or R290 through the components of refrigeration systems and heat pumps,

  • rapid food freezing processes,

  • food freeze-drying processes, 

  • heating batches of small- and high-power furnaces,

  • heating the active components in the combustion chambers.


UDF guidebook

User-Defined Functions (Fluent UDF) in Ansys Fluent are programmes that allow you to define advanced components of mathematical models. This guidebook discusses User-Defined Functions using the example of modelling thermal processes in electrical devices and machines.

The given examples (almost 50) have been presented in the form of full and comprehensively commented source codes of User-Defined Functions, which can be, directly or after modifications, used also for other applications. The source codes of User-Defined Functions have been formatted in such a way that they can be copied from the electronic version of the guidebook into a text file without a need for rewriting.

The presented examples of User-Defined Functions allow, among others, to define:

  • heat sources in the energy equation as quantities dependent on temperature, electrical parameters and position as the field of power losses based on another calculation algorithm,

  • properties of construction materials and refrigerants as quantities dependent on temperature and location for composite materials,

  • initial condition for a transient process and the starting condition for a steady-state process and controlling the computational process in a transient state,

  • boundary conditions as quantities dependent on temperature and location,

  • macros for your own transport UDS equation (User-Defined Scalar) for any scalar quantity,

  • data exchange between the programme and external files for the calculation algorithm in serial and parallel solvers,

  • macros in a parallel version of the computational algorithm.

UDF guidebook


Jacek Smołka

Silesian University of Technology

Department of Thermal Engineering (former Institute of Thermal Technology)

Konarskiego 22

44-100 Gliwice

Project websites:

Thank you for contacting us. We'll get back to you.

  • Jacek Smolka profil
bottom of page