2.3.22.  DEFINE_PRANDTL UDFs

The following DEFINE macros can be used to specify Prandtl numbers in ANSYS Fluent, for single-phase flows.

2.3.22.1.  DEFINE_PRANDTL_D

2.3.22.2. Description

You can use DEFINE_PRANDTL_D to specify Prandtl numbers for turbulent dissipation ().

2.3.22.3. Usage

DEFINE_PRANDTL_D (name, c, t)

Argument Type

Description

symbol name

UDF name.

cell_t c

Index of cell on which the Prandtl number function is to be applied.

Thread *t

Pointer to cell thread.

Function returns

real

There are three arguments to DEFINE_PRANDTL_D: name, c, and t. You supply name, the name of the UDF. c and t are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to return the real value for the turbulent dissipation Prandtl number to the solver.

2.3.22.4. Example

An example of a DEFINE_Prandtl_D UDF is provided below in the source listing for DEFINE_PRANDTL_K.

2.3.22.5. Hooking a Prandtl Number UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_PRANDTL_D is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_pr_d) will become visible and selectable in the Viscous Model dialog box in ANSYS Fluent. See Hooking DEFINE_PRANDTL UDFs for details.

2.3.22.6.  DEFINE_PRANDTL_K

2.3.22.7. Description

You can use DEFINE_PRANDTL_K to specify Prandtl numbers for turbulence kinetic energy ().

2.3.22.8. Usage

DEFINE_PRANDTL_K (name, c, t)

Argument Type

Description

symbol name

UDF name.

cell_t c

Index that identifies the cell on which the Prandtl number function is to be applied.

Thread *t

Pointer to cell thread.

Function returns

real

There are three arguments to DEFINE_PRANDTL_K: name, c, and t. You supply name, the name of the UDF. c and t are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to return the real value for the kinetic energy Prandtl number to the solver.

2.3.22.9. Example

The following UDF implements a high-Re version of the RNG model, using the - option that is activated in ANSYS Fluent.

Three steps are required:

  1. Set Cmu, C1eps, and C2eps as in the RNG model.

  2. Calculate Prandtl numbers for and using the UDF.

  3. Add the -r source term in the equation.

In the RNG model, diffusion in and equations appears as

while in the standard - model, it is given by

For the new implementation, a UDF is needed to define a Prandtl number as

in order to achieve the same implementation as the original RNG Model.

The following functions (which are concatenated into a single C source code file) demonstrate this usage. Note that the source code must be executed as a compiled UDF.

#include "udf.h"
 
 DEFINE_PRANDTL_K(user_pr_k,c,t)
 {
    real pr_k, alpha;
    real mu = C_MU_L(c,t);
    real mu_t = C_MU_T(c,t);

    alpha = rng_alpha(1., mu + mu_t, mu);

    pr_k = mu_t/((mu+mu_t)*alpha-mu);

    return pr_k;
 }
 
 DEFINE_PRANDTL_D(user_pr_d,c,t)
 {
    real pr_d, alpha;
    real mu = C_MU_L(c,t);
    real mu_t = C_MU_T(c,t);

    alpha = rng_alpha(1., mu + mu_t, mu);

    pr_d = mu_t/((mu+mu_t)*alpha-mu);

    return pr_d;
 }
 
 DEFINE_SOURCE(eps_r_source,c,t,dS,eqn)
 {
    real con, source;
    real mu = C_MU_L(c,t);
    real mu_t = C_MU_T(c,t);
    real k  = C_K(c,t);  real d  = C_D(c,t);
    real prod = C_PRODUCTION(c,t);

    real s = sqrt(prod/(mu+ mu_t)) ;
    real eta  = s*k/d;
    real eta_0 = 4.38;
    real term = mu_t*s*s*s/(1.0 + 0.012*eta*eta*eta);

    source = - term * (1. - eta/eta_0);
    dS[eqn] = - term/d;

    return source;
 } 

2.3.22.10. Hooking a Prandtl Number UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_PRANDTL_K is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_pr_k) will become visible and selectable in the Viscous Model dialog box in ANSYS Fluent. See Hooking DEFINE_PRANDTL UDFs for details.

2.3.22.11.  DEFINE_PRANDTL_O

2.3.22.12. Description

You can use DEFINE_PRANDTL_O to specify Prandtl numbers for specific dissipation ( in the - model).

2.3.22.13. Usage

DEFINE_PRANDTL_O (name, c, t)

Argument Type

Description

symbol name

UDF name.

cell_t c

Index that identifies the cell on which the Prandtl number function is to be applied.

Thread *t

Pointer to cell thread.

Function returns

real

There are three arguments to DEFINE_PRANDTL_O: name, c, and t. You supply name, the name of the UDF. c and t are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to return the real value for the specific dissipation Prandtl number to the solver.

2.3.22.14. Example

/* Specifying a Constant Specific Dissipation Prandtl Number */
 #include "udf.h"
 
 DEFINE_PRANDTL_O(user_pr_o,c,t)
 {
    real pr_o;
    pr_o = 2.;
    return pr_o;
 } 

2.3.22.15. Hooking a Prandtl Number UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_PRANDTL_O is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_pr_o) will become visible and selectable in the Viscous Model dialog box in ANSYS Fluent. See Hooking DEFINE_PRANDTL UDFs for details.

2.3.22.16.  DEFINE_PRANDTL_T

2.3.22.17. Description

You can use DEFINE_PRANDTL_T to specify Prandtl numbers that appear in the temperature equation diffusion term.

2.3.22.18. Usage

DEFINE_PRANDTL_T (name, c, t)

Argument Type

Description

symbol name

UDF name.

cell_t c

Index that identifies the cell on which the Prandtl number function is to be applied.

Thread *t

Pointer to cell thread.

Function returns

real

There are three arguments to DEFINE_PRANDTL_T: name, c, and t. You supply name, the name of the UDF. c and t are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to return the real value for the temperature Prandtl number to the solver.

2.3.22.19. Example

/* Specifying a Constant Temperature Prandtl Number */
 #include "udf.h"
 
 DEFINE_PRANDTL_T(user_pr_t,c,t)
 {
    real pr_t;
    pr_t = 0.85;
    return pr_t;
 } 

2.3.22.20. Hooking a Prandtl Number UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_PRANDTL_T is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_pr_t) will become visible and selectable in the Viscous Model dialog box in ANSYS Fluent. See Hooking DEFINE_PRANDTL UDFs for details.

2.3.22.21.  DEFINE_PRANDTL_T_WALL

2.3.22.22. Description

You can use DEFINE_PRANDTL_T_WALL to specify Prandtl numbers for thermal wall functions.

2.3.22.23. Usage

DEFINE_PRANDTL_T_WALL (name, c, t)

Argument Type

Description

symbol name

UDF name.

cell_t c

Index that identifies the cell on which the Prandtl number function is to be applied.

Thread *t

Pointer to cell thread.

Function returns

real

There are three arguments to DEFINE_PRANDTL_T_WALL: name, c, and t. You supply name, the name of the UDF. c and t are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to return the real value for the thermal wall function Prandtl number to the solver.

2.3.22.24. Example

/*************************************************************
  Specifying a constant thermal wall function Prandtl number
  ********************************************************* **/
 #include "udf.h"
 
 DEFINE_PRANDTL_T_WALL(user_pr_t_wall,c,t)
 {
    real pr_t_wall;
    pr_t_wall = 0.85;
    return pr_t_wall;
 } 

2.3.22.25. Hooking a Prandtl Number UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_PRANDTL_T_WALL is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_pr_t_wall) will become visible and selectable in the Viscous Model dialog box in ANSYS Fluent. See Hooking DEFINE_PRANDTL UDFs for details.


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