From 31043ac1deb003d77706d5162cffe7a2debc86e4 Mon Sep 17 00:00:00 2001 From: Cory Kinney Date: Tue, 9 Jul 2024 13:33:02 -0400 Subject: [PATCH] [Test] yaml2ck: Add test for phase with no reactions The test case verifies that a phase with no reactions will successfully write to a Chemkin file. --- test/data/yaml-ck-reactions.yaml | 9 +++++++++ test/python/test_convert.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/data/yaml-ck-reactions.yaml b/test/data/yaml-ck-reactions.yaml index 026afde338..cfb810672d 100644 --- a/test/data/yaml-ck-reactions.yaml +++ b/test/data/yaml-ck-reactions.yaml @@ -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 diff --git a/test/python/test_convert.py b/test/python/test_convert.py index 117d0d9a43..4f184591c2 100644 --- a/test/python/test_convert.py +++ b/test/python/test_convert.py @@ -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')