![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Description
You can use DEFINE_NET_REACTION_RATE to compute the homogeneous net molar reaction rates of all species. The net reaction rate of a species is the sum over all reactions of the volumetric reaction rates:
![]() |
(2.3-6) |
where
is the net reaction rate of species
and
is the Arrhenius molar rate of creation/destruction of species
in reaction
.
A DEFINE_NET_REACTION_RATE UDF may be used for the laminar finite-rate (with stiff chemistry enabled), EDC, and PDF Transport models, as well as for the surface chemistry model. In contrast, the volumetric UDF function DEFINE_VR_RATE and surface UDF function DEFINE_SR_RATE are used for the laminar finite-rate model when stiff chemistry is disabled.
Usage
DEFINE_NET_REACTION_RATE( name, c, t, particle, pressure, temp, yi, rr, jac) |
Argument Type | Description |
symbol name | UDF name. |
cell_t c | Cell index of current particle. |
Thread *t | Pointer to cell thread for particle. |
Particle *particle | Pointer to Particle data structure that contains |
data related to the particle being tracked. | |
double *pressure | Pointer to pressure variable. |
double *temp | Pointer to temperature variable. |
double *yi | Pointer to array containing species mass fractions. |
double *rr | Pointer to array containing net molar reaction rates. |
double *jac | Pointer to array of Jacobians. |
Function returns | |
void | |
There are nine arguments to
DEFINE_NET_REACTION_RATE:
name,
c,
t,
particle,
pressure,
temp,
yi,
rr, and
jac. You supply
name, the name of the UDF. The variables
c,
t,
particle,
pressure,
temp,
yi,
rr, and
jac are passed by the
ANSYS FLUENT solver to your UDF and have SI units. The outputs of the function are the array of net molar reaction rates,
rr (with units
), and the Jacobian array
jac. The Jacobian is only required for surface chemistry, and is the derivative of the surface net reaction rate with respect to the species concentration.
DEFINE_NET_REACTION_RATE is called for all fluid zones (volumetric reactions as well as surface reactions in porous media) and for all wall thread zones whenever the Reaction option is enabled in the boundary conditions dialog box and the UDF is hooked to ANSYS FLUENT in the User-Defined Function Hooks dialog box.
|
DEFINE_NET_REACTION_RATE functions can be executed only as compiled UDFs.
|
Example
The following UDF, named net_rxn, assumes that the net volumetric reaction rate is the expression,
![]() |
(2.3-7) |
where
is the number of species.
/*********************************************************** Net Reaction Rate Example UDF ************************************************************/ #include "udf.h" DEFINE_NET_REACTION_RATE(net_rxn,c,t,particle,pressure,temp,yi,rr,jac) { int i; for(i=0;i<n_spe;i++) rr[i] = 1./(real)n_spe - yi[i]; } |
Note that during the coarse of the ODE solution, the species mass fractions can exceed realizable bounds. For optimal ODE performance, the species mass fractions should not be clipped, but derived quantities, such as concentrations which are raised to non-integer powers, must be bounded. Also, if density is required, for instance to calculate concentrations, it should be calculated from the temperature and species passed into the UDF. Finally, double precision should be used for all local variables.
Hooking a Net Reaction Rate UDF to
ANSYS FLUENT
After the UDF that you have defined using DEFINE_NET_REACTION_RATE is interpreted (Chapter 4) or compiled (Chapter 5), the name of the argument that you supplied as the first DEFINE macro argument (e.g., net_rxn) will become visible and selectable in the User-Defined Function Hooks dialog box in ANSYS FLUENT. See Section 6.2.11 for details.