2.3.33.  DEFINE_SOOT_NUCLEATION_RATES

2.3.33.1. Description

You can use DEFINE_SOOT_NUCLEATION_RATES to specify a user-defined soot nucleation and coagulation rates. The UDF is available only if the Moss-Brookes or the Moss-Brookes-Hall soot model is enabled.

2.3.33.2. Usage

DEFINE_SOOT_NUCLEATION_RATES (name, c, t, Pollut, Pollut_Par, Soot, rates_linear, rates_nonlinear, index)

Argument Type

Description

symbol name

UDF name

cell_t c

Cell index

Thread *t

Pointer to cell thread on which the Soot nucleation rates is to be applied

Pollut_Cell *Pollut

Pointer to the data structure that contains the common data at each cell

Pollut_Parameter *Pollut_Par

Pointer to the data structure that contains auxiliary data

Soot *soot

Pointer to the data structure that contains data specific to the Soot mode.

real *rates_linear

Array to provide the linear components of soot nucleation rates

real *rates_nonlinear

Array to provide the nonlinear components of soot nucleation rates

int index

Integer value which tells whether the udf is called for nucleation or coagulation

Function returns

void

There are nine arguments to DEFINE_SOOT_NUCLEATION_RATES: name, c, t, Pollut, Pollut_Par, Soot, rates_linear, rates_nonlinear, and index. You supply name, the name of the UDF. Variables c, t, Pollut, Pollut_par, Soot, rates_linear, rates_nonlinear, and index are passed by the ANSYS Fluent solver to your function. A DEFINE_SOOT_NUCLEATION_RATES function does not output a value. The calculated soot nuclei rates will be stored in the arrays rates_linear and rates_nonlinear.

The soot nucleation rates consist of explicit and implicit parts and can be expressed as follows:

where is an explicit part of the nuclei (nucleation or coagulation) that can be a function of any variable(s) other than soot mass fraction and soot nuclei concentration, and is an implicit part of the nuclei rates that represents terms involving soot mass fraction and soot nuclei concentration. The term is stored in the rates_linear array, while the term is stored in the rates_nonlinear array.

The units of nuclei rate are nuclei/m3/s.

2.3.33.3. Example: Soot Nucleation and Coagulation Rates

The following compiled UDF, named user_soot_nuc_rates, is used to provide the user-defined soot nucleation rate.

/*********************************************************************
Following UDF is implementation of nucleation and coagulation terms of soot 
nuclei transport equation for Moss Brookes soot Model using UDF
*********************************************************************/

#include "udf.h"
#include "sg_pollut.h"
#define NNORM 1.e+15
#define soot_dens 1800
#define MAXSOOT 0.01

/*User defined Soot nucleation rates have to be in following form:
 Rate = A*B, Where B is function of soot mass fraction and/or soot nuclie 
 and A is function of any variables other than soot mass fraction and nuclei.
This break is done to ensure that the soot rates can be stored in PDF tables apriori.*/

/*
  Return from the UDF are:
  rates_linear[index] = A; /*Linear part*/
  rates_nonlinear[index] = B; /*Nonlinear part*/
*/

/*If any soot rates returned can be written in terms of only linear part (A)
and/or only nonlinear part (B), then this can be done in the following manner:*/

/*
   case 1 : Only A is required
      rates_linear[index] = A
      rates_nonlinear[index] = 1.
   case 2: Only B is required
      rates_linear[index] = 1.
      rates_nonlinear[index] = B
*/

DEFINE_SOOT_NUCLEATION_RATES(user_soot_nuc_rates, c, t, Pollut, Pollut_Par, Soot, 
rates_linear, rates_nonlinear,index)
{
    real T = Pollut->fluct.temp;
    int ns;
    real xmolprec,alpha;
    double avgn=6.022137e+26,nnorm=1.e+15;

    switch (index) 
       { 
        case UDF_NUC: /* index = 0 for user defined nucleation term in nuclei equation*/ 
          { 
           xmolprec=0.;
           for (ns=PRECSP; ns<PRECSP+Soot->nprec; ns++)
              {
               xmolprec += MOLECON(Pollut, ns)*1.e-03;
              }
           rates_linear[UDF_NUC] = (avgn/nnorm)*Soot->calpha*xmolprec*exp(MAX(-70, -Soot->talpha/T));
           rates_nonlinear[UDF_NUC] = 1.;
          }
       break ;
    case UDF_COAG: /* index = 1 for user defined coagulation term in nuclei equation*/
       {
        real pwr4=1./6., pwr3=5./6.;
        real term1,term2,beta;
        real rho = POLLUT_GASDEN(Pollut);
        real spsoot = MIN(MAX(Pollut->fluct.yi[IDX(SOOT)], 0.), MAXSOOT);
        real spnuclei = MAX(Pollut->fluct.yi[IDX(NUCLEI)], 0.);

        term1 = pow(24.*Pollut_Par->uni_R*1000.*T/(Soot->soot_mdens*avgn), 0.5);
        term2 = pow(6./(M_PI*Soot->soot_mdens), pwr4);
        rates_linear[UDF_COAG] = -rho*rho*Soot->cbeta*term1*term2*pow(nnorm, pwr3);
        rates_nonlinear[UDF_COAG] = pow(spsoot, pwr4)*pow(spnuclei, (pwr3+1.));
       }
      break; 
   default:
      Error("Wrong index for user defined soot nucleation terms\n");
      break;
   } 
}

2.3.33.4. Hooking a Nucleation and Coagulation Rates UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_SOOT_NUCLEATION_RATES is compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, user_soot_nuc_rates) will become visible and selectable in the User Defined Soot Nuclei Rates drop-down list of the Soot Model dialog box in ANSYS Fluent. See Hooking DEFINE_SOOT_NUCLEATION_RATES UDFs for details.


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