Project

Auto igniton using Cantera

INTRODUCTION :-

Combustion in IC engines is considered to be occurring in four stages. The very first stage is the ignition delay period. It is also known as preparatory phase during which some fuel has already been admitted but hasn’t yet been ignited. It is of extreme importance due to it’s effect on combustion rate, knocking, influence on engine starting ability and smoke formation in exhaust.

The period is initiated from injection of mixture to the point where P- Θ curve separates from air compression curve (motoring-curve). Basically the fuel doesn’t ignite immediately on injection. There is definite period of inactivity between the time when the first droplet of fuel hits the hot air in the combustion chamber and time for burning phase. This is the Ignition Delay Period.

Here the problem is solved in python using the reactor network available through cantera module. It defines the governing equations to be solved and advancing method at an interval of 1ms is implemented. For solving problems that are simulated using auto-ignition we must ensure that initial temperature must be greater than or equal to auto-ignition temperature, else the solution wouldn’t ignite. Hence-forth the ignition-time delay is given as below :-

PART I

To simulate the Auto Ignition Time for Methane under the following conditions :-

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

Python code :-

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

gas = ct.Solution(\'gri30.xml\')
T = 1250
P_start = 101325
P_end = 5*101325

Pressure = np.linspace(P_start,P_end,9)  #The NumPy linspace function called np.linspace is a tool in Python for creating numeric sequences.
Ignition_delay = [] #An array for storing ignition delay

for P in Pressure:

	gas.TPX = T,P,{\'CH4\':1,\'O2\':2, \'N2\':7.52}
	r = ct.IdealGasReactor(gas) # Ideal gas reactor is the class and r is instance of it
	sim = ct.ReactorNet([r]) # Creating the simulation object
	time = 0.0
	T_old = T
	states = ct.SolutionArray(gas,extra=[\'time_in_ms\',\'t\']) # As gases are in different temperature and pressure at instance
	i = 1
	# The simulation time as per the problem 10 sec = 10000 msec
	for i in range(10000): #Time step size = 10s
		time+=1e-3 #Solution to be calculated at every 1e-3s
		sim.advance(time) #Integrate system to the time given
		states.append(r.thermo.state,time_in_ms = time*1e3, t=time)
		T_new = states.T
		T_new = T_new[i-1]
		
		#An if loop for finding the ignition delay
		if (T_new>=400+T_old):
			Ignition_delay.append(time)
			
			T_old = states.T
			T_old = T_old[i-1]

			print(\'Ignition_delay\')


	
	
	plt.figure(1)
	plt.plot(states.t,states.T)


plt.legend([\'Pressure at=\' +str(P/101325) + \'[atm]\' for P in Pressure])
plt.xlabel(\'Time\')
plt.ylabel(\'Temperature\')

plt.figure(2)
plt.plot(Pressure/101325,Ignition_delay,\'-.\')
plt.xlabel(\'Pressure in (atm)\')
plt.ylabel(\'Ignition_delay in (ms)\')
plt.show()
plt.show()

PLOTS :-

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

Python code :-

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

gas = ct.Solution(\'gri30.xml\')
T_start = 950
T_end = 1450
P = 5*101325

Temperature = np.linspace(T_start,T_end,11) #The NumPy linspace function called np.linspace is a tool in Python for creating numeric sequences.
Ignition_delay = [] #creating an array for storing ignition delay

for T in Temperature:

	gas.TPX = T,P,{\'CH4\':1,\'O2\':2, \'N2\':7.52}
	r = ct.IdealGasReactor(gas) # Ideal gas reactor is the class and r is instance of it
	sim = ct.ReactorNet([r]) # Creating the simulation object
	time = 0.0
	T_old = T
	states = ct.SolutionArray(gas,extra=[\'time_in_ms\',\'t\']) # As gases are in different temperature and pressure at instance
	i=1
	for i in range(10000): #Time step size = 10s
		time+=1e-3 #Solution to be calculated at every 1e-3s
		sim.advance(time) #Integrate system to the time given
		states.append(r.thermo.state,time_in_ms = time*1e3, t=time)
		T_new = states.T
		T_new = T_new[i-1]
		
		#creating if loop for finding the ignition delay
		if (T_new>=400+T_old):
			Ignition_delay.append(time)
			
			T_old = states.T
			T_old = T_old[i-1]

			print(\'Ignition_delay\')
			


	
	
	plt.figure(1)
	plt.plot(states.t,states.T)


plt.legend([\'Temp = \' + str(T) + \'[k]\' for T in Temperature])
plt.xlabel(\'Time\')
plt.ylabel(\'Temperature\')
print(\'Ignition_delay = \',Ignition_delay)
plt.figure(2)
plt.plot(Temperature,Ignition_delay,\'-*\')
plt.xlabel(\'Temperature in [K]\')
plt.ylabel(\'Ignition_delay in [ms]\')
plt.show()
plt.show()

From the results of graphs simulated for methane at above given conditions it is evident that as temperature and pressure are raised the value of ignition delay decreases and tends to approach zero as the former values are increased.

PART II

Observe and print the rate of change of molar concentrations of the given elements \"H2O, O2, OH\" with respect to the time, (simulation time = 10 secs) at

i)When Temperature is 1000K and pressure 5 bar

ii)When Temperature is 500K and pressure 5 bar

Python code for both are almost same with a change in initial temperature i.e. 1000 or 500K.

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

gas = ct.Solution(\'gri30.xml\')

T = 1000 # Change T=1000 or 500K for observation
P = 5*101326


gas.TPX = T,P,{\'CH4\':1,\'O2\':2, \'N2\':7.52}
r = ct.IdealGasReactor(gas) #Ideal gas reactor is the class and r is instance of it
sim = ct.ReactorNet([r]) # Creating the simulation object
time = 0.0

states = ct.SolutionArray(gas,extra=[\'time_in_ms\',\'t\'])

for n in range(10000): #Time step size = 10s
	time+=1e-3 #Solution to be shown at every 1e-3s
	sim.advance(time) #Integrate system to the time given
	states.append(r.thermo.state,time_in_ms = time*1e3, t=time)

#The Matplotlib subplot() function can be called to plot two or more plots in one figure
plt.subplot(3,1,1) # Subplot(x=rows,y=columns,z=order)
plt.title(\'Concentration various of species at temperature = 1000k\')
plt.plot(states.t,states.X[:,gas.species_index(\'H2O\')])
plt.xlabel(\'Time(sec)\')
plt.ylabel(\'H2O-species\')
plt.subplot(3,1,2)
plt.plot(states.t,states.X[:,gas.species_index(\'OH\')])
plt.xlabel(\'Time(sec)\')
plt.ylabel(\'OH-species\')
plt.subplot(3,1,3)
plt.plot(states.t,states.X[:,gas.species_index(\'O2\')])
plt.xlabel(\'Time(sec)\')
plt.ylabel(\'O2-species\')
plt.tight_layout()

plt.show()

OBSERVATIONS:-

1. After the phase of ignition time lag the concentration of products increases as combustion occurs rapidly i.e. the concentration of OH and H2O increases and concentration of O2 simulataneously decreases as it is being used up for combustion of fuel.

2. As we have discussed above that the initial temperature of the reactor must be above the auto-ignition temperature of methane (540-600 degree celsius approximately) for combustion to occur. Therefore at 500K (227K) the fuel isn\'t lit and would require any external firing source for combustion to occur. Hence we observe a negligible amount of increase in molar concentration of products i.e (H2O and OH) and the molar concentration of O2 remains constant since air isn\'t utilized as combustion doesn\'t takes place.

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.