Skip to content

Commit

Permalink
update cantera syntax with cantera.cti2yaml.convert
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonBurns committed Jan 22, 2025
1 parent a31ca69 commit 128538e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 28 deletions.
44 changes: 26 additions & 18 deletions test/rmgpy/speciesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 22 additions & 10 deletions test/rmgpy/transportDataTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 128538e

Please sign in to comment.