2.3.4.  DEFINE_DIFFUSIVITY

2.3.4.1. Description

You can use DEFINE_DIFFUSIVITY to specify the diffusivity for the species transport equations (for example, mass diffusivity) or for user-defined scalar (UDS) transport equations. For details about UDS diffusivity, see User-Defined Scalar (UDS) Diffusivity in the User’s Guide.

2.3.4.2. Usage

DEFINE_DIFFUSIVITY (name, c, t, i)

Argument Type

Description

symbol name

UDF name.

cell_t c

Cell index.

Thread *t

Pointer to cell thread on which the diffusivity function is to be applied.

int i

Index that identifies the species or user-defined scalar.

Function returns

real

There are four arguments to DEFINE_DIFFUSIVITY: name, c, and t, and i. You supply name, the name of the UDF. c, t, and i are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to compute the diffusivity only for a single cell and return the real value to the solver.

Note that diffusivity UDFs are called by ANSYS Fluent from within a loop on cell threads. Consequently, your UDF will not need to loop over cells in a thread since ANSYS Fluent is doing it outside of the function call.

2.3.4.3. Example

The following UDF, named mean_age_diff, computes the diffusivity for the mean age of air using a user-defined scalar. Note that the mean age of air calculations do not require that energy, radiation, or species transport calculations have been performed. You will need to set uds-0 = at all inlets and outlets in your model. This function can be executed as an interpreted or compiled UDF.

/**********************************************************************
   UDF that computes diffusivity for mean age using a user-defined
   scalar.
 ***********************************************************************/
 
 #include "udf.h"
 
 DEFINE_DIFFUSIVITY(mean_age_diff,c,t,i)
 {
    return C_R(c,t) * 2.88e-05 + C_MU_EFF(c,t) / 0.7;
 } 

2.3.4.4. Hooking a Diffusivity UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_DIFFUSIVITY is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name that you specified in the DEFINE macro argument (for example, mean_age_diff) will become visible and selectable in the Create/Edit Materials dialog box in ANSYS Fluent. See Hooking DEFINE_DIFFUSIVITY UDFs for details.


Release 18.2 - © ANSYS, Inc. All rights reserved.