Temperature sensitivity analysis of GRI reaction mechanism
In this project, sensitivity analysis of GRI reaction mechanism to temperarture is carried out to find the ten most sensitive reactions.
The main aim of this project is to find out the most temperature sensitive reaction from a pool of hundreds of reactions which can help us figure out the reactions that significantly affects combustion parameters like the auto ignition. Changing the reaction rates of the most temperature sensitive reactions can significantly affect the auto ignition time either leading to speeding up or delaying the auto ignition, so using this one can tune the auto ignition according to requirement.
The code for the project is built with Cantera via Python. The initial conditions are taken as follow. The time period of the simulation is taken as 2e-3s with time steps of 5e-6s, the initial temperature is taken as 1500K with initial pressure of 1 atm. An ideal gas constant pressure reactor is setup considering `CH_4` as fuel source under stoichiometric condittion and the reaction is solved using Reactornet by using advance function. GRI reaction mechanism is employed.
Under stoichiometric conditions the simplified reaction equation is as follows:
`CH_4 + 2(O_2 +3.76N_2) rarr CO_2 + 2H_2O + 7.52N_2`
The absolute and relative tolerances of the reactor solver is set at 1e-15 and 1e-6. Since, for finding sensitivity seperate ODEs are solved, the absolute and relative tolerances of the sensitivity solver should be specified seperately, here both are taken as 1e-6.
The program is written such that sensitivity of all the 325 reactions of GRI mechanism to temperature is calculated at every time step and stored. From the data that is obtained, the absolute maximum sensitivity of each reaction is figured out from among the sensitivity measured at every timestep. The absolute maximum sensitivity of the reactions thus obtained is then sorted from highest to lowest absolute value which is then converted to the bar plot attached below the code.
The link for the code of the project is given below:
https://drive.google.com/file/d/1tKofzhGcA-HN00ur7Kk3ova0C6wVdRq3/view?usp=sharing
The code itself is also attached below:
import cantera as ct
import numpy as np
import matplotlib.pyplot as plt
import itertools
gas = ct.Solution(\'gri30.xml\')
T = 1500
P = ct.one_atm
sensitivity = [[0 for b in range(400)] for v in range(325)]
reaction_name = []
dictionary = {}
sensitivity_max = []
t = 0
gas.TPX = T,P,{\'CH4\':1,\'O2\':2,\'N2\':7.52}
r = ct.IdealGasConstPressureReactor(gas)
s = ct.ReactorNet([r])
for i in range(325):
r.add_sensitivity_reaction(i)
s.rtol = 1e-6
s.atol = 1e-15
s.rtol_sensitivity = 1e-6
s.atol_sensitivity = 1e-6
solution = ct.SolutionArray(gas)
for x in range(400):
t = t + 5e-6
s.advance(t)
for j in range(325):
sensitivity[j][x] = s.sensitivity(1,j)
solution.append(r.thermo.state)
for k in range(325):
reaction_name.append(gas.reaction_equation(k))
sensitivityar = np.array(sensitivity)
for y in sensitivity:
sensitivity_max.append(np.min(y) if np.max(np.abs(y)) == abs(np.min(y)) else np.max(y))
dictionary=dict(zip(reaction_name,sensitivity_max))
#print(dictionary)
sorted_d = {k: v for k, v in sorted(dictionary.items(), key=lambda x: abs(x[1]), reverse=True)}
#help(s)
#help(s.sensitivity_parameter_name)
#help(gas.reaction_equation)
N = 10
d_out = dict(itertools.islice(sorted_d.items(), N))
#print(d_out)
d_out = {k: v for k, v in sorted(d_out.items(), key=lambda x: abs(x[1]))}
X = np.arange(len(d_out))
plt.barh(X, d_out.values(),color=\'Red\')
plt.yticks(X, d_out.keys())
plt.ylabel(\"Reactions-->\")
plt.xlabel(\"Sensitivity-->\")
plt.title(\'Sensitivity of reactions to temperature\')
plt.tight_layout()
plt.show()
The result obtained in given below:
The figure above shows the most temperature sensitive reactions. One can note that there are both positive and negative temperature sensitive reactions, increasing the temperature of positive temperature sensitive reaction will increase the reaction rate which in turn will speed up auto ignition whereas in the case of negative sensitivity increasing the temperature will impedes the reaction rate which in turn it delays auto ignition.