The following DEFINE macros can be
used to specify Prandtl numbers in ANSYS Fluent, for single-phase flows.
You can use DEFINE_PRANDTL_D to specify
Prandtl numbers for turbulent dissipation ().
DEFINE_PRANDTL_D (name, c, t)
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Index of cell on which the Prandtl number function is to be applied. |
|
|
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.
An example of a DEFINE_Prandtl_D UDF
is provided below in the source listing for DEFINE_PRANDTL_K.
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.
You can use DEFINE_PRANDTL_K to specify
Prandtl numbers for turbulence kinetic energy ().
DEFINE_PRANDTL_K (name, c, t)
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Index that identifies the cell on which the Prandtl number function is to be applied. |
|
|
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.
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:
Set Cmu, C1eps, and C2eps as in the RNG model.
Calculate Prandtl numbers for and
using the UDF.
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;
}
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.
You can use DEFINE_PRANDTL_O to specify
Prandtl numbers for specific dissipation ( in the
-
model).
DEFINE_PRANDTL_O (name, c, t)
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Index that identifies the cell on which the Prandtl number function is to be applied. |
|
|
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.
/* 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;
}
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.
You can use DEFINE_PRANDTL_T to specify
Prandtl numbers that appear in the temperature equation diffusion
term.
DEFINE_PRANDTL_T (name, c, t)
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Index that identifies the cell on which the Prandtl number function is to be applied. |
|
|
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.
/* 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;
}
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.
You can use DEFINE_PRANDTL_T_WALL to
specify Prandtl numbers for thermal wall functions.
DEFINE_PRANDTL_T_WALL (name, c, t)
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Index that identifies the cell on which the Prandtl number function is to be applied. |
|
|
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.
/*************************************************************
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;
}
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.