Skip to content

Commit

Permalink
[Python/Examples] Save correct system state after integration step
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Jul 9, 2016
1 parent b4f2f82 commit 8ffbbea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion interfaces/cython/cantera/examples/reactors/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def __call__(self, t, y):
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
Expand All @@ -57,6 +58,7 @@ def __call__(self, t, y):
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
Expand Down

0 comments on commit 8ffbbea

Please sign in to comment.