9.1. User-Defined Scalar (UDS) Transport Equations

9.1.1. Introduction

Ansys Fluent can solve the transport equation for an arbitrary, user-defined scalar (UDS) in the same way that it solves the transport equation for a scalar such as species mass fraction. Extra scalar transport equations may be needed in certain types of combustion applications or for example in plasma-enhanced surface reaction modeling. Ansys Fluent allows you to define additional scalar transport equations in your model in the User-Defined Scalars Dialog Box.

9.1.2. UDS Theory

UDS theory is described in the following sections:

9.1.2.1. Single Phase Flow

For an arbitrary scalar , Ansys Fluent solves the equation

(9–1)

where and are the diffusion coefficient and source term supplied by you for each of the scalar equations. Note that is defined as a tensor in the case of anisotropic diffusivity. The diffusion term is therefore

For isotropic diffusivity, could be written as where I is the identity matrix.

For the steady-state case, Ansys Fluent will solve one of the three following equations, depending on the method used to compute the convective flux:

  • If convective flux is not to be computed, Ansys Fluent will solve the equation

    (9–2)

    where and are the diffusion coefficient and source term supplied by you for each of the scalar equations.

  • If convective flux is to be computed with mass flow rate, Ansys Fluent will solve the equation

    (9–3)

  • It is also possible to specify a user-defined function to be used in the computation of convective flux. In this case, the user-defined mass flux is assumed to be of the form

    (9–4)

where is the face vector area.


Important:  User-defined scalars in solid zones do not take into account the convective term with moving reference frames.


9.1.2.2. Multiphase Flow

For multiphase flows, Ansys Fluent solves transport equations for two types of scalars:   per phase and mixture. For an arbitrary scalar in phase-l, denoted by , Ansys Fluent solves the transport equation inside the volume occupied by phase-l

(9–5)

where , , and are the volume fraction, physical density, and velocity of phase-l, respectively. and are the diffusion coefficient and source term, respectively, which you will need to specify. In this case, scalar is associated only with one phase (phase-l) and is considered an individual field variable of phase-l.

The mass flux for phase-l is defined as

(9–6)

If the transport variable described by scalar represents the physical field that is shared between phases, or is considered the same for each phase, then you should consider this scalar as being associated with a mixture of phases, . In this case, the generic transport equation for the scalar is

(9–7)

where mixture density , mixture velocity , and mixture diffusivity for the scalar are calculated according to

(9–8)

(9–9)

(9–10)

(9–11)

(9–12)

To calculate mixture diffusivity, you must specify individual diffusivities for each material associated with individual phases.

Note that if the user-defined mass flux option is activated, then mass fluxes shown in Equation 9–6 and Equation 9–10 must be replaced in the corresponding scalar transport equations. For more information about the theoretical background of user-defined scalar transport equations, see User-Defined Scalar (UDS) Transport Equations in the Theory Guide.

9.1.3. Setting Up UDS Equations in Ansys Fluent

Ansys Fluent allows you to define up to user-defined scalar (UDS) transport equations in your model. The general scalar transport equation, Equation 1–8 in the Theory Guide, is shown below with the four terms (transient, flux, diffusivity, source) that you can customize. (Equation 9–13). You will define a UDS transport equation by setting the parameters for these four terms.

(9–13)

In addition, you can set boundary conditions for the variables within cells of a fluid or solid zone for a particular scalar equation. This is done by fixing the value of in Equation 9–13. When is fixed in a given cell, the UDS scalar transport is not solved and the cell is not included when the residual sum is computed. Additionally, you can also specify custom boundary conditions in the mixture on all wall, inflow, and outflow boundaries on a per-scalar basis.

The procedures for setting up a user-defined scalar (UDS) equation for single-phase and multiphase flows are outlined below. Note that a significant difference between a UDS for a single-phase versus a multiphase application is that you must associate each UDS with its corresponding phase domain or mixture domain, depending on your application. If you supply UDFs for transient terms, convective fluxes, and sources, you must be aware that they are directly called from the phase or mixture domains, according to the scalar association settings.

When setting up a UDS, ensure that the scalar transport problem is well defined with proper Dirichlet/Neumann boundary conditions. Depending on the nature of the problem, the UDS equation may need to converge further than the default convergence criterion of 0.1. Set the convergence criterion according to your needs.

In some instances, the residuals may not reflect the quality of the solution. In these cases you should create monitors on the UDS and use these monitors to judge solution convergence. There are several controls that you can adjust to improve convergence, however some of these adjustments can increase the computation time. The following controls can help with convergence:

  • Using a fixed cycle, such as F-Cycle in place of Flexible cycle in the Advanced Solution Controls dialog box.

  • Using an additional stabilizer such as the Biconjugate gradient stabilization method.

  • Using an ILU smoother.

  • Increasing the pre- and post-sweeps available in the Advanced Solution Controls dialog box.

  • Adjusting the under relaxation factors.

See the Fluent Customization Manual for information on using UDFs to define scalar quantities.

9.1.3.1. Single Phase Flow

  1. Specify the number of UDS equations you require in the User-Defined Scalars Dialog Box (Figure 9.1: The User-Defined Scalars Dialog Box).

     Parameters & Customization User Defined Scalars  New...


    Important:  The maximum number of user-defined scalar transport equations you can define is 50. Ansys Fluent assigns numbers to the equations starting with .



    Important:  Note that Ansys Fluent assigns a default name for each scalar equation (User Scalar 0, User Scalar 1, and so on). These labels will appear in graphics dialog boxes in Ansys Fluent. You can change them by means of a UDF. See the Fluent Customization Manual for details.


    Figure 9.1: The User-Defined Scalars Dialog Box

    The User-Defined Scalars Dialog Box

  2. Enable Inlet Diffusion if you want to include the diffusion term in the UDS transport equation for all inflow and outflow boundaries.

  3. Set the first user-defined scalar equation parameters by making sure that the UDS Index is set to .

    1. Specify the Solution Zones you want the scalar equation to be solved in as all fluid zones, all solid zones, all zones (fluid and solid) or selected zones. If you choose selected zones, click the Edit button to view the list of zones you can select.

    2. Specify the Flux Function to be none, mass flow rate, or a user-defined function (UDF). The Flux Function determines how the convective flux is computed, which determines the equation that Ansys Fluent solves for the user-defined scalar. Selecting none, mass flow rate, or a user-defined function results in Ansys Fluent solving Equation 1–9, Equation 1–10, or Equation 1–11, respectively (in the Theory Guide). See the Fluent Customization Manual for details on flux UDFs.

    3. Specify the Unsteady Function to be none, default, or a user-defined function (UDF). Select none for a steady state solution and default if you want the transient term in Equation 1–8 in the Theory Guide). See the separate Fluent Customization Manual for details on unsteady UDFs.

    4. Repeat this process for each scalar equation by incrementing the UDS Index.

    5. Click OK when all user scalar equations have been defined.

  4. To specify source term(s) for each of the UDS equations, enable the Source Terms option in the Fluid or Solid dialog box (Figure 9.2: The Fluid Dialog Box with Inputs for Source Terms for a User-Defined Scalar) and click the Source Terms tab. The source parameters will be displayed.

     Setup   Cell Zone Conditions

    Figure 9.2: The Fluid Dialog Box with Inputs for Source Terms for a User-Defined Scalar

    The Fluid Dialog Box with Inputs for Source Terms for a User-Defined Scalar

    1. Specify the number of sources you require for each scalar equation by clicking on the Edit... button next to the scalar name (for example, User Scalar 0). This will open the User Scalar 0 sources dialog box (Figure 9.3: The User Scalar Sources Dialog Box).

      Figure 9.3: The User Scalar Sources Dialog Box

      The User Scalar Sources Dialog Box

    2. Specify the Number of User Scalar Sources for the scalar equation by incrementing the counter. Based on the value you have chosen, the sources will be added to the list in the dialog box. Specify each source to be none, constant, or a user-defined function (UDF). For details on defining a UDF scalar source, see the Fluent Customization Manual. Click OK when you have specified all scalar sources.

  5. To specify diffusivity for each of the UDS equations, display the Materials Task Page (Figure 9.4: The Materials Dialog Box with Input for Diffusivity for UDS Equations) and select either defined-per-uds (the default) or user-defined in the drop-down list for UDS Diffusivity.

     Setup   Materials Create/Edit

    Figure 9.4: The Materials Dialog Box with Input for Diffusivity for UDS Equations

    The Materials Dialog Box with Input for Diffusivity for UDS Equations

    See User-Defined Scalar (UDS) Diffusivity for details on the different options available to you for defining diffusion coefficients.

  6. To specify boundary conditions for the user-defined scalars on wall, inflow, and outflow boundaries, you can define a specific value or a specific flux for each scalar. A coupled boundary condition can be specified on two-sided walls for scalars that are to be solved in regions on both sides of the wall (that is, scalars solved in both fluid and solid zones).

     Setup   Boundary Conditions

    1. In the UDS tab under User Defined Scalar Boundary Condition, select either Specified Flux or Specified Value in the drop-down list next to each scalar (for example, User Scalar 0) for a boundary wall. For interior walls, select Coupled Boundary if the scalars are to be solved on both sides of a two-sided wall. Note that the Coupled Boundary option will only show up in the drop-down list if the scalar is defined in the fluid and solid zones in the User-Defined Scalars Dialog Box.

    2. Under User Defined Scalar Boundary Value, enter a constant value or select a user-defined function from the drop-down list for each scalar. If you select Specified Flux, your input will be the value of the flux at the boundary (that is, the negative of the term in parenthesis on the left-hand side of in the Theory Guide) dot [as in the dot product of] [as in the vector, n], where is the normal into the domain). If you select Specified Value, your input will be the value of the scalar itself at the boundary. See the Fluent Customization Manual for information on using UDFs for UDS boundary conditions.

  7. Set the solution parameters in the Solution Controls task page, specify an initial value for each UDS (as you do for all other scalar transport equations), and calculate a solution.

  8. Examine the results using the usual postprocessing tools. In each postprocessing dialog box, the list of field variables will include the User Defined Scalars... category, which contains the value of each UDS and its diffusion coefficient ( in Equation 1–8, Equation 1–9, Equation 1–10, or Equation 1–11 (in the Theory Guide):

    • User Scalar-n

    • Diffusion Coef. of Scalar-n

9.1.3.2. Multiphase Flow

  1. Specify the number of scalars in the User-Defined Scalars Dialog Box (Figure 9.5: The User-Defined Scalars Dialog Box for a Multiphase Flow).

     Parameters & Customization User Defined Scalars  New...

    Figure 9.5: The User-Defined Scalars Dialog Box for a Multiphase Flow

    The User-Defined Scalars Dialog Box for a Multiphase Flow


    Important:  The maximum number of user-defined scalar transport equations you can define is 50. Ansys Fluent assigns numbers to the equations starting with . The default association type is set to mixture for all scalars.



    Important:  Note that Ansys Fluent assigns a default name for each scalar equation (User Scalar 0, User Scalar 1, and so on). These labels will appear in graphics dialog boxes in Ansys Fluent. You can change them by means of a UDF. See the Fluent Customization Manual for details.


  2. Keep the default Inlet Diffusion enabled if you want to include the diffusion term in the UDS transport equation for all inflow and outflow boundaries.

  3. Set the first user-defined scalar equation parameters by making sure that the UDS Index is set to .

    1. Select the Phase you want the scalar equation solved in as a primary phase, secondary phase, or the mixture.

    2. Specify the Solution Zones you want the scalar equation to be solved in as all fluid zones, all solid zones, all zones (fluid and solid) or selected zones. If you choose selected zones, click the Edit button to view the list of zones you can select.

    3. Specify the Flux Function to Unsteady Function the same way as you would for a single phase flow (see above).

    4. Repeat this process for each scalar equation by incrementing the UDS Index.

    5. Click OK when all user scalar equations have been defined.

  4. Specify source term(s) for each of the UDS equations in the Fluid or Solid dialog box as described for a single phase flow (see above).

  5. Specify boundary conditions for the user-defined scalars in the mixture on all wall, inflow, and outflow boundary as described for a single phase flow (see above).

  6. Set the solution parameters, specify an initial value for each UDS (as you do for all other scalar transport equations), and calculate a solution.