Skip to content

Commit 7e57e81

Browse files
committed
update cantera syntax with cantera.cti2yaml.convert
1 parent b9e3ac5 commit 7e57e81

2 files changed

Lines changed: 48 additions & 28 deletions

File tree

test/rmgpy/speciesTest.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -458,24 +458,32 @@ def test_cantera(self):
458458

459459
rmg_ct_species = rmg_species.to_cantera(use_chemkin_identifier=True)
460460

461-
ct_species = ct.Species.fromCti(
462-
"""species(name=u'Ar',
463-
atoms='Ar:1',
464-
thermo=(NASA([200.00, 1000.00],
465-
[ 2.50000000E+00, 0.00000000E+00, 0.00000000E+00,
466-
0.00000000E+00, 0.00000000E+00, -7.45375000E+02,
467-
4.37967000E+00]),
468-
NASA([1000.00, 6000.00],
469-
[ 2.50000000E+00, 0.00000000E+00, 0.00000000E+00,
470-
0.00000000E+00, 0.00000000E+00, -7.45375000E+02,
471-
4.37967000E+00])),
472-
transport=gas_transport(geom='atom',
473-
diam=3.33,
474-
well_depth=136.501,
475-
dipole=2.0,
476-
polar=1.0,
477-
rot_relax=15.0))"""
478-
)
461+
ct_species = ct.Species.from_yaml("""
462+
description: |-
463+
Argon
464+
465+
generator: cti2yaml
466+
cantera-version: 3.1.0
467+
date: Wed, 22 Jan 2025 13:43:24 -0500
468+
469+
species:
470+
- name: Ar
471+
composition: {Ar: 1}
472+
thermo:
473+
model: NASA7
474+
temperature-ranges: [200.0, 1000.0, 6000.0]
475+
data:
476+
- [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.37967]
477+
- [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.37967]
478+
transport:
479+
model: gas
480+
geometry: atom
481+
diameter: 3.33
482+
well-depth: 136.501
483+
dipole: 2.0
484+
polarizability: 1.0
485+
rotational-relaxation: 15.0
486+
""")
479487
assert type(rmg_ct_species) == type(ct_species)
480488
assert rmg_ct_species.name == ct_species.name
481489
assert rmg_ct_species.composition == ct_species.composition

test/rmgpy/transportDataTest.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,28 @@ def test_to_cantera(self):
161161
rmg_ct_transport = transport.to_cantera()
162162
import cantera as ct
163163

164-
ct_species = ct.Species.fromCti(
165-
"""species(name=u'Ar',
166-
atoms='Ar:1',
167-
transport=gas_transport(geom='atom',
168-
diam=3.33,
169-
well_depth=136.501,
170-
dipole=2.0,
171-
polar=1.0,
172-
rot_relax=15.0))"""
173-
)
164+
ct_species = ct.Species.fromCti("""
165+
description: |-
166+
Argon
167+
168+
generator: cti2yaml
169+
cantera-version: 3.1.0
170+
date: Wed, 22 Jan 2025 13:48:06 -0500
171+
172+
species:
173+
- name: Ar
174+
composition: {Ar: 1}
175+
thermo:
176+
model: constant-cp
177+
transport:
178+
model: gas
179+
geometry: atom
180+
diameter: 3.33
181+
well-depth: 136.501
182+
dipole: 2.0
183+
polarizability: 1.0
184+
rotational-relaxation: 15.0
185+
""")
174186

175187
ct_transport = ct_species.transport
176188

0 commit comments

Comments
 (0)