logo资料库

ANSYS FLUENT UDF 2020R1下载.pdf

第1页 / 共752页
第2页 / 共752页
第3页 / 共752页
第4页 / 共752页
第5页 / 共752页
第6页 / 共752页
第7页 / 共752页
第8页 / 共752页
资料共752页,剩余部分请下载后查看
ANSYS Fluent Customization Manual
Table of Contents
Using This Manual
1. The Contents of This Manual
2. Typographical Conventions
3. Mathematical Conventions
Part 1: Creating and Using User Defined Functions
Chapter 1: Overview of User-Defined Functions (UDFs)
1.1. What is a User-Defined Function?
1.2. Limitations
1.3. Defining Your UDF Using DEFINE Macros
1.3.1. Including the udf.h Header File in Your Source File
1.4. Interpreting and Compiling UDFs
1.4.1. Compiled UDFs
1.4.2. Interpreted UDFs
1.4.3. Differences Between Interpreted and Compiled UDFs
1.5. Hooking UDFs to Your ANSYS Fluent Model
1.6. Mesh Terminology
1.7. Data Types in ANSYS Fluent
1.8. UDF Calling Sequence in the Solution Process
1.8.1. Pressure-Based Segregated Solver
1.8.2. Pressure-Based Coupled Solver
1.8.3. Density-Based Solver
1.9. Special Considerations for Multiphase UDFs
1.9.1. Multiphase-specific Data Types
Chapter 2: DEFINE Macros
2.1. Introduction
2.2. General Purpose DEFINE Macros
2.2.1. DEFINE_ADJUST
2.2.1.1. Description
2.2.1.2. Usage
2.2.1.3. Example 1
2.2.1.4. Example 2
2.2.1.5. Hooking an Adjust UDF to ANSYS Fluent
2.2.2. DEFINE_DELTAT
2.2.2.1. Description
2.2.2.2. Usage
2.2.2.3. Example
2.2.2.4. Hooking an Adaptive Time Step UDF to ANSYS Fluent
2.2.3. DEFINE_EXECUTE_AT_END
2.2.3.1. Description
2.2.3.2. Usage
2.2.3.3. Example
2.2.3.4. Hooking an Execute-at-End UDF to ANSYS Fluent
2.2.4. DEFINE_EXECUTE_AT_EXIT
2.2.4.1. Description
2.2.4.2. Usage
2.2.4.3. Hooking an Execute-at-Exit UDF to ANSYS Fluent
2.2.5. DEFINE_EXECUTE_FROM_GUI
2.2.5.1. Description
2.2.5.2. Usage
2.2.5.3. Example
2.2.5.4. Hooking an Execute From GUI UDF to ANSYS Fluent
2.2.6. DEFINE_EXECUTE_ON_LOADING
2.2.6.1. Description
2.2.6.2. Usage
2.2.6.3. Example 1
2.2.6.4. Example 2
2.2.6.5. Hooking an Execute On Loading UDF to ANSYS Fluent
2.2.7. DEFINE_EXECUTE_AFTER_CASE/DATA
2.2.7.1. Description
2.2.7.2. Usage
2.2.7.3. Example
2.2.7.4. Hooking an Execute After Reading Case and Data File UDF to ANSYS Fluent
2.2.8. DEFINE_INIT
2.2.8.1. Description
2.2.8.2. Usage
2.2.8.3. Example
2.2.8.4. Hooking an Initialization UDF to ANSYS Fluent
2.2.9. DEFINE_ON_DEMAND
2.2.9.1. Description
2.2.9.2. Usage
2.2.9.3. Example
2.2.9.4. Hooking an On-Demand UDF to ANSYS Fluent
2.2.10. DEFINE_REPORT_DEFINITION_FN
2.2.10.1. Description
2.2.10.2. Usage
2.2.10.3. Example
2.2.10.4. Hooking a User Defined Report Definition to ANSYS Fluent
2.2.11. DEFINE_RW_FILE
2.2.11.1. Description
2.2.11.2. Usage
2.2.11.3. Example
2.2.11.4. Hooking a Read/Write Case or Data File UDF to ANSYS Fluent
2.2.12. DEFINE_RW_HDF_FILE
2.2.12.1. Description
2.2.12.2. Usage
2.2.12.3. Helper Functions
2.2.12.4. Examples
2.2.12.5. Hooking a Read/Write CFF Case or Data File UDF to ANSYS Fluent
2.3. Model-Specific DEFINE Macros
2.3.1. DEFINE_ANISOTROPIC_CONDUCTIVITY
2.3.1.1. Description
2.3.1.2. Usage
2.3.1.3. Example
2.3.1.4. Hooking an Anisotropic Conductivity UDF to ANSYS Fluent
2.3.2. DEFINE_CHEM_STEP
2.3.2.1. Description
2.3.2.2. Usage
2.3.2.3. Example
2.3.2.4. Hooking a Chemistry Step UDF to ANSYS Fluent
2.3.3. DEFINE_CPHI
2.3.3.1. Description
2.3.3.2. Usage
2.3.3.3. Hooking a Mixing Constant UDF to ANSYS Fluent
2.3.4. DEFINE_CURVATURE_CORRECTION_CCURV
2.3.4.1. Description
2.3.4.2. Usage
2.3.4.3. Example
2.3.4.4. Hooking a UDF for Curvature Correction Coefficient to ANSYS Fluent
2.3.5. DEFINE_DIFFUSIVITY
2.3.5.1. Description
2.3.5.2. Usage
2.3.5.3. Example
2.3.5.4. Hooking a Diffusivity UDF to ANSYS Fluent
2.3.6. DEFINE_DOM_DIFFUSE_REFLECTIVITY
2.3.6.1. Description
2.3.6.2. Usage
2.3.6.3. Example
2.3.6.4. Hooking a Discrete Ordinates Model (DOM) Diffuse Reflectivity UDF to ANSYS Fluent
2.3.7. DEFINE_DOM_SOURCE
2.3.7.1. Description
2.3.7.2. Usage
2.3.7.3. Example
2.3.7.4. Hooking a DOM Source UDF to ANSYS Fluent
2.3.8. DEFINE_DOM_SPECULAR_REFLECTIVITY
2.3.8.1. Description
2.3.8.2. Usage
2.3.8.3. Example
2.3.8.4. Hooking a Discrete Ordinates Model (DOM) Specular Reflectivity UDF to ANSYS Fluent
2.3.9. DEFINE_ECFM_SOURCE
2.3.9.1. Description
2.3.9.2. Usage
2.3.9.3. Example
2.3.9.4. Hooking an ECFM Flame Density Area Source UDF to ANSYS Fluent
2.3.10. DEFINE_ECFM_SPARK_SOURCE
2.3.10.1. Description
2.3.10.2. Usage
2.3.10.3. Example
2.3.10.4. Hooking an ECFM Spark Source UDF to ANSYS Fluent
2.3.11. DEFINE_EC_KINETICS_PARAMETER
2.3.11.1. Description
2.3.11.2. Usage
2.3.11.3. Example - Electrochemical Reaction Kinetics Parameter Using UDF
2.3.11.4. Hooking an Electrochemical Reaction Kinetics Parameter UDF to ANSYS Fluent
2.3.12. DEFINE_EC_RATE
2.3.12.1. Description
2.3.12.2. Usage
2.3.12.3. Example - Electrochemical Reaction Rate Using UDF
2.3.12.4. Hooking an Electrochemical Reaction Rate UDF to ANSYS Fluent
2.3.13. DEFINE_EDC_MDOT
2.3.13.1. Description
2.3.13.2. Usage
2.3.13.3. Example
2.3.13.4. Hooking a DEFINE_EDC_MDOT UDF to ANSYS Fluent
2.3.14. DEFINE_EDC_SCALES
2.3.14.1. Description
2.3.14.2. Usage
2.3.14.3. Example
2.3.14.4. Hooking a DEFINE_EDC_SCALES UDF to ANSYS Fluent
2.3.15. DEFINE_EMISSIVITY_WEIGHTING_FACTOR
2.3.15.1. Description
2.3.15.2. Usage
2.3.15.3. Example
2.3.15.4. Hooking an Emissivity Weighting Factor UDF to ANSYS Fluent
2.3.16. DEFINE_FLAMELET_PARAMETERS
2.3.16.1. Description
2.3.16.2. Usage
2.3.16.3. Example
2.3.16.4. Hooking a Flamelet Parameters UDF to ANSYS Fluent
2.3.17. DEFINE_ZONE_MOTION
2.3.17.1. Description
2.3.17.2. Usage
2.3.17.3. Example
2.3.17.4. Hooking a Frame Motion UDF to ANSYS Fluent
2.3.18. DEFINE_GRAY_BAND_ABS_COEFF
2.3.18.1. Description
2.3.18.2. Usage
2.3.18.3. Example
2.3.18.4. Hooking a Gray Band Coefficient UDF to ANSYS Fluent
2.3.19. DEFINE_HEAT_FLUX
2.3.19.1. Description
2.3.19.2. Usage
2.3.19.3. Example
2.3.19.4. Hooking a Heat Flux UDF to ANSYS Fluent
2.3.20. DEFINE_IGNITE_SOURCE
2.3.20.1. Description
2.3.20.2. Usage
2.3.20.3. Example
2.3.20.4. Hooking an Ignition Source UDF to ANSYS Fluent
2.3.21. DEFINE_KW_GEKO Coefficients and Blending Function
2.3.21.1. Description
2.3.21.2. Usage
2.3.21.3. Example
2.3.21.4. Hooking a UDF for GEKO Coefficients or Blending Function to ANSYS Fluent
2.3.22. DEFINE_MASS_TR_PROPERTY
2.3.22.1. Description
2.3.22.2. Usage
2.3.22.3. Example
2.3.22.4. Hooking a DEFINE_MASS_TR_PROPERTY UDF to ANSYS Fluent
2.3.23. DEFINE_NET_REACTION_RATE
2.3.23.1. Description
2.3.23.2. Usage
2.3.23.3. Example
2.3.23.4. Hooking a Net Reaction Rate UDF to ANSYS Fluent
2.3.24. DEFINE_NOX_RATE
2.3.24.1. Description
2.3.24.2. Usage
2.3.24.3. Example 1
2.3.24.4. Example 2
2.3.24.5. Hooking a NOx Rate UDF to ANSYS Fluent
2.3.25. DEFINE_PDF_TABLE
2.3.25.1. Description
2.3.25.2. Usage
2.3.25.3. Example
2.3.25.4. Hooking a DEFINE_PDF_TABLE UDF to ANSYS Fluent
2.3.26. DEFINE_PR_RATE
2.3.26.1. Description
2.3.26.2. Usage
2.3.26.3. Auxiliary function
2.3.26.4. Example 1
2.3.26.5. Example 2
2.3.26.6. Hooking a Particle Reaction Rate UDF to ANSYS Fluent
2.3.27. DEFINE_PRANDTL UDFs
2.3.27.1. DEFINE_PRANDTL_D
2.3.27.2. Description
2.3.27.3. Usage
2.3.27.4. Example
2.3.27.5. Hooking a Prandtl Number UDF to ANSYS Fluent
2.3.27.6. DEFINE_PRANDTL_K
2.3.27.7. Description
2.3.27.8. Usage
2.3.27.9. Example
2.3.27.10. Hooking a Prandtl Number UDF to ANSYS Fluent
2.3.27.11. DEFINE_PRANDTL_O
2.3.27.12. Description
2.3.27.13. Usage
2.3.27.14. Example
2.3.27.15. Hooking a Prandtl Number UDF to ANSYS Fluent
2.3.27.16. DEFINE_PRANDTL_T
2.3.27.17. Description
2.3.27.18. Usage
2.3.27.19. Example
2.3.27.20. Hooking a Prandtl Number UDF to ANSYS Fluent
2.3.27.21. DEFINE_PRANDTL_T_WALL
2.3.27.22. Description
2.3.27.23. Usage
2.3.27.24. Example
2.3.27.25. Hooking a Prandtl Number UDF to ANSYS Fluent
2.3.28. DEFINE_PROFILE
2.3.28.1. Description
2.3.28.2. Usage
2.3.28.3. Example 1 - Pressure Profile
2.3.28.4. Example 2 - Velocity, Turbulent Kinetic Energy, and Turbulent Dissipation Rate Profiles
2.3.28.5. Example 3 - Fixed Velocity UDF
2.3.28.6. Example 4 - Wall Heat Generation Rate Profile
2.3.28.7. Example 5 - Beam Direction Profile at Semi-Transparent Walls
2.3.28.8. Example 6 - Viscous Resistance Profile in a Porous Zone
2.3.28.9. Example 7 - Porous Resistance Direction Vector
2.3.28.10. Example 8 -Target Mass Flow Rate UDF as a Function of Physical Flow Time
2.3.28.11. Example 9 - Mass Flow Rate UDF for a Mass-Flow Inlet or Mass-Flow Outlet
2.3.28.12. Hooking a Boundary Profile UDF to ANSYS Fluent
2.3.29. DEFINE_PROPERTY UDFs
2.3.29.1. Description
2.3.29.2. Usage
2.3.29.3. Auxiliary Utilities
2.3.29.4. Example 1 - Temperature-dependent Viscosity Property
2.3.29.5. Example 2 - User-defined Mixing Law for Thermal Conductivity
2.3.29.6. Example 3 - Surface Tension Coefficient UDF
2.3.29.7. Example 4 - Density Function for Compressible Liquids
2.3.29.8. Hooking a Property UDF to ANSYS Fluent
2.3.30. DEFINE_REACTING_CHANNEL_BC
2.3.30.1. Description
2.3.30.2. Usage
2.3.30.3. Example
2.3.30.4. Hooking a Reacting Channel Solver UDF to ANSYS Fluent
2.3.31. DEFINE_REACTING_CHANNEL_SOLVER
2.3.31.1. Description
2.3.31.2. Usage
2.3.31.3. Example
2.3.31.4. Hooking a Reacting Channel Solver UDF to ANSYS Fluent
2.3.32. DEFINE_RELAX_TO_EQUILIBRIUM
2.3.32.1. Description
2.3.32.2. Usage
2.3.32.3. Example
2.3.32.4. Hooking a DEFINE_RELAX_TO_EQUILIBRIUM UDF to ANSYS Fluent
2.3.33. DEFINE_SBES_BF
2.3.33.1. Description
2.3.33.2. Usage
2.3.33.3. Example
2.3.33.4. Hooking an SBES Blending Function UDF to ANSYS Fluent
2.3.34. DEFINE_SCAT_PHASE_FUNC
2.3.34.1. Description
2.3.34.2. Usage
2.3.34.3. Example
2.3.34.4. Hooking a Scattering Phase UDF to ANSYS Fluent
2.3.35. DEFINE_SOLAR_INTENSITY
2.3.35.1. Description
2.3.35.2. Usage
2.3.35.3. Example
2.3.35.4. Hooking a Solar Intensity UDF to ANSYS Fluent
2.3.36. DEFINE_SOLIDIFICATION_PARAMS
2.3.36.1. Description
2.3.36.2. Usage
2.3.36.3. Example
2.3.36.4. Hooking a Solidification Parameter UDF in ANSYS Fluent
2.3.37. DEFINE_SOOT_MASS_RATES
2.3.37.1. Description
2.3.37.2. Usage
2.3.37.3. Example: Soot Mass Rate
2.3.37.4. Hooking a Soot Mass Rate UDF to ANSYS Fluent
2.3.38. DEFINE_SOOT_NUCLEATION_RATES
2.3.38.1. Description
2.3.38.2. Usage
2.3.38.3. Example: Soot Nucleation and Coagulation Rates
2.3.38.4. Hooking a Nucleation and Coagulation Rates UDF to ANSYS Fluent
2.3.39. DEFINE_SOOT_OXIDATION_RATE
2.3.39.1. Description
2.3.39.2. Usage
2.3.39.3. Example: Soot Oxidation Rate
2.3.39.4. Hooking a Soot Oxidation Rate UDF to ANSYS Fluent
2.3.40. DEFINE_SOOT_PRECURSOR
2.3.40.1. Description
2.3.40.1.1. Usage
2.3.40.1.2. Example: Soot Precursor
2.3.40.1.3. Hooking a SOOT_PRECURSOR UDF to ANSYS Fluent
2.3.41. DEFINE_SOURCE
2.3.41.1. Description
2.3.41.2. Usage
2.3.41.3. Example 1 - Source Term Addition
2.3.41.4. Example 2 - Degassing Boundary Condition
2.3.41.5. Hooking a Source UDF to ANSYS Fluent
2.3.42. DEFINE_SOX_RATE
2.3.42.1. Description
2.3.42.2. Usage
2.3.42.3. Example 1
2.3.42.4. Example 2
2.3.42.5. Hooking a SOx Rate UDF to ANSYS Fluent
2.3.43. DEFINE_SPARK_GEOM (R14.5 spark model)
2.3.43.1. Description
2.3.43.2. Usage
2.3.43.3. Example
2.3.43.4. Hooking a Spark Geometry UDF to ANSYS Fluent
2.3.44. DEFINE_SPECIFIC_HEAT
2.3.44.1. Description
2.3.44.2. Usage
2.3.44.3. Example
2.3.44.4. Hooking a Specific Heat UDF to ANSYS Fluent
2.3.45. DEFINE_SR_RATE
2.3.45.1. Description
2.3.45.2. Usage
2.3.45.3. Example 1 - Surface Reaction Rate Using Species Mass Fractions
2.3.45.4. Example 2 - Surface Reaction Rate Using Site Species
2.3.45.5. Hooking a Surface Reaction Rate UDF to ANSYS Fluent
2.3.46. DEFINE_THICKENED_FLAME_MODEL
2.3.46.1. Description
2.3.46.2. Usage
2.3.46.3. Example - Thickened Flame Model
2.3.46.4. Hooking a Thickened Flame Model UDF to ANSYS Fluent
2.3.47. DEFINE_TRANS UDFs
2.3.47.1. DEFINE_TRANS_FLENGTH
2.3.47.2. Description
2.3.47.3. Usage
2.3.47.4. Example
2.3.47.5. Hooking a Transition Correlation UDF to ANSYS Fluent
2.3.47.6. DEFINE_TRANS_GEOMRGH
2.3.47.7. Description
2.3.47.8. Usage
2.3.47.9. Example
2.3.47.10. Hooking a Transition Correlation UDF to ANSYS Fluent
2.3.47.11. DEFINE_TRANS_RETHETA_C
2.3.47.12. Description
2.3.47.13. Usage
2.3.47.14. Example
2.3.47.15. Hooking a Transition Correlation UDF to ANSYS Fluent
2.3.47.16. DEFINE_TRANS_RETHETA_T
2.3.47.17. Description
2.3.47.18. Usage
2.3.47.19. Example
2.3.47.20. Hooking a Transition Correlation UDF to ANSYS Fluent
2.3.48. DEFINE_TRANSIENT_PROFILE
2.3.48.1. Description
2.3.48.2. Usage
2.3.48.3. Example
2.3.48.4. Hooking a Transient Profile UDF to ANSYS Fluent
2.3.49. DEFINE_TURB_PREMIX_SOURCE
2.3.49.1. Description
2.3.49.2. Usage
2.3.49.3. Example
2.3.49.4. Hooking a Turbulent Premixed Source UDF to ANSYS Fluent
2.3.50. DEFINE_TURB_SCHMIDT UDF
2.3.50.1. Description
2.3.50.2. Usage
2.3.50.3. Example
2.3.50.4. Hooking a Turbulent Schmidt Number UDF to ANSYS Fluent
2.3.51. DEFINE_TURBULENT_VISCOSITY
2.3.51.1. Description
2.3.51.2. Usage
2.3.51.3. Example 1 - Single Phase Turbulent Viscosity UDF
2.3.51.4. Example 2 - Multiphase Turbulent Viscosity UDF
2.3.51.5. Hooking a Turbulent Viscosity UDF to ANSYS Fluent
2.3.52. DEFINE_VR_RATE
2.3.52.1. Description
2.3.52.2. Usage
2.3.52.3. Example 1
2.3.52.4. Example 2
2.3.52.5. Hooking a Volumetric Reaction Rate UDF to ANSYS Fluent
2.3.53. DEFINE_WALL_FUNCTIONS
2.3.53.1. Description
2.3.53.2. Usage
2.3.53.3. Example
2.3.53.4. Hooking a Wall Function UDF to ANSYS Fluent
2.3.54. DEFINE_WALL_NODAL_DISP
2.3.54.1. Description
2.3.54.2. Usage
2.3.54.3. Example
2.3.54.4. Hooking a Wall Nodal Displacement UDF to ANSYS Fluent
2.3.55. DEFINE_WALL_NODAL_FORCE
2.3.55.1. Description
2.3.55.2. Usage
2.3.55.3. Example
2.3.55.4. Hooking a Wall Nodal Force UDF to ANSYS Fluent
2.3.56. DEFINE_WSGGM_ABS_COEFF
2.3.56.1. Description
2.3.56.2. Usage
2.3.56.3. Example
2.3.56.4. Hooking a Wall Function UDF to ANSYS Fluent
2.4. Multiphase DEFINE Macros
2.4.1. DEFINE_BOILING_PROPERTY
2.4.1.1. Description
2.4.1.2. Usage
2.4.1.3. Example
2.4.1.4. Hooking a Boiling Property UDF to ANSYS Fluent
2.4.2. DEFINE_CAVITATION_RATE
2.4.2.1. Description
2.4.2.2. Usage
2.4.2.3. Example
2.4.2.4. Hooking a Cavitation Rate UDF to ANSYS Fluent
2.4.3. DEFINE_EXCHANGE_PROPERTY
2.4.3.1. Description
2.4.3.2. Usage
2.4.3.3. Example 1 - Custom Drag Law
2.4.3.4. Example 2 - Custom Lift Law
2.4.3.5. Example 3- Heat Transfer
2.4.3.6. Example 4- Custom Interfacial Area
2.4.3.7. Hooking an Exchange Property UDF to ANSYS Fluent
2.4.4. DEFINE_HET_RXN_RATE
2.4.4.1. Description
2.4.4.2. Usage
2.4.4.3. Example
2.4.4.4. Hooking a Heterogeneous Reaction Rate UDF to ANSYS Fluent
2.4.5. DEFINE_LINEARIZED_MASS_TRANSFER
2.4.5.1. Description
2.4.5.2. Usage
2.4.5.3. Example
2.4.5.4. Hooking a Linearized Mass Transfer UDF to ANSYS Fluent
2.4.6. DEFINE_MASS_TRANSFER
2.4.6.1. Description
2.4.6.2. Usage
2.4.6.3. Example
2.4.6.4. Hooking a Mass Transfer UDF to ANSYS Fluent
2.4.7. DEFINE_VECTOR_EXCHANGE_PROPERTY
2.4.7.1. Description
2.4.7.2. Usage
2.4.7.3. Example 1 — Custom Slip Velocity
2.4.7.4. Example 2 — Custom Turbulent Dispersion
2.4.7.5. Hooking a Vector Exchange Property UDF to ANSYS Fluent
2.5. Discrete Phase Model (DPM) DEFINE Macros
2.5.1. DEFINE_DPM_BC
2.5.1.1. Description
2.5.1.2. Usage
2.5.1.3. Example 1
2.5.1.4. Example 2
2.5.1.5. Example 3
2.5.1.6. Example 4
2.5.1.7. Hooking a DPM Boundary Condition UDF to ANSYS Fluent
2.5.2. DEFINE_DPM_BODY_FORCE
2.5.2.1. Description
2.5.2.2. Usage
2.5.2.3. Example
2.5.2.4. Hooking a DPM Body Force UDF to ANSYS Fluent
2.5.3. DEFINE_DPM_DRAG
2.5.3.1. Description
2.5.3.2. Usage
2.5.3.3. Example
2.5.3.4. Hooking a DPM Drag Coefficient UDF to ANSYS Fluent
2.5.4. DEFINE_DPM_EROSION
2.5.4.1. Description
2.5.4.2. Usage
2.5.4.3. Example
2.5.4.4. Hooking an Erosion/Accretion UDF to ANSYS Fluent
2.5.5. DEFINE_DPM_HEAT_MASS
2.5.5.1. Description
2.5.5.2. Usage
2.5.5.3. Example
2.5.5.4. Hooking a DPM Particle Heat and Mass Transfer UDF to ANSYS Fluent
2.5.6. DEFINE_DPM_INJECTION_INIT
2.5.6.1. Description
2.5.6.2. Usage
2.5.6.3. Example
2.5.6.4. Using DEFINE_DPM_INJECTION_INIT with an unsteady injection file
2.5.6.5. Hooking a DPM Initialization UDF to ANSYS Fluent
2.5.7. DEFINE_DPM_LAW
2.5.7.1. Description
2.5.7.2. Usage
2.5.7.3. Example
2.5.7.4. Hooking a Custom DPM Law to ANSYS Fluent
2.5.8. DEFINE_DPM_OUTPUT
2.5.8.1. Description
2.5.8.2. Usage
2.5.8.3. Example 1 - Sampling and Removing Particles
2.5.8.4. Example 2 - Source Code Template
2.5.8.5. Using DEFINE_DPM_OUTPUT in VOF-to-DPM Simulations
2.5.8.5.1. Example
2.5.8.6. Hooking a DPM Output UDF to ANSYS Fluent
2.5.9. DEFINE_DPM_PROPERTY
2.5.9.1. Description
2.5.9.2. Usage
2.5.9.3. Example
2.5.9.4. Hooking a DPM Material Property UDF to ANSYS Fluent
2.5.10. DEFINE_DPM_SCALAR_UPDATE
2.5.10.1. Description
2.5.10.2. Usage
2.5.10.3. Example
2.5.10.4. Hooking a DPM Scalar Update UDF to ANSYS Fluent
2.5.11. DEFINE_DPM_SOURCE
2.5.11.1. Description
2.5.11.2. Usage
2.5.11.3. Example
2.5.11.4. Hooking a DPM Source Term UDF to ANSYS Fluent
2.5.12. DEFINE_DPM_SPRAY_COLLIDE
2.5.12.1. Description
2.5.12.2. Usage
2.5.12.3. Example
2.5.12.4. Hooking a DPM Spray Collide UDF to ANSYS Fluent
2.5.13. DEFINE_DPM_SWITCH
2.5.13.1. Description
2.5.13.2. Usage
2.5.13.3. Example
2.5.13.4. Hooking a DPM Switching UDF to ANSYS Fluent
2.5.14. DEFINE_DPM_TIMESTEP
2.5.14.1. Description
2.5.14.2. Usage
2.5.14.3. Example 1
2.5.14.4. Example 2
2.5.14.5. Hooking a DPM Timestep UDF to ANSYS Fluent
2.5.15. DEFINE_DPM_VP_EQUILIB
2.5.15.1. Description
2.5.15.2. Usage
2.5.15.3. Example
2.5.15.4. Hooking a DPM Vapor Equilibrium UDF to ANSYS Fluent
2.5.16. DEFINE_IMPINGEMENT
2.5.16.1. Description
2.5.16.2. Usage
2.5.16.3. Example
2.5.16.4. Hooking an Impingement UDF to ANSYS Fluent
2.5.17. DEFINE_FILM_REGIME
2.5.17.1. Description
2.5.17.2. Usage
2.5.17.3. Example
2.5.17.4. Hooking a Film Regime UDF to ANSYS Fluent
2.5.18. DEFINE_SPLASHING_DISTRIBUTION
2.5.18.1. Description
2.5.18.2. Usage
2.5.18.3. Example
2.5.18.4. Hooking a Splashing Distribution UDF to ANSYS Fluent
2.6. Dynamic Mesh DEFINE Macros
2.6.1. DEFINE_CG_MOTION
2.6.1.1. Description
2.6.1.2. Usage
2.6.1.3. Example
2.6.1.4. Hooking a Center of Gravity Motion UDF to ANSYS Fluent
2.6.2. DEFINE_DYNAMIC_ZONE_PROPERTY
2.6.2.1. Description
2.6.2.2. Swirl Center Definition for In-Cylinder Applications
2.6.2.2.1. Usage
2.6.2.2.2. Example
2.6.2.2.3. Hooking a Swirl Center UDF to ANSYS Fluent
2.6.2.3. Variable Cell Layering Height
2.6.2.3.1. Usage
2.6.2.3.2. Example
2.6.2.3.3. Hooking a Variable Cell Layering Height UDF to ANSYS Fluent
2.6.3. DEFINE_GEOM
2.6.3.1. Description
2.6.3.2. Usage
2.6.3.3. Example
2.6.3.4. Hooking a Dynamic Mesh Geometry UDF to ANSYS Fluent
2.6.4. DEFINE_GRID_MOTION
2.6.4.1. Description
2.6.4.2. Usage
2.6.4.3. Example
2.6.4.4. Hooking a DEFINE_GRID_MOTION to ANSYS Fluent
2.6.5. DEFINE_SDOF_PROPERTIES
2.6.5.1. Description
2.6.5.2. Usage
2.6.5.3. Custom Transformation Variables
2.6.5.4. Example 1
2.6.5.5. Example 2
2.6.5.6. Example 3
2.6.5.7. Hooking a DEFINE_SDOF_PROPERTIES UDF to ANSYS Fluent
2.6.6. DEFINE_CONTACT
2.6.6.1. Description
2.6.6.2. Usage
2.6.6.3. Example 1
2.6.6.4. Example 2
2.6.6.5. Hooking a DEFINE_CONTACT UDF to ANSYS Fluent
2.7. User-Defined Scalar (UDS) Transport Equation DEFINE Macros
2.7.1. Introduction
2.7.1.1. Diffusion Coefficient UDFs
2.7.1.2. Flux UDFs
2.7.1.3. Unsteady UDFs
2.7.1.4. Source Term UDFs
2.7.1.5. Fixed Value Boundary Condition UDFs
2.7.1.6. Wall, Inflow, and Outflow Boundary Condition UDFs
2.7.2. DEFINE_ANISOTROPIC_DIFFUSIVITY
2.7.2.1. Description
2.7.2.2. Usage
2.7.2.3. Example
2.7.2.4. Hooking an Anisotropic Diffusivity UDF to ANSYS Fluent
2.7.3. DEFINE_UDS_FLUX
2.7.3.1. Description
2.7.3.2. Usage
2.7.3.3. Example
2.7.3.4. Hooking a UDS Flux Function to ANSYS Fluent
2.7.4. DEFINE_UDS_UNSTEADY
2.7.4.1. Description
2.7.4.2. Usage
2.7.4.3. Example
2.7.4.4. Hooking a UDS Unsteady Function to ANSYS Fluent
Chapter 3: Additional Macros for Writing UDFs
3.1. Introduction
3.2. Data Access Macros
3.2.1. Axisymmetric Considerations for Data Access Macros
3.2.2. Node Macros
3.2.2.1. Node Position
3.2.2.2. Number of Nodes in a Face (F_NNODES)
3.2.3. Cell Macros
3.2.3.1. Cell Centroid (C_CENTROID)
3.2.3.2. Cell Volume (C_VOLUME)
3.2.3.3. Number of Faces (C_NFACES) and Nodes (C_NNODES) in a Cell
3.2.3.4. Cell Face Index (C_FACE)
3.2.3.5. Cell Face Thread (C_FACE_THREAD)
3.2.3.6. Flow Variable Macros for Cells
3.2.3.6.1. Species Fractions Calculations with the Non- and Partially- Premixed Models
3.2.3.7. Gradient (G) and Reconstruction Gradient (RG) Vector Macros
3.2.3.8. Previous Time Step Macros
3.2.3.9. Derivative Macros
3.2.3.10. Material Property Macros
3.2.3.11. Reynolds Stress Model Macros
3.2.3.12. VOF Multiphase Model Macro
3.2.4. Face Macros
3.2.4.1. Face Centroid (F_CENTROID)
3.2.4.2. Face Area Vector (F_AREA)
3.2.4.3. Flow Variable Macros for Boundary Faces
3.2.4.4. Flow Variable Macros at Interior and Boundary Faces
3.2.5. Connectivity Macros
3.2.5.1. Adjacent Cell Index (F_C0, F_C1)
3.2.5.2. Adjacent Cell Thread (THREAD_T0, THREAD_T1)
3.2.5.3. Interior Face Geometry (INTERIOR_FACE_GEOMETRY)
3.2.5.4. Boundary Face Geometry (BOUNDARY_FACE_GEOMETRY)
3.2.5.5. Boundary Face Thread (BOUNDARY_FACE_THREAD)
3.2.5.6. Boundary Secondary Gradient Source (BOUNDARY_SECONDARY_GRADIENT_SOURCE)
3.2.6. Special Macros
3.2.6.1. Thread Pointer for Zone ID (Lookup_Thread)
3.2.6.2. Zone ID (THREAD_ID)
3.2.6.3. Domain Pointer (Get_Domain)
3.2.6.4. Set Boundary Condition Value (F_PROFILE)
3.2.6.5. THREAD_SHADOW(t)
3.2.7. Time-Sampled Data
3.2.8. Model-Specific Macros
3.2.8.1. DPM Macros
3.2.8.2. NOx Macros
3.2.8.3. SOx Macros
3.2.8.4. Dynamic Mesh Macros
3.2.9. NIST Real Gas Saturation Properties
3.2.9.1. Saturation Curves for Single-Species
3.2.9.2. Saturation Curves for Multi-Species (UDF 1)
3.2.9.3. Saturation Curves for Multi-Species (UDF 2)
3.2.9.3.1. Using Multi-Species User-Defined Function (UDF2)
3.2.9.3.2. Example Multi-Species User-Defined Function (UDF2)
3.2.10. NIST Real Gas UDF Access Macro for Multi-Species Mixtures
3.2.10.1. Description
3.2.10.2. Using get_prop_NIST_msp
3.2.10.3. Error Handling
3.2.10.4. Example
3.2.11. User-Defined Scalar (UDS) Transport Equation Macros
3.2.11.1. Set_User_Scalar_Name
3.2.11.2. F_UDSI
3.2.11.3. C_UDSI
3.2.11.4. Reserving UDS Variables
3.2.11.5. Reserve_User_Scalar_Vars
3.2.11.6. Unreserving UDS Variables
3.2.11.7. N_UDS
3.2.12. User-Defined Memory (UDM) Macros
3.2.12.1. Set_User_Memory_Name
3.2.12.2. Set_User_Node_Memory_Name
3.2.12.3. F_UDMI
3.2.12.4. C_UDMI
3.2.12.5. N_UDMI
3.2.12.6. Example UDF that Utilizes UDM and UDS Variables
3.2.12.7. Reserving UDM Variables Using Reserve_User_Memory_Vars
3.2.12.8. Example 1
3.2.12.9. Example 2
3.2.12.10. Unreserving UDM Variables
3.3. Looping Macros
3.3.1. Looping Over Cell Threads in a Domain (thread_loop_c)
3.3.2. Looping Over Face Threads in a Domain (thread_loop_f)
3.3.3. Looping Over Cells in a Cell Thread (begin...end_c_loop)
3.3.4. Looping Over Faces in a Face Thread (begin...end_f_loop)
3.3.5. Looping Over Faces of a Cell (c_face_loop)
3.3.6. Looping Over Nodes of a Cell (c_node_loop)
3.3.7. Looping Over Nodes of a Face (f_node_loop)
3.3.8. Overset Mesh Looping Macros
3.3.8.1. Looping Over Overset Interface Cell Threads (thread_loop_overset_c)
3.3.8.2. Looping Over Active Overset Cells in a Cell Thread (begin...end_c_loop_active, begin…end_c_loop_solve)
3.3.8.2.1. Example 1
3.3.8.2.2. Example 2
3.3.8.3. Looping Over Faces in a Face Thread with Overset Mesh (begin...end_f_loop_active)
3.3.8.3.1. Example
3.3.9. Multiphase Looping Macros
3.3.9.1. Looping Over Phase Domains in Mixture (sub_domain_loop)
3.3.9.2. Looping Over Phase Threads in Mixture (sub_thread_loop)
3.3.9.3. Looping Over Phase Cell Threads in Mixture (mp_thread_loop_c)
3.3.9.4. Looping Over Phase Face Threads in Mixture (mp_thread_loop_f)
3.3.10. Advanced Multiphase Macros
3.3.10.1. Phase Domain Pointer (DOMAIN_SUB_DOMAIN)
3.3.10.2. Phase-Level Thread Pointer (THREAD_SUB_THREAD)
3.3.10.3. Phase Thread Pointer Array (THREAD_SUB_THREADS)
3.3.10.4. Mixture Domain Pointer (DOMAIN_SUPER_DOMAIN)
3.3.10.5. Mixture Thread Pointer (THREAD_SUPER_THREAD)
3.3.10.6. Domain ID (DOMAIN_ID)
3.3.10.7. Phase Domain Index (PHASE_DOMAIN_INDEX)
3.4. Vector and Dimension Macros
3.4.1. Macros for Dealing with Two and Three Dimensions
3.4.1.1. RP_2D and RP_3D
3.4.2. The ND Macros
3.4.2.1. ND_ND
3.4.2.2. ND_SUM
3.4.2.3. ND_SET
3.4.3. The NV Macros
3.4.3.1. NV_V
3.4.3.2. NV_VV
3.4.3.3. NV_V_VS
3.4.3.4. NV_VS_VS
3.4.4. Vector Operation Macros
3.4.4.1. Vector Magnitude Using NV_MAG and NV_MAG2
3.4.4.2. Dot Product
3.4.4.3. Cross Product
3.5. Time-Dependent Macros
3.6. Scheme Macros
3.6.1. Defining a Scheme Variable in the Text Interface
3.6.2. Accessing a Scheme Variable in the Text Interface
3.6.3. Changing a Scheme Variable to Another Value in the Text Interface
3.6.4. Accessing a Scheme Variable in a UDF
3.7. Input/Output Functions
3.7.1. Message
3.7.2. Error
3.7.3. The par_fprintf_head and par_fprintf Functions
3.7.3.1. par_fprintf_head
3.7.3.2. par_fprintf
3.8. Miscellaneous Macros
3.8.1. Data_Valid_P()
3.8.2. FLUID_THREAD_P()
3.8.3. Get_Report_Definition_Values
3.8.4. M_PI
3.8.5. NULLP & NNULLP
3.8.6. N_UDM
3.8.7. N_UDS
3.8.8. SQR(k)
3.8.9. UNIVERSAL_GAS_CONSTANT
Chapter 4: Interpreting UDFs
4.1. Introduction
4.1.1. Location of the udf.h File
4.1.2. Limitations
4.2. Interpreting a UDF Source File Using the Interpreted UDFs Dialog Box
4.3. Common Errors Made While Interpreting A Source File
Chapter 5: Compiling UDFs
5.1. Introduction
5.1.1. Location of the udf.h File
5.1.2. Compilers
5.2. Compiling a UDF Using the GUI
5.3. Compile a UDF Using the TUI
5.3.1. Set Up the Directory Structure
5.3.1.1. Windows Systems
5.3.1.2. Linux Systems
5.3.2. Build the UDF Library
5.3.2.1. Windows Systems
5.3.2.2. Linux Systems
5.3.3. Load the UDF Library
5.4. Link Precompiled Object Files From Non-ANSYS Fluent Sources
5.4.1. Windows Systems
5.4.2. Linux Systems
5.4.3. Example: Link Precompiled Objects to ANSYS Fluent
5.5. Load and Unload Libraries Using the UDF Library Manager Dialog Box
5.5.1. Load the UDF Library
5.5.2. Unload the UDF Library
5.6. Common Errors When Building and Loading a UDF Library
5.6.1. Windows Distributed Parallel
5.7. Special Considerations for Parallel ANSYS Fluent
Chapter 6: Hooking UDFs to ANSYS Fluent
6.1. Hooking General Purpose UDFs
6.1.1. Hooking DEFINE_ADJUST UDFs
6.1.2. Hooking DEFINE_DELTAT UDFs
6.1.3. Hooking DEFINE_EXECUTE_AT_END UDFs
6.1.4. Hooking DEFINE_EXECUTE_AT_EXIT UDFs
6.1.5. Hooking DEFINE_INIT UDFs
6.1.6. Hooking DEFINE_ON_DEMAND UDFs
6.1.7. Hooking DEFINE_RW_FILE and DEFINE_RW_HDF_FILE UDFs
6.1.8. User-Defined Memory Storage
6.2. Hooking Model-Specific UDFs
6.2.1. Hooking DEFINE_ANISOTROPIC_CONDUCTIVITY UDFs
6.2.2. Hooking DEFINE_CHEM_STEP UDFs
6.2.3. Hooking DEFINE_CPHI UDFs
6.2.4. Hooking DEFINE_DIFFUSIVITY UDFs
6.2.5. Hooking DEFINE_DOM_DIFFUSE_REFLECTIVITY UDFs
6.2.6. Hooking DEFINE_DOM_SOURCE UDFs
6.2.7. Hooking DEFINE_DOM_SPECULAR_REFLECTIVITY UDFs
6.2.8. Hooking DEFINE_ECFM_SOURCE UDFs
6.2.9. Hooking DEFINE_ECFM_SPARK_SOURCE UDFs
6.2.10. Hooking DEFINE_EC_RATE UDFs
6.2.11. Hooking DEFINE_EC_KINETICS_PARAMETER UDFs
6.2.12. Hooking DEFINE_EDC_MDOT UDFs
6.2.13. Hooking DEFINE_EDC_SCALES UDFs
6.2.14. Hooking DEFINE_EMISSIVITY_WEIGHTING_FACTOR UDFs
6.2.15. Hooking DEFINE_FLAMELET_PARAMETERS UDFs
6.2.16. Hooking DEFINE_ZONE_MOTION UDFs
6.2.17. Hooking DEFINE_GRAY_BAND_ABS_COEFF UDFs
6.2.18. Hooking DEFINE_HEAT_FLUX UDFs
6.2.19. Hooking DEFINE_IGNITE_SOURCE UDFs
6.2.20. Hooking DEFINE_MASS_TR_PROPERTY UDFs
6.2.21. Hooking DEFINE_NET_REACTION_RATE UDFs
6.2.22. Hooking DEFINE_NOX_RATE UDFs
6.2.23. Hooking DEFINE_PDF_TABLE UDFs
6.2.24. Hooking DEFINE_PR_RATE UDFs
6.2.25. Hooking DEFINE_PRANDTL UDFs
6.2.26. Hooking DEFINE_PROFILE UDFs
6.2.26.1. Hooking Profiles for UDS Equations
6.2.27. Hooking DEFINE_PROPERTY UDFs
6.2.28. Hooking DEFINE_REACTING_CHANNEL_BC UDFs
6.2.29. Hooking DEFINE_REACTING_CHANNEL_SOLVER UDFs
6.2.30. Hooking DEFINE_RELAX_TO_EQUILIBRIUM UDFs
6.2.31. Hooking DEFINE_SBES_BF UDFs
6.2.32. Hooking DEFINE_SCAT_PHASE_FUNC UDFs
6.2.33. Hooking DEFINE_SOLAR_INTENSITY UDFs
6.2.34. Hooking DEFINE_SOLIDIFICATION_PARAMS UDFs
6.2.35. Hooking DEFINE_SOURCE UDFs
6.2.36. Hooking DEFINE_SOOT_MASS_RATES UDFs
6.2.37. Hooking DEFINE_SOOT_NUCLEATION_RATES UDFs
6.2.38. Hooking DEFINE_SOOT_OXIDATION_RATE UDFs
6.2.39. Hooking DEFINE_SOOT_PRECURSOR UDFs
6.2.40. Hooking DEFINE_SOX_RATE UDFs
6.2.41. Hooking DEFINE_SPARK_GEOM UDFs
6.2.42. Hooking DEFINE_SPECIFIC_HEAT UDFs
6.2.43. Hooking DEFINE_SR_RATE UDFs
6.2.44. Hooking DEFINE_THICKENED_FLAME_MODEL UDFs
6.2.45. Hooking DEFINE_TRANS UDFs
6.2.46. Hooking DEFINE_TRANSIENT_PROFILE UDFs
6.2.47. Hooking DEFINE_TURB_PREMIX_SOURCE UDFs
6.2.48. Hooking DEFINE_TURB_SCHMIDT UDFs
6.2.49. Hooking DEFINE_TURBULENT_VISCOSITY UDFs
6.2.50. Hooking DEFINE_VR_RATE UDFs
6.2.51. Hooking DEFINE_WALL_FUNCTIONS UDFs
6.2.52. Hooking DEFINE_WALL_NODAL_DISP UDFs
6.2.53. Hooking DEFINE_WALL_NODAL_FORCE UDFs
6.2.54. Hooking DEFINE_WSGGM_ABS_COEFF UDFs
6.3. Hooking Multiphase UDFs
6.3.1. Hooking DEFINE_BOILING_PROPERTY UDFs
6.3.2. Hooking DEFINE_CAVITATION_RATE UDFs
6.3.3. Hooking DEFINE_EXCHANGE_PROPERTY UDFs
6.3.4. Hooking DEFINE_HET_RXN_RATE UDFs
6.3.5. Hooking DEFINE_LINEARIZED_MASS_TRANSFER UDFs
6.3.6. Hooking DEFINE_MASS_TRANSFER UDFs
6.3.7. Hooking DEFINE_VECTOR_EXCHANGE_PROPERTY UDFs
6.4. Hooking Discrete Phase Model (DPM) UDFs
6.4.1. Hooking DEFINE_DPM_BC UDFs
6.4.2. Hooking DEFINE_DPM_BODY_FORCE UDFs
6.4.3. Hooking DEFINE_DPM_DRAG UDFs
6.4.4. Hooking DEFINE_DPM_EROSION UDFs
6.4.5. Hooking DEFINE_DPM_HEAT_MASS UDFs
6.4.6. Hooking DEFINE_DPM_INJECTION_INIT UDFs
6.4.7. Hooking DEFINE_DPM_LAW UDFs
6.4.8. Hooking DEFINE_DPM_OUTPUT UDFs
6.4.9. Hooking DEFINE_DPM_PROPERTY UDFs
6.4.10. Hooking DEFINE_DPM_SCALAR_UPDATE UDFs
6.4.11. Hooking DEFINE_DPM_SOURCE UDFs
6.4.12. Hooking DEFINE_DPM_SPRAY_COLLIDE UDFs
6.4.13. Hooking DEFINE_DPM_SWITCH UDFs
6.4.14. Hooking DEFINE_DPM_TIMESTEP UDFs
6.4.15. Hooking DEFINE_DPM_VP_EQUILIB UDFs
6.4.16. Hooking DEFINE_IMPINGEMENT UDFs
6.4.17. Hooking DEFINE_FILM_REGIME UDFs
6.4.18. Hooking DEFINE_SPLASHING_DISTRIBUTION UDFs
6.5. Hooking Dynamic Mesh UDFs
6.5.1. Hooking DEFINE_CG_MOTION UDFs
6.5.2. Hooking DEFINE_DYNAMIC_ZONE_PROPERTY UDFs
6.5.2.1. Hooking a Swirl Center UDF
6.5.2.2. Hooking a Variable Cell Layering Height UDF
6.5.3. Hooking DEFINE_GEOM UDFs
6.5.4. Hooking DEFINE_GRID_MOTION UDFs
6.5.5. Hooking DEFINE_SDOF_PROPERTIES UDFs
6.5.6. Hooking DEFINE_CONTACT UDFs
6.6. Hooking User-Defined Scalar (UDS) Transport Equation UDFs
6.6.1. Hooking DEFINE_ANISOTROPIC_DIFFUSIVITY UDFs
6.6.2. Hooking DEFINE_UDS_FLUX UDFs
6.6.3. Hooking DEFINE_UDS_UNSTEADY UDFs
6.7. Common Errors While Hooking a UDF to ANSYS Fluent
Chapter 7: Parallel Considerations
7.1. Overview of Parallel ANSYS Fluent
7.1.1. Command Transfer and Communication
7.2. Cells and Faces in a Partitioned Mesh
7.2.1. Cell Types in a Partitioned Mesh
7.2.2. Faces at Partition Boundaries
7.2.3. PRINCIPAL_FACE_P
7.2.4. Exterior Thread Storage
7.2.5. Extended Neighborhood
7.3. Parallelizing Your Serial UDF
7.3.1. Parallelization of Discrete Phase Model (DPM) UDFs
7.3.2. Macros for Parallel UDFs
7.3.2.1. Compiler Directives
7.3.2.2. Communicating Between the Host and Node Processes
7.3.2.2.1. Host-to-Node Data Transfer
7.3.2.2.2. Node-to-Host Data Transfer
7.3.2.3. Predicates
7.3.2.4. Global Reduction Macros
7.3.2.4.1. Global Summations
7.3.2.4.2. Global Maximums and Minimums
7.3.2.4.3. Global Logicals
7.3.2.4.4. Global Synchronization
7.3.2.5. Looping Macros
7.3.2.5.1. Looping Over Cells
7.3.2.5.2. Interior Cell Looping Macro
7.3.2.5.3. Exterior Cell Looping Macro
7.3.2.5.4. Interior and Exterior Cell Looping Macro
7.3.2.5.5. Looping Over Faces
7.3.2.6. Cell and Face Partition ID Macros
7.3.2.6.1. Cell Partition IDs
7.3.2.6.2. Face Partition IDs
7.3.2.7. Message Displaying Macros
7.3.2.8. Message Passing Macros
7.3.2.9. Macros for Exchanging Data Between Compute Nodes
7.3.3. Limitations of Parallel UDFs
7.3.4. Process Identification
7.3.5. Parallel UDF Example
7.4. Reading and Writing Files in Parallel
7.4.1. Reading Files in Parallel
7.4.2. Writing Files in Parallel
7.5. Enabling Fluent UDFs to Execute on General Purpose Graphics Processing Units (GPGPUs)
Chapter 8: Examples
8.1. Step-By-Step UDF Example
8.1.1. Process Overview
8.1.2. Step 1: Define Your Problem
8.1.3. Step 2: Create a C Source File
8.1.4. Step 3: Start ANSYS Fluent and Read (or Set Up) the Case File
8.1.5. Step 4: Interpret or Compile the Source File
8.1.5.1. Interpret the Source File
8.1.5.2. Compile the Source File
8.1.6. Step 5: Hook the UDF to ANSYS Fluent
8.1.7. Step 6: Run the Calculation
8.1.8. Step 7: Analyze the Numerical Solution and Compare to Expected Results
8.2. Detailed UDF Examples
8.2.1. Boundary Conditions
8.2.1.1. Parabolic Velocity Inlet Profile in an Elbow Duct
8.2.1.2. Transient Pressure Outlet Profile for Flow in a Tube
8.2.2. Source Terms
8.2.2.1. Adding a Momentum Source to a Duct Flow
8.2.3. Physical Properties
8.2.3.1. Solidification via a Temperature-Dependent Viscosity
8.2.4. Reaction Rates
8.2.4.1. Volume Reaction Rate
8.2.5. User-Defined Scalars
8.2.5.1. Postprocessing Using User-Defined Scalars
8.2.5.2. Implementing ANSYS Fluent’s P-1 Radiation Model Using User-Defined Scalars
8.2.6. User-Defined Real Gas Models (UDRGM)
8.2.6.1. UDRGM Example: Redlich-Kwong Equation of State
8.2.6.2. Specific Volume and Density
8.2.6.3. Derivatives of Specific Volume and Density
8.2.6.4. Specific Heat and Enthalpy
8.2.6.5. Entropy
8.2.6.6. Speed of Sound
8.2.6.7. Viscosity and Thermal Conductivity
8.2.6.8. Using the Redlich-Kwong Real Gas UDRGM
8.2.6.9. Redlich-Kwong Real Gas UDRGM Code Listing
8.2.6.9.1. UDRGM Example: Multiple-Species Real Gas Model
8.2.6.9.2. UDRGM Example: Real Gas Model with Volumetric Reactions
Appendix A. C Programming Basics
A.1. Introduction
A.2. Commenting Your C Code
A.3. C Data Types in ANSYS Fluent
A.4. Constants
A.5. Variables
A.5.1. Declaring Variables
A.5.2. External Variables
A.5.2.1. Example
A.5.3. Static Variables
A.5.3.1. Example - Static Global Variable
A.6. User-Defined Data Types
A.6.1. Example
A.7. Casting
A.8. Functions
A.9. Arrays
A.9.1. Examples
A.10. Pointers
A.10.1. Pointers as Function Arguments
A.11. Control Statements
A.11.1. if Statement
A.11.1.1. Example
A.11.2. if-else Statement
A.11.2.1. Example
A.11.3. for Loops
A.11.3.1. Example
A.12. Common C Operators
A.12.1. Arithmetic Operators
A.12.2. Logical Operators
A.13. C Library Functions
A.13.1. Trigonometric Functions
A.13.2. Miscellaneous Mathematical Functions
A.13.3. Standard I/O Functions
A.13.3.1. fopen
A.13.3.2. fclose
A.13.3.3. printf
A.13.3.4. fprintf
A.13.3.5. fscanf
A.14. Preprocessor Directives
A.14.1. Macro Substitution Directive Using #define
A.14.2. File Inclusion Directive Using #include
A.15. Comparison with FORTRAN
Appendix B. DEFINE Macro Definitions
B.1. General Solver DEFINE Macros
B.2. Model-Specific DEFINE Macro Definitions
B.3. Multiphase DEFINE Macros
B.4. Dynamic Mesh Model DEFINE Macros
B.5. Discrete Phase Model DEFINE Macros
B.6. User-Defined Scalar (UDS) DEFINE Macros
Appendix C. Quick Reference Guide for Multiphase DEFINE Macros
C.1. VOF Model
C.2. Mixture Model
C.3. Eulerian Model - Laminar Flow
C.4. Eulerian Model - Mixture Turbulence Flow
C.5. Eulerian Model - Dispersed Turbulence Flow
C.6. Eulerian Model - Per Phase Turbulence Flow
Bibliography
Part 2: Creating Custom User Interfaces in Fluent
Chapter 1: Introduction to Fluent User Interface Concepts
1.1. Introduction
1.2. Limitations
1.2.1. Menu Items Read Into Fluent Cannot Be Removed Or Overwritten
1.2.2. Help Button Unusable
1.3. Scheme Basics
1.3.1. Data Types
1.3.1.1. Boolean
1.3.1.2. Integers
1.3.1.3. Reals
1.3.1.4. Characters
1.3.1.5. Strings
1.3.1.6. Symbols
1.3.1.7. Pairs and Lists
1.3.2. Important Concepts
1.3.2.1. Define
1.3.2.2. Set!
1.3.2.3. Let
1.3.2.4. Lambda
1.3.2.5. If
1.3.2.6. Map
1.4. RP Variables
1.4.1. Creating an RP Variable
1.4.2. Changing an RP Variable
1.4.3. Accessing the Value of an RP Variable In Your GUI
1.4.4. Accessing the Value of an RP Variable In Your UDF
1.4.5. Saving and Loading RP Variables
1.5. The .fluent File
Chapter 2: How to Create an Interface
2.1. Dialog Boxes (cx-create-panel)
2.1.1. Description
2.1.2. Usage
2.1.2.1. cx-create-panel
2.1.2.2. cx-show-panel
2.1.3. Examples
2.1.3.1. Example One
2.1.3.2. Example Two
2.1.3.3. Additional Examples
2.2. Tables (cx-create-table)
2.2.1. Description
2.2.2. Usage
2.2.3. Examples
Chapter 3: Interface Elements
3.1. Integer Entry (cx-create-integer-entry)
3.1.1. Description
3.1.2. Usage
3.1.2.1. cx-create-integer-entry
3.1.2.2. cx-set-integer-entry
3.1.2.3. cx-show-integer-entry
3.1.3. Integer Entry Example
3.2. Real Number Entry (cx-create-real-entry)
3.2.1. Description
3.2.2. Usage
3.2.2.1. cx-create-real-entry
3.2.2.2. cx-set-real-entry
3.2.2.3. cx-show-real-entry
3.2.3. Real Number Entry Example
3.3. Text Entry (cx-create-text-entry)
3.3.1. Description
3.3.2. Usage
3.3.2.1. cx-create-text-entry
3.3.2.2. cx-set-text-entry
3.3.2.3. cx-show-text-entry
3.3.3. Text Entry Example
3.4. Check Boxes & Radio Buttons (cx-create-toggle-button)
3.4.1. Description
3.4.2. Usage
3.4.2.1. cx-create-button-box
3.4.2.2. cx-create-toggle-button
3.4.2.3. cx-set-toggle-button
3.4.2.4. cx-show-toggle-button
3.4.3. Check Box Example
3.4.4. Option Button Example
3.5. Buttons (cx-create-button)
3.5.1. Description
3.5.2. Usage
3.5.3. Button Example
3.6. Lists & Drop-down Lists (cx-create-list) & (cx-create-drop-down-list)
3.6.1. Description
3.6.2. Usage
3.6.2.1. cx-create-list
3.6.2.2. cx-create-drop-down-list
3.6.2.3. cx-set-list-items
3.6.2.4. cx-set-list-selections
3.6.2.5. cx-show-list-selections
3.6.3. List Example
3.6.4. Drop Down List Example
Chapter 4: Adding Menus to the Right of the Ribbon
4.1. Adding a New Menu
4.1.1. Description
4.1.2. Usage
4.1.3. Examples
4.2. Adding a New Submenu
4.2.1. Description
4.2.2. Usage
4.2.3. Examples
4.3. Adding a New Menu Item
4.3.1. Description
4.3.2. Usage
4.3.3. Examples
Chapter 5: Comprehensive Examples
5.1. Dialog Box Example
5.2. Example Menu Added to the Right of the Ribbon Tabs
5.3. UDF Example
Appendix A. Avoiding Common Mistakes
A.1. Keeping Track Of Parentheses
A.2. Knowing The Type Of Each Variable
A.3. Overwriting Interface Elements
A.3.1. Example One
A.3.2. Example Two
Appendix B. Reference Table For Fluent Macros
ANSYS Fluent Customization Manual ANSYS, Inc. Southpointe 2600 ANSYS Drive Canonsburg, PA 15317 ansysinfo@ansys.com http://www.ansys.com (T) 724-746-3304 (F) 724-514-9494 Release 2020 R1 January 2020 ANSYS, Inc. and ANSYS Europe, Ltd. are UL registered ISO 9001: 2015 companies.
Copyright and Trademark Information © 2020 ANSYS, Inc. Unauthorized use, distribution or duplication is prohibited. ANSYS, ANSYS Workbench, AUTODYN, CFX, FLUENT and any and all ANSYS, Inc. brand, product, service and feature names, logos and slogans are registered trademarks or trademarks of ANSYS, Inc. or its subsidiaries located in the United States or other countries. ICEM CFD is a trademark used by ANSYS, Inc. under license. CFX is a trademark of Sony Corporation in Japan. All other brand, product, service and feature names or trademarks are the property of their respective owners. FLEXlm and FLEXnet are trademarks of Flexera Software LLC. Disclaimer Notice THIS ANSYS SOFTWARE PRODUCT AND PROGRAM DOCUMENTATION INCLUDE TRADE SECRETS AND ARE CONFID- ENTIAL AND PROPRIETARY PRODUCTS OF ANSYS, INC., ITS SUBSIDIARIES, OR LICENSORS. The software products and documentation are furnished by ANSYS, Inc., its subsidiaries, or affiliates under a software license agreement that contains provisions concerning non-disclosure, copying, length and nature of use, compliance with exporting laws, warranties, disclaimers, limitations of liability, and remedies, and other provisions. The software products and documentation may be used, disclosed, transferred, or copied only in accordance with the terms and conditions of that software license agreement. ANSYS, Inc. and ANSYS Europe, Ltd. are UL registered ISO 9001: 2015 companies. U.S. Government Rights For U.S. Government users, except as specifically granted by the ANSYS, Inc. software license agreement, the use, duplication, or disclosure by the United States Government is subject to restrictions stated in the ANSYS, Inc. software license agreement and FAR 12.212 (for non-DOD licenses). Third-Party Software See the legal information in the product help files for the complete Legal Notice for ANSYS proprietary software and third-party software. If you are unable to access the Legal Notice, contact ANSYS, Inc. Published in the U.S.A.
Table of Contents Using This Manual ................................................................................................................................... xxxiii 1. The Contents of This Manual .......................................................................................................... xxxiii 2. Typographical Conventions ............................................................................................................ xxxv 3. Mathematical Conventions ........................................................................................................... xxxvii 1. Creating and Using User Defined Functions ........................................................................................... 1 1. Overview of User-Defined Functions (UDFs) .................................................................................... 3 1.1. What is a User-Defined Function? ................................................................................................ 3 1.2. Limitations ................................................................................................................................. 4 1.3. Defining Your UDF Using DEFINE Macros ................................................................................... 5 1.3.1. Including the udf.h Header File in Your Source File ........................................................... 6 1.4. Interpreting and Compiling UDFs ................................................................................................ 6 1.4.1. Compiled UDFs .................................................................................................................. 7 1.4.2. Interpreted UDFs ............................................................................................................... 7 1.4.3. Differences Between Interpreted and Compiled UDFs ......................................................... 8 1.5. Hooking UDFs to Your ANSYS Fluent Model ................................................................................. 9 1.6. Mesh Terminology ...................................................................................................................... 9 1.7. Data Types in ANSYS Fluent ....................................................................................................... 11 1.8. UDF Calling Sequence in the Solution Process ........................................................................... 12 1.8.1. Pressure-Based Segregated Solver .................................................................................... 13 1.8.2. Pressure-Based Coupled Solver ......................................................................................... 14 1.8.3. Density-Based Solver ........................................................................................................ 14 1.9. Special Considerations for Multiphase UDFs .............................................................................. 15 1.9.1. Multiphase-specific Data Types ......................................................................................... 15 2. DEFINE Macros ............................................................................................................................... 19 2.1. Introduction ............................................................................................................................. 19 2.2. General Purpose DEFINE Macros ............................................................................................. 20 2.2.1. DEFINE_ADJUST .......................................................................................................... 21 2.2.1.1. Description ............................................................................................................. 21 2.2.1.2. Usage ...................................................................................................................... 21 2.2.1.3. Example 1 ............................................................................................................... 21 2.2.1.4. Example 2 ............................................................................................................... 22 2.2.1.5. Hooking an Adjust UDF to ANSYS Fluent .................................................................. 22 2.2.2. DEFINE_DELTAT .......................................................................................................... 23 2.2.2.1. Description ............................................................................................................. 23 2.2.2.2. Usage ...................................................................................................................... 23 2.2.2.3. Example .................................................................................................................. 23 2.2.2.4. Hooking an Adaptive Time Step UDF to ANSYS Fluent .............................................. 24 2.2.3. DEFINE_EXECUTE_AT_END ......................................................................................... 24 2.2.3.1. Description ............................................................................................................. 24 2.2.3.2. Usage ...................................................................................................................... 24 2.2.3.3. Example .................................................................................................................. 24 2.2.3.4. Hooking an Execute-at-End UDF to ANSYS Fluent ..................................................... 25 2.2.4. DEFINE_EXECUTE_AT_EXIT ....................................................................................... 25 2.2.4.1. Description ............................................................................................................. 25 2.2.4.2. Usage ...................................................................................................................... 25 2.2.4.3. Hooking an Execute-at-Exit UDF to ANSYS Fluent ..................................................... 25 2.2.5. DEFINE_EXECUTE_FROM_GUI .................................................................................... 26 2.2.5.1. Description ............................................................................................................. 26 2.2.5.2. Usage ...................................................................................................................... 26 2.2.5.3. Example .................................................................................................................. 26 Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates. iii
Customization Manual 2.2.5.4. Hooking an Execute From GUI UDF to ANSYS Fluent ................................................. 27 2.2.6. DEFINE_EXECUTE_ON_LOADING ................................................................................ 27 2.2.6.1. Description ............................................................................................................. 27 2.2.6.2. Usage ...................................................................................................................... 28 2.2.6.3. Example 1 ............................................................................................................... 28 2.2.6.4. Example 2 ............................................................................................................... 28 2.2.6.5. Hooking an Execute On Loading UDF to ANSYS Fluent ............................................. 29 2.2.7. DEFINE_EXECUTE_AFTER_CASE/DATA ..................................................................... 29 2.2.7.1. Description ............................................................................................................. 29 2.2.7.2. Usage ...................................................................................................................... 30 2.2.7.3. Example .................................................................................................................. 30 2.2.7.4. Hooking an Execute After Reading Case and Data File UDF to ANSYS Fluent .............. 30 2.2.8. DEFINE_INIT ............................................................................................................... 31 2.2.8.1. Description ............................................................................................................. 31 2.2.8.2. Usage ...................................................................................................................... 31 2.2.8.3. Example .................................................................................................................. 31 2.2.8.4. Hooking an Initialization UDF to ANSYS Fluent ......................................................... 32 2.2.9. DEFINE_ON_DEMAND .................................................................................................... 32 2.2.9.1. Description ............................................................................................................. 32 2.2.9.2. Usage ...................................................................................................................... 32 2.2.9.3. Example .................................................................................................................. 33 2.2.9.4. Hooking an On-Demand UDF to ANSYS Fluent ......................................................... 34 2.2.10. DEFINE_REPORT_DEFINITION_FN .......................................................................... 34 2.2.10.1. Description ............................................................................................................ 34 2.2.10.2. Usage .................................................................................................................... 34 2.2.10.3. Example ................................................................................................................ 35 2.2.10.4. Hooking a User Defined Report Definition to ANSYS Fluent .................................... 35 2.2.11. DEFINE_RW_FILE ...................................................................................................... 35 2.2.11.1. Description ............................................................................................................ 35 2.2.11.2. Usage .................................................................................................................... 36 2.2.11.3. Example ................................................................................................................ 36 2.2.11.4. Hooking a Read/Write Case or Data File UDF to ANSYS Fluent ................................. 37 2.2.12. DEFINE_RW_HDF_FILE ............................................................................................. 37 2.2.12.1. Description ............................................................................................................ 37 2.2.12.2. Usage .................................................................................................................... 37 2.2.12.3. Helper Functions ................................................................................................... 38 2.2.12.4. Examples ............................................................................................................... 43 2.2.12.5. Hooking a Read/Write CFF Case or Data File UDF to ANSYS Fluent ........................... 44 2.3. Model-Specific DEFINE Macros ................................................................................................ 44 2.3.1. DEFINE_ANISOTROPIC_CONDUCTIVITY ................................................................... 51 2.3.1.1. Description ............................................................................................................. 51 2.3.1.2. Usage ...................................................................................................................... 51 2.3.1.3. Example .................................................................................................................. 52 2.3.1.4. Hooking an Anisotropic Conductivity UDF to ANSYS Fluent ...................................... 53 2.3.2. DEFINE_CHEM_STEP .................................................................................................... 53 2.3.2.1. Description ............................................................................................................. 53 2.3.2.2. Usage ...................................................................................................................... 54 2.3.2.3. Example .................................................................................................................. 54 2.3.2.4. Hooking a Chemistry Step UDF to ANSYS Fluent ....................................................... 55 2.3.3. DEFINE_CPHI ............................................................................................................... 55 2.3.3.1. Description ............................................................................................................. 55 2.3.3.2. Usage ...................................................................................................................... 55 iv Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.
Customization Manual 2.3.3.3. Hooking a Mixing Constant UDF to ANSYS Fluent ..................................................... 55 2.3.4. DEFINE_CURVATURE_CORRECTION_CCURV .............................................................. 56 2.3.4.1. Description ............................................................................................................. 56 2.3.4.2. Usage ...................................................................................................................... 56 2.3.4.3. Example .................................................................................................................. 56 2.3.4.4. Hooking a UDF for Curvature Correction Coefficient to ANSYS Fluent ........................ 57 2.3.5. DEFINE_DIFFUSIVITY ............................................................................................... 57 2.3.5.1. Description ............................................................................................................. 57 2.3.5.2. Usage ...................................................................................................................... 57 2.3.5.3. Example .................................................................................................................. 57 2.3.5.4. Hooking a Diffusivity UDF to ANSYS Fluent .............................................................. 58 2.3.6. DEFINE_DOM_DIFFUSE_REFLECTIVITY ................................................................... 58 2.3.6.1. Description ............................................................................................................. 58 2.3.6.2. Usage ...................................................................................................................... 58 2.3.6.3. Example .................................................................................................................. 59 2.3.6.4. Hooking a Discrete Ordinates Model (DOM) Diffuse Reflectivity UDF to ANSYS Flu- ent ..................................................................................................................................... 59 2.3.7. DEFINE_DOM_SOURCE .................................................................................................. 60 2.3.7.1. Description ............................................................................................................. 60 2.3.7.2. Usage ...................................................................................................................... 60 2.3.7.3. Example .................................................................................................................. 60 2.3.7.4. Hooking a DOM Source UDF to ANSYS Fluent ........................................................... 61 2.3.8. DEFINE_DOM_SPECULAR_REFLECTIVITY ................................................................. 61 2.3.8.1. Description ............................................................................................................. 61 2.3.8.2. Usage ...................................................................................................................... 61 2.3.8.3. Example .................................................................................................................. 62 2.3.8.4. Hooking a Discrete Ordinates Model (DOM) Specular Reflectivity UDF to ANSYS Flu- ent ..................................................................................................................................... 62 2.3.9. DEFINE_ECFM_SOURCE ............................................................................................... 63 2.3.9.1. Description ............................................................................................................. 63 2.3.9.2. Usage ...................................................................................................................... 63 2.3.9.3. Example .................................................................................................................. 64 2.3.9.4. Hooking an ECFM Flame Density Area Source UDF to ANSYS Fluent .......................... 64 2.3.10. DEFINE_ECFM_SPARK_SOURCE ................................................................................ 64 2.3.10.1. Description ............................................................................................................ 64 2.3.10.2. Usage .................................................................................................................... 64 2.3.10.3. Example ................................................................................................................ 65 2.3.10.4. Hooking an ECFM Spark Source UDF to ANSYS Fluent ............................................. 65 2.3.11. DEFINE_EC_KINETICS_PARAMETER ....................................................................... 66 2.3.11.1. Description ............................................................................................................ 66 2.3.11.2. Usage .................................................................................................................... 66 2.3.11.3. Example - Electrochemical Reaction Kinetics Parameter Using UDF ......................... 66 2.3.11.4. Hooking an Electrochemical Reaction Kinetics Parameter UDF to ANSYS Fluent ...... 67 2.3.12. DEFINE_EC_RATE ...................................................................................................... 67 2.3.12.1. Description ............................................................................................................ 67 2.3.12.2. Usage .................................................................................................................... 67 2.3.12.3. Example - Electrochemical Reaction Rate Using UDF .............................................. 68 2.3.12.4. Hooking an Electrochemical Reaction Rate UDF to ANSYS Fluent ............................ 68 2.3.13. DEFINE_EDC_MDOT .................................................................................................... 69 2.3.13.1. Description ............................................................................................................ 69 2.3.13.2. Usage .................................................................................................................... 69 2.3.13.3. Example ................................................................................................................ 70 Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates. v
Customization Manual 2.3.13.4. Hooking a DEFINE_EDC_MDOT UDF to ANSYS Fluent ........................................... 70 2.3.14. DEFINE_EDC_SCALES ................................................................................................ 70 2.3.14.1. Description ............................................................................................................ 70 2.3.14.2. Usage .................................................................................................................... 71 2.3.14.3. Example ................................................................................................................ 71 2.3.14.4. Hooking a DEFINE_EDC_SCALES UDF to ANSYS Fluent ....................................... 72 2.3.15. DEFINE_EMISSIVITY_WEIGHTING_FACTOR .......................................................... 72 2.3.15.1. Description ............................................................................................................ 72 2.3.15.2. Usage .................................................................................................................... 72 2.3.15.3. Example ................................................................................................................ 73 2.3.15.4. Hooking an Emissivity Weighting Factor UDF to ANSYS Fluent ................................ 73 2.3.16. DEFINE_FLAMELET_PARAMETERS ............................................................................ 73 2.3.16.1. Description ............................................................................................................ 73 2.3.16.2. Usage .................................................................................................................... 73 2.3.16.3. Example ................................................................................................................ 74 2.3.16.4. Hooking a Flamelet Parameters UDF to ANSYS Fluent ............................................. 75 2.3.17. DEFINE_ZONE_MOTION ............................................................................................. 75 2.3.17.1. Description ............................................................................................................ 75 2.3.17.2. Usage .................................................................................................................... 75 2.3.17.3. Example ................................................................................................................ 76 2.3.17.4. Hooking a Frame Motion UDF to ANSYS Fluent ....................................................... 76 2.3.18. DEFINE_GRAY_BAND_ABS_COEFF ............................................................................ 77 2.3.18.1. Description ............................................................................................................ 77 2.3.18.2. Usage .................................................................................................................... 77 2.3.18.3. Example ................................................................................................................ 77 2.3.18.4. Hooking a Gray Band Coefficient UDF to ANSYS Fluent ........................................... 77 2.3.19. DEFINE_HEAT_FLUX .................................................................................................. 78 2.3.19.1. Description ............................................................................................................ 78 2.3.19.2. Usage .................................................................................................................... 78 2.3.19.3. Example ................................................................................................................ 79 2.3.19.4. Hooking a Heat Flux UDF to ANSYS Fluent .............................................................. 79 2.3.20. DEFINE_IGNITE_SOURCE ......................................................................................... 79 2.3.20.1. Description ............................................................................................................ 79 2.3.20.2. Usage .................................................................................................................... 79 2.3.20.3. Example ................................................................................................................ 80 2.3.20.4. Hooking an Ignition Source UDF to ANSYS Fluent ................................................... 81 2.3.21. DEFINE_KW_GEKO Coefficients and Blending Function ................................................... 81 2.3.21.1. Description ............................................................................................................ 81 2.3.21.2. Usage .................................................................................................................... 81 2.3.21.3. Example ................................................................................................................ 82 2.3.21.4. Hooking a UDF for GEKO Coefficients or Blending Function to ANSYS Fluent ........... 82 2.3.22. DEFINE_MASS_TR_PROPERTY .................................................................................. 83 2.3.22.1. Description ............................................................................................................ 83 2.3.22.2. Usage .................................................................................................................... 83 2.3.22.3. Example ................................................................................................................ 84 2.3.22.4. Hooking a DEFINE_MASS_TR_PROPERTY UDF to ANSYS Fluent ......................... 85 2.3.23. DEFINE_NET_REACTION_RATE ................................................................................ 85 2.3.23.1. Description ............................................................................................................ 85 2.3.23.2. Usage .................................................................................................................... 85 2.3.23.3. Example ................................................................................................................ 86 2.3.23.4. Hooking a Net Reaction Rate UDF to ANSYS Fluent ................................................. 87 2.3.24. DEFINE_NOX_RATE .................................................................................................... 87 vi Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.
Customization Manual 2.3.24.1. Description ............................................................................................................ 87 2.3.24.2. Usage .................................................................................................................... 87 2.3.24.3. Example 1 ............................................................................................................. 88 2.3.24.4. Example 2 ............................................................................................................. 90 2.3.24.5. Hooking a NOx Rate UDF to ANSYS Fluent .............................................................. 91 2.3.25. DEFINE_PDF_TABLE .................................................................................................. 91 2.3.25.1. Description ............................................................................................................ 91 2.3.25.2. Usage .................................................................................................................... 92 2.3.25.3. Example ................................................................................................................ 95 2.3.25.4. Hooking a DEFINE_PDF_TABLE UDF to ANSYS Fluent .............................................. 96 2.3.26. DEFINE_PR_RATE ...................................................................................................... 96 2.3.26.1. Description ............................................................................................................ 96 2.3.26.2. Usage .................................................................................................................... 96 2.3.26.3. Auxiliary function .................................................................................................. 97 2.3.26.4. Example 1 ............................................................................................................. 98 2.3.26.5. Example 2 ............................................................................................................. 98 2.3.26.6. Hooking a Particle Reaction Rate UDF to ANSYS Fluent ......................................... 100 2.3.27. DEFINE_PRANDTL UDFs ............................................................................................ 100 2.3.27.1. DEFINE_PRANDTL_D ....................................................................................... 100 2.3.27.2. Description .......................................................................................................... 100 2.3.27.3. Usage .................................................................................................................. 100 2.3.27.4. Example .............................................................................................................. 101 2.3.27.5. Hooking a Prandtl Number UDF to ANSYS Fluent .................................................. 101 2.3.27.6. DEFINE_PRANDTL_K ....................................................................................... 101 2.3.27.7. Description .......................................................................................................... 101 2.3.27.8. Usage .................................................................................................................. 101 2.3.27.9. Example .............................................................................................................. 101 2.3.27.10. Hooking a Prandtl Number UDF to ANSYS Fluent ................................................ 103 2.3.27.11. DEFINE_PRANDTL_O ..................................................................................... 103 2.3.27.12. Description ........................................................................................................ 103 2.3.27.13. Usage ................................................................................................................ 103 2.3.27.14. Example ............................................................................................................ 103 2.3.27.15. Hooking a Prandtl Number UDF to ANSYS Fluent ................................................ 103 2.3.27.16. DEFINE_PRANDTL_T ..................................................................................... 104 2.3.27.17. Description ........................................................................................................ 104 2.3.27.18. Usage ................................................................................................................ 104 2.3.27.19. Example ............................................................................................................ 104 2.3.27.20. Hooking a Prandtl Number UDF to ANSYS Fluent ................................................ 104 2.3.27.21. DEFINE_PRANDTL_T_WALL .......................................................................... 104 2.3.27.22. Description ........................................................................................................ 104 2.3.27.23. Usage ................................................................................................................ 105 2.3.27.24. Example ............................................................................................................ 105 2.3.27.25. Hooking a Prandtl Number UDF to ANSYS Fluent ................................................ 105 2.3.28. DEFINE_PROFILE .................................................................................................... 105 2.3.28.1. Description .......................................................................................................... 105 2.3.28.2. Usage .................................................................................................................. 106 2.3.28.3. Example 1 - Pressure Profile .................................................................................. 107 2.3.28.4. Example 2 - Velocity,Turbulent Kinetic Energy, and Turbulent Dissipation Rate Pro- files .................................................................................................................................. 108 2.3.28.5. Example 3 - Fixed Velocity UDF ............................................................................. 110 2.3.28.6. Example 4 - Wall Heat Generation Rate Profile ....................................................... 112 2.3.28.7. Example 5 - Beam Direction Profile at Semi-Transparent Walls ............................... 112 Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates. vii
Customization Manual 2.3.28.8. Example 6 - Viscous Resistance Profile in a Porous Zone ........................................ 113 2.3.28.9. Example 7 - Porous Resistance Direction Vector .................................................... 114 2.3.28.10. Example 8 -Target Mass Flow Rate UDF as a Function of Physical Flow Time ......... 114 2.3.28.11. Example 9 - Mass Flow Rate UDF for a Mass-Flow Inlet or Mass-Flow Outlet ......... 115 2.3.28.12. Hooking a Boundary Profile UDF to ANSYS Fluent ............................................... 115 2.3.29. DEFINE_PROPERTY UDFs .......................................................................................... 116 2.3.29.1. Description .......................................................................................................... 116 2.3.29.2. Usage .................................................................................................................. 117 2.3.29.3. Auxiliary Utilities .................................................................................................. 118 2.3.29.4. Example 1 - Temperature-dependent Viscosity Property ....................................... 119 2.3.29.5. Example 2 - User-defined Mixing Law for Thermal Conductivity ............................ 120 2.3.29.6. Example 3 - Surface Tension Coefficient UDF ........................................................ 120 2.3.29.7. Example 4 - Density Function for Compressible Liquids ......................................... 121 2.3.29.8. Hooking a Property UDF to ANSYS Fluent ............................................................. 121 2.3.30. DEFINE_REACTING_CHANNEL_BC .......................................................................... 122 2.3.30.1. Description .......................................................................................................... 122 2.3.30.2. Usage .................................................................................................................. 122 2.3.30.3. Example .............................................................................................................. 122 2.3.30.4. Hooking a Reacting Channel Solver UDF to ANSYS Fluent ..................................... 124 2.3.31. DEFINE_REACTING_CHANNEL_SOLVER ................................................................. 124 2.3.31.1. Description .......................................................................................................... 124 2.3.31.2. Usage .................................................................................................................. 124 2.3.31.3. Example .............................................................................................................. 125 2.3.31.4. Hooking a Reacting Channel Solver UDF to ANSYS Fluent ..................................... 127 2.3.32. DEFINE_RELAX_TO_EQUILIBRIUM ........................................................................ 127 2.3.32.1. Description .......................................................................................................... 127 2.3.32.2. Usage .................................................................................................................. 127 2.3.32.3. Example .............................................................................................................. 128 2.3.32.4. Hooking a DEFINE_RELAX_TO_EQUILIBRIUM UDF to ANSYS Fluent ............... 128 2.3.33. DEFINE_SBES_BF .................................................................................................... 128 2.3.33.1. Description .......................................................................................................... 128 2.3.33.2. Usage .................................................................................................................. 128 2.3.33.3. Example .............................................................................................................. 129 2.3.33.4. Hooking an SBES Blending Function UDF to ANSYS Fluent .................................... 129 2.3.34. DEFINE_SCAT_PHASE_FUNC ................................................................................... 129 2.3.34.1. Description .......................................................................................................... 129 2.3.34.2. Usage .................................................................................................................. 129 2.3.34.3. Example .............................................................................................................. 130 2.3.34.4. Hooking a Scattering Phase UDF to ANSYS Fluent ................................................. 131 2.3.35. DEFINE_SOLAR_INTENSITY ................................................................................... 131 2.3.35.1. Description .......................................................................................................... 131 2.3.35.2. Usage .................................................................................................................. 131 2.3.35.3. Example .............................................................................................................. 132 2.3.35.4. Hooking a Solar Intensity UDF to ANSYS Fluent .................................................... 132 2.3.36. DEFINE_SOLIDIFICATION_PARAMS ...................................................................... 132 2.3.36.1. Description .......................................................................................................... 132 2.3.36.2. Usage .................................................................................................................. 132 2.3.36.3. Example .............................................................................................................. 133 2.3.36.4. Hooking a Solidification Parameter UDF in ANSYS Fluent ...................................... 133 2.3.37. DEFINE_SOOT_MASS_RATES ................................................................................... 133 2.3.37.1. Description .......................................................................................................... 133 2.3.37.2. Usage .................................................................................................................. 133 viii Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.
分享到:
收藏