Simply the best answers.Get 100$ bonus
The definition of Jacobian of the surface net mass reaction rate wrt the species concentration in DEFINE_NET_REACTION_RATE macro
The definition of the jacobian array "jac" which is passed as an argument to the macro DEFINE_NET_REACTION_RATE are not given, The docuemntation states it is the derivative of the surface net mass reaction rate with respect to the species concentration. But that is not enough to get the idea about the elements of the array. This array is necessary for surface chemistry.
Here is the definition of "jac" array,
Fluent uses an Arrhenius expression for the surface reaction rate,
w_i = stoich_reactant_i * k_f * PROD_k ( [C_k]^nu_k )
where k_f = A exp(-E/RT) * T^b
For A + B -> C this would be
w_i = stoich_reactant_i * k_f * [A]^a * [B] ^ b
so the Jacobian, dw_i / d[C_j] is
= w_i * nu_j / [C_j]
[C_j] is the concentration of species j. In your numerical
evalualtion, be careful not to divide by zero.
Also, see how the index to the Jacobian is handled:
ij = ID(i,j,ngs);
where ngs is the total numner of gas + surface (bulk) + site species...
const int nspe = MIXTURE_NSPECIES(m);
const int nsurf = MIXTURE_SURFACE_NSPECIES(m);
const int nsite = MIXTURE_SITE_NSPECIES(m);
const int ngs = nspe + nsite + nsurf;
ID is defined as
#define ID(ie, je, n_cols) ((ie)*(n_cols) + (je)) /* store by rows */
Hope this explains the definition of "jac" array for net reaction rate UDF.