6.6. Hooking User-Defined Scalar (UDS) Transport Equation UDFs

This section contains methods for hooking anisotropic diffusion coefficient, flux, and unsteady UDFs for scalar equations that have been defined using DEFINE macros described in User-Defined Scalar (UDS) Transport Equation DEFINE Macros and interpreted or compiled using methods described in Interpreting UDFs or Compiling UDFs, respectively. See Hooking DEFINE_PROFILE UDFs, Hooking DEFINE_SOURCE UDFs, and Hooking DEFINE_DIFFUSIVITY UDFs to hook scalar source term, profile, or isotropic diffusion coefficient UDFs.

6.6.1. Hooking DEFINE_ANISOTROPIC_DIFFUSIVITY UDFs

After you have interpreted (Interpreting UDFs) or compiled (Compiling UDFs) your DEFINE_ANISOTROPIC_DIFFUSIVITY UDF, the name of the function you supplied as the first DEFINE macro argument will become visible and selectable in Ansys Fluent.

To hook the UDF to Ansys Fluent, you will first need to open the User-Defined Scalars dialog box.

 Parameters & Customization User Defined Scalars  Edit...

In the User-Defined Scalars dialog box, specify the Number of User-Defined Scalars (for example, 2) and click OK. Next, open the Materials task page.

 Setup   Materials

Select one of the materials in the Materials list and click Create/Edit... to open the Create/Edit Materials dialog box (Figure 6.121: The Create/Edit Materials Dialog Box).

Figure 6.121: The Create/Edit Materials Dialog Box

The Create/Edit Materials Dialog Box

Scroll down the Properties group box in the Create/Edit Materials dialog box (Figure 6.121: The Create/Edit Materials Dialog Box), and select defined-per-uds from the UDS Diffusivity drop-down list. This will open the UDS Diffusion Coefficients dialog box (Figure 6.122: The UDS Diffusion Coefficients Dialog Box).

Figure 6.122: The UDS Diffusion Coefficients Dialog Box

The UDS Diffusion Coefficients Dialog Box

In the UDS Diffusion Coefficients dialog box, select a scalar equation (for example, uds-0) and select user-defined-anisotropic from the drop-down list under Coefficient. This will open the User-Defined Functions dialog box. Select the name of the UDF (for example, cyl_ortho_diff::libudf) you want to hook, and click OK. The name of the UDF will be displayed in the field below the Coefficient drop-down list in the UDS Diffusion Coefficients dialog box. Click OK, and then click Change/Create in the Create/Edit Materials dialog box.

Note that you can hook a unique diffusion coefficient UDF for each scalar transport equation you have defined in your model.

See DEFINE_ANISOTROPIC_DIFFUSIVITY for details about defining DEFINE_ANISOTROPIC_DIFFUSIVITY UDFs and the User's Guide for general information about UDS anisotropic diffusivity.

6.6.2. Hooking DEFINE_UDS_FLUX UDFs

After you have interpreted (Interpreting UDFs) or compiled (Compiling UDFs) your DEFINE_UDS_FLUX UDF, the name of the argument that you supplied as the first DEFINE macro argument will become visible and selectable in the User-Defined Scalars dialog box (Figure 6.123: The User-Defined Scalars Dialog Box) in Ansys Fluent.

 Parameters & Customization User Defined Scalars  Edit...

Figure 6.123: The User-Defined Scalars Dialog Box

The User-Defined Scalars Dialog Box

To hook the UDF to Ansys Fluent, first specify the Number of User-Defined Scalars (for example, 2) in the User-Defined Scalars dialog box (Figure 6.123: The User-Defined Scalars Dialog Box). As you enter the number of user-defined scalars, the dialog box will expand to show the User-Defined Scalars Options group box. Next, for each scalar you have defined, increment the UDS Index and select the Solution Zones (for example, all fluid zones) and the name of the function (for example, my_uds_flux::libudf) from the Flux Function drop-down list, and click OK.


Note:  Only fluid zones should be selected from the Solution Zones drop-down list, as DEFINE_UDS_FLUX UDFs cannot be used to calculate convective flux in solid zones.


6.6.3. Hooking DEFINE_UDS_UNSTEADY UDFs

After you have interpreted (Interpreting UDFs) or compiled (Compiling UDFs) your DEFINE_UDS_UNSTEADY UDF, the name of the argument that you supplied as the first DEFINE macro argument will become visible and selectable in the User-Defined Scalars dialog box in Ansys Fluent.


Important:  Make sure that you have selected Transient from the Time list in the Solver group box of the General task page.


To hook the UDF to Ansys Fluent, first open the User-Defined Scalars dialog box.

 Parameters & Customization User Defined Scalars  Edit...

Figure 6.124: The User-Defined Scalars Dialog Box

The User-Defined Scalars Dialog Box

In the User-Defined Scalars dialog box (Figure 6.124: The User-Defined Scalars Dialog Box), specify the Number of User-Defined Scalars (for example, 2) in the User-Defined Scalars dialog box (Figure 6.124: The User-Defined Scalars Dialog Box). As you enter the number of user-defined scalars, the dialog box will expand to show the User-Defined Scalars Options group box. Next, for each scalar you have defined, increment the UDS Index and select the Zone Type and the Flux Function. Then select the name of your UDF (for example, my_uds_unsteady::libudf) from the Unsteady Function drop-down list, and click OK.