|
| 1 | +# Converting Legacy CTI and XML Input Files to YAML |
| 2 | + |
| 3 | +If you want to convert an existing, legacy CTI or XML input file to the YAML format, |
| 4 | +this section will help. |
| 5 | + |
| 6 | +## cti2yaml |
| 7 | + |
| 8 | +Cantera comes with a converter utility `cti2yaml` (or `cti2yaml.py`) that converts |
| 9 | +legacy CTI format mechanisms into the new YAML format introduced in Cantera 2.5. This |
| 10 | +program can be run from the command line to convert files to the YAML format. |
| 11 | + |
| 12 | +**Usage:** |
| 13 | + |
| 14 | +```bash |
| 15 | +cti2yaml [-h] input [output] |
| 16 | +``` |
| 17 | + |
| 18 | +The `input` argument is required, and specifies the name of the input file to be |
| 19 | +converted. The optional `output` argument specifies the name of the new output file. If |
| 20 | +`output` is not specified, then the output file will have the same name as the input |
| 21 | +file, with the extension replaced with `.yaml`. The full command line interface for |
| 22 | +`cti2yaml` is documented [here](/yaml/cti2yaml). |
| 23 | + |
| 24 | +**Example:** |
| 25 | + |
| 26 | +```bash |
| 27 | +cti2yaml mymech.cti |
| 28 | +``` |
| 29 | + |
| 30 | +will generate the output file `mymech.yaml`. |
| 31 | + |
| 32 | +If the `cti2yaml` script is not on your path, but the Cantera Python module is, |
| 33 | +`cti2yaml` can be used by running: |
| 34 | + |
| 35 | +```bash |
| 36 | +python -m cantera.cti2yaml mymech.cti |
| 37 | +``` |
| 38 | + |
| 39 | +It is not necessary to use `cti2yaml` to convert any of the CTI input files previously |
| 40 | +included with Cantera. YAML versions of these files are already included with Cantera. |
| 41 | + |
| 42 | +```{tip} |
| 43 | +For input files where you have both the CTI and XML versions, `cti2yaml` is recommended |
| 44 | +over `ctml2yaml`. In cases where the mechanism was originally converted from a CK-format |
| 45 | +mechanism, it is recommended to use `ck2yaml` if the original input files are available. |
| 46 | +``` |
| 47 | + |
| 48 | +## ctml2yaml |
| 49 | + |
| 50 | +Cantera comes with a converter utility `ctml2yaml` (or `ctml2yaml.py`) that converts |
| 51 | +legacy XML (CTML) format mechanisms into the new YAML format introduced in Cantera 2.5. |
| 52 | +This program can be run from the command line to convert files to the YAML format. |
| 53 | + |
| 54 | +**Usage:** |
| 55 | + |
| 56 | +```bash |
| 57 | +ctml2yaml [-h] input [output] |
| 58 | +``` |
| 59 | + |
| 60 | +The `input` argument is required, and specifies the name of the input file to be |
| 61 | +converted. The optional `output` argument specifies the name of the new output file. If |
| 62 | +`output` is not specified, then the output file will have the same name as the input |
| 63 | +file, with the extension replaced with `.yaml`. The full command line interface for |
| 64 | +`ctml2yaml` is documented [here](/yaml/ctml2yaml). |
| 65 | + |
| 66 | +**Example:** |
| 67 | + |
| 68 | +```bash |
| 69 | +ctml2yaml mymech.xml |
| 70 | +``` |
| 71 | + |
| 72 | +will generate the output file `mymech.yaml`. |
| 73 | + |
| 74 | +If the `ctml2yaml` script is not on your path, but the Cantera Python module is, |
| 75 | +`ctml2yaml` can be used by running: |
| 76 | + |
| 77 | +```bash |
| 78 | +python -m cantera.cti2yaml mymech.xml |
| 79 | +``` |
| 80 | + |
| 81 | +It is not necessary to use `ctml2yaml` to convert any of the XML input files included |
| 82 | +with Cantera. YAML versions of these files are already included with Cantera. |
0 commit comments