From 982f9af20c29e02482d8134f0803a79541213497 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 24 May 2013 17:47:29 +0000 Subject: [PATCH] [Test/Reactor] Fixed test of sensitivity coefficients --- interfaces/cython/cantera/test/test_reactor.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/interfaces/cython/cantera/test/test_reactor.py b/interfaces/cython/cantera/test/test_reactor.py index 3b452fb93..62796e1b2 100644 --- a/interfaces/cython/cantera/test/test_reactor.py +++ b/interfaces/cython/cantera/test/test_reactor.py @@ -770,18 +770,13 @@ class TestReactorSensitivities(utilities.CanteraTest): # Index of first variable corresponding to r2 K2 = Ns + gas1.n_species + interface.n_species - # Constant internal energy and volume should generate zero - # sensitivity coefficients - self.assertArrayNear(S[0:Ns,:], np.zeros((Ns,2))) - self.assertArrayNear(S[K2:K2+Ns,:], np.zeros((Ns,2))) + # Constant volume should generate zero sensitivity coefficient + self.assertArrayNear(S[1,:], np.zeros(2)) + self.assertArrayNear(S[K2+1,:], np.zeros(2)) - S11 = np.linalg.norm(S[Ns:K2,0]) - S21 = np.linalg.norm(S[Ns:K2,1]) - S12 = np.linalg.norm(S[K2+Ns:,0]) - S22 = np.linalg.norm(S[K2+Ns:,1]) - - self.assertTrue(S11 > 1e5 * S12) - self.assertTrue(S22 > 1e5 * S21) + # Sensitivity coefficients for the disjoint reactors should be zero + self.assertNear(np.linalg.norm(S[Ns:K2,1]), 0.0) + self.assertNear(np.linalg.norm(S[K2+Ns:,0]), 0.0) def test_parameter_order1(self): # Single reactor, changing the order in which parameters are added