1D solver can fail when flames propagate too close to inlet boundary

Open
#384 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start by running the provided Python reproducer with BurnerFlame and inspect the timestep history and boundary oscillations. Compare behavior for BurnerFlame, ImpingingJet, and possibly CounterflowPremixedFlame; done means the reproducer no longer gets stuck in non-decaying oscillations during timestepping.

Written by the indexing model from the issue text.

Description

1D Flames bug

Some simulations get stuck in a process where timestepping can continue successfully, either for some small/medium value of the timestep. One cause of this is when the adiabatic flame speed exceeds the inlet velocity and the flame pushes up against the inlet. This can generate simultaneous oscillations in the mixture composition and velocity at the boundary (but not the boundary temperature, which is fixed) which then translate into oscillations in the flame temperature and propagation speed which do not decay with time.

This failure mode has been observed for BurnerFlame and ImpingingJet flames (and presumably can occur for CounterflowPremixedFlame as well.)

An example:

import cantera as ct
import numpy as np
import os
from collections import defaultdict
import matplotlib.pyplot as plt

# parameter values
p = 50 * ct.one_atm  # pressure
tburner = 300.0  # burner temperature
mdot = 0.22 # kg/m^2/s
width = 0.05 # m

# Set up the problem
gas = ct.Solution('h2o2.cti')

# set state to that of the unburned gas at the burner
gas.set_equivalence_ratio(0.4, 'H2', 'O2:1.0, AR:4')
gas.TP = tburner, p

# Create the stagnation flow object with a non-reactive surface.
sim = ct.BurnerFlame(gas=gas, width=width)

# Use callback function to collect data after each timestep
grids = {}
TT = defaultdict(list)
YY = defaultdict(list)
UU = defaultdict(list)
def callback(x):
    N = len(sim.grid)
    grids[N] = sim.grid
    TT[N].append(sim.T)
    YY[N].append(sim.Y[gas.species_index('O2')])
    UU[N].append(sim.u)
    return 0

sim.set_time_step_callback(callback)

# set the mass flow rate at the inlet
sim.burner.mdot = mdot

sim.set_refine_criteria(ratio=3, slope=0.1, curve=0.2, prune=0)

try:
    sim.solve(loglevel=1, auto=False)
except ct.CanteraError as e:
    print(e)
    sim.show_stats()

# Get data from the last (failed) solution attempt
N = max(grids)
T = np.array(TT[N])
Y = np.array(YY[N])
U = np.array(UU[N])

f,ax = plt.subplots(3, figsize=(7,9))
ax[0].plot(T[:,1])
ax[1].plot(Y[:,0])
ax[2].plot(U[:,0])

ax[0].set_ylabel('Temperature at j=1')
ax[1].set_ylabel('O2 mass fraction at j=0')
ax[2].set_ylabel('Axial velocity at j=0')
ax[2].set_xlabel('time step')
f.tight_layout()

plt.show()

Results in the timestepping history:


 Grid   Timesteps  Functions      Time  Jacobians      Time
    9          20        304    0.0055         14    0.0068
   12          10        350    0.0093          8    0.0071
   17          10        270    0.0118          7    0.0101
   23          20        450    0.0288         13    0.0268
   29         330      14168    1.1422        433    1.2063
   33          20        474    0.0424         15    0.0470
   38         500      20245    2.1994        674    2.5676

And the observed oscillations on the final grid where the failure occurs:
figure_1-1

Dominant language
C++
Stars
883
Forks
436
Avg merge
3h 41m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Cantera/cantera

All issues in Cantera/cantera

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.