[Python/Reactor] Use constant pressure reactor instead of adding Wall

This shows the preferred method for simulating a constant pressure reactor,
rather than using a Wall with a high expansion rate coefficient which introduces
unnecessary stiffness to the problem.
This commit is contained in:
Ray Speth 2015-02-20 23:43:38 +00:00
parent 0ad8d45baf
commit afb5b13eb4

View file

@ -8,18 +8,8 @@ import numpy as np
import cantera as ct
gri3 = ct.Solution('gri30.xml')
air = ct.Solution('air.xml')
gri3.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:4'
r = ct.IdealGasReactor(gri3)
env = ct.Reservoir(air)
# Define a wall between the reactor and the environment, and
# make it flexible, so that the pressure in the reactor is held
# at the environment pressure.
w = ct.Wall(r, env)
w.expansion_rate_coeff = 1.0e6 # set expansion parameter. dV/dt = KA(P_1 - P_2)
w.area = 1.0
r = ct.IdealGasConstPressureReactor(gri3)
sim = ct.ReactorNet([r])
time = 0.0