The C code

Important

Some run-time options for C-language integrators (specified in the ICNTRL and RCNTRL arrays) do not exactly correspond to the Fortran90 run-time options. We will standardize run-time integrator options across all target languages in a future KPP release.

The driver file ROOT.c contains the main (driver) program and numerical integrator functions, as well as declarations and initializations of global variables.

The generated C code includes three header files which are #include-d in other files as appropriate.

  1. Global parameters are #include-d in the header file ROOT_Parameters.h.

  2. Global variables are extern-declared in ROOT_Global.h and declared in the driver file ROOT.c.

  3. Extern declarations of sparse data structures for the Jacobian, Hessian and stoichiometric matrix, and the Jacobian of reaction products are in the header file ROOT_Sparse.h. The actual declarations of each data structure is done in the corresponding files.

The code for the ODE function is in ROOT_Function.c.

The ODE Jacobian and sparse multiplications is in ROOT_Jacobian.c, and the declaration and initialization of the Jacobian sparse data structures is in the file ROOT_JacobianSP.c.

Similarly, the Hessian function and associated sparse multiplications) are in ROOT_Hessian.c, and the declaration and initialization of Hessian sparse data structures are in ROOT_HessianSP.c.

Functions for reactant products and its Jacobian, and derivatives with respect to rate coefficients are in the file ROOT_Stoichiom.c.

The declaration and initialization of the stoichiometric matrix and the associated sparse data structures) is done in ROOT_StoichiomSP.c.

Sparse linear algebra routines are in the file ROOT_LinearAlgebra.c. The code to update the rate constants and user defined code for rate laws is in ROOT_Rates.c.

Various utility and input/output functions are in ROOT_Util.c and ROOT_Monitor.c.

Finally, mex gateway routines that allow the C implementation of the ODE function, Jacobian, and Hessian to be called directly from Matlab are also generated in the files ROOT_mex_Fun.c, ROOT_mex_Jac_SP.c, and ROOT_mex_Hessian.c.