[ANSYS, Inc. Logo] return to home search
next up previous contents index

2.3.14 DEFINE_PRANDTL UDFs

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



DEFINE_PRANDTL_D




Description


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



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.



Example


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



Hooking a Prandtl Number UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_PRANDTL_D is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., user_pr_d) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section  6.2.14 for details.



DEFINE_PRANDTL_K




Description


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



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.



Example


The following UDF implements a high-Re version of the RNG model, using the $k$- $\epsilon$ 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 $k$ and $\epsilon$ using the UDF.

3.   Add the -r source term in the $\epsilon$ equation.

In the RNG model, diffusion in $k$ and $\epsilon$ equations appears as


(\mu + \mu_t) * \alpha

while in the standard $k$- $\epsilon$ model, it is given by


\mu + \frac{\mu_t}{Pr}

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


Pr = \frac{\mu_t}{[(\mu + \mu_t) * \alpha - \mu]}

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;
}



Hooking a Prandtl Number UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_PRANDTL_K is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., user_pr_k) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section  6.2.14 for details.



DEFINE_PRANDTL_O




Description


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



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.



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;
}



Hooking a Prandtl Number UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_PRANDTL_O is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., user_pr_o) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section  6.2.14 for details.



DEFINE_PRANDTL_T




Description


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



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.



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;
}



Hooking a Prandtl Number UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_PRANDTL_T is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., user_pr_t) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section  6.2.14 for details.



DEFINE_PRANDTL_T_WALL




Description


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



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.



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;
}



Hooking a Prandtl Number UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_PRANDTL_T_WALL is interpreted (Chapter  4) or compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., user_pr_t_wall) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section  6.2.14 for details.


next up previous contents index Previous: 2.3.13 DEFINE_PR_RATE
Up: 2.3 Model-Specific DEFINE Macros
Next: 2.3.15 DEFINE_PROFILE
Release 12.0 © ANSYS, Inc. 2009-01-14