2.3.44.  DEFINE_TURB_PREMIX_SOURCE

2.3.44.1. Description

You can use DEFINE_TURB_PREMIX_SOURCE to customize the turbulent flame speed and source term ( in Equation 9–1 and in Equation 10–8 in the Fluent Theory Guide) in the premixed combustion model and the partially premixed combustion model.

2.3.44.2. Usage

DEFINE_TURB_PREMIX_SOURCE (name, c, t, turb_flame_speed, source)

Argument Type

Description

symbol name

UDF name.

cell_t c

Cell index.

Thread *t

Pointer to cell thread on which the turbulent premixed source term is to be applied.

real *turb_flame_speed

Pointer to the turbulent flame speed.

real *source

Pointer to the reaction progress source term.

Function returns

void

There are five arguments to DEFINE_TURB_PREMIX_SOURCE: name, c, t, turb_flame_speed, and source. You supply name, the name of the UDF. c, t, turb_flame_speed, and source are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to set the turbulent flame speed to the value referenced by the turb_flame_speed pointer. It will also need to set the source term to the value referenced by the source pointer.

2.3.44.3. Example

The following UDF, named turb_flame_src, specifies a custom turbulent flame speed and source term in the premixed combustion model. The source code must be executed as a compiled UDF in ANSYS Fluent.

In the standard premixed combustion model in ANSYS Fluent, the mean reaction rate of the progress variable (that is, the source term) is modeled as

(2–12)

where is the mean reaction progress variable, is the density, and is the turbulent flame speed.

In the UDF example, the turbulent flame speed is modeled as

(2–13)

where is the laminar flame speed and is the turbulent fluctuation. Note that the partially premixed combustion model is assumed to be enabled (see Modeling Partially Premixed Combustion in the User's Guide), so that the unburned density and laminar flame speed are available as polynomials. See Additional Macros for Writing UDFs for details on the NULLP, THREAD_STORAGE, and SV_VARS macros.

/*******************************************************************
  UDF that specifies a custom turbulent flame speed and source
  for the premixed combustion model
 ********************************************************************/
 
 #include "udf.h"
 #include "sg_pdf.h" /* not included in udf.h so must include here */
 
 DEFINE_TURB_PREMIX_SOURCE(turb_flame_src,c,t,turb_flame_speed,source)
 {
    real up = TRB_VEL_SCAL(c,t);
    real ut, ul, grad_c, rho_u, Xl, DV[ND_ND];
    ul = C_LAM_FLAME_SPEED(c,t);
    Xl = THREAD_VAR(t).fluid.premix_var.tdiff_u;
    rho_u = THREAD_VAR(t).fluid.premix_var.rho_u;

    if(NNULLP(THREAD_STORAGE(t,SV_PREMIXC_G)))
      {
         NV_V(DV, =, C_STORAGE_R_NV(c,t,SV_PREMIXC_G));
         grad_c = sqrt(NV_DOT(DV,DV));
      }
    ut = ul*sqrt(1. + SQR(up/ul));
    *turb_flame_speed = ut;
    *source = rho_u*ut*grad_c;
 } 

2.3.44.4. Hooking a Turbulent Premixed Source UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_TURB_PREMIX_SOURCE is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, turb_flame_src) will become visible and selectable in the User-Defined Function Hooks dialog box in ANSYS Fluent. See Hooking DEFINE_TURB_PREMIX_SOURCE UDFs for details.


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