All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
INTRODUCTION In any particular reaction, there are multiple intermediate reactions happening which affect the rate of the entire mechanism. These reactions depend on different operating conditions and can be controlled to alter the mechanism to the desired state. In order to control the reactions, we can change different…
Shouvik Bandopadhyay
updated on 31 Jan 2020
INTRODUCTION
MATHEMATICAL EXPLANATION OF SENSITIVITY
NOTE: Image from MIT OCW
Consider Y=f(X,p)
X = Input parapemet
p = independent parameter
The two plots represent the variation of Y when the value of p is changed from p to p+δp. This change in the parameter affects the value of Y by a certain value . Then the sensitivity of with respect to the parameter p is defined as:
Sensitivity=δyδp
We can adjust the value of p to obtain the desired output Y. Similarly, for a chemical reaction mechanism, there are several independent parameters that can be used to control the entire mechanism.
PROCEDURE FOR THE COMPUTATIONAL EXPERIMENT
PYTHON CODE
\"\"\"
Program to identify top 10 temperature sensitive reactions for the GRI 3.0 mechanism
Program by: Shouvik Bandopadhyay
\"\"\"
import numpy as np
import matplotlib.pyplot as plt
import cantera as ct
# Initial conditions for the reaction mechanism
gas = ct.Solution(\'gri30.xml\')
T0 = 1500
P0 = ct.one_atm
gas.TPX = T0, P0, {\'CH4\':1, \'O2\':2, \'N2\':7.52}
# Initializing the reactor and the reactor network
r = ct.IdealGasConstPressureReactor(gas)
sim = ct.ReactorNet([r])
reactions = gas.reaction_equations()
# Extracting and adding reactions from the mechanism to sensitivity analysis
n = gas.n_reactions
rid = np.linspace(1,n,n).astype(int)
N = 10 # Number of sensitive reactions to be displayed
for i in range(n):
r.add_sensitivity_reaction(i)
# Setting the relative and absolute tolerances for the solver
sim.rtol = 1e-06
sim.atol = 1e-15
sim.rtol_sensitivity = 1e-06
sim.atol_sensitivity = 1e-06
# Initializing the maximum temperature sensitivities of each reaction
sT_max = [0]*n
# Initializing a solution array to store the reaction properties at each time-step
states = ct.SolutionArray(gas, extra=[\'t_in_ms\'])
# Creating the time domain for the reactor network
t = np.linspace(0, 2e-3, 401)
# Outer time loop
for i in range(len(t)):
sim.advance(t[i])
states.append(r.thermo.state, t_in_ms=t[i]*1e3)
# Storing the maximum sensitivities of each reaction
for j in range(n):
sT = sim.sensitivity(\'temperature\',j)
if np.abs(sT) >= np.abs(sT_max[j]):
sT_max[j] = sT
# Sorting the reactions and reaction IDs based on absolute value of sensitivities
reactions = [r for s,r in sorted(zip(np.abs(sT_max),reactions), reverse=True)]
rid = [r for s,r in sorted(zip(np.abs(sT_max),rid), reverse=True)]
sT_max = [sT for abs_sT, sT in sorted(zip(np.abs(sT_max),sT_max), reverse=True)]
# Extracting the top 10 sensitive reactions
rplot = reactions[0:N]
rid_plot = rid[0:N]
splot = sT_max[0:N]
# Printing the results
print(\"The top %d temperature sensitive reactions are:\" % (N))
print(\"-------------------------------------------------------------\")
print(\"%8s %4s %18s %12s %12s\" % (\'Reaction ID\',\'|\',\'Reaction\',\'|\',\'Sensitivity\'))
print(\"-------------------------------------------------------------\")
for i in range(N):
print(\"%7d %8s %26s %4s %10.4f\" % (rid_plot[i],\'|\',rplot[i],\'|\',splot[i]))
print(\"-------------------------------------------------------------\")
# Extracting mole fractions of OH, H and CH4
OH = states.X[:, states.species_index(\'OH\')]
H = states.X[:, states.species_index(\'H\')]
CH4 = states.X[:, states.species_index(\'CH4\')]
# Plotting the results
fig1, ax1 = plt.subplots()
y_pos = np.arange(len(rplot))
plt.grid(\'both\',linestyle=\'--\',linewidth=1.2)
ax1.set_axisbelow(True)
ax1.barh(y_pos, splot, 0.5, align=\'center\', color=\'green\')
ax1.set_yticks(y_pos)
ax1.set_yticklabels(rplot, rotation=0, fontweight=\'bold\')
ax1.invert_yaxis()
xticks = [-20, -15, -10, -5, 0, 5, 10, 15, 20]
ax1.set_xticklabels(xticks, rotation=0, fontsize = 12)
ax1.set_xlabel(\'Temperature Sensitivity\', fontsize = 18, fontweight=\'bold\')
plt.title(\'10 most temperature sensitive reactions for the GRI 3.0 mechanism of CH4 combustion\', fontsize=20, fontweight = \'bold\')
figManager = plt.get_current_fig_manager()
figManager.window.state(\'zoomed\')
fig2, ax2 = plt.subplots(2,2)
plt.subplot(2,2,1)
plt.plot(states.t_in_ms,states.T,linewidth=2)
plt.grid(\'both\',linestyle=\'--\',linewidth=0.8)
plt.xlabel(\'Time [ms]\',fontweight=\'bold\')
plt.ylabel(\'Temperature [K]\',fontweight=\'bold\')
plt.subplot(2,2,2)
plt.plot(states.t_in_ms,OH,linewidth=2)
plt.grid(\'both\',linestyle=\'--\',linewidth=0.8)
plt.xlabel(\'Time [ms]\',fontweight=\'bold\')
plt.ylabel(\'OH Mole Fraction\',fontweight=\'bold\')
plt.subplot(2,2,3)
plt.plot(states.t_in_ms,H,linewidth=2)
plt.grid(\'both\',linestyle=\'--\',linewidth=0.8)
plt.xlabel(\'Time [ms]\',fontweight=\'bold\')
plt.ylabel(\'H Mole Fraction\',fontweight=\'bold\')
plt.subplot(2,2,4)
plt.plot(states.t_in_ms,CH4,linewidth=2)
plt.grid(\'both\',linestyle=\'--\',linewidth=0.8)
plt.xlabel(\'Time [ms]\',fontweight=\'bold\')
plt.ylabel(\'CH4 Mole Fraction\',fontweight=\'bold\')
plt.tight_layout()
plt.show()
RESULTS
1. TOP 10 MOST SENSITIVE REACTIONS
2. TEMPERATURE SENSITIVITY BAR PLOT
Positive Sensitivity: Increase in temperature denotes increase in the rate of reaction.
Negative Sensitivity: Increase in temperature denotes decrease in the rate of reaction.
3. TEMPORAL VARIATION OF PARAMETERS
CONCLUSION
Sensitivity Analysis has been performed to successfully find the 10 most sensitive reactions in methane combustion.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
FULL SCALE COMBUSTION MODELLING OF A PORT FUEL INJECTION ENGINE
…
22 Jul 2020 08:09 AM IST
Week 7: Shock tube simulation project
…
24 May 2020 08:21 PM IST
Week 8: Literature review - RANS derivation and analysis
RANS LITERATURE REVIEW: DERIVATION OF RANS EQUATONS FOR TURBULENT FLUID FLOWS OBJECTIVE To apply Reynolds Decomposition to NS Equations and obtain the expression for Reynold's Stress …
21 May 2020 05:36 PM IST
Week 5 - Compact Notation Derivation for a simple Mechanism
Please Find the solution of the challenge attached.
20 May 2020 07:20 PM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.