from Cantera import *
from Cantera.Reactor import *
from Cantera.Func import *
gas = GRI30()
gas.set(T=600.0, P=0.2*OneAtm, X='CH4:1.1, O2:2, N2:7.52')
dia = 0.1
stroke = 0.18
cl = 0.02
A = math.pi/4 *(dia**2)
vcom = 0.001
vmax = 3
vol_start = (math.pi/4 *(dia**2)*(stroke+cl)) + vcomtaccel = 5e-3
t_end = 20e-3
r1 = Reactor(gas, volume=vol_start)
env = Reservoir(Air())
w = Wall(left = env, right = r1)
sim = ReactorNet([r1])
f_accel = Polynomial([0.0, vmax / taccel]) # f(t) = vmax * t / taccel
w.setVelocity(f_accel)
t = 0.0
while t <= taccel:
t += 1.0e-6
sim.advance(t)
print sim.time(), r1.temperature(), r1.volume()
sim.setInitialTime(taccel)
f_const = Polynomial([vmax])
w.setVelocity(f_const)
while t < t_end:
t += 1.0e-5
sim.advance(t)
print sim.time(), r1.temperature(), r1.volume()
from Cantera import *
from Cantera.Reactor import *
from Cantera.Func import *
gas = GRI30()
gas.set(T=600.0, P=0.2*OneAtm, X='CH4:1.1, O2:2, N2:7.52')
dia = 0.1
stroke = 0.18
cl = 0.02
A = math.pi/4 *(dia**2)
vcom = 0.001
vmax = 3
vol_start = (math.pi/4 *(dia**2)*(stroke+cl)) + vcomtaccel = 5e-3
t_end = 20e-3
r1 = Reactor(gas, volume=vol_start)
env = Reservoir(Air())
w = Wall(left = env, right = r1)
sim = ReactorNet([r1])
f_accel = Polynomial([0.0, vmax / taccel]) # f(t) = vmax * t / taccel
w.setVelocity(f_accel)
t = 0.0
while t <= taccel:
try
sim.advance(t + 1e-06)
t += 1.0e-6
print sim.time(), r1.temperature(), r1.volume()
catch err
%nothing to do
end
sim.setInitialTime(taccel)
f_const = Polynomial([vmax])
w.setVelocity(f_const)
while t < t_end:
try
sim.advance(t + 1e-05)
t += 1.0e-5
print sim.time(), r1.temperature(), r1.volume()
catch err
%nothing to do
end
try:
code here
except:
#nothin to do