![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Description
You can use
DEFINE_TURBULENT_VISCOSITY to specify a custom turbulent viscosity function for the Spalart-Allmaras,
-
, and
-
turbulence models for single-phase applications. In addition, for 3d versions of
ANSYS FLUENT you can specify a subgrid-scale turbulent viscosity UDF for the large eddy simulation model. For Eulerian multiphase flows, turbulent viscosity UDFs can be assigned on a per-phase basis, and/or to the mixture, depending on the turbulence model. See Table
2.3.6 for details.
Usage
DEFINE_TURBULENT_VISCOSITY( name, c, t) |
Argument Type | Description |
symbol name | UDF name. |
cell_t c | Cell index. |
Thread *t | Pointer to cell thread on which the turbulent viscosity |
is to be applied. | |
Function returns | |
real | |
There are three arguments to DEFINE_TURBULENT_VISCOSITY: 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 of the turbulent viscosity to the solver.
Example 1 - Single Phase Turbulent Viscosity UDF
The following UDF, named
user_mu_t, defines a custom turbulent viscosity for the standard
-
turbulence model. Note that the value of
M_keCmu in the example is defined through the graphical user interface, but made accessible to all UDFs. The source code can be interpreted or compiled in
ANSYS FLUENT.
/******************************************************************** UDF that specifies a custom turbulent viscosity for standard k-epsilon formulation *********************************************************************/ #include "udf.h" DEFINE_TURBULENT_VISCOSITY(user_mu_t,c,t) { real mu_t; real rho = C_R(c,t); real k = C_K(c,t); real d = C_D(c,t); mu_t = M_keCmu*rho*SQR(k)/d; return mu_t; } |
Example 2 - Multiphase Turbulent Viscosity UDF
/******************************************************************** Custom turbulent viscosity functions for each phase and the mixture in a two-phase multiphase flow *********************************************************************/ #include "udf.h" DEFINE_TURBULENT_VISCOSITY(mu_t_ke_mixture, c, t) { real mu_t; real rho = C_R(c,t); real k = C_K(c,t); real d = C_D(c,t); real cmu = M_keCmu; mu_t = rho*cmu*k*k/d; return mu_t; } DEFINE_TURBULENT_VISCOSITY(mu_t_ke_1, c, t) { Thread *tm = lookup_thread_by_id(DOMAIN_SUPER_DOMAIN(THREAD_DOMAIN(t)), t->id); CACHE_T_SV_R (density, t, SV_DENSITY); CACHE_T_SV_R (mu_t, t, SV_MU_T); CACHE_T_SV_R (density_m, tm, SV_DENSITY); CACHE_T_SV_R (mu_t_m, tm, SV_MU_T); return density[c]/density_m[c]*mu_t_m[c]; } DEFINE_TURBULENT_VISCOSITY(mu_t_ke_2, c, t) { Thread *tm = lookup_thread_by_id(DOMAIN_SUPER_DOMAIN(THREAD_DOMAIN(t)), t->id); CACHE_T_SV_R (density, t, SV_DENSITY); CACHE_T_SV_R (mu_t, t, SV_MU_T); CACHE_T_SV_R (density_m, tm, SV_DENSITY); CACHE_T_SV_R (mu_t_m, tm, SV_MU_T); return density[c]/density_m[c]*mu_t_m[c]; } |
Hooking a Turbulent Viscosity UDF to
ANSYS FLUENT
After the UDF that you have defined using DEFINE_TURBULENT_VISCOSITY is interpreted (Chapter 4) or compiled (Chapter 5), the function name(s) that you specified in the DEFINE macro argument(s) (for example user_mu_t for single phase, or mu_t_ke_mixture, mu_t_ke_1, and mu_t_ke_2 for multiphase) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section 6.2.26 for details.