Auto Ignition using Cantera
AIM: To write a code to calculate auto-ignition time for combustion of Methane under different operating conditions using cantera
Case 1:Plotting the variation of Auto Ignition time of Methane with a constant temperature of 1250 K and pressure varying from 1 to 5 atm
Case 2: Plotting the variation of Auto Ignition time of Methane with a constant pressure of 5 atm and temperature varying from 950 to 1450 K
Case 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 5 atm & 1000 K) and (at 5 atm and 500 K)
Simulation Time for all cases: 10 seconds
Case 1:
Code:
\"\"\"\"
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:
It can be seen that for a low pressure reactor ignition delay is high and for a high pressure reactor, ignition delay is low. Also the maximum Flame temperature reached by the products is maximum for a high pressure reactor and low for a lo pressure reactor
It can be seen from the graph that ignition delay is maximum 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, thus cutting down the delay
Case 2:
Code:
\"\"\"\"
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:
It can be seen that, for a high initial temperature, the auto-ignition delay time is the least and also the final temperature achieved after ignition is the highest for high initial temperature
It can be seen from the graph that ignition delay is maximum 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, thus cutting down the delay
Case 3:
Code:
\"\"\"\"
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:
Pressure: 5 atm; Temperature: 1000 K
Pressure: 5 atm; Temperature: 500 K
For 1st case i.e. at 5 atm and 1000 K, the auto-ignition occurs within a few miliseconds, while for the second case, the auto-ignition does not occur. This shows that even if the fuel mixture is stoichiometric, the initial temperature plays an important role in auto-igniting the fuel. At 1000 K , the stoichiometric mixture of fuel auto-ignites while at 500 K, it doesn\'t