diff --git a/interfaces/cython/cantera/test/test_reaction.py b/interfaces/cython/cantera/test/test_reaction.py index a7c42f4f94e..08e4a648c1e 100644 --- a/interfaces/cython/cantera/test/test_reaction.py +++ b/interfaces/cython/cantera/test/test_reaction.py @@ -133,6 +133,7 @@ def setUpClass(cls): cls.gas = ct.Solution("kineticsfromscratch.yaml") cls.gas.X = "H2:0.1, H2O:0.2, O2:0.7, O:1e-4, OH:1e-5, H:2e-5" cls.gas.TP = 900, 2*ct.one_atm + cls.gas.Te = 2300 def from_parts(self): # create reaction rate object from parts @@ -285,6 +286,43 @@ def test_negative_A(self): self.assertTrue(rate.allow_negative_pre_exponential_factor) +class TestETempRate(ReactionRateTests, utilities.CanteraTest): + # test ETemp rate expressions + + _cls = ct.ETempRate + _type = "electron-temperature" + _index = 11 + _input = {"rate-constant": {"A": 17283, "b": -3.1, "Ea_T": -5.8201, "Ea_Te": 10.809}} # Te associated cal. is wrong + _yaml = """ + type: electron-temperature + rate-constant: {A: 17283, b: -3.1, Ea_T: -700 K, Ea_Te: 1300 K} + """ + + @classmethod + def setUpClass(cls): + ReactionRateTests.setUpClass() + cls._parts = cls._input["rate-constant"] + + def eval(self, rate): + # check evaluation as a function of temperature and electron temperature + return rate(self.gas.T, self.gas.Te) + + def test_from_parts(self): + rate = self.from_parts() + self.assertEqual(self._parts["A"], rate.pre_exponential_factor) + self.assertEqual(self._parts["b"], rate.temperature_exponent) + self.assertAlmostEqual(self._parts["Ea_T"], rate.activation_energy) + self.assertAlmostEqual(self._parts["Ea_Te"], rate.activation_electron_energy) + self.check_rate(rate) + + def test_negative_A(self): + # test reaction rate property + rate = self.from_parts() + self.assertFalse(rate.allow_negative_pre_exponential_factor) + rate.allow_negative_pre_exponential_factor = True + self.assertTrue(rate.allow_negative_pre_exponential_factor) + + class FalloffRateTests(ReactionRateTests): # test Falloff rate expressions _n_data = [0] # list of valid falloff coefficient array lengths diff --git a/test/data/kineticsfromscratch.yaml b/test/data/kineticsfromscratch.yaml index 2b873616d82..8090835594e 100644 --- a/test/data/kineticsfromscratch.yaml +++ b/test/data/kineticsfromscratch.yaml @@ -80,3 +80,7 @@ reactions: type: chemically-activated high-P-rate-constant: [5.88E-14, 6.721, -3022.227] low-P-rate-constant: [282320.078, 1.46878, -3270.56495] +- equation: O + H <=> O + H # Reaction 12 + units: {length: cm, quantity: mol} + type: electron-temperature + rate-constant: {A: 17283, b: -3.1, Ea_T: -700 K, Ea_Te: 1300 K} \ No newline at end of file