From a68cdecd948d7b3af3e6e3d656dd2bb97a8911f3 Mon Sep 17 00:00:00 2001 From: imitrichev Date: Sun, 21 Feb 2016 15:26:25 +0300 Subject: [PATCH] [Test] Add test for specifying non-reactant orders in CTI files --- .../cython/cantera/test/test_convert.py | 8 +++++++ test/data/reaction-orders.cti | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/data/reaction-orders.cti diff --git a/interfaces/cython/cantera/test/test_convert.py b/interfaces/cython/cantera/test/test_convert.py index be9c4d88d2..ecc6961374 100644 --- a/interfaces/cython/cantera/test/test_convert.py +++ b/interfaces/cython/cantera/test/test_convert.py @@ -390,3 +390,11 @@ def test_noninteger_atomicity(self): gas = ct.Solution('../data/noninteger-atomicity.cti') self.assertNear(gas.molecular_weights[gas.species_index('CnHm')], 10.65*gas.atomic_weight('C') + 21.8*gas.atomic_weight('H')) + + def test_reaction_orders(self): + gas = ct.Solution('../data/reaction-orders.cti') + R = gas.reaction(0) + self.assertTrue(R.allow_nonreactant_orders) + self.assertNear(R.orders.get('OH'), 0.15) + self.assertTrue(R.allow_negative_orders) + self.assertNear(R.orders.get('H2'), -0.25) diff --git a/test/data/reaction-orders.cti b/test/data/reaction-orders.cti new file mode 100644 index 0000000000..58a3831f77 --- /dev/null +++ b/test/data/reaction-orders.cti @@ -0,0 +1,23 @@ +# Input file to test use of non-reactant species + +units(length = "cm", time = "s", quantity = "mol", act_energy = "kJ/mol") + +ideal_gas(name = "gas", + elements = " O H ", + species = """gri30: H2 O2 H2O OH """, + reactions = "all", + initial_state = state(temperature = 300.0, + pressure = OneAtm) ) + +#------------------------------------------------------------------------------- +# Reactions data +#------------------------------------------------------------------------------- + +#test negative orders and non-reactant orders +reaction("2 H2 + O2 => 2 H2O", [1e13, 0.0, 0.0], + order="H2:-0.25 OH:0.15", + options=['negative_orders', 'nonreactant_orders']) + +#if uncomment, should throw an error +#reaction("2 H2 + O2 => 2 H2O", [1e13, 0.0, 0.0], +# order="OH:0.15")