|
|
Description
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.
Usage
| DEFINE_WALL_FUNCTIONS( name, f, t, c0, t0, wf_ret, yPlus, Emod) |
| Argument Type | Description |
| symbol name | UDF name. |
| face_t f | face index. |
| Thread *t | pointer to cell thread |
| cell_t c0 | cell index. |
| Thread *t0 | pointer to face thread. |
| int wf_ret | wall function index |
| real yPlus | y+ value |
| real Emod | 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+, and dY+ for laminar and turbulent regions and return them to the solver.
Example
The following UDF, named user_log_law, computes U+ and dU+, and dY+ 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;
}
|
Hooking a Wall Function UDF to
ANSYS FLUENT
After the UDF that you have defined using DEFINE_WALL_FUNCTIONS 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_log_law) will become visible and selectable in the Viscous Model dialog box in ANSYS FLUENT. See Section 6.2.28 for details.