From fde505113166473b1d5ad3cd61f6aed5dd7b9d4f Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Mon, 5 Mar 2018 18:38:12 -0500 Subject: [PATCH] [Test/1D] Test that solving in inconsistent transport state errors If Soret diffusion and mixture-averaged transport properties are enabled, test that an exception is thrown. Also test that multicomponent diffusion and Soret diffusion can be enabled/disabled in either order. Also test that the automatic flame solver correctly disables Soret diffusion. --- interfaces/cython/cantera/test/test_onedim.py | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/test/test_onedim.py b/interfaces/cython/cantera/test/test_onedim.py index bbe7615b8..b21e0cee2 100644 --- a/interfaces/cython/cantera/test/test_onedim.py +++ b/interfaces/cython/cantera/test/test_onedim.py @@ -292,14 +292,39 @@ class TestFreeFlame(utilities.CanteraTest): self.assertNear(Su_multi, Su_soret, 2e-1) self.assertNotEqual(Su_multi, Su_soret) - def test_soret_flag(self): + def test_soret_with_mix(self): + # Test that enabling Soret diffusion without + # multicomponent transport results in an error + self.create_sim(101325, 300, 'H2:1.0, O2:1.0') self.assertFalse(self.sim.soret_enabled) + self.assertFalse(self.sim.transport_model == 'Multi') + with self.assertRaises(ct.CanteraError): self.sim.soret_enabled = True + self.sim.solve(loglevel=0, auto=False) + + def test_soret_with_auto(self): + # Test that auto solving with Soret enabled works + self.create_sim(101325, 300, 'H2:2.0, O2:1.0') + self.sim.soret_enabled = True + self.sim.transport_model = 'Multi' + self.sim.solve(loglevel=0, auto=True) + + def test_set_soret_multi_mix(self): + # Test that the transport model and Soret diffusion + # can be set in any order without raising errors + + self.create_sim(101325, 300, 'H2:1.0, O2:1.0') self.sim.transport_model = 'Multi' self.sim.soret_enabled = True + self.sim.transport_model = 'Mix' + self.sim.soret_enabled = False + + self.sim.soret_enabled = True + self.sim.transport_model = 'Multi' + def test_prune(self): reactants = 'H2:1.1, O2:1, AR:5' p = ct.one_atm