![](https://csdnimg.cn/release/download_crawler_static/76146726/bg13.jpg)
3.4.4. Vector Operation Macros ................................................................................................ 383
3.4.4.1.Vector Magnitude Using NV_MAG and NV_MAG2 ................................................... 383
3.4.4.2. Dot Product ........................................................................................................... 383
3.4.4.3. Cross Product ........................................................................................................ 384
3.5.Time-Dependent Macros ......................................................................................................... 384
3.6. Scheme Macros ...................................................................................................................... 386
3.6.1. Defining a Scheme Variable in the Text Interface ............................................................. 386
3.6.2. Accessing a Scheme Variable in the Text Interface ........................................................... 387
3.6.3. Changing a Scheme Variable to Another Value in the Text Interface ................................. 387
3.6.4. Accessing a Scheme Variable in a UDF ............................................................................. 387
3.7. Input/Output Functions .......................................................................................................... 388
3.7.1. Message ...................................................................................................................... 389
3.7.2. Error .......................................................................................................................... 389
3.7.3.The par_fprintf_head and par_fprintf Functions ............................................. 390
3.7.3.1. par_fprintf_head ......................................................................................... 390
3.7.3.2. par_fprintf .................................................................................................... 390
3.8. Miscellaneous Macros ............................................................................................................. 391
3.8.1. Data_Valid_P() ...................................................................................................... 391
3.8.2. FLUID_THREAD_P() .................................................................................................. 391
3.8.3. Get_Report_Definition_Values ....................................................................... 392
3.8.4. M_PI ............................................................................................................................ 394
3.8.5. NULLP & NNULLP ...................................................................................................... 394
3.8.6. N_UDM .......................................................................................................................... 395
3.8.7. N_UDS .......................................................................................................................... 395
3.8.8. SQR(k) ........................................................................................................................ 395
3.8.9. UNIVERSAL_GAS_CONSTANT ..................................................................................... 395
4. Interpreting UDFs .......................................................................................................................... 397
4.1. Introduction ........................................................................................................................... 397
4.1.1. Location of the udf.h File ............................................................................................. 397
4.1.2. Limitations ..................................................................................................................... 398
4.2. Interpreting a UDF Source File Using the Interpreted UDFs Dialog Box ..................................... 399
4.3. Common Errors Made While Interpreting A Source File ............................................................ 401
5. Compiling UDFs ............................................................................................................................. 403
5.1. Introduction ........................................................................................................................... 404
5.1.1. Location of the udf.h File ............................................................................................. 405
5.1.2. Compilers ...................................................................................................................... 405
5.2. Compiling a UDF Using the GUI ............................................................................................... 407
5.3. Compile a UDF Using the TUI ................................................................................................... 411
5.3.1. Set Up the Directory Structure ........................................................................................ 412
5.3.1.1. Windows Systems .................................................................................................. 412
5.3.1.2. Linux Systems ........................................................................................................ 413
5.3.2. Build the UDF Library ..................................................................................................... 415
5.3.2.1. Windows Systems .................................................................................................. 415
5.3.2.2. Linux Systems ........................................................................................................ 417
5.3.3. Load the UDF Library ...................................................................................................... 418
5.4. Link Precompiled Object Files From Non-Ansys Fluent Sources ................................................ 418
5.4.1.Windows Systems ........................................................................................................... 418
5.4.2. Linux Systems ................................................................................................................ 419
5.4.3. Example: Link Precompiled Objects to Ansys Fluent ........................................................ 420
5.5. Load and Unload Libraries Using the UDF Library Manager Dialog Box ..................................... 423
5.5.1. Load the UDF Library ...................................................................................................... 423
xix
Release 2022 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Customization Manual