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
File |
Contents |
|---|---|
|
Derivatives with respect to reaction rates |
|
Derivatives with respect to reaction rates |
|
Makefiles to build Fortran-90 code |
|
Mex files. |
|
Mex files. |
|
Sparse utility functions. |
|
Function related to equation tags. |
|
Function related to solar zenith angle. |
|
User-defined rate-law functions. |
|
Input/output utilities. |
List of symbols replaced by the substitution preprocessor
Symbol |
Replacement |
Example |
|---|---|---|
KPP_ROOT |
The |
|
KPP_REAL |
The real data type |
|
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 |
|