Skip to content

Commit db3fc12

Browse files
committed
[Doc] Transfer legacy2yaml tutorial
1 parent ee1d52a commit db3fc12

File tree

4 files changed

+86
-4
lines changed

4 files changed

+86
-4
lines changed

doc/sphinx/userguide/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ conditions, or calculating the voltage of a Lithium-ion battery as it is dischar
3131
- [](creating-mechanisms)
3232
- [](thermobuild)
3333
- [](input-errors)
34+
- [](legacy2yaml-tutorial)
3435

3536
```{toctree}
3637
:hidden:
@@ -42,4 +43,5 @@ ck2yaml-tutorial
4243
creating-mechanisms
4344
thermobuild
4445
input-errors
46+
legacy2yaml-tutorial
4547
```
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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.

doc/sphinx/yaml/cti2yaml.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ CTI to YAML conversion
55
***********************
66

77
.. seealso::
8-
For a tutorial, refer to the `Converting CTI and XML input files to YAML
9-
<https://cantera.org/tutorials/legacy2yaml.html>`_ pages.
8+
For a tutorial, refer to the page :doc:`/userguide/legacy2yaml-tutorial`.
109

1110
.. argparse::
1211
:module: cantera.cti2yaml

doc/sphinx/yaml/ctml2yaml.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ CTML to YAML conversion
55
***********************
66

77
.. seealso::
8-
For a tutorial, refer to the `Converting CTI and XML input files to YAML
9-
<https://cantera.org/tutorials/legacy2yaml.html>`_ pages.
8+
For a tutorial, refer to the page :doc:`/userguide/legacy2yaml-tutorial`.
109

1110
.. argparse::
1211
:module: cantera.ctml2yaml

0 commit comments

Comments
 (0)