Expand/Collapse all
Using This Manual
1. The Contents of This Manual
2. Typographical Conventions
3. Mathematical Conventions
I. Creating and Using User Defined Functions
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
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. Example 3
2.2.1.6. 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 Legacy 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_CAPILLARY_PRESSURE
2.3.2.1. Description
2.3.2.2. Usage
2.3.2.3. Example
2.3.2.4. Example 2
2.3.2.5. Hooking a Capillary Pressure UDF to Ansys Fluent
2.3.3. DEFINE_CHEM_STEP
2.3.3.1. Description
2.3.3.2. Usage
2.3.3.3. Example
2.3.3.4. Hooking a Chemistry Step UDF to Ansys Fluent
2.3.4. DEFINE_CPHI
2.3.4.1. Description
2.3.4.2. Usage
2.3.4.3. Hooking a Mixing Constant UDF to Ansys Fluent
2.3.5. DEFINE_CORNER_FLOW_CORRECTION_CCORNER
2.3.5.1. Description
2.3.5.2. Usage
2.3.5.3. Example
2.3.5.4. Hooking a UDF for Corner Flow Correction Coefficient to Ansys Fluent
2.3.6. DEFINE_CURVATURE_CORRECTION_CCURV
2.3.6.1. Description
2.3.6.2. Usage
2.3.6.3. Example
2.3.6.4. Hooking a UDF for Curvature Correction Coefficient to Ansys Fluent
2.3.7. DEFINE_DIFFUSIVITY
2.3.7.1. Description
2.3.7.2. Usage
2.3.7.3. Example
2.3.7.4. Hooking a Diffusivity UDF to Ansys Fluent
2.3.8. DEFINE_DOM_DIFFUSE_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) Diffuse Reflectivity UDF to Ansys Fluent
2.3.9. DEFINE_DOM_SOURCE
2.3.9.1. Description
2.3.9.2. Usage
2.3.9.3. Example
2.3.9.4. Hooking a DOM Source UDF to Ansys Fluent
2.3.10. DEFINE_DOM_SPECULAR_REFLECTIVITY
2.3.10.1. Description
2.3.10.2. Usage
2.3.10.3. Example
2.3.10.4. Hooking a Discrete Ordinates Model (DOM) Specular Reflectivity 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_ELECTROLYSIS_ECHEM_RATE
2.3.15.1. Description
2.3.15.2. Usage
2.3.15.3. Example
2.3.15.4. Hooking a DEFINE_ELECTROLYSIS_ECHEM_RATE UDF UDF to Ansys Fluent
2.3.16. DEFINE_ELECTROLYSIS_RELATIVE_PERMEABILITY
2.3.16.1. Description
2.3.16.2. Usage
2.3.16.3. Example
2.3.16.4. Hooking a DEFINE_ELECTROLYSIS_RELATIVE_PERMEABILITY UDF UDF to Ansys Fluent
2.3.17. DEFINE_EMISSIVITY_WEIGHTING_FACTOR
2.3.17.1. Description
2.3.17.2. Usage
2.3.17.3. Example
2.3.17.4. Hooking an Emissivity Weighting Factor UDF to Ansys Fluent
2.3.18. DEFINE_FLAMELET_PARAMETERS
2.3.18.1. Description
2.3.18.2. Usage
2.3.18.3. Example
2.3.18.4. Hooking a Flamelet Parameters UDF to Ansys Fluent
2.3.19. DEFINE_GAP_MODEL_SOURCE
2.3.19.1. Description
2.3.19.2. Usage
2.3.19.3. Example
2.3.19.4. Hooking a Gap Model Source UDF to Ansys Fluent
2.3.20. DEFINE_GEOMETRY
2.3.20.1. Description
2.3.20.2. Usage
2.3.20.3. Example
2.3.20.4. Hooking a Dynamic Mesh Geometry UDF to Ansys Fluent
2.3.21. DEFINE_GRAY_BAND_ABS_COEFF
2.3.21.1. Description
2.3.21.2. Usage
2.3.21.3. Example
2.3.21.4. Hooking a Gray Band Coefficient UDF to Ansys Fluent
2.3.22. DEFINE_HEAT_FLUX
2.3.22.1. Description
2.3.22.2. Usage
2.3.22.3. Example
2.3.22.4. Hooking a Heat Flux UDF to Ansys Fluent
2.3.23. DEFINE_IGNITE_SOURCE
2.3.23.1. Description
2.3.23.2. Usage
2.3.23.3. Example
2.3.23.4. Hooking an Ignition Source UDF to Ansys Fluent
2.3.24. DEFINE_KW_GEKO Coefficients and Blending Function
2.3.24.1. Description
2.3.24.2. Usage
2.3.24.3. Example
2.3.24.4. Hooking a UDF for GEKO Coefficients or Blending Function to Ansys Fluent
2.3.25. DEFINE_MASS_TR_PROPERTY
2.3.25.1. Description
2.3.25.2. Usage
2.3.25.3. Example
2.3.25.4. Hooking a DEFINE_MASS_TR_PROPERTY UDF to Ansys Fluent
2.3.26. DEFINE_NET_REACTION_RATE
2.3.26.1. Description
2.3.26.2. Usage
2.3.26.3. Example
2.3.26.4. Hooking a Net Reaction Rate UDF to Ansys Fluent
2.3.27. DEFINE_NOX_RATE
2.3.27.1. Description
2.3.27.2. Usage
2.3.27.3. Example 1
2.3.27.4. Example 2
2.3.27.5. Hooking a NOx Rate UDF to Ansys Fluent
2.3.28. DEFINE_PERFORATED_CD
2.3.28.1. Description
2.3.28.2. Usage
2.3.28.3. Example
2.3.28.4. Hooking a DEFINE_PERFORATED_CD UDF to Ansys Fluent
2.3.29. DEFINE_PDF_TABLE
2.3.29.1. Description
2.3.29.2. Usage
2.3.29.3. Example
2.3.29.4. Hooking a DEFINE_PDF_TABLE UDF to Ansys Fluent
2.3.30. DEFINE_PR_RATE
2.3.30.1. Description
2.3.30.2. Usage
2.3.30.3. Auxiliary function
2.3.30.4. Example 1
2.3.30.5. Example 2
2.3.30.6. Hooking a Particle Reaction Rate UDF to Ansys Fluent
2.3.31. DEFINE_PRANDTL UDFs
2.3.31.1. DEFINE_PRANDTL_D
2.3.31.2. Description
2.3.31.3. Usage
2.3.31.4. Example
2.3.31.5. Hooking a Prandtl Number UDF to Ansys Fluent
2.3.31.6. DEFINE_PRANDTL_K
2.3.31.7. Description
2.3.31.8. Usage
2.3.31.9. Example
2.3.31.10. Hooking a Prandtl Number UDF to Ansys Fluent
2.3.31.11. DEFINE_PRANDTL_O
2.3.31.12. Description
2.3.31.13. Usage
2.3.31.14. Example
2.3.31.15. Hooking a Prandtl Number UDF to Ansys Fluent
2.3.31.16. DEFINE_PRANDTL_T
2.3.31.17. Description
2.3.31.18. Usage
2.3.31.19. Example
2.3.31.20. Hooking a Prandtl Number UDF to Ansys Fluent
2.3.31.21. DEFINE_PRANDTL_T_WALL
2.3.31.22. Description
2.3.31.23. Usage
2.3.31.24. Example
2.3.31.25. Hooking a Prandtl Number UDF to Ansys Fluent
2.3.32. DEFINE_PROFILE
2.3.32.1. Description
2.3.32.2. Usage
2.3.32.3. Example 1 - Pressure Profile
2.3.32.4. Example 2 - Velocity, Turbulent Kinetic Energy, and Turbulent Dissipation Rate Profiles
2.3.32.5. Example 3 - Fixed Velocity UDF
2.3.32.6. Example 4 - Wall Heat Generation Rate Profile
2.3.32.7. Example 5 - Beam Direction Profile at Semi-Transparent Walls
2.3.32.8. Example 6 - Viscous Resistance Profile in a Porous Zone
2.3.32.9. Example 7 - Porous Resistance Direction Vector
2.3.32.10. Example 8 -Target Mass Flow Rate UDF as a Function of Physical Flow Time
2.3.32.11. Example 9 - Mass Flow Rate UDF for a Mass-Flow Inlet or Mass-Flow Outlet
2.3.32.12. Hooking a Boundary Profile UDF to Ansys Fluent
2.3.33. DEFINE_PROPERTY UDFs
2.3.33.1. Description
2.3.33.2. Usage
2.3.33.3. Auxiliary Utilities
2.3.33.4. Example 1 - Temperature-dependent Viscosity Property
2.3.33.5. Example 2 - User-defined Mixing Law for Thermal Conductivity
2.3.33.6. Example 3 - Surface Tension Coefficient UDF
2.3.33.7. Example 4 - Density Function for Compressible Liquids
2.3.33.8. Hooking a Property UDF to Ansys Fluent
2.3.34. DEFINE_REACTING_CHANNEL_BC
2.3.34.1. Description
2.3.34.2. Usage
2.3.34.3. Example
2.3.34.4. Hooking a Reacting Channel Solver UDF to Ansys Fluent
2.3.35. DEFINE_REACTING_CHANNEL_SOLVER
2.3.35.1. Description
2.3.35.2. Usage
2.3.35.3. Example
2.3.35.4. Hooking a Reacting Channel Solver UDF to Ansys Fluent
2.3.36. DEFINE_RELAX_TO_EQUILIBRIUM
2.3.36.1. Description
2.3.36.2. Usage
2.3.36.3. Example
2.3.36.4. Hooking a DEFINE_RELAX_TO_EQUILIBRIUM UDF to Ansys Fluent
2.3.37. DEFINE_SBES_BF
2.3.37.1. Description
2.3.37.2. Usage
2.3.37.3. Example
2.3.37.4. Hooking an SBES Blending Function UDF to Ansys Fluent
2.3.38. DEFINE_SCAT_PHASE_FUNC
2.3.38.1. Description
2.3.38.2. Usage
2.3.38.3. Example
2.3.38.4. Hooking a Scattering Phase UDF to Ansys Fluent
2.3.39. DEFINE_SOLAR_INTENSITY
2.3.39.1. Description
2.3.39.2. Usage
2.3.39.3. Example
2.3.39.4. Hooking a Solar Intensity UDF to Ansys Fluent
2.3.40. DEFINE_SOLIDIFICATION_PARAMS
2.3.40.1. Description
2.3.40.2. Usage
2.3.40.3. Example
2.3.40.4. Hooking a Solidification Parameter UDF in Ansys Fluent
2.3.41. DEFINE_SOOT_MASS_RATES
2.3.41.1. Description
2.3.41.2. Usage
2.3.41.3. Example: Soot Mass Rate
2.3.41.4. Hooking a Soot Mass Rate UDF to Ansys Fluent
2.3.42. DEFINE_SOOT_MOM_RATES
2.3.42.1. Description
2.3.42.2. Usage
2.3.42.3. Example: Soot MOM Rates
2.3.42.4. Hooking a Soot MOM Rates UDF to Ansys Fluent
2.3.43. DEFINE_SOOT_NUCLEATION_RATES
2.3.43.1. Description
2.3.43.2. Usage
2.3.43.3. Example: Soot Nucleation and Coagulation Rates
2.3.43.4. Hooking a Nucleation and Coagulation Rates UDF to Ansys Fluent
2.3.44. DEFINE_SOOT_OXIDATION_RATE
2.3.44.1. Description
2.3.44.2. Usage
2.3.44.3. Example: Soot Oxidation Rate
2.3.44.4. Hooking a Soot Oxidation Rate UDF to Ansys Fluent
2.3.45. DEFINE_SOOT_PRECURSOR
2.3.45.1. Description
2.3.45.1.1. Usage
2.3.45.1.2. Example: Soot Precursor
2.3.45.1.3. Hooking a SOOT_PRECURSOR UDF to Ansys Fluent
2.3.46. DEFINE_SOURCE
2.3.46.1. Description
2.3.46.2. Usage
2.3.46.3. Example 1 - Source Term Addition
2.3.46.4. Example 2 - Degassing Boundary Condition
2.3.46.5. Hooking a Source UDF to Ansys Fluent
2.3.47. DEFINE_SPARK_GEOM (R14.5 spark model)
2.3.47.1. Description
2.3.47.2. Usage
2.3.47.3. Example
2.3.47.4. Hooking a Spark Geometry UDF to Ansys Fluent
2.3.48. DEFINE_SPECIFIC_HEAT
2.3.48.1. Description
2.3.48.2. Usage
2.3.48.3. Example
2.3.48.4. Hooking a Specific Heat UDF to Ansys Fluent
2.3.49. DEFINE_SR_RATE
2.3.49.1. Description
2.3.49.2. Usage
2.3.49.3. Example 1 - Surface Reaction Rate Using Species Mass Fractions
2.3.49.4. Example 2 - Surface Reaction Rate Using Site Species
2.3.49.5. Hooking a Surface Reaction Rate UDF to Ansys Fluent
2.3.50. DEFINE_THICKENED_FLAME_MODEL
2.3.50.1. Description
2.3.50.2. Usage
2.3.50.3. Example - Thickened Flame Model
2.3.50.4. Hooking a Thickened Flame Model UDF to Ansys Fluent
2.3.51. DEFINE_TRANS UDFs
2.3.51.1. DEFINE_TRANS_ALG_REC_COR
2.3.51.1.1. Description
2.3.51.1.2. Usage
2.3.51.1.3. Example
2.3.51.1.4. Hooking a UDF for Critical Reynolds Number to Ansys Fluent
2.3.51.2. DEFINE_TRANS_FLENGTH
2.3.51.3. Description
2.3.51.4. Usage
2.3.51.5. Example
2.3.51.6. Hooking a Transition Correlation UDF to Ansys Fluent
2.3.51.7. DEFINE_TRANS_GEOMRGH
2.3.51.8. Description
2.3.51.9. Usage
2.3.51.10. Example
2.3.51.11. Hooking a Transition Correlation UDF to Ansys Fluent
2.3.51.12. DEFINE_TRANS_RETHETA_C
2.3.51.13. Description
2.3.51.14. Usage
2.3.51.15. Example
2.3.51.16. Hooking a Transition Correlation UDF to Ansys Fluent
2.3.51.17. DEFINE_TRANS_RETHETA_T
2.3.51.18. Description
2.3.51.19. Usage
2.3.51.20. Example
2.3.51.21. Hooking a Transition Correlation UDF to Ansys Fluent
2.3.52. DEFINE_TRANSIENT_PROFILE
2.3.52.1. Description
2.3.52.2. Usage
2.3.52.3. Example
2.3.52.4. Hooking a Transient Profile UDF to Ansys Fluent
2.3.53. DEFINE_TURB_PREMIX_SOURCE
2.3.53.1. Description
2.3.53.2. Usage
2.3.53.3. Example
2.3.53.4. Hooking a Turbulent Premixed Source UDF to Ansys Fluent
2.3.54. DEFINE_TURB_SCHMIDT UDF
2.3.54.1. Description
2.3.54.2. Usage
2.3.54.3. Example
2.3.54.4. Hooking a Turbulent Schmidt Number UDF to Ansys Fluent
2.3.55. DEFINE_TURBULENT_VISCOSITY
2.3.55.1. Description
2.3.55.2. Usage
2.3.55.3. Example 1 - Single Phase Turbulent Viscosity UDF
2.3.55.4. Example 2 - Multiphase Turbulent Viscosity UDF
2.3.55.5. Hooking a Turbulent Viscosity UDF to Ansys Fluent
2.3.56. DEFINE_VR_RATE
2.3.56.1. Description
2.3.56.2. Usage
2.3.56.3. Example 1
2.3.56.4. Example 2
2.3.56.5. Hooking a Volumetric Reaction Rate UDF to Ansys Fluent
2.3.57. DEFINE_WALL_FUNCTIONS
2.3.57.1. Description
2.3.57.2. Usage
2.3.57.3. Example
2.3.57.4. Hooking a Wall Function UDF to Ansys Fluent
2.3.58. DEFINE_WALL_NODAL_DISP
2.3.58.1. Description
2.3.58.2. Usage
2.3.58.3. Example
2.3.59. DEFINE_WALL_NODAL_FORCE
2.3.59.1. Description
2.3.59.2. Usage
2.3.59.3. Example
2.3.60. DEFINE_SOURCE_FE
2.3.60.1. Description
2.3.60.2. Usage
2.3.60.3. Example
2.3.60.4. Hooking a Volumetric Structural Body Force UDF to Ansys Fluent
2.3.61. DEFINE_WSGGM_ABS_COEFF
2.3.61.1. Description
2.3.61.2. Usage
2.3.61.3. Example
2.3.61.4. Hooking a Wall Function UDF to Ansys Fluent
2.3.62. DEFINE_ZONE_MOTION
2.3.62.1. Description
2.3.62.2. Usage
2.3.62.3. Example
2.3.62.4. Hooking a Zone Motion 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. Example 3 - Custom Blending Factors for Flow Regime Modeling
2.4.7.6. 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. Example 5
2.5.1.8. 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 1
2.6.4.4. Example 2
2.6.4.5. Hooking a DEFINE_GRID_MOTION to Ansys Fluent
2.6.5. DEFINE_PERDISP_MOTION
2.6.5.1. Description
2.6.5.2. Usage
2.6.5.3. Example
2.6.5.4. Hooking a DEFINE_PERDISP_MOTION to Ansys Fluent
2.6.6. DEFINE_SDOF_PROPERTIES
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. Example 3
2.6.6.6. Hooking a DEFINE_SDOF_PROPERTIES UDF to Ansys Fluent
2.6.7. DEFINE_CONTACT
2.6.7.1. Description
2.6.7.2. Usage
2.6.7.3. Example 1
2.6.7.4. Example 2
2.6.7.5. Hooking a DEFINE_CONTACT UDF to Ansys Fluent
2.7. Battery Model DEFINE Macros
2.7.1. DEFINE_BATTERY_ABUSE_RATE
2.7.1.1. Description
2.7.1.2. Usage
2.7.1.3. Example
2.7.1.4. Hooking a DEFINE_BATTERY_ABUSE_RATE UDF to Ansys Fluent
2.7.2. DEFINE_BATTERY_CLUSTER
2.7.2.1. Description
2.7.2.2. Usage
2.7.2.3. Example
2.7.2.4. Hooking a DEFINE_BATTERY_CLUSTER UDF to Ansys Fluent
2.7.3. DEFINE_BATTERY_ECHEM_MODEL
2.7.3.1. Description
2.7.3.2. Usage
2.7.3.3. Example
2.7.3.4. Hooking a DEFINE_BATTERY_ECHEM_MODEL UDF to Ansys Fluent
2.7.4. DEFINE_BATTERY_ELOAD_PROFILE
2.7.4.1. Description
2.7.4.2. Usage
2.7.4.3. Example 1
2.7.4.4. Example 2
2.7.4.5. Hooking a DEFINE_BATTERY_ELOAD_PROFILE UDF to Ansys Fluent
2.7.5. DEFINE_BATTERY_ENTROPIC_HEAT
2.7.5.1. Description
2.7.5.2. Usage
2.7.5.3. Example
2.7.5.4. Hooking a DEFINE_BATTERY_ENTROPIC_HEAT UDF to Ansys Fluent
2.7.6. DEFINE_BATTERY_NEWMAN_BV_RATE
2.7.6.1. Description
2.7.6.2. Usage
2.7.6.3. Example
2.7.6.4. Hooking a DEFINE_BATTERY_NEWMAN_BV_RATE UDF to Ansys Fluent
2.7.7. DEFINE_BATTERY_NEWMAN_POSTPROCESSING
2.7.7.1. Description
2.7.7.2. Usage
2.7.7.3. Example
2.7.7.4. Hooking a DEFINE_BATTERY_NEWMAN_POSTPROCESSING UDF to Ansys Fluent
2.7.8. DEFINE_BATTERY_PARAMETER_ECM
2.7.8.1. Description
2.7.8.2. Usage
2.7.8.3. Example
2.7.8.4. Hooking a DEFINE_BATTERY_PARAMETER_ECM UDF to Ansys Fluent
2.7.9. DEFINE_BATTERY_PARAMETER_NTGK
2.7.9.1. Description
2.7.9.2. Usage
2.7.9.3. Example
2.7.9.4. Hooking a DEFINE_BATTERY_PARAMETER_NTGK UDF to Ansys Fluent
2.7.10. DEFINE_BATTERY_PROPERTY
2.7.10.1. Description
2.7.10.2. Usage
2.7.10.3. Example
2.7.10.4. Hooking a DEFINE_BATTERY_PROPERTY UDF to Ansys Fluent
2.7.11. DEFINE_BATTERY_SWELL_LAYER_N
2.7.11.1. Description
2.7.11.2. Usage
2.7.11.3. Example
2.7.11.4. Hooking a DEFINE_BATTERY_SWELL_LAYER_N UDF to Ansys Fluent
2.7.12. DEFINE_BATTERY_SWELL_STRAIN
2.7.12.1. Description
2.7.12.2. Usage
2.7.12.3. Example
2.7.12.4. Hooking a DEFINE_BATTERY_PROPERTY UDF to Ansys Fluent
2.8. User-Defined Scalar (UDS) Transport Equation DEFINE Macros
2.8.1. Introduction
2.8.1.1. Diffusion Coefficient UDFs
2.8.1.2. Flux UDFs
2.8.1.3. Unsteady UDFs
2.8.1.4. Source Term UDFs
2.8.1.5. Fixed Value Boundary Condition UDFs
2.8.1.6. Wall, Inflow, and Outflow Boundary Condition UDFs
2.8.2. DEFINE_ANISOTROPIC_DIFFUSIVITY
2.8.2.1. Description
2.8.2.2. Usage
2.8.2.3. Example
2.8.2.4. Hooking an Anisotropic Diffusivity UDF to Ansys Fluent
2.8.3. DEFINE_UDS_FLUX
2.8.3.1. Description
2.8.3.2. Usage
2.8.3.3. Example
2.8.3.4. Hooking a UDS Flux Function to Ansys Fluent
2.8.4. DEFINE_UDS_UNSTEADY
2.8.4.1. Description
2.8.4.2. Usage
2.8.4.3. Example
2.8.4.4. Hooking a UDS Unsteady Function to Ansys Fluent
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. Multiphase Model Macros
3.2.3.13. Potential/Electrochemistry Model Macros
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. Dynamic Mesh Macros
3.2.8.4. Battery Model 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
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
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
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_CAPILLARY_PRESSURE UDFs
6.2.3. Hooking DEFINE_CHEM_STEP UDFs
6.2.4. Hooking DEFINE_CPHI UDFs
6.2.5. Hooking DEFINE_DIFFUSIVITY UDFs
6.2.6. Hooking DEFINE_DOM_DIFFUSE_REFLECTIVITY UDFs
6.2.7. Hooking DEFINE_DOM_SOURCE UDFs
6.2.8. Hooking DEFINE_DOM_SPECULAR_REFLECTIVITY UDFs
6.2.9. Hooking DEFINE_EC_RATE UDFs
6.2.10. Hooking DEFINE_EC_KINETICS_PARAMETER UDFs
6.2.11. Hooking DEFINE_EDC_MDOT UDFs
6.2.12. Hooking DEFINE_EDC_SCALES UDFs
6.2.13. Hooking DEFINE_ELECTROLYSIS_ECHEM_RATE UDFs
6.2.14. Hooking DEFINE_ELECTROLYSIS_RELATIVE_PERMEABILITY UDFs
6.2.15. Hooking DEFINE_EMISSIVITY_WEIGHTING_FACTOR UDFs
6.2.16. Hooking DEFINE_FLAMELET_PARAMETERS UDFs
6.2.17. Hooking DEFINE_GAP_MODEL_SOURCE UDFs
6.2.18. Hooking DEFINE_GEOMETRY UDFs
6.2.19. Hooking DEFINE_GRAY_BAND_ABS_COEFF UDFs
6.2.20. Hooking DEFINE_HEAT_FLUX UDFs
6.2.21. Hooking DEFINE_IGNITE_SOURCE UDFs
6.2.22. Hooking DEFINE_MASS_TR_PROPERTY UDFs
6.2.23. Hooking DEFINE_NET_REACTION_RATE UDFs
6.2.24. Hooking DEFINE_NOX_RATE UDFs
6.2.25. Hooking DEFINE_PERFORATED_CD UDFs
6.2.26. Hooking DEFINE_PDF_TABLE UDFs
6.2.27. Hooking DEFINE_PR_RATE UDFs
6.2.28. Hooking DEFINE_PRANDTL UDFs
6.2.29. Hooking DEFINE_PROFILE UDFs
6.2.29.1. Hooking Profiles for UDS Equations
6.2.30. Hooking DEFINE_PROPERTY UDFs
6.2.31. Hooking DEFINE_REACTING_CHANNEL_BC UDFs
6.2.32. Hooking DEFINE_REACTING_CHANNEL_SOLVER UDFs
6.2.33. Hooking DEFINE_RELAX_TO_EQUILIBRIUM UDFs
6.2.34. Hooking DEFINE_SBES_BF UDFs
6.2.35. Hooking DEFINE_SCAT_PHASE_FUNC UDFs
6.2.36. Hooking DEFINE_SOLAR_INTENSITY UDFs
6.2.37. Hooking DEFINE_SOLIDIFICATION_PARAMS UDFs
6.2.38. Hooking DEFINE_SOURCE UDFs
6.2.39. Hooking DEFINE_SOOT_MASS_RATES UDFs
6.2.40. Hooking DEFINE_SOOT_MOM_RATES UDFs
6.2.41. Hooking DEFINE_SOOT_NUCLEATION_RATES UDFs
6.2.42. Hooking DEFINE_SOOT_OXIDATION_RATE UDFs
6.2.43. Hooking DEFINE_SOOT_PRECURSOR UDFs
6.2.44. Hooking DEFINE_SPARK_GEOM UDFs
6.2.45. Hooking DEFINE_SPECIFIC_HEAT UDFs
6.2.46. Hooking DEFINE_SR_RATE UDFs
6.2.47. Hooking DEFINE_THICKENED_FLAME_MODEL UDFs
6.2.48. Hooking DEFINE_TRANS UDFs
6.2.49. Hooking DEFINE_TRANSIENT_PROFILE UDFs
6.2.50. Hooking DEFINE_TURB_PREMIX_SOURCE UDFs
6.2.51. Hooking DEFINE_TURB_SCHMIDT UDFs
6.2.52. Hooking DEFINE_TURBULENT_VISCOSITY UDFs
6.2.53. Hooking DEFINE_VR_RATE UDFs
6.2.54. Hooking DEFINE_WALL_FUNCTIONS UDFs
6.2.55. Hooking DEFINE_SOURCE_FE UDFs
6.2.56. Hooking DEFINE_WSGGM_ABS_COEFF UDFs
6.2.57. Hooking DEFINE_ZONE_MOTION 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. Hooking Battery Model UDFs
6.8. Common Errors While Hooking a UDF to Ansys Fluent
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)
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
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
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
B.7. Battery Model DEFINE Macros
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
II. Creating Custom User Interfaces in Fluent
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
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. Task Pages (cx-create-taskpage)
2.2.1. Description
2.2.2. Usage
2.2.2.1. cx-create-taskpage
2.2.2.2. cx-show-taskpage
2.2.3. Examples
2.2.3.1. Example One
2.2.3.2. Example Two
2.2.3.3. Additional Examples
2.3. Tables (cx-create-table)
2.3.1. Description
2.3.2. Usage
2.3.3. Examples
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
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
5. Comprehensive Examples
5.1. Dialog Box Example
5.2. Task Page Example
5.3. Example Menu Added to the Right of the Ribbon Tabs
5.4. UDF Example
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
B. Reference Table For Fluent Macros