Working With Input Files¶
The required input files can be provided via one of several methods:
Use one of the pre-existing input files provided with Cantera
Convert a pre-existing mechanism from Chemkin (CK) format to YAML format (New in Cantera 2.5)
Convert a pre-existing mechanism from Chemkin (CK) format to Cantera (CTI) format
Create your own YAML file from scratch or by editing an existing file (New in Cantera 2.5)
Create your own CTI file, either from scratch (not recommended) or by editing an existing file
The first two options will suffice for a majority of Cantera users. Advanced users may, however, need to edit an existing input file in order to define additional species, reactions, or entirely new phases. Even if you need to create an entirely new input file, it is still advisable to start from an existing file, to cut down on syntax errors.
Whenever you edit a Cantera input file, it is highly advised that you begin by copying the existing file and saving it under a new name, before editing the new file. Editing a file under its original name can easily lead to errors, if one forgets that this file does not represent the original mechanism.
Input files distributed with Cantera¶
Several reaction mechanism files in the CTI format are included in the Cantera distribution,
including ones that model natural gas combustion (
gri30.cti), high-temperature air
air.cti), a hydrogen/oxygen reaction mechanism (
h2o2.cti), some pure fluids in the
liquid-vapor region (
liquidvapor.cti), and a few surface reaction mechanisms (such as
diamond.cti, etc.), among others. Under Windows, these files may be located
C:\Program Files\Cantera\data depending on how you installed Cantera and the options you
specified. On a Unix/Linux/macOS machine, they are usually kept in the
within the Cantera installation directory. Starting with Cantera 2.5, corresponding
versions of these input files in the YAML format are also installed.
Converting or Creating New Input Files¶
If you want to model a phase not available in the input files distributed with Cantera, you will need to either procure a new input file (there are a limited number of input files available on the web), or create a new one.
There are three primary options for creating a new Cantera input file:
Understanding Input File Syntax¶
For any of these options (adapting an existing Cantera input file, converting from CK, or creating a new input file), it can be helpful to understand the input file syntax requirements. Clearly, anyone writing directly in the CTI or YAML formats must conform to these standards. However, even when importing an externally-provided file or converting from CK format, understanding the input file syntax can help diagnose and correct any errors (although many/most of the CK conversion errors will be related to errors in the CK syntax formatting).