Gas mixture is not exploding, although it should be

361 views
Skip to first unread message

Nicole Neumann

unread,
Jul 19, 2022, 1:19:27 PM7/19/22
to Cantera Users' Group
Hi all,
-----SHORT Version --------------
I am having difficulties in calculating the lower flammability limit with Cantera. The gas mixture does not react in a simulated reactor, but does so under same starting conditions when using gas.equilibrate('UV'). Where is the difference?
-------LONG Version-------------
My aim is to calculate the lower flammability limit for ammonia in O2-enriched air. To test my code, I started with using the gri3.0 mechanism for the lower flammability limit for methane as there are more experimental data available to validate the calculations. However, according to my results a mixture of methane in air with equivalence ratio 1.0 is not reacting, when I simulate a reactor with this gas mixture. In contrast, the equilibrate() function shows that methane is combusted to CO2.
----------------------------------------

My code:

import cantera as ct

#parameters for reaction proceeding and explosion check
t_step = 0.5 # s
t_end = 600 # s
temp_change = 0 # K/ms
explosion_limit = 0.1 # K/ms
LEL_found = True
Explosion = False

#Set starting conditions of gas in reactor network "sim"
P = ct.one_atm
T_start = 25+273.15 # K
fuel = "CH4"
air = "O2:0.21,N2:0.79"

gas = ct.Solution('gri30.yaml')
gas.TP = T_start, P
gas.set_equivalence_ratio(phi=1.0, fuel = 'CH4:1', oxidizer=air)

print(gas())
print('{:10s} {:10s} {:10s} {:10s} {:14s}'.format('t [s]', 'T [K]', 'P [Pa]', 'temp_change [K/ms]', 'mol fuel'))
r1 = ct.Reactor(contents = gas, energy = 'on')
sim = ct.ReactorNet([r1])
states = ct.SolutionArray(gas, extra=['t'])
states.append(r1.thermo.state,t=sim.time * 1e3)

#Check for explosion by running the reactor network "sim"
while gas.T < (T_start + 1500) and sim.time < t_end:
     print('{:10.3e} {:10.3f} {:10.3f} {:14.6f} {:10.3f} {:10.3f}'.format(sim.time, r1.T, r1.thermo.P, r1.thermo.u,temp_change,states.X[-1, gas.species_index('CH4')]))
     sim.advance(sim.time + t_step)
     states.append(r1.thermo.state, t=sim.time * 1e3)
     temp_change = (states.T[-1] - states.T[-2]) / (states.t[-1] - states.t[-2]) # [K/ms]
#Check if gas mixture exploded
    if temp_change > explosion_limit:
             Explosion = True
             LEL_found = False
             break
gas.equilibrate('UV')
print(gas())


-------------------------------------
I don't understand why the Methane-Air mixture is not reacting in the reactor network as it should and does when using the equilibrate function. Is my code wrong?
Any help is very much appreciated!

Best,
Nicole


------------------------------
Cantera 2.5.1
Python 3.9
OS: Windows 10

Mark E. Fuller

unread,
Jul 19, 2022, 2:02:42 PM7/19/22
to Cantera Users' Group
Hi Nicole,

First, it is important to note that the mixture is not "reacting" per se when you run `equilibrate` - it is equilabrating, which is a thermodynamic calculation. You could put methane and air outside of the explosive limits and also equilibrate it to CO2 and water.

Second, your reaction simulation has no "spark" or means of initiating the reaction. It's possible to have an explosive mixture that does not explode simply because there is no initiating event to kick off the reaction.
See the use of "igniter" at https://github.com/Cantera/cantera/blob/main/interfaces/cython/cantera/test/test_reactor.py as an example or the deleted code mentioned below.

There's some discussion around it at https://groups.google.com/g/cantera-users/c/dE3ufaJQwpg

N.B for Steven and Ingmar - this used to be included in https://github.com/Cantera/cantera/blame/main/interfaces/cython/cantera/examples/reactors/combustor.py , but was removed by Ray with Brian's approval in PR#550 (https://github.com/Cantera/cantera/pull/550) four years ago:

Nicole Neumann

unread,
Jul 25, 2022, 2:52:57 PM7/25/22
to Cantera Users' Group
Hi Mark,

first of all: thanks for your explanations and hints! I had a look at all links and modified my code to include an iginition source.

The gas mixture is reacting now also at lower temperatures due to the added ignition source. However, I noticed some weird behavior and apparent inconsistency of the advance() and step() function:
  1. When varying the CH4 and O2 concentration in the explosion region, there are certain CH4/O2 concentrations at which the mixture does not react, although slightly higher or lower fuel concentration (still being in the explosion region) lead to an explosion
  2. When varying the time step for the advance() function, these certain fuel/O2 concentrations change at which the mixture does not explode, despite being in the explosion range. Thus, advance() and step () yield different results
  3. The CH4 also explodes at concentrations below the explosion limit (<4 %) with again different results depending on the time step of advance() function

Do you have any idea what is wrong with my code? 

Below is a figure showing the results of an explosion check for CH4 in O2 and N2. The gas compositions of the blue points don't result in a temperature increase 15 >  K/ms (explosion check -> no explosion), and the red dots show gas mixtures which explode. 
Beside that I attached example figures for CH4 concentrations below the lower explosion limit with different time steps and thus different results and my code.

Best,
Nicole
CH4-Combustion_t_step-1e-4.png
CH4-Combustion_t_step-5e-4.png
Code_CH4 combustion.txt
Explosion Check_CH4 combustion_V1.png

Nicole Neumann

unread,
Jul 28, 2022, 12:28:55 PM7/28/22
to Cantera Users' Group
Hi all,

has there anyone else encountered such inconsistencies with the advance() and step() function for reactor networks? Any help is very much appreciated!

Thanks and best regards,
Nicole

Mark E. Fuller

unread,
Jul 29, 2022, 7:56:09 AM7/29/22
to Cantera Users' Group
Sorry, but I can't add anything too helpful other than to suggest reading the docs on the advance and step functions and see about reducing the rtol and atol values used in the solvers.
This is a bit of a finicky problem since you can see that simply being an explosive mixture doesn't cause explosion (we have to perturb the mixture, in this case with the "igniter").
I suspect some of the variability in results right around the explosive limits is due to the resolution of the numerical solutions.

If you run a broader range of mixtures, do you get a clear region of non-explosion, explosion, and then a muddled middle? If yes, I would pin it on the solver tolerances.
Reply all
Reply to author
Forward
0 new messages