Week 7 - Auto ignition using Cantera
Objective: To write a code to calculate auto-ignition time for combustion of Methane under different operating conditions using cantera
Part 1:Plot Auto Ignition time of Methane with a constant temperature of 1250 K and pressure varying from 1 to 5 atm
Part 2: Plot Auto Ignition time of Methane with a constant pressure of 5 atm and temperature varying from 950 to 1450 K
Part 3: Rate of change of Molar concentrations of H2O, O2, OH with respect to time for a total simulation time of 10 seconds and for two conditions
- At P= 5 bar & T=1000 K
- At P= 5 bar & T=500 K
Part 1:
""""
CH4+2(O2+3.76N2)=CO2+2H2O+7.52N2
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
import cantera as ct
gas = ct.Solution('gri30.xml')
T_initial = 1250
Pressure = np.linspace(1,5,9)
Temp_at_diff_pressure = []
ignition_delay_time = []
n = 10000
for P in Pressure:
gas.TPX = T_initial,P*101325,{'CH4':1,'O2':2,'N2':7.52}
autoignition_temp = 0
autoignition_time = 0
r = ct.IdealGasReactor(gas)
sim = ct.ReactorNet([r])
time = 0.0
states = ct.SolutionArray(gas,extra = ['time_in_ms', 't'])
for n in range(n):
time += 1e-3
sim.advance(time)
states.append(r.thermo.state, time_in_ms = time*1e3, t = time)
Temp_at_diff_pressure.append(states.T)
for i in range(n):
T_error = states.T[i] - T_initial - 400
if T_error>0:
autoignition_temp = states.T[i]
autoignition_time = states.time_in_ms[i]
ignition_delay_time.append(autoignition_time)
Temp_at_diff_pressure = np.array(Temp_at_diff_pressure)
for k in range (len(Pressure)):
plt.figure(1)
plt.plot(Temp_at_diff_pressure[k])
plt.xlabel('number of time steps')
plt.ylabel('Temperature')
plt.title('Variation of auto ignition Temperature with pressure')
plt.legend(['1 atm','1.5 atm','2 atm','2.5 atm','3 atm','3.5 atm','4 atm','4.5 atm','5 atm'])
plt.figure(2)
plt.plot(Pressure,ignition_delay_time,'k-*')
plt.xlabel('pressure')
plt.ylabel('Auto ignition time')
plt.title('Iginition delay vs pressure')
plt.show()
Results:
> Low pressure reactor => ignition delay is high
> High pressure reactor =>ignition delay is low.
> Max Flame temperature reached by the products is maximum for a high pressure reactor and low for a low pressure reactor
> Ign. delay is max for a low pressure reactor and minimum for a high pressure reactor.
> The high pressure enhances the auto-ignition and helps the fuel mixture burn faster reducing delay.
Part 2 :
""""
CH4+2(O2+3.76N2)=CO2+2H2O+7.52N2
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
import cantera as ct
gas = ct.Solution('gri30.xml')
Temperature = np.linspace(950,1450,11)
Pressure = 5
Temp_at_diff_temp = []
ignition_delay_time = []
n = 10000
for T in Temperature:
gas.TPX = T,Pressure*101325,{'CH4':1,'O2':2,'N2':7.52}
autoignition_temp = 0
autoignition_time = 0
r = ct.IdealGasReactor(gas)
sim = ct.ReactorNet([r])
time = 0.0
states = ct.SolutionArray(gas,extra = ['time_in_ms', 't'])
for n in range(n):
time += 1e-3
sim.advance(time)
states.append(r.thermo.state, time_in_ms = time*1e3, t = time)
Temp_at_diff_temp.append(states.T)
for i in range(n):
T_error = states.T[i] - Tp - 400
if T_error>0:
autoignition_temp = states.T[i]
autoignition_time = states.time_in_ms[i]
ignition_delay_time.append(autoignition_time)
Temp_at_diff_temp = np.array(Temp_at_diff_temp)
for k in range (len(Temperature)):
plt.figure(1)
plt.plot(Temp_at_diff_temp[k])
plt.xlabel('number of time steps')
plt.ylabel('Temperature')
plt.title('Variation of auto ignition Temperature with Temperature')
plt.legend(['950','1000','1050','1100','1150','1200','1250','1300','1350','1400','1450'])
plt.figure(2)
plt.plot(Temperature,ignition_delay_time,'k-*')
plt.xlabel('Temperature')
plt.ylabel('Auto ignition time')
plt.title('Iginition delay vs Temperature')
plt.show()
Results:
> Higher initial temperature => auto-ignition delay time is the least
> Final temperature achieved after ignition is the highest for high initial temperature.
> Delay max for a low temperature reactor and minimum for a high temperature reactor.
> The high temperature enhances the auto-ignition and helps the fuel mixture burn faster.
Part 3:
""""
CH4+2(O2+3.76N2)=CO2+2H2O+7.52N2
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
import cantera as ct
gas = ct.Solution('gri30.xml')
T_initial = 500
Pressure = 5
n = 10000
molar_conc = []
gas.TPX = T_initial,Pressure*101325,{'CH4':1,'O2':2,'N2':7.52}
autoignition_temp = 0
autoignition_time = 0
r = ct.IdealGasReactor(gas)
sim = ct.ReactorNet([r])
time = 0.0
states = ct.SolutionArray(gas,extra = ['time_in_ms', 't'])
for n in range(n):
time += 1e-3
sim.advance(time)
states.append(r.thermo.state, time_in_ms = time*1e3, t = time)
plt.subplot(3,1,1)
plt.title('Molar concentration vs Time')
plt.plot(states.t,states.X[:, gas.species_index('H2O')],'r')
plt.xlabel('time (s)')
plt.ylabel('H2O')
plt.subplot(3,1,2)
plt.plot(states.t,states.X[:, gas.species_index('O2')],'b')
plt.xlabel('time (s)')
plt.ylabel('O2')
plt.subplot(3,1,3)
plt.plot(states.t,states.X[:, gas.species_index('OH')],'g')
plt.xlabel('time (s)')
plt.ylabel('OH')
plt.show()
Results:
i ) Pressure: 5 atm; Temperature: 1000 K
ii) Pressure: 5 atm; Temperature: 500 K
Observation:
i) At, 5 atm and 1000 K, the auto-ignition occurs within a few miliseconds.
ii) For the second case, the auto-ignition does not occur.
iii) Hence, the initial temperature plays an important role in auto-igniting the fuel.