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

We should replace cantera.Species.fromCti() calls with cantera.Species.from_yaml() calls #2676

Open
2 tasks
rwest opened this issue Jun 10, 2024 · 3 comments
Open
2 tasks

Comments

@rwest
Copy link
Member

rwest commented Jun 10, 2024

Bug Description

The unit tests include the warning:

test/rmgpy/speciesTest.py::TestSpecies::test_cantera
  /home/runner/work/RMG-Py/RMG-Py/test/rmgpy/speciesTest.py:477: DeprecationWarning: XML_Node::build: 
  The CTI and XML input file formats are deprecated and will be removed in
  Cantera 3.0. Use 'cti2yaml.py' or 'ctml2yaml.py' to convert CTI or XML input
  files to the YAML format. See https://cantera.org/tutorials/legacy2yaml.html
  for more information.

The relevant part of RMG-Py/test/rmgpy/speciesTest.py is

        rmg_ct_species = rmg_species.to_cantera(use_chemkin_identifier=True)

        ct_species = ct.Species.fromCti(
            """species(name=u'Ar',
        atoms='Ar:1',
        thermo=(NASA([200.00, 1000.00],
                     [ 2.50000000E+00,  0.00000000E+00,  0.00000000E+00,
                       0.00000000E+00,  0.00000000E+00, -7.45375000E+02,
                       4.37967000E+00]),
                NASA([1000.00, 6000.00],
                     [ 2.50000000E+00,  0.00000000E+00,  0.00000000E+00,
                       0.00000000E+00,  0.00000000E+00, -7.45375000E+02,
                       4.37967000E+00])),
        transport=gas_transport(geom='atom',
                                diam=3.33,
                                well_depth=136.501,
                                dipole=2.0,
                                polar=1.0,
                                rot_relax=15.0))"""
        )
        assert type(rmg_ct_species) == type(ct_species)

We should replace the fromCti block with a from_yaml block with a syntax a bit like this (this example is obviously a different species)

ct.Species.from_yaml(
'''name: C6H5CH3
composition: {C: 7, H: 8}
thermo:
  model: NASA7
  temperature-ranges: [100.00, 1073.72, 5000.00]
  data:
  - [2.05719474e+00, 3.12152776E-02, 3.04758250E-05, -5.05435593E-08, 
     1.81542493E-11, 3.83493690E+03, 1.65378111E+01]
  - [9.30667130E+00, 3.36713230E-02, -1.41158452E-05, 2.69973752E-09, 
    -1.93204076E-13, 5.79813528E+02, -2.68610894E+01]'''
    )

Note the transportDataTest.py also has a fromCti call.

  • speciesTest.py
  • transportDataTest.py

How To Reproduce

Run the unit tests, specifically test/rmgpy/speciesTest.py

Expected Behavior

We wouldn't get deprecation warnings from Cantera.

@JacksonBurns
Copy link
Contributor

Would this also require setting a new lower limit to the supported Cantera version inside the environment file? I assume that this new function has not been backported to all previous versions, and there would be some new cutoff.

@rwest
Copy link
Member Author

rwest commented Jun 25, 2024

For a year now we have required Cantera 2.6, and from_yaml is documented in that version. (It already existed in 2.5.1 but was called fromYaml)

Copy link

This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days.

@github-actions github-actions bot added the stale stale issue/PR as determined by actions bot label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants