KEMBAR78
Fluent Inc. December 3, 2001 | PDF | Pointer (Computer Programming) | Subroutine
0% found this document useful (0 votes)
85 views10 pages

Fluent Inc. December 3, 2001

This document discusses user-defined functions (UDFs) in FLUENT. It covers basics of UDFs including their purpose, limitations, and changes between versions. It also provides details on C programming basics, writing UDFs, and DEFINE macros for customizing solver behavior.

Uploaded by

sxasxasx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views10 pages

Fluent Inc. December 3, 2001

This document discusses user-defined functions (UDFs) in FLUENT. It covers basics of UDFs including their purpose, limitations, and changes between versions. It also provides details on C programming basics, writing UDFs, and DEFINE macros for customizing solver behavior.

Uploaded by

sxasxasx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Contents

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

2 C Programming Basics for UDFs 2-1


2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.2 Commenting Your C Code . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.3 C Data Types in FLUENT . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.5 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.5.1 Declaring Variables . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.5.2 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.5.3 Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.5.4 External Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.5.5 Static Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
2.6 User-Defined Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5

c Fluent Inc. December 3, 2001


TOC-1
CONTENTS

2.7 Casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6


2.8 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.9 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.10 Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.10.1 Pointers as Function Arguments . . . . . . . . . . . . . . . . . . 2-8
2.11 Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.11.1 if Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.11.2 if-else Statement . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.11.3 for Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.12 Common C Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.12.1 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . 2-11
2.12.2 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
2.13 C Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
2.13.1 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.13.2 Miscellaneous Mathematical Functions . . . . . . . . . . . . . . . 2-12
2.13.3 Standard I/O Functions . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.14 Macro Substitution Directive Using #define . . . . . . . . . . . . . . . . 2-13
2.15 File Inclusion Directive Using #include . . . . . . . . . . . . . . . . . . 2-14
2.16 Comparison with FORTRAN . . . . . . . . . . . . . . . . . . . . . . . . 2-14

3 Writing UDFs 3-1


3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.2 Restrictions on Writing Interpreted UDFs . . . . . . . . . . . . . . . . . 3-2
3.3 Sequencing of UDFs in the FLUENT Solution Process . . . . . . . . . . . 3-3
3.4 FLUENT Grid Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3.5 FLUENT Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3.6 Defining Your UDF Using DEFINE Macros . . . . . . . . . . . . . . . . . 3-6
3.7 Including the udf.h File in Your UDF Source File . . . . . . . . . . . . 3-8
3.8 Defining Variables in Your Function . . . . . . . . . . . . . . . . . . . . 3-9
3.9 Function Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9

TOC-2 c Fluent Inc. December 3, 2001



CONTENTS

3.10 UDF Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9


3.10.1 Functions that Return a Value . . . . . . . . . . . . . . . . . . . 3-10
3.10.2 Functions that Modify an Argument . . . . . . . . . . . . . . . . 3-11
3.10.3 Functions that Return a Value and Modify an Argument . . . . . 3-12
3.10.4 Functions that Modify a FLUENT Variable . . . . . . . . . . . . 3-13
3.10.5 Functions that Write to or Read from a Case or Data File . . . . 3-14
3.11 Writing UDFs for Multiphase Applications . . . . . . . . . . . . . . . . . 3-15
3.11.1 Data Structure for Multiphase Applications . . . . . . . . . . . . 3-15
3.11.2 Using UDFs for Multiphase Models . . . . . . . . . . . . . . . . 3-18
3.12 Using Your UDF in Parallel . . . . . . . . . . . . . . . . . . . . . . . . . 3-24

4 DEFINE Macros 4-1


4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
4.2 General Solver DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . 4-2
4.2.1 DEFINE ADJUST . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4.2.2 DEFINE INIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4.2.3 DEFINE ON DEMAND . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
4.2.4 DEFINE RW FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
4.3 Model-Specific DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . 4-13
4.3.1 DEFINE DELTAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
4.3.2 DEFINE DIFFUSIVITY . . . . . . . . . . . . . . . . . . . . . . . . 4-16
4.3.3 DEFINE HEAT FLUX . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
4.3.4 DEFINE NOX RATE . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
4.3.5 DEFINE PROFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
4.3.6 DEFINE PROPERTY . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
4.3.7 DEFINE SCAT PHASE FUNC . . . . . . . . . . . . . . . . . . . . . . 4-37
4.3.8 DEFINE SOURCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
4.3.9 DEFINE SR RATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44
4.3.10 DEFINE TURB PREMIX SOURCE . . . . . . . . . . . . . . . . . . . . 4-47
4.3.11 DEFINE TURBULENT VISCOSITY . . . . . . . . . . . . . . . . . . . 4-50

c Fluent Inc. December 3, 2001


TOC-3
CONTENTS

4.3.12 DEFINE UDS FLUX . . . . . . . . . . . . . . . . . . . . . . . . . . 4-52


4.3.13 DEFINE UDS UNSTEADY . . . . . . . . . . . . . . . . . . . . . . . . 4-56
4.3.14 DEFINE VR RATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-58
4.4 Multiphase DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . . 4-62
4.4.1 DEFINE CAVITATION RATE . . . . . . . . . . . . . . . . . . . . . . 4-63
4.4.2 DEFINE EXCHANGE PROPERTY . . . . . . . . . . . . . . . . . . . . 4-65
4.4.3 DEFINE VECTOR EXCHANGE PROPERTY . . . . . . . . . . . . . . . . 4-68
4.5 DPM DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-70
4.5.1 DEFINE DPM BODY FORCE . . . . . . . . . . . . . . . . . . . . . . . 4-72
4.5.2 DEFINE DPM DRAG . . . . . . . . . . . . . . . . . . . . . . . . . . 4-74
4.5.3 DEFINE DPM EROSION . . . . . . . . . . . . . . . . . . . . . . . . 4-76
4.5.4 DEFINE DPM INJECTION INIT . . . . . . . . . . . . . . . . . . . . 4-82
4.5.5 DEFINE DPM LAW . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-84
4.5.6 DEFINE DPM OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . 4-86
4.5.7 DEFINE DPM PROPERTY . . . . . . . . . . . . . . . . . . . . . . . . 4-87
4.5.8 DEFINE DPM SCALAR UPDATE . . . . . . . . . . . . . . . . . . . . . 4-90
4.5.9 DEFINE DPM SOURCE . . . . . . . . . . . . . . . . . . . . . . . . . 4-93
4.5.10 DEFINE DPM SWITCH . . . . . . . . . . . . . . . . . . . . . . . . . 4-95

5 Accessing FLUENT Solver Variables Using Macros 5-1


5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
5.2 Cell Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5.2.1 Macros for Accessing Flow Variables . . . . . . . . . . . . . . . . 5-3
5.2.2 Macros for Accessing Derivatives . . . . . . . . . . . . . . . . . . 5-6
5.2.3 Macros for Accessing Material Properties . . . . . . . . . . . . . 5-6
5.2.4 Macros for Accessing User-Defined Scalars and Memory . . . . . 5-8
5.2.5 Reynolds Stress Model Macros . . . . . . . . . . . . . . . . . . . 5-8
5.3 Face Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
5.3.1 Macros for Accessing Flow Variables . . . . . . . . . . . . . . . . 5-9
5.3.2 Macros for Accessing User-Defined Scalars and Memory . . . . . 5-10

TOC-4 c Fluent Inc. December 3, 2001



CONTENTS

5.3.3 Miscellaneous Face Variable Macros . . . . . . . . . . . . . . . . 5-10


5.4 Geometry Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11
5.4.1 Number of Nodes and Faces . . . . . . . . . . . . . . . . . . . . . 5-11
5.4.2 Cell and Face Centroids . . . . . . . . . . . . . . . . . . . . . . . 5-11
5.4.3 Face Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
5.4.4 Cell Volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
5.4.5 Cell-to-Cell and Cell-to-Face Centroid Macros . . . . . . . . . . . 5-12
5.5 Node Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15
5.6 Multiphase Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
5.7 DPM Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17
5.8 NOx Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-20

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

c Fluent Inc. December 3, 2001


TOC-5
CONTENTS

6.5.3 Phase-Level Thread Pointer Using the Phase Domain Index


(THREAD SUB THREAD) . . . . . . . . . . . . . . . . . . . . . . . . 6-14
6.5.4 Phase Thread Pointer Array Using Mixture-Level Thread
(THREAD SUB THREADS) . . . . . . . . . . . . . . . . . . . . . . . . 6-15
6.5.5 Mixture Domain Pointer Using a Phase Domain Pointer
(DOMAIN SUPER DOMAIN) . . . . . . . . . . . . . . . . . . . . . . . 6-16
6.5.6 Mixture Thread Pointer Using a Phase Thread Pointer
(THREAD SUPER THREAD) . . . . . . . . . . . . . . . . . . . . . . . 6-16
6.5.7 Thread Pointer Using a Zone ID (Lookup Thread) . . . . . . . . 6-17
6.5.8 domain id Using a Phase Domain Pointer (DOMAIN ID) . . . . . . 6-18
6.5.9 Phase Domain Index Using a Phase Domain Pointer
(PHASE DOMAIN INDEX) . . . . . . . . . . . . . . . . . . . . . . . . 6-19
6.6 Accessing Neighboring Cell and Thread Variables . . . . . . . . . . . . . 6-19
6.7 User-Defined Memory for Cells (C UDMI) . . . . . . . . . . . . . . . . . . 6-20
6.8 Vector Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21
6.8.1 NV MAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21
6.8.2 NV MAG2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21
6.8.3 ND ND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22
6.8.4 ND SUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22
6.8.5 ND SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22
6.8.6 NV V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23
6.8.7 NV VV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23
6.8.8 NV V VS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23
6.8.9 NV VS VS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23
6.8.10 ND DOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24
6.9 Macros for Time-Dependent Simulations . . . . . . . . . . . . . . . . . . 6-25
6.10 Miscellaneous Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26
6.10.1 Data Valid P . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26
6.10.2 FLUID THREAD P . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26
6.10.3 NULLP & NNULLP . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27
6.10.4 BOUNDARY FACE THREAD P(t) . . . . . . . . . . . . . . . . . . . . 6-27
6.10.5 C FACE THREAD(c,t,i) . . . . . . . . . . . . . . . . . . . . . . . 6-27

TOC-6 c Fluent Inc. December 3, 2001



CONTENTS

6.10.6 C FACE(c,t,i) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27


6.10.7 M PI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27
6.10.8 UNIVERSAL GAS CONSTANT . . . . . . . . . . . . . . . . . . . . . . 6-27
6.10.9 SQR(k) and SQRT(k) . . . . . . . . . . . . . . . . . . . . . . . . 6-27
6.10.10 Message Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-28
6.10.11 Error Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-28

7 Compiling and Linking UDFs 7-1


7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.2 Interpreted UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
7.2.1 Compiling an Interpreted UDF . . . . . . . . . . . . . . . . . . . 7-3
7.2.2 Directory Structure for Windows Parallel Networks . . . . . . . . 7-5
7.2.3 Debugging Interpreted UDFs . . . . . . . . . . . . . . . . . . . . 7-6
7.3 Compiled UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
7.3.1 General Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
7.3.2 Setting Up the Directory Structure . . . . . . . . . . . . . . . . . 7-8
7.3.3 Compiling and Building Your Shared Library . . . . . . . . . . . 7-12
7.3.4 Linking Your Shared Library to the FLUENT Executable . . . . . 7-15
7.3.5 Common Errors Made While Compiling or Linking Your Compiled
UDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16

8 Activating Your UDF in FLUENT 8-1


8.1 Activating General Solver UDFs . . . . . . . . . . . . . . . . . . . . . . 8-1
8.1.1 Adjustment of Computed Values . . . . . . . . . . . . . . . . . . 8-1
8.1.2 Solution Initialization . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.1.3 Executing a UDF On Demand . . . . . . . . . . . . . . . . . . . 8-2
8.1.4 Reading from and Writing to Case and Data Files . . . . . . . . 8-3
8.1.5 User-Defined Memory . . . . . . . . . . . . . . . . . . . . . . . . 8-3
8.2 Activating Model-Specific UDFs . . . . . . . . . . . . . . . . . . . . . . 8-4
8.2.1 Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . 8-4
8.2.2 Heat Flux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5

c Fluent Inc. December 3, 2001


TOC-7
CONTENTS

8.2.3 NOx Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5


8.2.4 Material Properties . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
8.2.5 Premixed Combustion Source Term . . . . . . . . . . . . . . . . 8-7
8.2.6 Reaction Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8
8.2.7 Source Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8
8.2.8 Time Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10
8.2.9 Turbulent Viscosity . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
8.2.10 User-Defined Scalar Flux . . . . . . . . . . . . . . . . . . . . . . 8-12
8.2.11 User-Defined Unsteady Scalar Term . . . . . . . . . . . . . . . . 8-12
8.3 Activating Multiphase UDFs . . . . . . . . . . . . . . . . . . . . . . . . 8-13
8.3.1 Cavitation Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13
8.3.2 Slip Velocity for the Mixture Model . . . . . . . . . . . . . . . . 8-13
8.3.3 Particle Diameter for the Mixture Model . . . . . . . . . . . . . 8-15
8.3.4 Drag and Lift Coefficients for the Eulerian Model . . . . . . . . . 8-17
8.4 Activating DPM UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
8.4.1 DPM Body Force . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
8.4.2 Drag Coefficient for the DPM . . . . . . . . . . . . . . . . . . . . 8-18
8.4.3 Erosion and Accretion Rates for the DPM . . . . . . . . . . . . . 8-18
8.4.4 DPM Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . 8-20
8.4.5 Custom DPM Laws . . . . . . . . . . . . . . . . . . . . . . . . . 8-21
8.4.6 DPM Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-21
8.4.7 DPM Material Properties . . . . . . . . . . . . . . . . . . . . . . 8-22
8.4.8 DPM Scalar Update . . . . . . . . . . . . . . . . . . . . . . . . . 8-22
8.4.9 DPM Source Terms . . . . . . . . . . . . . . . . . . . . . . . . . 8-23

9 User-Defined Scalar Transport Modeling 9-1


9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
9.2 Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
9.3 Defining, Solving, and Postprocessing a UDS . . . . . . . . . . . . . . . 9-2

TOC-8 c Fluent Inc. December 3, 2001



CONTENTS

10 Sample Applications 10-1


10.1 Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1
10.1.1 Parabolic Velocity Inlet Profile in a Turbine Vane . . . . . . . . 10-1
10.1.2 Transient Velocity Inlet Profile for Flow in a Tube . . . . . . . . 10-7
10.2 Source Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13
10.2.1 Adding a Momentum Source to a Duct Flow . . . . . . . . . . . 10-13
10.3 Physical Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18
10.3.1 Solidification via a Temperature-Dependent Viscosity . . . . . . 10-18
10.4 Reaction Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22
10.4.1 A Custom Volume Reaction Rate . . . . . . . . . . . . . . . . . . 10-22
10.5 User-Defined Scalars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27
10.5.1 Postprocessing Using User-Defined Scalars . . . . . . . . . . . . . 10-27
10.5.2 Implementing FLUENT’s P-1 Radiation Model . . . . . . . . . . 10-30

A DEFINE Macro Definitions A-1


A.1 General Solver DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . A-1
A.2 Model-Specific DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . A-1
A.3 Multiphase DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . . A-3
A.4 Discrete Phase Model DEFINE Macros . . . . . . . . . . . . . . . . . . . . A-3

c Fluent Inc. December 3, 2001


TOC-9
CONTENTS

TOC-10 c Fluent Inc. December 3, 2001

You might also like