Skip to content

Commit

Permalink
[Test/1D] Test that solving in inconsistent transport state errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bryanwweber committed Mar 13, 2018
1 parent 4bd5e92 commit fde5051
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,38 @@ def test_multicomponent(self):
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'
Expand Down

0 comments on commit fde5051

Please sign in to comment.