Auxiliary files and the substitution preprocessor

The auxiliary files in the $KPP_HOME/util subdirectory are templates for integrators, drivers, and utilities. They are inserted into the KPP output after being run through the substitution preprocessor. This preprocessor replaces several placeholder symbols in the template files with their particular values in the model at hand. Usually, only KPP_ROOT and KPP_REAL are needed because the other values can also be obtained via the variables listed in KPP inlined types.

KPP_REAL is replaced by the appropriate single or double precision declaration type. Depending on the target language KPP will select the correct declaration type. For example if one needs to declare an array BIG of size 1000, a declaration like the following must be used:

KPP_REAL :: BIG(1000)

When used with the command #DOUBLE ON, the above line will be automatically translated into:

REAL(kind=dp) :: BIG(1000)

and when used with the command #DOUBLE OFF, the same line will become:

REAL(kind=sp) :: BIG(1000)

in the resulting Fortran90 output file.

KPP_ROOT is replaced by the root file name of the main kinetic description file. In our example where we are processing small_strato.kpp, a line in an auxiliary Fortran90 file like

USE KPP_ROOT_Monitor

will be translated into

USE small_strato_Monitor

in the generated Fortran90 output file.

List of auxiliary files for Fortran90

Auxiliary files for Fortran90

File

Contents

dFun_dRcoeff.f90

Derivatives with respect to reaction rates

dJac_dRcoeff.f90

Derivatives with respect to reaction rates

Makefile_f90 and Makefile_upper_F90

Makefiles to build Fortran-90 code

Mex_Fun.f90 and Mex_Jac_SP.f90

Mex files.

Mex_Hessian.f90

Mex files.

sutil.f90

Sparse utility functions.

tag2num.f90

Function related to equation tags.

UpdateSun.f90

Function related to solar zenith angle.

UserRateLaws.f90 and UserRateLawsInterfaces.f90

User-defined rate-law functions.

util.f90

Input/output utilities.

List of symbols replaced by the substitution preprocessor

Symbols and their replacements

Symbol

Replacement

Example

KPP_ROOT

The ROOT name

small_strato

KPP_REAL

The real data type

REAL(kind=dp)

KPP_NSPEC

Number of species

7

KPP_NVAR

Number of variable species

5

KPP_NFIX

Number of fixed species

2

KPP_NREACT

Number of chemical reactopms

10

KPP_NONZERO

Number of Jacobian nonzero elements

18

KPP_LU_NONZERO

Number of Jacobian nonzero elements, with LU fill0in

19

KPP_LU_NHESS

Number of Hessian nonzero elements

19

KPP_FUN_OR_FUN_SPLIT

Name of the function to be called

FUN(Y,FIX,RCONST,Ydot)