Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
b49359f
[ctml2yaml] Add first working version of ctml2yaml
bryanwweber Aug 14, 2019
4c8050d
[ctml2yaml] Simplify handling of species transport properties
bryanwweber Aug 15, 2019
9f958a5
[ctml2yaml] Add pressure-dependent reactions
bryanwweber Aug 16, 2019
9af1131
[ctml2yaml] Include reaction orders in output
bryanwweber Aug 16, 2019
6327208
[ctml2yaml] Handle more complicated speciesArrays
bryanwweber Aug 16, 2019
cf4cc43
[ctml2yaml] Add state information from phase
bryanwweber Aug 16, 2019
349857e
[ctml2yaml] Process reactionArray node
bryanwweber Aug 16, 2019
d6a5d41
[ctml2yaml] Add ptcombust test
bryanwweber Nov 26, 2019
6af0ad0
[ctml2yaml] Fix composition string processing
bryanwweber Aug 19, 2019
2a87071
[ctml2yaml] Use lowercase in property mappings
bryanwweber Aug 19, 2019
0a397dd
[ctml2yaml] Allow density as a thermo property
bryanwweber Aug 19, 2019
8479d42
[ctml2yaml] Allow empty/nonexistant reactionArrays
bryanwweber Aug 19, 2019
adaae42
[ctml2yaml] Add reaction ID to output
bryanwweber Aug 19, 2019
9a34719
[ctml2yaml] Add constant-cp species thermo
bryanwweber Aug 19, 2019
ed684d7
[ctml2yaml] Add edge reaction types
bryanwweber Aug 19, 2019
4096b7c
[ctml2yaml] Allow reactions to be filtered
bryanwweber Aug 19, 2019
f3e7569
[ctml2yaml] Add test_sofc to ctml2yaml tests
bryanwweber Aug 19, 2019
d3b0c29
[ctml2yaml] Fix integer-like reaction IDs error
bryanwweber Aug 23, 2019
f2485cb
[ctml2yaml] Add Flow classes to format YAML output
bryanwweber Sep 6, 2019
dde5546
[ctml2yaml] Refactor reaction processing to class
bryanwweber Sep 7, 2019
ece6ebe
[ctml2yaml] Improve formatting of output file
bryanwweber Sep 7, 2019
c76c53e
[ctml2yaml] Simplify handling of NumPy functions
bryanwweber Nov 26, 2019
7826037
[ctml2yaml] Refactor phase definition to a class
bryanwweber Sep 7, 2019
ac80882
[ctml2yaml] Refactor species into a class
bryanwweber Sep 7, 2019
f0804e0
[ctml2yaml] Refactor SpeciesThermo to a class
bryanwweber Sep 8, 2019
af71fed
[ctml2yaml] Refactor SpeciesTransport to a class
bryanwweber Sep 8, 2019
3f484e2
[ctml2yaml] Simplify YAML output section
bryanwweber Nov 26, 2019
8cd35b6
[ctml2yaml] Add handling of liquidvapor phases
bryanwweber Sep 9, 2019
fa4eed6
[ctml2yaml] Check for empty species section
bryanwweber Sep 9, 2019
5be317c
[ctml2yaml] Add R-K equation of state
bryanwweber Sep 10, 2019
635d592
[ctml2yaml] Add Reitz n-dodecane RK test
bryanwweber Sep 10, 2019
3b8b86e
[ctml2yaml] Add diamond conversion test
bryanwweber Sep 11, 2019
08c567e
[ctml2yaml] Add lithium_ion_battery test
bryanwweber Sep 11, 2019
2f7667d
[ctml2yaml] Add negative-A handling for reactions
bryanwweber Sep 14, 2019
d1e1fcf
[ctml_writer] Fix warning invalid escape sequence
bryanwweber Sep 19, 2019
bfaa1a2
[SCons] Remove test/work directory during cleaning
bryanwweber Sep 19, 2019
6046cc4
[ctml2yaml] Add ch4_ion test
bryanwweber Sep 19, 2019
7ae7f75
[ctml2yaml] Add NASA9 species thermo
bryanwweber Sep 19, 2019
88634a9
[ctml2yaml] Add chemically activated reaction type
bryanwweber Oct 4, 2019
3e4d64a
[ctml2yaml] Add negative reaction orders option
bryanwweber Oct 4, 2019
3239940
[ctml2yaml] Fixed chemical potential phase thermo
bryanwweber Oct 4, 2019
ee690e8
[ctml2yaml] Add liquid water phase
bryanwweber Oct 6, 2019
449fbd2
[ctml2yaml] Use speciesData id name
bryanwweber Oct 6, 2019
be0e17e
[ctml2yaml] Add Shomate species thermo
bryanwweber Oct 7, 2019
9e1598c
[ctml2yaml] Specialize for Redlich-Kwong EOS
bryanwweber Oct 7, 2019
3ed782b
[ctml2yaml] Phase model lookups are case-sensitive
bryanwweber Oct 7, 2019
47d33fb
[ctml2yaml] HMW-electrolyte and piecewise-Gibbs
bryanwweber Oct 6, 2019
c435b84
[Thermo] Fix typos in error messages
bryanwweber Oct 17, 2019
49bf4b5
[ctml2yaml] Add Debye-Huckel phase-thermo type
bryanwweber Oct 19, 2019
28f4c78
[ctml2yaml] Rename Species parameter species_node
bryanwweber Oct 19, 2019
8fc20ee
[ctml2yaml] Add types and resolve mypy errors
bryanwweber Oct 23, 2019
c76891d
[ctml2yaml] Refactor species and reaction creation
bryanwweber Oct 29, 2019
a388402
[ctml2yaml] Use the fancy new error classes
bryanwweber Oct 30, 2019
1418d1a
[ctml2yaml] Fix RK phase generation after refactor
bryanwweber Oct 30, 2019
e61f4b8
[ctml2yaml] Change XXXX_attribs to just attribs
bryanwweber Oct 30, 2019
c7181a3
[ctml2yaml] Finish Debye-Huckel phase-thermo type
bryanwweber Oct 30, 2019
66ce20b
[ctml2yaml] Add MaskellSolidSolnPhase
bryanwweber Oct 30, 2019
e2af32a
[Thermo] Make sure the neutral phase is initialized
bryanwweber Nov 1, 2019
1de5d66
[Thermo] Check that special species was specified
bryanwweber Nov 1, 2019
3b5bcca
[Thermo] IonsFromNeutral can specify the neutral phase in another file
bryanwweber Nov 1, 2019
bc58b9c
[ctml2yaml] Margules and ions-from-neutral phases
bryanwweber Nov 1, 2019
70f062a
[ctml2yaml] Add Motz-Wise correction option
bryanwweber Nov 1, 2019
09975ee
[ctml2yaml] Simplify duplicate id checks
bryanwweber Nov 1, 2019
b2f87f4
[ctml2yaml] Add Redlich-Kister thermo phase type
bryanwweber Nov 2, 2019
7b2a2f9
[ctml2yaml] Parse pathological species names
bryanwweber Nov 3, 2019
51ae226
[ctml2yaml] Add SRI falloff reaction type
bryanwweber Nov 26, 2019
80816a3
[ctml2yaml] Move reaction equation to top of node
bryanwweber Nov 3, 2019
df6bcc8
[ctml2yaml] Simplify reaction type hints
bryanwweber Nov 3, 2019
b10d1d8
[Test] Replace phaseid and phases args to converters
bryanwweber Nov 3, 2019
794905c
[ctml2yaml] Refactor SpeciesThermo for polynomials
bryanwweber Nov 4, 2019
89fd38b
[ctml2yaml] Add Ideal VPSS and PDSS_HKFT types
bryanwweber Nov 4, 2019
7c800db
[ctml2yaml] Add last species standard state models
bryanwweber Nov 4, 2019
f1474d7
[ctml2yaml] Add LatticeSolid phase
bryanwweber Nov 4, 2019
b9522a4
[ctml2yaml] Finish adding Margules phase thermo
bryanwweber Nov 4, 2019
1745c4a
[Test] Use ThermoPhase to load Debye-Huckel
bryanwweber Nov 4, 2019
eb5dbc6
[ctml2yaml] Add IdealSolidSolnPhase conversion
bryanwweber Nov 11, 2019
0534b11
[ctml2yaml] Rework reaction type factory
bryanwweber Nov 13, 2019
c5c0902
[ctml2yaml] Add IdealMolalSoln thermo type
bryanwweber Nov 13, 2019
645a86a
[ctml2yaml] Add conversion for more transport models
bryanwweber Nov 13, 2019
3a74c97
[ctml2yaml] Add non-reactant orders
bryanwweber Nov 13, 2019
76ab074
[ctml2yaml] Fix trailing space if units is empty
bryanwweber Nov 13, 2019
844f4a0
[ctml2yaml] Rename class attributes to non-private
bryanwweber Nov 13, 2019
0ec1c9d
[ctml2yaml] Retain zero values in the YAML output
bryanwweber Nov 26, 2019
66c1433
[ctml2yaml] Add temperature_polynomial conversion
bryanwweber Nov 13, 2019
dfd4e6d
[ctml2yaml] Fix several XML parsing errors
bryanwweber Nov 18, 2019
e31ad91
[ctml2yaml] Combine duplicate section ids
bryanwweber Nov 19, 2019
3376fcb
[ctml2yaml/Doc] Add docstrings
bryanwweber Nov 24, 2019
1d62ec0
[Doc] Add documentation for ctml2yaml script
bryanwweber Nov 24, 2019
6a47942
[ctml2yaml] Add QUANTITY type definition
bryanwweber Nov 25, 2019
06627ed
[ctml2yaml] Add command line arguments
bryanwweber Nov 25, 2019
c525c7e
[ctml2yaml] Improve error messages
bryanwweber Nov 25, 2019
c3701ba
[ctml2yaml] RK does not need activityCoefficients
bryanwweber Nov 26, 2019
96d9c17
[ctml2yaml/Test] Remove on-the-fly ctml_writer use
bryanwweber Nov 26, 2019
4d6dcce
[Test] Remove unnecessary enumerate
bryanwweber Nov 26, 2019
3ef2709
[cti2yaml/Test] Remove test class setup
bryanwweber Nov 26, 2019
c544d2f
[ctml2yaml/Test] Reformat test file paths
bryanwweber Nov 26, 2019
4c977e4
[Python] Add entry point scripts for converters
bryanwweber Nov 26, 2019
20906b6
[SCons/Python] Minimum Python version is 3.5
bryanwweber Nov 26, 2019
6508179
[cti2yaml] Update command line interface
bryanwweber Nov 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ if 'clean' in COMMAND_LINE_TARGETS:
removeDirectory('build')
removeDirectory('stage')
removeDirectory('.sconf_temp')
removeDirectory('test/work')
removeFile('.sconsign.dblite')
removeFile('include/cantera/base/config.h')
removeFile('src/pch/system.h.gch')
Expand Down Expand Up @@ -1199,7 +1200,7 @@ if env['VERBOSE']:
env['python_cmd_esc'] = quoted(env['python_cmd'])

# Python Package Settings
python_min_version = LooseVersion('3.3')
python_min_version = LooseVersion('3.5')
cython_min_version = LooseVersion('0.23')
numpy_min_test_version = LooseVersion('1.8.1')

Expand Down
9 changes: 8 additions & 1 deletion doc/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
'sphinx.ext.autosummary',
'sphinxcontrib.doxylink',
'sphinxcontrib.katex', # Use KaTeX because it's faster and the main site uses it
'sphinx.ext.intersphinx',
]

katex_version = '0.10.0-beta'
katex_version = '0.11.1'

autodoc_default_flags = ['members','show-inheritance','undoc-members']

Expand All @@ -53,6 +54,12 @@
'../../doxygen/html/')
}

intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
}

# Ensure that the primary domain is the Python domain, since we've added the
# MATLAB domain with sphinxcontrib.matlab
primary_domain = 'py'
Expand Down
51 changes: 51 additions & 0 deletions doc/sphinx/yaml/ctml_conversion.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
***********************
CTML to YAML conversion
***********************

.. py:module:: cantera.ctml2yaml
.. py:currentmodule:: cantera.ctml2yaml

The script ``ctml2yaml.py`` will convert files from the legacy CTML format to YAML input
format. The documentation below describes the classes and functions in the script. Each
function/method is annotated with the Python types that the function accepts.

Most users will access the functionality of this module via the command line with the
``ctml2yaml`` entry-point script. For programmatic access, the `main` and/or `convert`
functions should be used. `main` should be used when command line arguments must be
processed, while `convert` takes an input filename or a string containing the CTML file
to be converted, and optionally the name of the output file.

Module-level functions
======================

.. autofunction:: float2string
.. autofunction:: represent_float
.. autofunction:: get_float_or_quantity
.. autofunction:: split_species_value_string
.. autofunction:: clean_node_text
.. autofunction:: create_species_from_data_node
.. autofunction:: create_reactions_from_data_node
.. autofunction:: create_phases_from_data_node
.. autofunction:: convert
.. autofunction:: main

Conversion classes
==================

.. autoclass:: Phase
:no-undoc-members:
.. autoclass:: Species
:no-undoc-members:
.. autoclass:: SpeciesThermo
:no-undoc-members:
.. autoclass:: SpeciesTransport
:no-undoc-members:
.. autoclass:: Reaction
:no-undoc-members:

Exceptions
==========

.. autoexception:: MissingXMLNode
.. autoexception:: MissingXMLAttribute
.. autoexception:: MissingNodeText
1 change: 1 addition & 0 deletions doc/sphinx/yaml/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ YAML Input File Reference
elements
species
reactions
ctml_conversion
47 changes: 33 additions & 14 deletions interfaces/cython/cantera/cti2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
# This file is part of Cantera. See License.txt in the top-level directory or
# at https://cantera.org/license.txt for license and copyright information.

"""
cti2yaml.py: Convert legacy CTI input files to YAML

Usage:
python cti2yaml.py mech.cti [out.yaml]
"""Convert legacy CTI input files to YAML.

This will produce the output file 'mech.yaml' if an output file name is not
specified.
There are two main entry points to this script, `main` and `convert`. The former is
used from the command line interface and parses the arguments passed. The latter
accepts either the name of the CTI input file or a string containing the CTI
content.
"""

import sys
Expand All @@ -19,6 +17,7 @@
from collections import OrderedDict
import numpy as np
from email.utils import formatdate
import argparse

try:
import ruamel_yaml as yaml
Expand Down Expand Up @@ -1669,13 +1668,33 @@ def convert(filename=None, output_name=None, text=None):


def main():
if len(sys.argv) == 1 or sys.argv[1] in ('-h', '--help'):
print(__doc__)
sys.exit(0)
if len(sys.argv) not in (2,3):
raise ValueError("Incorrect number of command line arguments.\n"
"See 'cti2yaml --help' for more information.")
convert(*sys.argv[1:])
"""Parse command line arguments and pass them to `convert`."""
parser = argparse.ArgumentParser(
description="Convert legacy CTI input files to YAML format",
epilog=("The 'output' argument is optional. If it is not given, an output "
"file with the same name as the input file is used, with the extension "
"changed to '.yaml'.")
)
parser.add_argument("input", help="The input CTI filename. Must be specified.")
parser.add_argument("output", nargs="?", help="The output YAML filename. Optional.")
if len(sys.argv) not in [2, 3]:
if len(sys.argv) > 3:
print(
"cti2yaml.py: error: unrecognized arguments:",
' '.join(sys.argv[3:]),
file=sys.stderr,
)
parser.print_help(sys.stderr)
sys.exit(1)
args = parser.parse_args()
input_file = pathlib.Path(args.input)
if args.output is None:
output_file = input_file.with_suffix(".yaml")
else:
output_file = pathlib.Path(args.output)

convert(input_file, output_file)


if __name__ == "__main__":
main()
Loading