2.3.48.  DEFINE_WALL_FUNCTIONS

2.3.48.1. 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, and cannot be combined with the Eulerian multiphase model.

2.3.48.2. 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 face thread

cell_t c0

cell index.

Thread *t0

pointer to cell 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+/dy+, and d2U+/dY+2 for laminar and turbulent regions and return them to the solver.

2.3.48.3. Example

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

2.3.48.4. Hooking a Wall Function UDF to ANSYS Fluent

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.


Release 18.2 - © ANSYS, Inc. All rights reserved.