Challenge

Week 7 - Auto ignition using Cantera

Aim:To determine ignition delay for a given fuel at different temperature and pressure.

Objective:

  • Determine ignition delay for varying pressure from 1 to 5atm and temperature contant at 1250K.
  • Determine ignition delay for varying temperature from 950 to 1450K and fixed pressure of 5atm.
  • Determine the mole fraction of reactants and products after the end of ignition process i.e. H2O,OH,CH4,O2 etc.

Introduction:

Auto ignition is process as it name suggests auto igniting of fuel, for this process to occur we need the mixture to be initially at igniting temperature which is averaged around 1000k for fuels.

If the temperature is below igniting temperture it will take more amount of time for the ignition hence is inefficient.

How does the fuel reach igniting temperature??

Lets start to tear down a engine when we start our vehicle using key the solenoid gets engaged which will connect high voltage line to drive the starter motor, the starter motor in turn drives crankshaft and the piston moves from TDC to BDC during which air and fuel mixture is sucked into the engine, In next stroke the compression of this mixture takes place under constant pressure which will increase the temperature of mixture upto some extent, the spark plug comes into play now which generates spark of around 40000V which creates the ignition of fuel and expansion which will force piston with great amount of power hence driving the vehicle.

Sometime during compression process the fuel may not reach a igniting temperature so in this case the Solution is of preheating the mixture before supplied into the engine.

And sometime there are multiple expansion spots which when collide creates a blast inside the engine we call it as Knocking. the knocking increases the engine temperature to greater extent hence should be avoided.

So the conclusion from above discussion is the temperature for ignition should not be either low or high it should be a medium value.

To calculate ignition temperature in cantera we will be using the reactor and reactor net function.

Steps:

  • First we will define a gas object and the reactants.
  • Now we will take gas object and simulate it in reactor.
  • Next step is to create reactor network to simulate the ignition with time step, In our simulation we will assume time step to be 1millisecond.
  • To advance the reaction forward with 1ms time step we will be using reactornet.advance operator which is a functionality of reactornet.
  • Now we are completed with the reaction we can store it in states array, and to get results we will insert a command states.array(r.thermo.state) which will provide results for all the parameters i.e. pressure, temperature and molefractions.

Ignition delay calculation:

To calculate the ignition delay time the formula is given as:

T_ignition-delay = T_old + 400

Program structure:

CASES:

case1: By keeping temperature constant(1250K) and varying pressure from (1 to 5atm), the plots for temperature vs time in milliseconds, and ignition delay vs pressure array is been displayed on the screen.

case2: By keeping pressure constant(5atm) and varying temperature from (950 to 1450K), the plots for temperature vs time in milliseconds, and ignition delay vs temperature array is been displayed on the screen.

case3: At temperature(1000K,500K) and pressure at (5atm), the plots for molefraction of H2O, O2, OH, and CH4 is been displayed on the screen.

Python code to simulate all cases:

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

gas = ct.Solution('gri30.xml')
#for case 1
P_array = np.linspace(1,5,5)
T_fix = 1250
#for case 2
T_array = np.arange(950,1450,100)
P_fix =5
#for case 3
temp_mol = [500,1000]
P_mol = 5
ignition_delay = []

def reactor(T,P):
	gas.TPX = T,P*101325,{'CH4':1,'O2':2,'N2':7.52}
	r = ct.IdealGasReactor(gas)
	rn = ct.ReactorNet([r])
	states = ct.SolutionArray(gas)
	return(rn,states,r)

cases = input("Enter the case to be inspected = ")
case = int(cases)
if case==1:
	for P in P_array:
		[reac_net,states,r] = reactor(T_fix,P)
		t = 0
		itera = 1
		T_igd = T_fix+400
		for i in range(1000):
			t = t+1e-4
			reac_net.advance(t)
			states.append(r.thermo.state)
			T_new = states.T
			T_new = T_new[i]
			if (T_new>=T_igd and itera==1):
				ignition_delay.append(t*100)
				itera = itera+1
		
		plt.figure(1)
		plt.plot(states.T)
		plt.title('Temperature vs time in milliseconds')
		plt.xlabel('Time in ms')
		plt.ylabel('Temperature in K')
		plt.legend(('1atm','2atm','3atm','4atm','5atm'),loc = 'best')
		plt.text(300,11,'As the pressure increase the ignition delay decreases',style='oblique',wrap = 'true')
		plt.savefig('case1_0.png')

	plt.figure(2)	
	plt.plot(ignition_delay,P_array,'ro-')
	plt.title('Pressure vs ignition delay')
	plt.xlabel('ignition delay in milliseconds')
	plt.ylabel('pressure in atm')
	plt.grid('on')
	plt.savefig('case1_1.png')
	plt.show()

elif case==2:
	for i in range(len(T_array)):
		[reac_net,states,r] = reactor(T_array[i],P_fix)
		t = 0
		itera = 1
		T_igd = T_array[i]+400
		for i in range(5000):
			t = t+1e-4
			reac_net.advance(t)
			states.append(r.thermo.state)
			T_new = states.T
			T_new = T_new[i]
			if (T_new>=T_igd and itera==1):
				ignition_delay.append(t*100)
				itera = itera+1
		
		plt.figure(1)
		plt.title('Temperature vs time in milliseconds')
		plt.plot(states.T)
		plt.xlabel('Time in ms')
		plt.ylabel('Temperature in K')
		plt.legend(('950K','1075K','1200K','1325K','1450K'),loc = 'best')
		plt.text(300,11,'As the pressure increase the ignition delay decreases',style='oblique',wrap = 'true')
		plt.savefig('case2_0.png')
	

	plt.figure(2)
	plt.title('Temperature vs ignition delay')	
	plt.plot(ignition_delay,T_array,'ro-')
	plt.xlabel('ignition delay in milliseconds')
	plt.ylabel('Temperature in K')
	plt.grid('on')
	plt.savefig('case2_1.png')

	plt.show()

elif case==3:
	for T in temp_mol:
		[reac_net,states,r] = reactor(T,P_mol)
		t = 0.0
		for i in range(1000):
			t = t+1e-4
			reac_net.advance(t)
			states.append(r.thermo.state)

	#plotting
	plt.figure(1)
	plt.plot(states.X[:,gas.species_index('H2O')],'m--',label = 'H20')
	plt.title('Variation of H2O concentartion')
	plt.xlabel('Time in ms')
	plt.ylabel('concentration in moles')
	plt.savefig('case3_0.png')

	plt.figure(2)
	plt.plot(states.X[:,gas.species_index('O2')],'r:',label = 'O2')
	plt.title('Variation of O2 concentartion')
	plt.xlabel('Time in ms')
	plt.ylabel('concentration in moles')
	plt.savefig('case3_1.png')

	plt.figure(3)
	plt.plot(states.X[:,gas.species_index('OH')],'-g',label = 'OH')	
	plt.title('Variation of OH concentartion')
	plt.xlabel('Time in ms')
	plt.ylabel('concentration in moles')
	plt.savefig('case3_2.png')

	plt.figure(4)
	plt.plot(states.X[:,gas.species_index('CH4')],'--k',label = 'CH4')
	plt.title('Variation of CH4 concentartion')
	plt.xlabel('Time in ms')
	plt.ylabel('concentration in moles')
	plt.savefig('case3_3.png')	
	plt.show()

PLOTS:

case1:

In above graph as pressure increases we can see that ignition delay decreases.

The plot of ignition delay with pressure.

case2:

In above graph as temperature increases we can see that ignition delay decreases.

The plot of ignition delay with pressure.

case3:

Above is a plot of 'H2O' which increases with respect to time which is quite simple that its the product and product concentartion always increases in forward reaction, also due to presence of H2O we find corrosion in muffler of exhaust system.

Above is a plot of 'O2' which decreasess with respect to time because its reactant and is consumed in combustion process.

Above is a plot of 'OH' which increases with respect to time because its product, this 'OH' combines with free nitrogen to form 'NOx' (nitroxide) which is major pollutant.

Above is a plot of 'CH4' which decreases with respect to time because its reactant and is consumed in combustion process.

Conclusion:

Ignition delay of any fuel is directly propotional to pressure, and temperature.

Ig ∝ T*P

Id = Ft*T*P

where,

Ft = fuel type

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.