From 128538e75b2c58b2594e65737db2c77866c018dc Mon Sep 17 00:00:00 2001 From: JacksonBurns Date: Wed, 22 Jan 2025 13:49:22 -0500 Subject: [PATCH] update cantera syntax with cantera.cti2yaml.convert --- test/rmgpy/speciesTest.py | 44 +++++++++++++++++++-------------- test/rmgpy/transportDataTest.py | 32 ++++++++++++++++-------- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/test/rmgpy/speciesTest.py b/test/rmgpy/speciesTest.py index 6c2f558b21..704185e5f7 100644 --- a/test/rmgpy/speciesTest.py +++ b/test/rmgpy/speciesTest.py @@ -458,24 +458,32 @@ def test_cantera(self): 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))""" - ) + ct_species = ct.Species.from_yaml(""" +description: |- + Argon + +generator: cti2yaml +cantera-version: 3.1.0 +date: Wed, 22 Jan 2025 13:43:24 -0500 + +species: +- name: Ar + composition: {Ar: 1} + thermo: + model: NASA7 + temperature-ranges: [200.0, 1000.0, 6000.0] + data: + - [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.37967] + - [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.37967] + transport: + model: gas + geometry: atom + diameter: 3.33 + well-depth: 136.501 + dipole: 2.0 + polarizability: 1.0 + rotational-relaxation: 15.0 +""") assert type(rmg_ct_species) == type(ct_species) assert rmg_ct_species.name == ct_species.name assert rmg_ct_species.composition == ct_species.composition diff --git a/test/rmgpy/transportDataTest.py b/test/rmgpy/transportDataTest.py index 59dee0a542..fc53e595a9 100644 --- a/test/rmgpy/transportDataTest.py +++ b/test/rmgpy/transportDataTest.py @@ -161,16 +161,28 @@ def test_to_cantera(self): rmg_ct_transport = transport.to_cantera() import cantera as ct - ct_species = ct.Species.fromCti( - """species(name=u'Ar', - atoms='Ar:1', - transport=gas_transport(geom='atom', - diam=3.33, - well_depth=136.501, - dipole=2.0, - polar=1.0, - rot_relax=15.0))""" - ) + ct_species = ct.Species.fromCti(""" +description: |- + Argon + +generator: cti2yaml +cantera-version: 3.1.0 +date: Wed, 22 Jan 2025 13:48:06 -0500 + +species: +- name: Ar + composition: {Ar: 1} + thermo: + model: constant-cp + transport: + model: gas + geometry: atom + diameter: 3.33 + well-depth: 136.501 + dipole: 2.0 + polarizability: 1.0 + rotational-relaxation: 15.0 +""") ct_transport = ct_species.transport