Fluent Inc. December 3, 2001
Fluent Inc. December 3, 2001
1 Introduction 1-1
1.1 What is a User-Defined Function? . . . . . . . . . . . . . . . . . . . . . 1-1
1.2 Why Use UDFs? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.3 Limitations of UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.4 Changes in UDFs from FLUENT 5 to FLUENT 6 . . . . . . . . . . . . . . 1-2
1.5 UDF Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
1.5.1 Transport Equations . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
1.5.2 Cells, Faces, Zones, and Threads . . . . . . . . . . . . . . . . . . 1-4
1.5.3 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
1.5.4 Solver Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
1.5.5 Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
1.6 Interpreted vs. Compiled UDFs . . . . . . . . . . . . . . . . . . . . . . . 1-5
1.7 A Step-by-Step UDF Example . . . . . . . . . . . . . . . . . . . . . . . 1-7
6 Utilities 6-1
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
6.2 General-Purpose Looping Macros . . . . . . . . . . . . . . . . . . . . . . 6-2
6.2.1 Looping over Cell Threads in a Domain (thread loop c) . . . . 6-2
6.2.2 Looping over Face Threads in a Domain (thread loop f) . . . . 6-2
6.2.3 Looping over Cells in a Cell Thread (begin...end c loop) . . . 6-3
6.2.4 Looping over Faces in a Face Thread (begin...end f loop) . . . 6-3
6.2.5 Looping over Faces on a Cell (c face loop) . . . . . . . . . . . . 6-4
6.2.6 Looping over Nodes of a Cell (c node loop) . . . . . . . . . . . . 6-5
6.3 Multiphase-Specific Looping Macros . . . . . . . . . . . . . . . . . . . . 6-6
6.3.1 Looping over Phase Domains in a Mixture (sub domain loop) . . 6-6
6.3.2 Looping over Phase Threads in a Mixture (sub thread loop) . . 6-8
6.3.3 Looping over Phase Cell Threads in a Mixture (mp thread loop c) 6-8
6.3.4 Looping over Phase Face Threads in a Mixture (mp thread loop f) 6-9
6.4 Setting Face Variables (F PROFILE) . . . . . . . . . . . . . . . . . . . . . 6-10
6.5 Accessing Variables That Are Not Passed as Arguments . . . . . . . . . 6-11
6.5.1 Get Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11
6.5.2 Phase Domain Pointer Using the Phase Domain Index
(DOMAIN SUB DOMAIN) . . . . . . . . . . . . . . . . . . . . . . . . 6-14