Project

Performing 1D Flame Speed Analysis for the combustion of Methane and Hydrogen using Python and Cantera

Objective:

To write a code to perform a 1D Flame Speed Analysis for Methane and Hydrogen.

Approach:

The flame speed analysis can be performed in Python with the help of Cantera module. The 'Burner Stabilized Flame' approach where the reference coordinates are fixed at the flame front has been used to solve for the flame speed. In this approach, the whole system is observed from the location of the flame-front.

Type of analysis

Though the problem is of transient nature i.e., the flame changes its location with time, it can be converted into a steady-state problem by using the flame reference coordinates where the origin is set on the flame front and moves along with the flame. This would cause the relative motion of the unburnt gases to appear towards the flame and of the burnt gases to appear away from the flame. And when the relative velocity of the incoming unburnt gases reaches a steady-state, it is equal to the flame propagation speed which is what needs to be measured.

But sometimes, the solution may not converge in steady-state. In such cases, Cantera will automatically use the transient solution approach for the first few steps and switch over to the steady-state approach when a guess value good enough for steady-state convergence is achieved.

Mechanism files

The mechanism file used for the flame speed analysis of methane is the 'gri30' mechanism file. This mechanism file would also work for the flame speed analysis of hydrogen, but however, would not give an accurate result as it is specially optimized for the combustion of methane. Therefore, we need a separate mechanism file for the combustion of hydrogen, just for the accuracy.

Program Script:

(1) Flame speed analysis code for the combustion of Methane

"""
flame speed analysis for combustion of methane
"""

import cantera as ct
import matplotlib.pyplot as plt

# initial conditions
pres = ct.one_atm
temp = 300.0
reactants = 'CH4:1, O2:2, N2:7.52'

# domain length for 1d flame propagation
width = 0.03

# initializing and defining gas object
gas = ct.Solution('gri30.cti', 'gri30_mix')
gas.TPX = temp, pres, reactants

# creating a freeflame object and passing gas object and width
f = ct.FreeFlame(gas, width = width)

# setting the refine criteria for automated grid refinement
f.set_refine_criteria(ratio = 3, slope = 0.07, curve = 0.14)
f.solve()
conc = f.concentrations
index = gas.species_index('CO2')


# potting the results
fig1 = plt.figure(1)
plt.subplot(2,1,1)
plt.plot(f.grid, f.T)
plt.ylabel('Temperature (K)')
plt.xlabel('Domain length (m)')
plt.title('Flame Speed analysis for combustion of Methane')
plt.subplot(2,1,2)
plt.plot(f.grid, f.u)
plt.ylabel('Velocity (m/s)')
plt.xlabel('Domain length (m)')
fig1.tight_layout()

fig2 = plt.figure(2)
plt.plot(f.grid, conc[index,:])
plt.xlabel('Domain length (m)')
plt.ylabel('Concentration of CO2 (kmol/m^3)')
fig2.suptitle('Variation in concentration of CO2 across the domain')
plt.show()

(2) Flame speed analysis code for the combustion of Hydrogen

"""
flame speed analysis for the combustion of hydrogen
"""

import cantera as ct
import matplotlib.pyplot as plt

# initial conditions
temp = 300
pres = ct.one_atm
reactants = 'H2:2, O2:1, N2:3.76'

# defining the gas object
gas =  ct.Solution('h2_mech.cti')
gas.TPX = temp, pres, reactants

# defining the domain width for 1d flame peopagation
width = 0.03

# creating a freeflame object
f = ct.FreeFlame(gas, width = width)

# setting the refine criteria for automated geid refinement
f.set_refine_criteria(ratio = 3, slope = 0.07, curve = 0.14)
f.solve()
conc = f.concentrations
index = gas.species_index('CO2')


# plotting the results
fig = plt.figure(1)
plt.subplot(2,1,1)
plt.plot(f.grid, f.T)
plt.ylabel('Temperature (K)')
plt.xlabel('Domain length (m)')
plt.title('Flame Speed analysis for combustion of Hydrogen')
plt.subplot(2,1,2)
plt.plot(f.grid, f.u)
plt.ylabel('Velocity (m/s)')
plt.xlabel('Domain length (m)')
fig.tight_layout()

fig2 = plt.figure(2)
plt.plot(f.grid, conc[index,:])
plt.xlabel('Domain length (m)')
plt.ylabel('Concentration of CO2 (kmol/m^3)')
fig2.suptitle('Variation in concentration of CO2 across the domain')
plt.show()

Result

(1) Flame Speed analysis for Methane

(2) Flame Speed analysis for Hydrogen

Inference

Flame location: From the above plots, it can be seen that both temperature and velocity are initially constant, and at a certain common point, they abruptly increase to their maximum and remain there through the rest of the domain. The point of the abrupt increase in temperature and velocity represents the start of the flame front. It is important to know that the flame starts propagating from the midpoint of the linear domain as we're using the flame reference coordinates, and at around 0.005 m away from the domain midpoint, the velocity reaches a steady-state.

Flame width: The flame width can also be predicted from the above graphs. We know that as soon as the unburnt gases enter the flame, the temperature shoots up and keeps increasing till the gases are inside the flame. After they exit the flame, the temperature of the unburnt gases remains constant. Therefore, flame width can be defined as the distance across with the temperature steeply changes. From the above graphs, the flame width for both H2 and CH4 can be predicted as approximately 0.05 m.

Laminar flame speed: The domain to the right of the flame front where the temperature and velocity are maximum represents the burnt gases and the domain to the left of the flame front where the temperature and velocity are minimum represents the unburnt gases. The flame speed is equal to the velocity of the incoming unburnt gases as can be inferred from the velocity graph.

Therefore, the laminar flame speed for methane can be inferred from the graph as approximately 0.35 m/s and the laminar flame speed for hydrogen can be inferred from the respective graph as approximately 2.5 m/s.

Variation in concentration of CO2

(1) In the combustion of methane

(2) In the combustion of hydrogen

Inference:

The above graphs depict the variation in the concentration of CO2 as the unburnt gases enter the flame and come out as burnt gases. In both of the graphs at a certain point, the CO2 concentration steeply increases. It can be noted from the earlier graphs that this point is also where the temperature and the velocity steeply increase. And we also know that CO2 is one of the primary products of combustion. Therefore, the CO2 concentration plot further corroborates our earlier finding of the location of the flame front because the steep increase in CO2 can only be attributed to the combustion of unburnt gases as they enter the flame front located at that point.

Another interesting thing can be noted in the CO2 concentration variation plot for the combustion of H2, that the concentration curve has a few fluctuations, and moreover the concentration values are all negative and that this is not the case for CH4. This can be attributed to the fact that we are dealing with a very small amount of CO2 (in order of 10^-18) in the combustion of H2 unlike in the combustion of CH4 where the reactant itself consists of carbon and the amount of CO2 produced is significantly higher (order of 10^-4). This fact combined with another that at the flame front, the CO2 production rate or the slope of CO2 concentration with respect to flame width distance is very high, causes some uncertainty in approximation, and hence the negative values and fluctuations.

Effect of the width parameter

The width parameter has no effect on the laminar flame speed. It is just there to define the domain for plotting the graph and for convenient visualization. The relative location of the flame front also remains the same irrespective of the width of the domain for steady-state analysis.

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.