网页 综合 更新时间 2026-11-14 10:01:48

Converting Chemkin Format Files — Cantera 3.2.0 documentation

自动蜘蛛 cantera.org 正文约 5999 字
Many existing reaction mechanism files are in CK format, by which we mean the input file format developed for use with the Chemkin-II software package (and subsequent releases) as specified in the report describing the Chemkin software [Kee et al., 1989]. Cantera comes with a converter utility program ck2yaml (or ck2yaml.py) that converts CK format into Cantera’s YAML format. If you want to convert a Chemkin-format file to YAML format, or you’re having errors when you try to do so, this section will help.
For documentation of all the command line options that can be used with ck2yaml, see its documentation in the reference section.
To convert a gas phase mechanism where the thermodynamic and transport data are provided as separate files, run the following command from a terminal (command prompt):
If the ck2yaml script is not on your path but the Cantera Python module is, ck2yaml can also be used by running:
If you’re using Cantera from IPython or a Jupyter Notebook, you can run the above shell command from Python by prefixing it with an exclamation point. For example:
For mechanisms involving both surface and gas phase species, an additional input file is needed to define the surface species and reactions occurring on the surface. This file is specified with the --surface option:
An input file containing only species definitions (which can be referenced from phase definitions in other input files) can be created by specifying only a thermo file. For example:
When ck2yaml encounters an error, it attempts to print the surrounding information to help you to locate the error. Many of the most common errors are due to an inconsistency of the input files from their standard, as defined in the report for Chemkin referenced above. Here, we describe some requirements of the CK format that are common sources of errors.
Many existing CK format files cause errors in ck2yaml when they are processed. Some of these errors may be avoided by specifying the --permissive option. This option allows certain recoverable parsing errors (for example, duplicate transport or thermodynamic data) to be ignored.
Each section of a CK input file must start with a keyword representing that section and end with the keyword END. Keywords that may begin a section include:
THERMO or THERMO ALL
The thermodynamic data is read in a fixed format. This means that each column of the input has a particular meaning. The format for each thermodynamic entry should be as follows:
Many common errors are generated because information is missing or in the wrong column. Check thoroughly for extraneous or missing spaces. Also make sure that the input file does not contain tab characters.
The following table is adapted from the Chemkin manual [Kee et al., 1989] to describe the column positioning of each required part of the entry. Empty columns should be filled with spaces.
Atomic Symbols and formula
Phase of species (S, L, or G)
Additional Atomic Symbols
Coefficients \(a_1\) to \(a_5\) for the upper temperature interval
Coefficients \(a_6,\ a_7\) for the upper temperature interval, and \(a_1,\ a_2,\ a_3\) for the lower temperature interval
Coefficients \(a_4\) through \(a_7\) for the lower temperature interval
The first 18 columns are reserved for the species name. The name assigned to the species in the thermodynamic data must be the same as the species name defined in the SPECIES section. If the species name is shorter than 18 characters, the rest of the characters should be filled by spaces.
The next six columns (columns 19–24) are typically used to write a date; they are not used further.
The next 20 columns (25–44) are used to specify the elemental composition of the species. Five characters are used for each element: the first two specify the element symbol, while the remaining three specify the number of atoms of that element in the species. Up to four elements may be specified this way. For species with more than four elements, the extended composition format described below may be used.
In column 45, the phase of the species (S, L, or G for solid, liquid, or gas respectively) should be specified.
The next 28 columns are reserved for the temperatures that delimit the ranges of the polynomials specified on the next several lines. The first two temperatures have a width of 10 columns each (46–55 and 56–65), and represent the lowest temperature and highest temperature for which the polynomials are valid. The last temperature has a width of 8 columns (66–73) and is the common temperature, where the switch from low to high occurs.
The next 5 columns (74–78) are reserved for atomic symbols and are usually left blank for the default behavior.
Column 79 is blank; and finally, the row is ended in column 80 with the integer 1.
The next three lines of the thermodynamic entry have a similar format. They contain the coefficients of the 7-coefficient polynomial formulation in two temperature regions.
The second row of the thermo entry (the first after the information row) contains the first five coefficients that apply to the temperature range between the midpoint and the upper limit. 15 columns are alloted for each coefficient (for a total of 75 columns), with no spaces between them. Although the entry above shows spaces between positive coefficients, it is to be noted that this is done only for formatting consistency with other lines that contain negative numbers. After the coefficients, four spaces in columns 76–79 are followed by the integer 2 in column 80.
On the next line, the last two coefficients for the upper temperature range and the first three coefficients for the lower temperature range are specified. Once again, this takes up the first 75 columns, columns 76–79 are blank, and the integer 3 is in column 80.
Finally, on the last line of a particular entry, the last four coefficients of the lower temperature range are specified in columns 1–60, 19 blank spaces are present, and the integer 4 is in column 80.
If the number of atoms of
访问原文 返回搜索 https://cantera.org/stable/userguide/ck2yaml-tutorial.html
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。