Skip to content

Commit

Permalink
[Test] yaml2ck: Add test for phase with no reactions
Browse files Browse the repository at this point in the history
The test case verifies that a phase with no reactions will successfully write to a Chemkin file.
  • Loading branch information
corykinney authored and speth committed Jul 9, 2024
1 parent 27a9a96 commit 31043ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/data/yaml-ck-reactions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ phases:
state:
T: 300.0
P: 1.01325e+05
- name: no-reactions
thermo: ideal-gas
elements: [O, H, Ar]
kinetics: gas
transport: mixture-averaged
reactions: none
state:
T: 300.0
P: 1.01325e+05

species:
- name: AR
Expand Down
10 changes: 10 additions & 0 deletions test/python/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,16 @@ def test_yaml_2_ck_reactions(self):
self.check_kinetics(ck_phase, yaml_phase, [900, 1800], [2e5, 20e5], tol=2e-7)
self.check_transport(ck_phase, yaml_phase, [298, 1001, 2400])

def test_phase_no_reactions(self):
input_file = self.test_data_path / "yaml-ck-reactions.yaml"
yaml_phase = ct.Solution(input_file, name="no-reactions")
assert yaml_phase.n_reactions == 0

ck_file = self.test_work_path / 'no-reactions.ck'
ck_file.unlink(missing_ok=True)
yaml_phase.write_chemkin(ck_file, quiet=True)
assert ck_file.exists()

def test_write_chemkin(self):
# test alternative converter
yaml_phase = ct.Solution('h2o2.yaml')
Expand Down

0 comments on commit 31043ac

Please sign in to comment.