3.1. Basic Requirements of a Chemkin Program

In addition to using pre-built Ansys Chemkin Reactor Models, users may opt to write their own, directly accessing the Gas-phase Kinetics, Surface Kinetics, and/or Transport subroutine libraries. In order to do so, you must have the following:

  • A compatible FORTRAN compiler installed on the computer where Ansys Chemkin is installed.

  • (optional) A C or C++ compiler, when programming in C or C++. This compiler should be compatible with the FORTRAN compiler and with the Ansys Chemkin build.

  • Knowledge of the FORTRAN language and the C/C++ language if applicable.

  • Experience with compiling and linking programs on the computer platform of interest.

For more information on the compiler compatibility with Ansys Chemkin libraries, see Compiler Compatibility.

The basic requirements for any program are declaration of variables and arrays, allocation of memory, and file manipulation. Ansys Chemkin-based programs must also establish a link to the user's chemistry data through initialization routines that access the Linking Files generated by Pre-processor programs, as discussed in Introduction . This section provides an introduction to these processes.

More specific detail is provided by way of example, in Gas-phase Kinetics Sample Program (CONP) through Transport Sample Problem (PROPS) , which describe sample programs that demonstrate the use of Ansys Chemkin subroutine calls. These sample programs are provided as source code with a standard Chemkin installation. Also provided at installation are sample makefiles and macros to facilitate compiling and linking of a FORTRAN or C++ program.

Note that any program linked to the Ansys Chemkin /API requires that a Chemistry Set has been successfully pre-processed before the program can run. This will ensure that the needed Linking Files have been created and can be accessed by the user program. These dependencies are discussed in Introduction . The Gas-phase Kinetics Linking File (for example, chem.asc) is required in all cases. Use of Surface Kinetics library routines requires the Surface Kinetics Linking File (e.g., surf.asc) to be created. Similarly, Transport subroutine library calls require that the Transport Linking File (for example, tran.asc) be created through a successful run of the Transport Pre-processor.

When users author their own Applications, they will need to access the Linking File from the Application program after the Pre-processor has been successfully executed, so that subroutines from the Gas-phase Kinetics Subroutine Library can be called from the Application. The Application's first step must be to dimension three storage arrays (one integer, one floating point, and one character data type) and then call the initialization subroutine CKINIT to fill the storage arrays from the Linking File data. One or more of these arrays is required input to nearly every other subroutine in the Gas-phase Kinetics package.


Note:  The minimum length for the arrays can be found in Pre-processor output. The storage-array sizes can also be determined by a call to the subroutine CKLEN.


Once CKINIT has been successfully called in an Application program, any number of Gas-phase Kinetics subroutines can be used to return various types of information. The subroutine needed for a particular function can be determined by referencing descriptions of equations in the Chemkin Theory Manual , or through the subject-based quick-reference list in Quick Reference Guide to the Gas-phase Kinetics Subroutine Library of this manual. Detailed information about the subroutine call lists are provided in an alphabetical listing in Alphabetical Listing of the Gas-phase Kinetics Subroutine Library . Normally only a few of the subroutines in the package would be called for any one problem.

For the Surface Kinetics and Transport subroutine libraries, there is a similar requirement of array allocation and calling of an initialization routine. In this case, the necessary array sizes can be found by calls to SKLEN and MCLEN, respectively, and the initialization occurs through calls to SKINIT and MCINIT, respectively.

The following sections outline specific components that form the basic requirements for an Ansys Chemkin application program.