Challenge

Week 7 - Auto ignition using Cantera

Objective:

To simulate the Auto Ignition Time for Methane under the following condition

Part I

  1. In a reactor simulate the Auto Ignition time of Methane with a constant temperature of 1250K and pressure varying from 1 to 5 atm.
  2. In a reactor simulate the Auto Ignition time of Methane with a constant pressure of 5 atm and temperature varying from 950 K to 1450 K.

Part II

  1. Plot the rate of change of molar concentrations of H20,O2,OH
  2. When temperature is 1000 K and pressure 5 bar
  3. When Temperature is 500K and pressure 5 bar

1.Introduction:

Auto ignition:

The auto ignition temperature of a substance is the lowest temperature at which it spontaneously ignites in normal atmosphere without an external source of ignition, such as a flame or spark.

Ignition delay:

Ignition delay in compression ignition is the time interval between the start of injection and start of combustion.There are two types of delay i physical delay ii chemical delay.

Ignition delay depends on Temperature,pressure & mixture conditions of the fuel.

2.Explanation of Code:

The Auto ignition of methane is simulated using python program under various conditions.

  1. A reactor is an object of the ReactorBase class, that describes the vessel.
  2. Reactors are closed (no inlets or outlets), have fixed volume, and have adiabatic, chemically-inert walls and arre unsteady .
  3. IdealGasReactor is a constant volume, zero-dimensional reactor for ideal gas mixtures
  4. The evolution of a reactor, or a network of reactors -which are 0-D objects- with time, is performed
    through an integrator object ReactorNet.
  5. The reactornet is advanced in time using .advance.
  6. The Simulation is run for 10 secs.
  7. The ignition delay is calculated using the Formula .
  8. The simulation is plotted using matplotlib.pyplot.
  9. The various plots for different conditions are plotted.

Part i

Auto Ignition time of Methane with a constant temperature of 1250K and pressure varying from 1 to 5 atm.

'''
Program to calculate the Auto ignition of Methane(CH4)
pressure from 1 atm to 5 atm
Temperature = 1250 K
CH4+2O2+7.52N2 => Co2+2H20+7.52N2
'''
# importing packages
import sys
import numpy as np 
import cantera as ct 
import matplotlib.pyplot as plt 
#Temperature
T=1250
#gas object
gas=ct.Solution('gri30.xml')
#pressure condition
p_initial=1*101325
p_final=5*101325
T_initial=T
# Simulation time - 10secs
time_end=10*1000
Pr=np.linspace(p_initial,p_final,5)
ignition_delay=[]
for P in Pr:
	gas.TPX=T,P,{'CH4':1,'O2':2,'N2':7.52}
	r=ct.IdealGasReactor(gas)
	sim=ct.ReactorNet([r])
	time=0.0 
	states=ct.SolutionArray(gas,extra=['time_in_ms','t'])
	for i in range(time_end):
		time+=1e-3
		sim.advance(time)
		states.append(r.thermo.state,time_in_ms=time*1e3,t=time)
		T_n=states.T
		T_n=T_n[i-1]
		#Time_ig=Time_initial+400K
		if ((T_n-T_initial)>=400):
			ignition_delay.append(time)
		T_initial=states.T
		T_initial=T_initial[i-1]
	plt.subplot(2,1,1)
	plt.plot(states.t,states.T)
plt.legend(['P='+str(P/101325)+'atm'for P in Pr])
plt.xlabel('Time in ms')
plt.ylabel('Temperature')
plt.subplot(2,1,2)
plt.plot(Pr/101325,ignition_delay)
plt.xlabel('pressure')
plt.ylabel('ignition delay')
plt.show()

Auto Ignition time of Methane with a constant pressure of 5 atm and temperature varying from 950 K to 1450 K.

'''
Program to calculate the Auto ignition of Methane(CH4)
pressure = 5 atm
Temperature = 950 to 1250 K
CH4+2O2+7.52N2 => Co2+2H20+7.52N2
'''
# importing packages
import sys
import numpy as np 
import cantera as ct 
import matplotlib.pyplot as plt 
#pressure
P=5*101325
gas=ct.Solution('gri30.xml')
#Temperature
T_start=950
T_stop=1450
time_end=10*1000
Temp=np.linspace(T_start,T_stop,5)
ignition_delay=[]
for T in Temp:
	gas.TPX=T,P,{'CH4':1,'O2':2,'N2':7.52}
	r=ct.IdealGasReactor(gas)
	sim=ct.ReactorNet([r])
	time=0.0 
	states=ct.SolutionArray(gas,extra=['time_in_ms','t'])
	T_initial=T
	for i in range(time_end):
		time+=1e-3
		sim.advance(time)
		states.append(r.thermo.state,time_in_ms=time*1e3,t=time)
		T_n=states.T
		T_n=T_n[i-1]
		if ((T_n-T_initial)>=400):
			ignition_delay.append(time)
		T_initial=states.T
		T_initial=T_initial[i-1]
	plt.subplot(2,1,1)
	plt.plot(states.time_in_ms,states.T)
plt.legend(['T='+str(T)+'K'for T in Temp])
plt.xlabel('Time in ms')
plt.ylabel('Temperature')
plt.grid()
plt.subplot(2,1,2)
plt.plot(Temp,ignition_delay)
plt.xlabel('Temperature')
plt.ylabel('ignition delay')
plt.grid()
plt.show()

Part ii

  • Plot the rate of change of molar concentrations of H20,O2,OH
  • When temperature is 1000 K and pressure 5 bar
  • When Temperature is 500K and pressure 5 bar
'''
Program to calculate the Molar Concentration of H20,O2,OH
pressure = 5 atm
Temperature = 500 K And 1000 K
CH4+2O2+7.52N2 => Co2+2H20+7.52N2
'''
# importing packages
import sys
import numpy as np 
import cantera as ct 
import matplotlib.pyplot as plt 
#pressure
P=5*101325
gas=ct.Solution('gri30.xml')
time_end=10*1000
#temperature
Temp=[500,1000]
for T in Temp:
	gas.TPX=T,P,{'CH4':1,'O2':2,'N2':7.52}
	r=ct.IdealGasReactor(gas)
	sim=ct.ReactorNet([r])
	time=0.0 
	T_initial=T
	states=ct.SolutionArray(gas,extra=['time_in_ms','t'])
	for i in range(time_end):
		time+=1e-3
		sim.advance(time)
		states.append(r.thermo.state,time_in_ms=time*1e3,t=time)
	plt.figure(1)
	plt.plot(states.t,states.X[:,gas.species_index('H2O')])
	plt.xlabel('Time ')
	plt.ylabel('Mole concentration of H2O')
	plt.grid()
	plt.show()
	plt.figure(2)
	plt.plot(states.t,states.X[:,gas.species_index('O2')])
	plt.xlabel('Time ')
	plt.ylabel('Mole concentration of O2')
	plt.grid()
	plt.show()
	plt.figure(3)
	plt.plot(states.t,states.X[:,gas.species_index('OH')])
	plt.xlabel('Time ')
	plt.ylabel('Mole concentration of OH')
	plt.grid()
	plt.show()
	plt.show()

Plots:

Constant Temperature

Constant Pressure

Part II

Molar concentration of H20,O2,OH at 500K

H2O

O2

OH

Molar concentration of H20,O2,OH at 1000K

H2O

O2

OH

Results:

Part I

From the above plots we can conclude that as the initial temperature increases the ignition delay decreases.

Similarly as the Pressure increases the ignition delay decrease.

Part II

At 500K temperature the Ignition of methane does not occur even if the pressure is too high ,So the concentration of O2 remains constant as combustion doesn't occur.

For 1000 K the concentration of O2 decrease with the time.

The concentration of H20 increases as a function of time and remains constant.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.