Skip to content

Commit

Permalink
[Doc] Transfer legacy2yaml tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Oct 22, 2023
1 parent dc17c37 commit 60ea75a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/sphinx/userguide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ conditions, or calculating the voltage of a Lithium-ion battery as it is dischar
- [](creating-mechanisms)
- [](thermobuild)
- [](input-errors)
- [](legacy2yaml-tutorial)

```{toctree}
:hidden:
Expand All @@ -42,4 +43,5 @@ ck2yaml-tutorial
creating-mechanisms
thermobuild
input-errors
legacy2yaml-tutorial
```
82 changes: 82 additions & 0 deletions doc/sphinx/userguide/legacy2yaml-tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Converting Legacy CTI and XML Input Files to YAML

If you want to convert an existing, legacy CTI or XML input file to the YAML format,
this section will help.

## cti2yaml

Cantera comes with a converter utility `cti2yaml` (or `cti2yaml.py`) that converts
legacy CTI format mechanisms into the new YAML format introduced in Cantera 2.5. This
program can be run from the command line to convert files to the YAML format.

**Usage:**

```bash
cti2yaml [-h] input [output]
```

The `input` argument is required, and specifies the name of the input file to be
converted. The optional `output` argument specifies the name of the new output file. If
`output` is not specified, then the output file will have the same name as the input
file, with the extension replaced with `.yaml`. The full command line interface for
`cti2yaml` is documented [here](/yaml/cti2yaml).

**Example:**

```bash
cti2yaml mymech.cti
```

will generate the output file `mymech.yaml`.

If the `cti2yaml` script is not on your path, but the Cantera Python module is,
`cti2yaml` can be used by running:

```bash
python -m cantera.cti2yaml mymech.cti
```

It is not necessary to use `cti2yaml` to convert any of the CTI input files previously
included with Cantera. YAML versions of these files are already included with Cantera.

```{tip}
For input files where you have both the CTI and XML versions, `cti2yaml` is recommended
over `ctml2yaml`. In cases where the mechanism was originally converted from a CK-format
mechanism, it is recommended to use `ck2yaml` if the original input files are available.
```

## ctml2yaml

Cantera comes with a converter utility `ctml2yaml` (or `ctml2yaml.py`) that converts
legacy XML (CTML) format mechanisms into the new YAML format introduced in Cantera 2.5.
This program can be run from the command line to convert files to the YAML format.

**Usage:**

```bash
ctml2yaml [-h] input [output]
```

The `input` argument is required, and specifies the name of the input file to be
converted. The optional `output` argument specifies the name of the new output file. If
`output` is not specified, then the output file will have the same name as the input
file, with the extension replaced with `.yaml`. The full command line interface for
`ctml2yaml` is documented [here](/yaml/ctml2yaml).

**Example:**

```bash
ctml2yaml mymech.xml
```

will generate the output file `mymech.yaml`.

If the `ctml2yaml` script is not on your path, but the Cantera Python module is,
`ctml2yaml` can be used by running:

```bash
python -m cantera.cti2yaml mymech.xml
```

It is not necessary to use `ctml2yaml` to convert any of the XML input files included
with Cantera. YAML versions of these files are already included with Cantera.
3 changes: 1 addition & 2 deletions doc/sphinx/yaml/cti2yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ CTI to YAML conversion
***********************

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

.. argparse::
:module: cantera.cti2yaml
Expand Down
3 changes: 1 addition & 2 deletions doc/sphinx/yaml/ctml2yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ CTML to YAML conversion
***********************

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

.. argparse::
:module: cantera.ctml2yaml
Expand Down

0 comments on commit 60ea75a

Please sign in to comment.