## Autoignition delay - Cantera

The purpose of this project is to show the effect of initial temperature and pressure in the ignition delay in a combustion process. For this purpose, a Constant Volume Reactor and the corresponding network objects are created in Cantera, and the combustion process is simulated.

1) Effect of Initial Temperature in the ignition delay (P=5atm).

To compute this, a simple loop is used to change the initial temperature. The combustion within the reactor is stored in a function, called from the main program within the loop. This program is attached at the end of the project.

In the top graph, we can see the temperature evaluation within the reactor. In any of the lines,it is the sudden rise in temperature that tells us that the combustion has already started. The time until this happens is what is commonly known as ignition delay. Some literature, analyze this time as the time when the sudden rise occurs, and other when the temperature reaches a certain level above the initial one. The idea of this project was to select the ignition delay as the time that takes to reach 400K above the initial temperature. However, this process takes place in a matter of less than 1 ms, and the current computer was not able to capture this effect. Instead, the time was selected at the beggining of the rise (maximum slope). The code for the 400K criteria is included for reference.

As expected, increasing the initial temperature of the fuel-air mixture, leads to a smaller ingnition delay. This behaviours is also exponential, definitely not linear. Actually, notice that for a initial temperature of 950 K, the combustion does not even take place in the graph limits (took place at 400 ms), and therefore the first point in the second graph should not be considered.On the other hand, when the initial temperature is high enough, the combustion will take place in one ms or less (as in 1450K). Also highlight that the ignition is taking place automatically (autoignition) and therefore there will be a limit below of which it will never happen.

2) Effect of Initial Pressure in the ignition delay (T=1250K).

Similarly, the effect of the initial pressure of the mixture in the autoignition time was analyzed with Cantera.

In this case, autoignition takes place for all the pressures analyzed within the first 25 ms. Although it is also exponential, note that rising the pressure does not have the same effect than the previous case: autoignition is definitely more sensible to temperature increases.

Conclusions:

- The autoignition delay is in the order of miliseconds for all the cases studied.

- Increasing both temperature or pressure of the initial mixture leads to a quicker combustion

- This reduction in the ingition delay is exponential

- Autoignition is more sensible to temperature.

"""
Analysis on Reactor Ignition Delay
-Temperature Analysis
"""
import sys
import numpy as np
import cantera as ct
import matplotlib.pyplot as plt
from Reactor_Control_Volume import Reactor_CV as cvc

#Specie and Initial Conditions for the combustion chamber
species_dict ={'CH4':1, 'O2':2, 'N2':7.52}
p= 5*101235

# Analyzing the initial temperature effect in the ignition delay
T_initial = 950
T_final = 1450
n2 = 5 # Number of temperatures analyzed
Ts= np.linspace(T_initial,T_final,n2)

#Loop parameters
h= 1e-5 #Step within the combustion loop
t = 75 #Final combustion computing time [ms]
tau = np.ones((1,len(Ts)))
ct=0

for T in Ts:
states = cvc(T,p,species_dict,h,t)
plt.subplot(2,1,1)
plt.plot(states.time_in_ms,states.T)
tau[0,ct] = states.t[(np.argmax((np.diff(states.T))))]
ct = ct + 1

legends = ['T_initial = ' + str(T) + '[K]' for T in Ts]
plt.legend(legends)
plt.xlabel('Time [ms]')
plt.ylabel('Temperature [K]')

plt.subplot(2,1,2)
plt.plot(Ts, tau[0,:]*1000, '-o')
plt.xlabel(('Initial Temperature [K]'))
plt.ylabel('IgnitionDelay [ms]')

plt.show()
print(tau)

"""
Analysis on Reactor Ignition Delay
-Pressure Analysis
"""
import sys
import numpy as np
import cantera as ct
import matplotlib.pyplot as plt
from Reactor_Control_Volume import Reactor_CV as cvc

#Specie and Initial Conditions for the combustion chamber
species_dict ={'CH4':1, 'O2':2, 'N2':7.52}
T= 1250

# Analyzing the initial pressure effect in the ignition delay
P_initial = 101325
P_final = 5*101325
n2 = 5 # Number of pressures analyzed
Ps= np.linspace(P_initial,P_final,n2)

#Loop parameters
h= 1e-5 #Step within the combustion loop
t = 25 #Final combustion computing time [ms]
tau = np.ones((1,len(Ps)))
ct=0

for P in Ps:
states = cvc(T,P,species_dict,h,t)
plt.subplot(2,1,1)
plt.plot(states.time_in_ms,states.T)
tau[0,ct] = states.t[(np.argmax((np.diff(states.T))))]
ct = ct + 1

legends = ['P_initial = ' + (str(P/101325))+ '[atm]' for P in Ps]
plt.legend(legends)
plt.xlabel('Time [ms]')
plt.ylabel('Temperature [K]')

plt.subplot(2,1,2)
plt.plot(Ps/101325, tau[0,:]*1000, '-o')
plt.xlabel(('Initial Pressure [atm]'))
plt.ylabel('IgnitionDelay [ms]')

plt.show()
print(tau)
def Reactor_CV (T,p,species_dict, h, final_time_in_ms):

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

gas = ct.Solution('gri30.xml')
gas.TPX = T, p, species_dict

#Creating the Reactor Object
r = ct.IdealGasReactor(gas)

#Creating the Network Object
sim = ct.ReactorNet([r])

time = 0

#Creating the array to store the different states of the gas object through time
states = ct.SolutionArray(gas, extra=['time_in_ms', 't'])

#Paramenters for the loops
T0 = T
n= round(0.001*final_time_in_ms/h)

for i in range (n):
time += h #This is the time througout we want to integrate the solution. The time step is decided within Cantera depending on how stiff is the system
states.append(r.thermo.state , time_in_ms = time*1e3 , t = time) #This writes the reactor state into the states array

"""
#If a HPC is available, use this code to precisely compute the delay. i.e time when T=T_initial+400.
for i in range (n):
T_error = states.T[i] - T0 - 400
if T_error > 0:
T_ignition = states.T[i]
t_ignition = states.time_in_ms[i]
break
"""

return states


### Shock Tube Simulation using Converge Jorge Martinez · 2018-11-27 02:11:31

The purpose of this project, is to setup and analyze a transient shock tube simulation using Converge Studio. The project will analyze how the interaction of the original shock waves and the reflected waves affect the fluid in the tube, and how the computational mesh ha Read more

### Conjugate Heat Transfer Simulation Jorge Martinez · 2018-10-23 03:33:38

The purpose of this project is to simulate the conjugate heat transfer in a pipe using Converge Studio. For this, an air flow is simulated through an aluminum pipe, which is receiveing a constant heat flux of 10,000 W/m2 at the outside wall. The objective is to understa Read more

### Prandtl-Meyer Shock Problem - Converge Studio Jorge Martinez · 2018-10-20 03:51:53

This project objective is to simulate the Prandtl Meyer shock wave phenomena using Converge Studio. First, a quick literature review about shock waves and their boundary conditions is provided. Then , the problem is set up and solved, focusing in how the different param Read more

### Multivariate Newton-Raphson method Jorge Martinez · 2018-10-18 00:46:05

The purpose of this assignment is to create a Python program including a Multivariate Newton Rhapson Solver, to solve a non-linear coupled differential system. This method is really useful for stiff systems, where the explicit solver are unstable. The system of equatio Read more

### Simulation of Flow Over a Throttle Body Converge Studio - Transient Jorge Martinez · 2018-10-13 22:13:18

The objective of this part of the project, is to simulate the transient flow through an elbow pipe with a throttle valve in the middle. This valve will be rotating from zero to 25 degrees, and then stay steady.  Case Setup. In the steady state part of the project Read more

### Simulation of Flow Over a Throttle Body - Steady State Jorge Martinez · 2018-10-12 03:30:10

This project purpose is to simulate the flow over an elbow body that contains a throttle using CONVERGE Studio. In this first part of the project, an steady state analysis will be set up. This means that the throttle will not move. This case helps set up the real analys Read more

### Heat Recuperator - Combustion Efficiency Jorge Martinez · 2018-10-10 05:34:46

In this challenge, the efficiency of using a heat recuperator to pre-heat the air is analyzed. For that, we simulate a furnace burning methane and air mixture, and we analyze first how the pre-heating affects at the AFL, and then the total heat/work that could be extrac Read more

### Adiabatic Flame Temperature using Python and Cantera - Reactor with Heat Loss Jorge Martinez · 2018-10-09 02:16:08

This project main objective is to calculate the Adiabatic Flame Temperature using Python and Cantera. In the first part of the project, the effect of the equivalence ratio for the methane combustion in a constant volume chamber is analyzed, and the python and cantera re Read more

### Backward Facing Step Flow - CONVERGE Studio Jorge Martinez · 2018-10-03 02:52:16

This projects aims to simulate a backward facing step flow using CONVERGE Studio. The flow is creating when a not reacting specie, air (23% O2 and 77% N2 in mass fraction), suffers a pressure gradient between the ends of the channel. The velocity, pressure and recirulat Read more