Challenge

Week 7 - Auto ignition using Cantera

Aim

To simulate the case of auto ignition of methane fuel to determine the ignition delay and study the influence of temperature and pressure on the ignition delay

  1. Introduction

The auto ignition temperature is the lowest temperature at which the fuel mixture spontaneously ignites without an external source of ignition. In terms of chemical kinetics, it is the temperature required to provide the activation energy to carry out the combustion reaction.

Ignition delay is the time delay after which combustion occurs when subjected to a temperature equal to that of auto ignition temperature. The ignition delay is a crucial parameter in Internal combustion engines where the crank cycle time is in the order of few seconds (6000 rpm = 0.625 s for 1 revolution). That is the timing set for ignition is very critical for smooth operation of engine. In case of Compression Ignition Engine (diesel engine), the fuel is ignition by achieving the auto ignition temperature by means of compressing the fuel mixture. In such a case, any delay in ignition would cause misfiring of the engine operation resulting in poor performance results. Thus, extensive research is carried out on determining accurate values of ignition delay and adjusting the timing of the engine to suit the combustion process.

In this study, we determine the ignition delay by using Cantera. The fuel mixture is assigned to a reactor method and which is further linked to a reactor network. We solve the reactor network for advancement of time parameter and determine the state of the reactor at a later stage. Using the results obtained, we determine ignition delay as follows:

  1. Objective

Part-I

  1. a) To plot the variation of Auto Ignition time of Methane with a constant temperature of 1250K and pressure varying from 1 to 5 atm.
  2. b) To plot the variation of Auto Ignition time of Methane with a constant pressure of 5 atm and temperature varying from 950K to 1450K.

Part-II

To observe and print the rate of change of molar concentrations of the given elements "H2O, O2, OH" with respect to the time when

  • Temperature is 1000K and pressure 5 bar
  • Temperature is 500K and pressure 5 bar
  1. Program algorithm

The below steps are used to calculate the ignition delay

  1. The cantera and numpy library are imported. An instance “gas” of the Solution class is created and the values of temperature, pressure and molar concentrations are initialized
  2. The next step is to create an instance of IdealGasReactor class by passing the ‘gas’ object.
  3. Create an instance of ReactorNet by passing reactor object.
  4. Create instance of Solution array class to store the states of the reactor
  5. Advance the instance of ReactorNet and append the results into the instance of Solution array.
  6. Calculate ignition delay by determining the timestep at which Temperature is 400 K more than Ignition temperature.

4. Variation of Auto Ignition time with temperature and pressure

4.1 Variation of auto ignition time or ignition delay with varying pressure from1 atm to 5 atm at a constant temperature of 1250 K

The program code is as follows:

"""

Program to plot the variation of autoignition time delay

CH4 + 2( O2 + 3.52 N2) => CO2 + 2H2O + 7.52 N2

Written by
Vignesh V

"""

import numpy as np 
import cantera as ct 
import matplotlib.pyplot as plt 

gas = ct.Solution("gri30.xml")

T= 1250 #K
P= [1,2,3,4,5] #Pa
autoignition_time= []

j=0
for j in range(5):
	gas.TPX= T,P[j]*101325,{'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 n in range(10000):
		time+=1e-3
		sim.advance(time)
		states.append(r.thermo.state,time_in_ms = time*1e3 , t =time)

	for i in range(len(states.T)):
		if states[i].T >= (1250+400):
			autoignition_time.append(states.time_in_ms[i])

			break

plt.plot(P,autoignition_time)
plt.xlabel('Pressure in bar')
plt.ylabel('Autoignition time delay (in ms)')
plt.title('Variation of ignition time delay with pressure')
plt.show()

It is evident from the figure that with an increase in pressure, the ignition delay is reduced.

4.2 Variation of auto ignition time or ignition delay with varying temperature from 950 K to 1450 Kat a constant pressure of 5 atm

"""

Program to plot the variation of autoignition time delay

CH4 + 2( O2 + 3.52 N2) => CO2 + 2H2O + 7.52 N2

Written by
Vignesh V

"""

import numpy as np 
import cantera as ct 
import matplotlib.pyplot as plt 

gas = ct.Solution("gri30.xml")

P= 5*101325 #Pa
T= np.linspace(950,1450,100) #K
autoignition_time= []

j=0
for j in range(len(T)):
	gas.TPX= T[j],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 n in range(10000):
		time+=1e-3
		sim.advance(time)
		states.append(r.thermo.state,time_in_ms = time*1e3 , t =time)

	for i in range(len(states.T)):
		if states[i].T >= (1250+400):
			autoignition_time.append(states.time_in_ms[i])

			break

plt.plot(T,autoignition_time)
plt.xlabel('Temperature in K')
plt.ylabel('Autoignition time delay (in ms)')
plt.title('Variation of ignition time delay with Temperature')
plt.show()

It can be observed from the figure that with an increase in temperature, there is a significant drop of ignition delay towards zero. After a certain threshold, the ignition delay remains zero and there is no impact of further increase in temperature of the system.

  1. Rate of change of molar concentrations of OH, O2 and H2O

The simulation is run for two cases of a) Temperature = 1000K and pressure = 5 bar and b) Temperature is 500K and pressure 5 bar

"""

Program to plot the variation of autoignition time delay

CH4 + 2( O2 + 3.52 N2) => CO2 + 2H2O + 7.52 N2

Written by
Vignesh V

"""

import numpy as np 
import cantera as ct 
import matplotlib.pyplot as plt 

gas = ct.Solution("gri30.xml")

P= 5*101325 #Pa
T= [500,1000] #K
autoignition_time= []

a=0
j=0
for j in range(2):
	gas.TPX= T[j],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'])
	states2 = ct.SolutionArray(gas, extra = ['time_in_ms', 't'])

	if j ==0:
		for n in range(10000):
			time+=1e-3
			sim.advance(time)
			states.append(r.thermo.state,time_in_ms = time*1e3 , t =time)

		plt.figure(1)	
		plt.subplot(2,1,1)
		plt.plot(states.t,states.X[:,gas.species_index('H2O')],color='red')	
		plt.ylabel('[H2O]')
		plt.title('Molar concentration of H2O')
		plt.legend(['T=500K'])

		plt.figure(2)
		plt.subplot(2,1,1)
		plt.plot(states.t,states.X[:,gas.species_index('O2')],color='red')	
		plt.ylabel('[O2]')
		plt.title('Molar concentration of O2')
		plt.legend(['T=500K'])
		

		plt.figure(3)
		plt.subplot(2,1,1)
		plt.plot(states.t,states.X[:,gas.species_index('OH')],color='red')	
		plt.ylabel('[OH]')
		plt.title('Molar concentration of OH')
		plt.legend(['T=500K'])
				
	if j ==1:	
		for n in range(10000):
			time+=1e-3
			sim.advance(time)
			states2.append(r.thermo.state,time_in_ms = time*1e3 , t =time)
		
		plt.figure(1)	
		plt.subplot(2,1,2)
		plt.plot(states2.t,states2.X[:,gas.species_index('H2O')],color='blue')	
		plt.ylabel('[H2O]')
		plt.legend(['T=1000K'])

		plt.figure(2)
		plt.subplot(2,1,2)
		plt.plot(states2.t,states2.X[:,gas.species_index('O2')],color='blue')	
		plt.xlabel('Time in seconds')
		plt.ylabel('[O2]')
		plt.legend(['T=1000K'])
		

		plt.figure(3)
		plt.subplot(2,1,2)
		plt.plot(states2.t,states2.X[:,gas.species_index('OH')],color='blue')	
		plt.xlabel('Time in seconds')
		plt.ylabel('[OH]')
		plt.legend(['T=1000K'])

plt.show()

From the above figure, it can be seen that for the first case, where the temperature is very low compared to ignition temperature of methane, the molar concentration are unrealistic. This is due to no combustion reaction taking place inside the reactor network and the results can be attributed to the default values allocated in the Cantera module.

For the second case where the temperature is 1000 K, we can see that the concentration of OH is zero at the initial time step. After a small ignition delay, combustion occurs and the intermediary product OH is formed. This explains the increase in the concentration of OH. After the combustion process occurs, the intermediary species attain equilibrium and the concentration of OH remains the same.

Similar to that of OH plots, for the first case, the values of O2 concentration are irrelevant. A significant observation is that there is no change in the concentration of O2 over time indicating that there is no combustion reaction taking place. For the second case, combustion occurs after a small ignition delay after which the reactant O2 is consumed and its concentration is found to be close to zero.

The similar results are obtained for H2O concentration. It can be noted in the below figure that for the second case where temperature is1000 K, the concentration of reaction product- H2O increases after combustion takes place in the reactor system.

  1. Conclusion

The following conclusions can be made based on the given study:

  • With an increase in pressure and/or temperature, there is a decrease in ignition delay
  • The rate of change of molar concerntration of reactant O2 decreases over time whereas intermediary products H2O and OH show an increasing trend in a combustion chamber when T=Tignition
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.