在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → FLUENT UDF帮助手册.pdf

FLUENT UDF帮助手册.pdf

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:4.23M
  • 下载次数:8
  • 浏览次数:338
  • 发布时间:2021-01-08
  • 实例类别:一般编程问题
  • 发 布 人:尹珩宇
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: Fluent UDF en 助手 手册

实例介绍

【实例简介】FLUENT 6.3 UDF Manual.pdf

【实例截图】

from clipboard

【核心代码】

Contents
Preface i
1 Overview 1-1
1.1 What is a User-Defined Function (UDF)? . . . . . . . . . . . . . . . . . 1-1
1.2 Why Use UDFs? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.3 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.4 Defining Your UDF Using DEFINE Macros . . . . . . . . . . . . . . . . . 1-3
1.4.1 Including the udf.h Header File in Your Source File . . . . . . . 1-5
1.5 Interpreting and Compiling UDFs . . . . . . . . . . . . . . . . . . . . . . 1-6
1.5.1 Differences Between Interpreted and Compiled UDFs . . . . . . . 1-7
1.6 Hooking UDFs to Your FLUENT Model . . . . . . . . . . . . . . . . . . 1-8
1.7 Grid Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
1.8 Data Types in FLUENT . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10
1.9 UDF Calling Sequence in the Solution Process . . . . . . . . . . . . . . . 1-12
1.10 Special Considerations for Multiphase UDFs . . . . . . . . . . . . . . . . 1-17
1.10.1 Multiphase-specific Data Types . . . . . . . . . . . . . . . . . . . 1-17
2 DEFINE Macros 2-1
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.2 General Purpose DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . 2-2
2.2.1 DEFINE ADJUST . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.2.2 DEFINE DELTAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.2.3 DEFINE EXECUTE AT END . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.2.4 DEFINE EXECUTE AT EXIT . . . . . . . . . . . . . . . . . . . . . . 2-11
2.2.5 DEFINE EXECUTE FROM GUI . . . . . . . . . . . . . . . . . . . . . 2-12
c Fluent Inc. September 11, 2006 i
CONTENTS
2.2.6 DEFINE EXECUTE ON LOADING . . . . . . . . . . . . . . . . . . . . 2-14
2.2.7 DEFINE INIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17
2.2.8 DEFINE ON DEMAND . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19
2.2.9 DEFINE RW FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22
2.3 Model-Specific DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . 2-24
2.3.1 DEFINE CHEM STEP . . . . . . . . . . . . . . . . . . . . . . . . . . 2-29
2.3.2 DEFINE CPHI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-31
2.3.3 DEFINE DIFFUSIVITY . . . . . . . . . . . . . . . . . . . . . . . . 2-32
2.3.4 DEFINE DOM DIFFUSE REFLECTIVITY . . . . . . . . . . . . . . . . 2-34
2.3.5 DEFINE DOM SOURCE . . . . . . . . . . . . . . . . . . . . . . . . . 2-36
2.3.6 DEFINE DOM SPECULAR REFLECTIVITY . . . . . . . . . . . . . . . 2-38
2.3.7 DEFINE GRAY BAND ABS COEFF . . . . . . . . . . . . . . . . . . . . 2-40
2.3.8 DEFINE HEAT FLUX . . . . . . . . . . . . . . . . . . . . . . . . . . 2-42
2.3.9 DEFINE NET REACTION RATE . . . . . . . . . . . . . . . . . . . . . 2-44
2.3.10 DEFINE NOX RATE . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46
2.3.11 DEFINE PR RATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-50
2.3.12 DEFINE PRANDTL UDFs . . . . . . . . . . . . . . . . . . . . . . . 2-55
2.3.13 DEFINE PROFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-63
2.3.14 DEFINE PROPERTY UDFs . . . . . . . . . . . . . . . . . . . . . . . 2-76
2.3.15 DEFINE SCAT PHASE FUNC . . . . . . . . . . . . . . . . . . . . . . 2-84
2.3.16 DEFINE SOLAR INTENSITY . . . . . . . . . . . . . . . . . . . . . . 2-87
2.3.17 DEFINE SOURCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-89
2.3.18 DEFINE SOX RATE . . . . . . . . . . . . . . . . . . . . . . . . . . 2-92
2.3.19 DEFINE SR RATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-97
2.3.20 DEFINE TURB PREMIX SOURCE . . . . . . . . . . . . . . . . . . . . 2-101
2.3.21 DEFINE TURBULENT VISCOSITY . . . . . . . . . . . . . . . . . . . 2-103
2.3.22 DEFINE VR RATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-107
2.3.23 DEFINE WALL FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . 2-111
ii c Fluent Inc. September 11, 2006
CONTENTS
2.4 Multiphase DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . . 2-113
2.4.1 DEFINE CAVITATION RATE . . . . . . . . . . . . . . . . . . . . . . 2-115
2.4.2 DEFINE EXCHANGE PROPERTY . . . . . . . . . . . . . . . . . . . . 2-118
2.4.3 DEFINE HET RXN RATE . . . . . . . . . . . . . . . . . . . . . . . . 2-123
2.4.4 DEFINE MASS TRANSFER . . . . . . . . . . . . . . . . . . . . . . . 2-129
2.4.5 DEFINE VECTOR EXCHANGE PROPERTY . . . . . . . . . . . . . . . . 2-132
2.5 Discrete Phase Model (DPM) DEFINE Macros . . . . . . . . . . . . . . . 2-135
2.5.1 DEFINE DPM BC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-137
2.5.2 DEFINE DPM BODY FORCE . . . . . . . . . . . . . . . . . . . . . . . 2-145
2.5.3 DEFINE DPM DRAG . . . . . . . . . . . . . . . . . . . . . . . . . . 2-147
2.5.4 DEFINE DPM EROSION . . . . . . . . . . . . . . . . . . . . . . . . 2-149
2.5.5 DEFINE DPM HEAT MASS . . . . . . . . . . . . . . . . . . . . . . . 2-155
2.5.6 DEFINE DPM INJECTION INIT . . . . . . . . . . . . . . . . . . . . 2-158
2.5.7 DEFINE DPM LAW . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-162
2.5.8 DEFINE DPM OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . 2-164
2.5.9 DEFINE DPM PROPERTY . . . . . . . . . . . . . . . . . . . . . . . . 2-168
2.5.10 DEFINE DPM SCALAR UPDATE . . . . . . . . . . . . . . . . . . . . . 2-172
2.5.11 DEFINE DPM SOURCE . . . . . . . . . . . . . . . . . . . . . . . . . 2-176
2.5.12 DEFINE DPM SPRAY COLLIDE . . . . . . . . . . . . . . . . . . . . . 2-178
2.5.13 DEFINE DPM SWITCH . . . . . . . . . . . . . . . . . . . . . . . . . 2-181
2.5.14 DEFINE DPM TIMESTEP . . . . . . . . . . . . . . . . . . . . . . . . 2-186
2.5.15 DEFINE DPM VP EQUILIB . . . . . . . . . . . . . . . . . . . . . . . 2-189
2.6 Dynamic Mesh DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . 2-192
2.6.1 DEFINE CG MOTION . . . . . . . . . . . . . . . . . . . . . . . . . . 2-193
2.6.2 DEFINE GEOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-196
2.6.3 DEFINE GRID MOTION . . . . . . . . . . . . . . . . . . . . . . . . 2-198
2.6.4 DEFINE SDOF PROPERTIES . . . . . . . . . . . . . . . . . . . . . . 2-201
c Fluent Inc. September 11, 2006 iii
CONTENTS
2.7 User-Defined Scalar (UDS) Transport Equation DEFINE Macros . . . . . 2-205
2.7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-205
2.7.2 DEFINE ANISOTROPIC DIFFUSIVITY . . . . . . . . . . . . . . . . 2-207
2.7.3 DEFINE UDS FLUX . . . . . . . . . . . . . . . . . . . . . . . . . . 2-211
2.7.4 DEFINE UDS UNSTEADY . . . . . . . . . . . . . . . . . . . . . . . . 2-215
3 Additional Macros for Writing UDFs 3-1
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3.2 Data Access Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3.2.2 Node Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3.2.3 Cell Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
3.2.4 Face Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
3.2.5 Connectivity Macros . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
3.2.6 Special Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26
3.2.7 Model-Specific Macros . . . . . . . . . . . . . . . . . . . . . . . . 3-32
3.2.8 User-Defined Scalar (UDS) Transport Equation Macros . . . . . 3-39
3.2.9 User-Defined Memory (UDM) Macros . . . . . . . . . . . . . . . 3-42
3.3 Looping Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-51
3.3.1 Multiphase Looping Macros . . . . . . . . . . . . . . . . . . . . . 3-55
3.3.2 Advanced Multiphase Macros . . . . . . . . . . . . . . . . . . . . 3-59
3.4 Vector and Dimension Macros . . . . . . . . . . . . . . . . . . . . . . . . 3-64
3.4.1 Macros for Dealing with Two and Three Dimensions . . . . . . . 3-64
3.4.2 The ND Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64
3.4.3 The NV Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-66
3.4.4 Vector Operation Macros . . . . . . . . . . . . . . . . . . . . . . 3-67
3.5 Time-Dependent Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-69
iv c Fluent Inc. September 11, 2006
CONTENTS
3.6 Scheme Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-71
3.6.1 Defining a Scheme Variable in the Text Interface . . . . . . . . . 3-71
3.6.2 Accessing a Scheme Variable in the Text Interface . . . . . . . . 3-72
3.6.3 Changing a Scheme Variable to Another Value in the Text Interface 3-72
3.6.4 Accessing a Scheme Variable in a UDF . . . . . . . . . . . . . . 3-72
3.7 Input/Output Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-73
3.8 Miscellaneous Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-74
4 Interpreting UDFs 4-1
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
4.1.1 Location of the udf.h File . . . . . . . . . . . . . . . . . . . . . 4-2
4.1.2 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
4.2 Interpreting a UDF Source File Using the Interpreted UDFs Panel . . . . 4-3
4.3 Common Errors Made While Interpreting A Source File . . . . . . . . . 4-5
4.4 Special Considerations for Parallel FLUENT . . . . . . . . . . . . . . . . 4-7
5 Compiling UDFs 5-1
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
5.1.1 Location of the udf.h File . . . . . . . . . . . . . . . . . . . . . 5-3
5.1.2 Compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
5.2 Compile a UDF Using the GUI . . . . . . . . . . . . . . . . . . . . . . . 5-4
5.3 Compile a UDF Using the TUI . . . . . . . . . . . . . . . . . . . . . . . 5-11
5.3.1 Set Up the Directory Structure . . . . . . . . . . . . . . . . . . . 5-11
5.3.2 Build the UDF Library . . . . . . . . . . . . . . . . . . . . . . . 5-14
5.3.3 Load the UDF Library . . . . . . . . . . . . . . . . . . . . . . . 5-19
5.4 Link Precompiled Object Files From Non-FLUENT Sources . . . . . . . . 5-19
5.4.1 Example - Link Precompiled Objects to FLUENT . . . . . . . . . 5-19
5.5 Load and Unload Libraries Using the UDF Library Manager Panel . . . . 5-25
5.6 Common Errors When Building and Loading a UDF Library . . . . . . . 5-27
5.7 Special Considerations for Parallel FLUENT . . . . . . . . . . . . . . . . 5-28
c Fluent Inc. September 11, 2006 v
CONTENTS
6 Hooking UDFs to FLUENT 6-1
6.1 Hooking General Purpose UDFs . . . . . . . . . . . . . . . . . . . . . . 6-1
6.1.1 Hooking DEFINE ADJUST UDFs . . . . . . . . . . . . . . . . . . . 6-2
6.1.2 Hooking DEFINE DELTAT UDFs . . . . . . . . . . . . . . . . . . . 6-4
6.1.3 Hooking DEFINE EXECUTE AT END UDFs . . . . . . . . . . . . . . 6-6
6.1.4 Hooking DEFINE EXECUTE AT EXIT UDFs . . . . . . . . . . . . . 6-8
6.1.5 Hooking DEFINE INIT UDFs . . . . . . . . . . . . . . . . . . . . 6-10
6.1.6 Hooking DEFINE ON DEMAND UDFs . . . . . . . . . . . . . . . . . 6-12
6.1.7 Hooking DEFINE RW FILE UDFs . . . . . . . . . . . . . . . . . . 6-13
6.1.8 User-Defined Memory Storage . . . . . . . . . . . . . . . . . . . 6-15
6.2 Hooking Model-Specific UDFs . . . . . . . . . . . . . . . . . . . . . . . . 6-15
6.2.1 Hooking DEFINE CHEM STEP UDFs . . . . . . . . . . . . . . . . . 6-16
6.2.2 Hooking DEFINE CPHI UDFs . . . . . . . . . . . . . . . . . . . . 6-17
6.2.3 Hooking DEFINE DIFFUSIVITY UDFs . . . . . . . . . . . . . . . . 6-18
6.2.4 Hooking DEFINE DOM DIFFUSE REFLECTIVITY UDFs . . . . . . . 6-20
6.2.5 Hooking DEFINE DOM SOURCE UDFs . . . . . . . . . . . . . . . . 6-21
6.2.6 Hooking DEFINE DOM SPECULAR REFLECTIVITY UDFs . . . . . . . 6-22
6.2.7 Hooking DEFINE GRAY BAND ABS COEFF UDFs . . . . . . . . . . . 6-23
6.2.8 Hooking DEFINE HEAT FLUX UDFs . . . . . . . . . . . . . . . . . 6-24
6.2.9 Hooking DEFINE NET REACTION RATE UDFs . . . . . . . . . . . . 6-25
6.2.10 Hooking DEFINE NOX RATE UDFs . . . . . . . . . . . . . . . . . . 6-27
6.2.11 Hooking DEFINE PR RATE UDFs . . . . . . . . . . . . . . . . . . 6-29
6.2.12 Hooking DEFINE PRANDTL UDFs . . . . . . . . . . . . . . . . . . 6-30
6.2.13 Hooking DEFINE PROFILE UDFs . . . . . . . . . . . . . . . . . . 6-31
6.2.14 Hooking DEFINE PROPERTY UDFs . . . . . . . . . . . . . . . . . . 6-36
6.2.15 Hooking DEFINE SCAT PHASE FUNC UDFs . . . . . . . . . . . . . 6-38
6.2.16 Hooking DEFINE SOLAR INTENSITY UDFs . . . . . . . . . . . . . 6-40
6.2.17 Hooking DEFINE SOURCE UDFs . . . . . . . . . . . . . . . . . . . 6-42
6.2.18 Hooking DEFINE SOX RATE UDFs . . . . . . . . . . . . . . . . . . 6-44
vi c Fluent Inc. September 11, 2006
CONTENTS
6.2.19 Hooking DEFINE SR RATE UDFs . . . . . . . . . . . . . . . . . . 6-46
6.2.20 Hooking DEFINE TURB PREMIX SOURCE UDFs . . . . . . . . . . . 6-47
6.2.21 Hooking DEFINE TURBULENT VISCOSITY UDFs . . . . . . . . . . 6-48
6.2.22 Hooking DEFINE VR RATE UDFs . . . . . . . . . . . . . . . . . . 6-49
6.2.23 Hooking DEFINE WALL FUNCTIONS UDFs . . . . . . . . . . . . . . 6-50
6.3 Hooking Multiphase UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . 6-51
6.3.1 Hooking DEFINE CAVITATION RATE UDFs . . . . . . . . . . . . . 6-51
6.3.2 Hooking DEFINE EXCHANGE PROPERTY UDFs . . . . . . . . . . . . 6-53
6.3.3 Hooking DEFINE HET RXN RATE UDFs . . . . . . . . . . . . . . . 6-55
6.3.4 Hooking DEFINE MASS TRANSFER UDFs . . . . . . . . . . . . . . 6-56
6.3.5 Hooking DEFINE VECTOR EXCHANGE PROPERTY UDFs . . . . . . . 6-57
6.4 Hooking Discrete Phase Model (DPM) UDFs . . . . . . . . . . . . . . . 6-59
6.4.1 Hooking DEFINE DPM BC UDFs . . . . . . . . . . . . . . . . . . . 6-59
6.4.2 Hooking DEFINE DPM BODY FORCE UDFs . . . . . . . . . . . . . . 6-61
6.4.3 Hooking DEFINE DPM DRAG UDFs . . . . . . . . . . . . . . . . . . 6-62
6.4.4 Hooking DEFINE DPM EROSION UDFs . . . . . . . . . . . . . . . . 6-63
6.4.5 Hooking DEFINE DPM HEAT MASS UDFs . . . . . . . . . . . . . . . 6-64
6.4.6 Hooking DEFINE DPM INJECTION INIT UDFs . . . . . . . . . . . 6-66
6.4.7 Hooking DEFINE DPM LAW UDFs . . . . . . . . . . . . . . . . . . 6-68
6.4.8 Hooking DEFINE DPM OUTPUT UDFs . . . . . . . . . . . . . . . . 6-69
6.4.9 Hooking DEFINE DPM PROPERTY UDFs . . . . . . . . . . . . . . . 6-70
6.4.10 Hooking DEFINE DPM SCALAR UPDATE UDFs . . . . . . . . . . . . 6-72
6.4.11 Hooking DEFINE DPM SOURCE UDFs . . . . . . . . . . . . . . . . 6-73
6.4.12 Hooking DEFINE DPM SPRAY COLLIDE UDFs . . . . . . . . . . . . 6-74
6.4.13 Hooking DEFINE DPM SWITCH UDFs . . . . . . . . . . . . . . . . 6-76
6.4.14 Hooking DEFINE DPM TIMESTEP UDFs . . . . . . . . . . . . . . . 6-77
6.4.15 Hooking DEFINE DPM VP EQUILIB UDFs . . . . . . . . . . . . . . 6-78
c Fluent Inc. September 11, 2006 vii
CONTENTS
6.5 Hooking Dynamic Mesh UDFs . . . . . . . . . . . . . . . . . . . . . . . 6-79
6.5.1 Hooking DEFINE CG MOTION UDFs . . . . . . . . . . . . . . . . . 6-79
6.5.2 Hooking DEFINE GEOM UDFs . . . . . . . . . . . . . . . . . . . . 6-81
6.5.3 Hooking DEFINE GRID MOTION UDFs . . . . . . . . . . . . . . . . 6-83
6.5.4 Hooking DEFINE SDOF PROPERTIES UDFs . . . . . . . . . . . . . 6-85
6.6 Hooking User-Defined Scalar (UDS) Transport Equation UDFs . . . . . 6-87
6.6.1 Hooking DEFINE ANISOTROPIC DIFFUSIVITY UDFs . . . . . . . . 6-87
6.6.2 Hooking DEFINE UDS FLUX UDFs . . . . . . . . . . . . . . . . . . 6-90
6.6.3 Hooking DEFINE UDS UNSTEADY UDFs . . . . . . . . . . . . . . . 6-91
6.7 Common Errors While Hooking a UDF to FLUENT . . . . . . . . . . . . 6-92
7 Parallel Considerations 7-1
7.1 Overview of Parallel FLUENT . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.1.1 Command Transfer and Communication . . . . . . . . . . . . . . 7-4
7.2 Cells and Faces in a Partitioned Grid . . . . . . . . . . . . . . . . . . . . 7-7
7.3 Parallelizing Your Serial UDF . . . . . . . . . . . . . . . . . . . . . . . . 7-11
7.4 Parallelization of Discrete Phase Model (DPM) UDFs . . . . . . . . . . 7-12
7.5 Macros for Parallel UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13
7.5.1 Compiler Directives . . . . . . . . . . . . . . . . . . . . . . . . . 7-13
7.5.2 Communicating Between the Host and Node Processes . . . . . . 7-16
7.5.3 Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
7.5.4 Global Reduction Macros . . . . . . . . . . . . . . . . . . . . . . 7-19
7.5.5 Looping Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-23
7.5.6 Cell and Face Partition ID Macros . . . . . . . . . . . . . . . . . 7-30
7.5.7 Message Displaying Macros . . . . . . . . . . . . . . . . . . . . . 7-31
7.5.8 Message Passing Macros . . . . . . . . . . . . . . . . . . . . . . . 7-32
7.5.9 Macros for Exchanging Data Between Compute Nodes . . . . . . 7-36
7.6 Limitations of Parallel UDFs . . . . . . . . . . . . . . . . . . . . . . . . 7-37
7.7 Process Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-39
viii c Fluent Inc. September 11, 2006
CONTENTS
7.8 Parallel UDF Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-41
7.9 Writing Files in Parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-44
8 Examples 8-1
8.1 Step-By-Step UDF Example . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.1.1 Process Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.1.2 Step 1: Define Your Problem . . . . . . . . . . . . . . . . . . . . 8-3
8.1.3 Step 2: Create a C Source File . . . . . . . . . . . . . . . . . . . 8-5
8.1.4 Step 3: Start FLUENT and Read (or Set Up) the Case File . . . 8-6
8.1.5 Step 4: Interpret or Compile the Source File . . . . . . . . . . . 8-6
8.1.6 Step 5: Hook the UDF to FLUENT . . . . . . . . . . . . . . . . . 8-13
8.1.7 Step 6: Run the Calculation . . . . . . . . . . . . . . . . . . . . 8-14
8.1.8 Step 7: Analyze the Numerical Solution and Compare
to Expected Results . . . . . . . . . . . . . . . . . . . . . . . . . 8-14
8.2 Detailed UDF Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15
8.2.1 Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . 8-15
8.2.2 Source Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-26
8.2.3 Physical Properties . . . . . . . . . . . . . . . . . . . . . . . . . 8-33
8.2.4 Reaction Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-38
8.2.5 User-Defined Scalars . . . . . . . . . . . . . . . . . . . . . . . . . 8-44
A C Programming Basics A-1
A.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
A.2 Commenting Your C Code . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
A.3 C Data Types in FLUENT . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
A.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
A.5 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
A.5.1 Declaring Variables . . . . . . . . . . . . . . . . . . . . . . . . . A-4
A.5.2 External Variables . . . . . . . . . . . . . . . . . . . . . . . . . . A-5
A.5.3 Static Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7
c Fluent Inc. September 11, 2006 ix
CONTENTS
A.6 User-Defined Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
A.7 Casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
A.8 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
A.9 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-9
A.10 Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-9
A.11 Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-11
A.11.1 if Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-11
A.11.2 if-else Statement . . . . . . . . . . . . . . . . . . . . . . . . . A-11
A.11.3 for Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-12
A.12 Common C Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-13
A.12.1 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . A-13
A.12.2 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . A-13
A.13 C Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-14
A.13.1 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . A-14
A.13.2 Miscellaneous Mathematical Functions . . . . . . . . . . . . . . . A-14
A.13.3 Standard I/O Functions . . . . . . . . . . . . . . . . . . . . . . . A-15
A.14 Preprocessor Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . A-18
A.15 Comparison with FORTRAN . . . . . . . . . . . . . . . . . . . . . . . . A-19
B DEFINE Macro Definitions B-1
B.1 General Solver DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . B-1
B.2 Model-Specific DEFINE Macro Definitions . . . . . . . . . . . . . . . . . . B-2
B.3 Multiphase DEFINE Macros . . . . . . . . . . . . . . . . . . . . . . . . . B-4
B.4 Dynamic Mesh Model DEFINE Macros . . . . . . . . . . . . . . . . . . . B-6
B.5 Discrete Phase Model DEFINE Macros . . . . . . . . . . . . . . . . . . . . B-7
B.6 User-Defined Scalar (UDS) DEFINE Macros . . . . . . . . . . . . . . . . . B-8
x c Fluent Inc. September 11, 2006
CONTENTS
C Quick Reference Guide for Multiphase DEFINE Macros C-1
C.1 VOF Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
C.2 Mixture Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4
C.3 Eulerian Model - Laminar Flow . . . . . . . . . . . . . . . . . . . . . . . C-7
C.4 Eulerian Model - Mixture Turbulence Flow . . . . . . . . . . . . . . . . C-11
C.5 Eulerian Model - Dispersed Turbulence Flow . . . . . . . . . . . . . . . . C-14
C.6 Eulerian Model - Per Phase Turbulence Flow . . . . . . . . . . . . . . . C-18

标签: Fluent UDF en 助手 手册

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警