You can use DEFINE_WALL_FUNCTIONS to provide custom wall functions for applications when you want
to replace the standard wall functions in ANSYS Fluent. Note that this is available
only for use with the -
turbulence models, and cannot be combined
with the Eulerian multiphase model.
DEFINE_WALL_FUNCTIONS (name, f, t, c0, t0, wf_ret, yPlus, Emod)
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
face index. |
|
|
pointer to face thread |
|
|
cell index. |
|
|
pointer to cell thread. |
|
|
wall function index |
|
|
y+ value |
|
|
wall function E constant |
Function returns
real
There are eight arguments to DEFINE_WALL_FUNCTIONS: name, f, t, c0, t0, wf_ret, yPlus, and Emod. You supply name, the name of the UDF. f, t, c0, t0, wf_ret, yPlus, and Emod are variables that are passed by the ANSYS Fluent solver
to your UDF. Your UDF will need to compute the real value of the wall functions U+, dU+/dy+, and d2U+/dY+2 for
laminar and turbulent regions and return them to the solver.
The following UDF, named user_log_law, computes U+ and dU+/dy+, and d2U+/dY+2 for
laminar and turbulent regions using DEFINE_WALL_FUNCTIONS. The source code can be interpreted or compiled in ANSYS Fluent.
/******************************************************************
User-defined wall functions: separated into turbulent and laminar regimes
/*****************************************************************/
#include "udf.h"
DEFINE_WALL_FUNCTIONS(user_log_law, f, t, c0, t0, wf_ret, yPlus, Emod)
{
real wf_value;
switch (wf_ret)
{
case UPLUS_LAM:
wf_value = yPlus;
break;
case UPLUS_TRB:
wf_value = log(Emod*yPlus)/KAPPA;
break;
case DUPLUS_LAM:
wf_value = 1.0;
break;
case DUPLUS_TRB:
wf_value = 1./(KAPPA*yPlus);
break;
case D2UPLUS_TRB:
wf_value = -1./(KAPPA*yPlus*yPlus);
break;
default:
printf("Wall function return value unavailable\n");
}
return wf_value;
}
After the UDF that you have defined using DEFINE_WALL_FUNCTIONS 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_log_law) will become visible and selectable in the Viscous Model dialog box in ANSYS Fluent. See Hooking DEFINE_WALL_FUNCTIONS UDFs for details.