[ANSYS, Inc. Logo] return to home search
next up previous contents index

2.3.1 DEFINE_CHEM_STEP



Description


You can use DEFINE_CHEM_STEP to specify the change in mass fraction due to homogeneous reaction over a time step:


 Y_i^{\Delta t} = Y_i^0 + \int_0^{\Delta t} \frac{d Y_i}{dt} dt (2.3-1)

where $Y_i^0$ is the initial mass fraction of species $i$, $t$ is time, ${\Delta t}$ is the given time step, and $\frac{d Y_i}{dt}$ is the net rate of change of the $i$th species mass fraction. $Y_i^{\Delta t}$ is $i$th species mass fraction at the end of the integration.

DEFINE_CHEM_STEP UDFs are used for the Laminar finite-rate (with Stiff Chemistry enabled), EDC and PDF Transport models.



Usage



DEFINE_CHEM_STEP( name, c, t, p, num_p, n_spe, dt, pres, temp, yk)


Argument Type Description
symbol name UDF name.
cell_t c Cell index of current particle.
Thread *t Pointer to cell thread for particle.
Particle *p Pointer to particle data structure that contains
  data related to the particle being tracked.
int num_p Not Used.
int n_spec Number of volumetric species.
double *dt Time step.
double *pres Pointer to pressure.
double *temp Pointer to temperature.
double *yk Pointer to array of initial species mass fractions.
   
Function returns  
void  
   

There are nine arguments to DEFINE_CHEM_STEP: name, c, p , num_p, n_spe, dt, pres, temp, and yk. You supply name, the name of the UDF. c, p, n_spe, dt, pres, temp, and yk are variables that are passed by the ANSYS FLUENT solver to your UDF. num_p is not used by the function and can be ignored. The output of the function is the array of mass fractions yk after the integration step. The initial mass fractions in array yk are overwritten.



Example


The following UDF, named user_chem_step, assumes that the net volumetric reaction rate is the expression,


 \frac{d Y_k}{dt} = 1/N_{spe} - Y_k (2.3-2)

where $N_{spe}$ is the number of species.

An analytic solution exists for the integral of this ODE as,


 Y_k^{\Delta t} = (Y_k^0 - 1/N_{spe}) exp(-{\Delta t}) + 1/N_{spe} (2.3-3)

/***************************************************
   Example UDF that demonstrates DEFINE_CHEM_STEP 
***************************************************/
#include "udf.h"

DEFINE_CHEM_STEP(user_chem_step,cell,thread,particle,nump,nspe,dt,pres,temp,yk)
{
   int i;
   double c = 1./(double)nspe;
   double decay = exp(-(*dt));
   for(i=0;i<n_spe;i++)
     yk[i] = (yk[i]-c)*decay + c;
}



Hooking a Chemistry Step UDF to ANSYS FLUENT


After the UDF that you have defined using DEFINE_CHEM_STEP 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_chem_step) will become visible and selectable in the User-Defined Function Hooks dialog box in ANSYS FLUENT. See Section  6.2.1 for details.


next up previous contents index Previous: 2.3 Model-Specific DEFINE Macros
Up: 2.3 Model-Specific DEFINE Macros
Next: 2.3.2 DEFINE_CPHI
Release 12.0 © ANSYS, Inc. 2009-01-14