From 8ffbbea93f76589b9fc8dcbcb6f8df8287e8d95f Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 1 Jul 2016 22:47:48 -0400 Subject: [PATCH] [Python/Examples] Save correct system state after integration step --- interfaces/cython/cantera/examples/reactors/custom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/examples/reactors/custom.py b/interfaces/cython/cantera/examples/reactors/custom.py index d0412e63d..48e5128a6 100644 --- a/interfaces/cython/cantera/examples/reactors/custom.py +++ b/interfaces/cython/cantera/examples/reactors/custom.py @@ -40,7 +40,8 @@ class ReactorOde(object): gas = ct.Solution('gri30.xml') # Initial condition -gas.TPX = 1001, ct.one_atm, 'H2:2,O2:1,N2:4' +P = ct.one_atm +gas.TPX = 1001, P, 'H2:2,O2:1,N2:4' y0 = np.hstack((gas.T, gas.Y)) # Set up objects representing the ODE and the solver @@ -57,6 +58,7 @@ dt = 1e-5 while solver.successful() and solver.t < t_end: solver.integrate(solver.t + dt) t_out.append(solver.t) + gas.TPY = solver.y[0], P, solver.y[1:] states.append(gas.state) # Plot the results