User-defined functions (UDFs) allow you to customize Ansys Fluent and can significantly enhance its capabilities. Part 1 of the Ansys Fluent Customization Manual presents detailed information on how to write, compile, and use UDFs in Ansys Fluent. Examples have also been included, where available. General information about C programming basics is included in an appendix.
Learning to customize the Ansys Fluent user interface to build your own graphical user interface (GUI) will allow you to easily change critical data being used by your UDF at will. Part 2 of the Ansys Fluent Customization Manual will walk you through the process of creating a customized addition to the Ansys Fluent user interface through the use of Scheme macros. General information about Scheme programming basics is included in chapter 1 of part 2.
Important: Under U.S. and international copyright law, ANSYS, Inc. is unable to distribute copies of the papers listed in the bibliography, other than those published internally by ANSYS, Inc. Use your library or a document delivery service to obtain copies of copyrighted papers.
Information in part 1 of this manual is presented in the following chapters:
Overview of User-Defined Functions (UDFs), presents an introduction to User Defined Functions (UDFs).
DEFINE
Macros, describes predefinedDEFINE
macros that you will use to define your UDF.Additional Macros for Writing UDFs, describes additional predefined macros that you will use to define your UDF.
Interpreting UDFs, describes how to interpret the source file for your UDFs.
Compiling UDFs, describes how to compile the UDF source file, build a shared library from the resulting objects, and load the library into Ansys Fluent.
Hooking UDFs to Ansys Fluent, describes how to add, or hook, your UDF into the Ansys Fluent interface.
Parallel Considerations, describes how to use UDFs in a parallel computing environment.
Examples, presents examples of UDFs.
Appendix A: C Programming Basics, presents an introduction to the C programming language.
Appendix B:
DEFINE
Macro Definitions, presents a series ofDEFINE
macro definitions for multiple categories.Appendix C: Quick Reference Guide for Multiphase
DEFINE
Macros, presents a series of reference tables for multiphase-relatedDEFINE
macros.
Information in part 2 of this manual is presented in the following chapters:
Introduction to Fluent User Interface Concepts, presents an introduction to Fluent GUI concepts such as limitations, the Scheme language, and RP variables.
How to Create an Interface, describes the process of creating a dialog box to add interface elements to, and using tables to organize these elements.
Interface Elements, presents each of the interface elements that can be added to a dialog box and explains the macros needed to use them.
Adding Menus to the Right of the Ribbon, describes the process of adding menus, submenus, and menu items to the Fluent ribbon that are used to open your dialog box.
Comprehensive Examples, presents a number of examples that encompass all of the concepts that are covered in the rest of part 2 of this manual.
Appendix A: Avoiding Common Mistakes, describes mistakes that can be easily made throughout the GUI creation process and how to avoid them.
Appendix B: Reference Table For Fluent Macros, provides a reference table for all of the Ansys Fluent Scheme macros used throughout part 2 of this manual.
This document provides some basic information about the C programming language (Part 1 Appendix A) as it relates to user-defined functions in Ansys Fluent, and assumes that you are an experienced programmer in C. If you are unfamiliar with C, consult a C language reference guide (for example, [6], [9]) before you begin the process of writing UDFs and using them in your Ansys Fluent model.
This document also provides some basic information about the Scheme programming language (Part 2 Chapter 1) as it relates to Fluent interface macros, and assumes that you are an experienced programmer in Scheme. If you are unfamiliar with Scheme, consult a Scheme language reference guide (for example http://www.scheme.com/tspl4/) before you begin the process of writing GUI code for use with your Fluent UDF.
This document does not imply responsibility on the part of ANSYS, Inc. for the accuracy or stability of solutions obtained using UDFs that are either user-generated or provided by ANSYS, Inc. Support for current license holders will be limited to guidance related to communication between a UDF and the Ansys Fluent solver. Other aspects of the UDF development process that include conceptual function design, implementation (writing C code), compilation and debugging of C source code, execution of the UDF, and function design verification will remain the responsibility of the UDF author.
UDF compiled libraries are specific to the computer architecture being used and the version of the Ansys Fluent executable being run and must be rebuilt any time Ansys Fluent is upgraded, your operating system changes, or the job is run on a different type of computer. Note that UDFs may need to be updated with new versions of Ansys Fluent.