Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to convert CTML to YAML input format #693

Merged
merged 99 commits into from
Dec 2, 2019

Commits on Dec 2, 2019

  1. [ctml2yaml] Add first working version of ctml2yaml

    Correctly converts GRI-3.0 from CTML to YAML format.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    b49359f View commit details
    Browse the repository at this point in the history
  2. [ctml2yaml] Simplify handling of species transport properties

    Check that values for properties are not equal to zero and only include
    them in that case.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    4c8050d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9f958a5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9af1131 View commit details
    Browse the repository at this point in the history
  5. [ctml2yaml] Handle more complicated speciesArrays

    Can now handle undeclared element options and species arrays located in
    another file.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    6327208 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    cf4cc43 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    349857e View commit details
    Browse the repository at this point in the history
  8. [ctml2yaml] Add ptcombust test

    Adds surface phase types
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    d6a5d41 View commit details
    Browse the repository at this point in the history
  9. [ctml2yaml] Fix composition string processing

    Composition strings can be separated by comma or by space with no
    differences. Also, the value could be an int or a float, so check both.
    Use updated function to set the elemental composition of species.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    6af0ad0 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2a87071 View commit details
    Browse the repository at this point in the history
  11. [ctml2yaml] Allow density as a thermo property

    In phase definitions, density can be specified for certain thermo models
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    0a397dd View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    8479d42 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    adaae42 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    9a34719 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    ed684d7 View commit details
    Browse the repository at this point in the history
  16. [ctml2yaml] Allow reactions to be filtered

    Reaction entries can now be filtered as specified in the include node of
    the reactionArray node. Fix typo in transport key name at phase level.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    4096b7c View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    f3e7569 View commit details
    Browse the repository at this point in the history
  18. [ctml2yaml] Fix integer-like reaction IDs error

    reaction_id nodes that look like integers (e.g., '0001') are being read
    as integers by the parser and converting them to strings throws errors.
    The fix is to only include the reaction_id if it doesn't look like an
    integer.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    d3b0c29 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    f2485cb View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    dde5546 View commit details
    Browse the repository at this point in the history
  21. [ctml2yaml] Improve formatting of output file

    Add metadata to the output. Add newlines between each top-level key.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    ece6ebe View commit details
    Browse the repository at this point in the history
  22. [ctml2yaml] Simplify handling of NumPy functions

    Use a global flag to determine the available formatting functions from
    NumPy. Move some functions around for readability.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    c76c53e View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    7826037 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    ac80882 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    f0804e0 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    af71fed View commit details
    Browse the repository at this point in the history
  27. [ctml2yaml] Simplify YAML output section

    This change simplifies how classes are registered with the YAML
    emitter.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    3f484e2 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    8cd35b6 View commit details
    Browse the repository at this point in the history
  29. [ctml2yaml] Check for empty species section

    Species can be specified in another data source.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    fa4eed6 View commit details
    Browse the repository at this point in the history
  30. [ctml2yaml] Add R-K equation of state

    The XML file for this test wasn't already present in the repo, so
    convert the CTI file to XML first.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    5be317c View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    635d592 View commit details
    Browse the repository at this point in the history
  32. [ctml2yaml] Add diamond conversion test

    This commit includes some work-around for the fact that electron-cloud
    phases include the density in the phase definition but
    fixed-stoichiometry phases put the density in the species definition.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    3b8b86e View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    08c567e View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    2f7667d View commit details
    Browse the repository at this point in the history
  35. [ctml_writer] Fix warning invalid escape sequence

    The docstring for the reaction class has some math formatting. This was
    causing an invalid escape sequence warning during build. The fix is to
    make the docstring a raw string.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    d1e1fcf View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    bfaa1a2 View commit details
    Browse the repository at this point in the history
  37. [ctml2yaml] Add ch4_ion test

    Requires multipel reactionArray nodes, multiple speciesArray nodes, and
    the option to skip undeclared third body species.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    6046cc4 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    7ae7f75 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    88634a9 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    3e4d64a View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    3239940 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    ee690e8 View commit details
    Browse the repository at this point in the history
  43. [ctml2yaml] Use speciesData id name

    If a speciesData node has an id other than species_data, use it to label
    the corresponding section in the YAML output file.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    449fbd2 View commit details
    Browse the repository at this point in the history
  44. [ctml2yaml] Add Shomate species thermo

    Fixes error when speciesData has an id attribute other than species_data
    and the phase is StoichSubstance.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    be0e17e View commit details
    Browse the repository at this point in the history
  45. [ctml2yaml] Specialize for Redlich-Kwong EOS

    The R-K EOS is moving activity coefficient data from the phase node to
    the species node in YAML. However, other phases are retaining this data
    in the phase node. This change specializes the previous processing of
    the activityCoefficient node to be only for the R-K phase thermo model.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    9e1598c View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    3ed782b View commit details
    Browse the repository at this point in the history
  47. [ctml2yaml] HMW-electrolyte and piecewise-Gibbs

    Use ThermoPhase to load the input files rather than Solution. This
    avoids a bug in TransportFactory that would be hit by using Solution.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    47d33fb View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    c435b84 View commit details
    Browse the repository at this point in the history
  49. [ctml2yaml] Add Debye-Huckel phase-thermo type

    The implementation is not quite complete, some refactoring needs to be
    done to make it easier to move data from the phase node to the species
    nodes.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    49bf4b5 View commit details
    Browse the repository at this point in the history
  50. [ctml2yaml] Rename Species parameter species_node

    Just clarify what the input argument is
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    28f4c78 View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    8fc20ee View commit details
    Browse the repository at this point in the history
  52. [ctml2yaml] Refactor species and reaction creation

    Create Species and Reaction objects before Phase objects. This allows
    the Phase constructor to modify the appropriate objects based on
    reaction filtering or various equation of state models where information
    is moving from the phase node to the Species.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    c76891d View commit details
    Browse the repository at this point in the history
  53. [ctml2yaml] Use the fancy new error classes

    Use error classes that better describe what is missing and print the
    actual node instead of its memory address
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    a388402 View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    1418d1a View commit details
    Browse the repository at this point in the history
  55. [ctml2yaml] Change XXXX_attribs to just attribs

    For Species and Reaction classes. This makes it easier to reference
    these attributes and the extra specifier is not needed because it is
    implied by the type of class already.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    e61f4b8 View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    c7181a3 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    66ce20b View commit details
    Browse the repository at this point in the history
  58. [Thermo] Make sure the neutral phase is initialized

    In the IonsFromNeutral phase, make sure the neutralMoleculePhase is
    initialized before we try to use it. This prevents a segfault if the
    input YAML file does not have the neutral-phase key.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    e2af32a View commit details
    Browse the repository at this point in the history
  59. [Thermo] Check that special species was specified

    In the IonsFromNeutral phase, if a special-species is not included the
    index is never set after initialization and remains at npos. The check
    here ensures that a special-species is specified.
    
    Also move building the elemVectorI outside of the jNeut loop. It doesn't
    appear to need to be done for every neutral species, so this would save
    some effort
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    1de5d66 View commit details
    Browse the repository at this point in the history
  60. [Thermo] IonsFromNeutral can specify the neutral phase in another file

    When specified in YAML input, the neutral-phase can now be specified as
    being in another file by using a / to delimit the file from the phase
    name. This is similar to specifying species or elements in another file.
    This brings back parity with the XML specification of these phases.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    3b5bcca View commit details
    Browse the repository at this point in the history
  61. [ctml2yaml] Margules and ions-from-neutral phases

    Add Margules and ions-from-neutral-molecule phases. Margules is not
    complete, it is missing the interaction parameters.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    bc58b9c View commit details
    Browse the repository at this point in the history
  62. [ctml2yaml] Add Motz-Wise correction option

    If the Motz-Wise option is specified at the global reactionData node
    level, this is used to set the option for all the reactions in that node
    that don't otherwise specify the option. This method is easier than
    setting the equivalent phase-level option.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    70f062a View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    09975ee View commit details
    Browse the repository at this point in the history
  64. Configuration menu
    Copy the full SHA
    b2f87f4 View commit details
    Browse the repository at this point in the history
  65. [ctml2yaml] Parse pathological species names

    These changes allow parsing composition map strings where colons are
    allowed as characters in keys in a colon delimited map, as well as
    handling comma or space separated pairs where commas are also valid
    characters in the keys.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    7b2a2f9 View commit details
    Browse the repository at this point in the history
  66. Configuration menu
    Copy the full SHA
    51ae226 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    80816a3 View commit details
    Browse the repository at this point in the history
  68. Configuration menu
    Copy the full SHA
    df6bcc8 View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    b10d1d8 View commit details
    Browse the repository at this point in the history
  70. [ctml2yaml] Refactor SpeciesThermo for polynomials

    Extract a method to process the polynomials. Ensure that sorting of the
    temperature ranges correlates with the sorting of the data.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    794905c View commit details
    Browse the repository at this point in the history
  71. Configuration menu
    Copy the full SHA
    89fd38b View commit details
    Browse the repository at this point in the history
  72. Configuration menu
    Copy the full SHA
    7c800db View commit details
    Browse the repository at this point in the history
  73. Configuration menu
    Copy the full SHA
    f1474d7 View commit details
    Browse the repository at this point in the history
  74. Configuration menu
    Copy the full SHA
    b9522a4 View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    1745c4a View commit details
    Browse the repository at this point in the history
  76. Configuration menu
    Copy the full SHA
    eb5dbc6 View commit details
    Browse the repository at this point in the history
  77. [ctml2yaml] Rework reaction type factory

    The changes now match all of the options in newReaction, including
    synonyms. Butler-Volmer parameters are deprecated so the user is warned.
    Simplify processing interface type reactions into one method, since the
    electrochem node is optional.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    0534b11 View commit details
    Browse the repository at this point in the history
  78. Configuration menu
    Copy the full SHA
    c5c0902 View commit details
    Browse the repository at this point in the history
  79. Configuration menu
    Copy the full SHA
    645a86a View commit details
    Browse the repository at this point in the history
  80. Configuration menu
    Copy the full SHA
    3a74c97 View commit details
    Browse the repository at this point in the history
  81. [ctml2yaml] Fix trailing space if units is empty

    Add a docstring for get_float_or_units. Use the clean_node_text
    function.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    76ab074 View commit details
    Browse the repository at this point in the history
  82. Configuration menu
    Copy the full SHA
    844f4a0 View commit details
    Browse the repository at this point in the history
  83. [ctml2yaml] Retain zero values in the YAML output

    As demonstrated in Cantera#683, sometimes the zero values are intentional and
    meaningful. Rework the SpeciesTransport class to not use this function.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    0ec1c9d View commit details
    Browse the repository at this point in the history
  84. Configuration menu
    Copy the full SHA
    66c1433 View commit details
    Browse the repository at this point in the history
  85. [ctml2yaml] Fix several XML parsing errors

    The Python Expat parser requires that the <?xml version...> tag occur as
    the first characters in the file, even before any blank space, so lstrip
    is used to remove any whitespace. In addition, raw & characters are
    replaced with their escaped version.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    dfd4e6d View commit details
    Browse the repository at this point in the history
  86. [ctml2yaml] Combine duplicate section ids

    If a reactionData or speciesData node has a duplicated id attribute,
    combine the duplicate sections together. If duplicate reaction id
    attributes or species names are found, either warn or raise an error.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    e31ad91 View commit details
    Browse the repository at this point in the history
  87. Configuration menu
    Copy the full SHA
    3376fcb View commit details
    Browse the repository at this point in the history
  88. [Doc] Add documentation for ctml2yaml script

    Add intersphinx extension to auto-link to Python docs. Bump KaTeX
    version.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    1d62ec0 View commit details
    Browse the repository at this point in the history
  89. [ctml2yaml] Add QUANTITY type definition

    A quantity is a value that can be either just a number (i.e., a float)
    or a number plus a unit (i.e., a str).
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    6a47942 View commit details
    Browse the repository at this point in the history
  90. [ctml2yaml] Add command line arguments

    Add parsing of arguments passed when the script is run from the command
    line. A new function is introduced to parse the arguments and is the
    default function when the file is executed as a script. Update the
    documentation to add the new function.
    
    Add a new argument to convert that takes a string containing the content
    of a CTML file. This allows convert to be used from within the Python
    interpreter more easily.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    06627ed View commit details
    Browse the repository at this point in the history
  91. [ctml2yaml] Improve error messages

    Node tag names are now quoted for clarity.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    c525c7e View commit details
    Browse the repository at this point in the history
  92. [ctml2yaml] RK does not need activityCoefficients

    The Redlich-Kwong phase-thermo model doesn't require the
    activityCoefficients node. If not specified, values will be found from
    critProperties.xml
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    c3701ba View commit details
    Browse the repository at this point in the history
  93. [ctml2yaml/Test] Remove on-the-fly ctml_writer use

    ctml_writer.py maintains global state between calling convert(). This
    change commits the resulting XML file into the test/data directory
    rather than converting during the test.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    96d9c17 View commit details
    Browse the repository at this point in the history
  94. [Test] Remove unnecessary enumerate

    The index from the enumerate is not actually used anywhere.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    4d6dcce View commit details
    Browse the repository at this point in the history
  95. [cti2yaml/Test] Remove test class setup

    There isn't a reason to convert gri30 every time the class is
    instantiated. Move the conversion into the test_gri30 function.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    3ef2709 View commit details
    Browse the repository at this point in the history
  96. [ctml2yaml/Test] Reformat test file paths

    Better conform to PEP-8.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    c544d2f View commit details
    Browse the repository at this point in the history
  97. [Python] Add entry point scripts for converters

    The YAML converters are now installed as scripts from the Python
    package. The zip_safe flag is needed to ensure that data files are
    accessible by the package. This was added to resolve a build problem
    with Python 3.8. I'm not sure why it hasn't been a problem until now.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    4c977e4 View commit details
    Browse the repository at this point in the history
  98. [SCons/Python] Minimum Python version is 3.5

    Bump the minimum Python version to 3.5 to support features in ctml2yaml.
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    20906b6 View commit details
    Browse the repository at this point in the history
  99. [cti2yaml] Update command line interface

    Use argparse to have the CLI match ctml2yaml.py
    bryanwweber committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    6508179 View commit details
    Browse the repository at this point in the history