![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Description
You can use DEFINE_CHEM_STEP to specify the change in mass fraction due to homogeneous reaction over a time step:
![]() |
(2.3-1) |
where
is the initial mass fraction of species
,
is time,
is the given time step, and
is the net rate of change of the
th species mass fraction.
is
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,
![]() |
(2.3-2) |
where
is the number of species.
An analytic solution exists for the integral of this ODE as,
![]() |
(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.