Skip to content

Negative molar fractions appear when using ReactorSurface #1880

@ilyapopov

Description

@ilyapopov

Problem description

When using ReactorSurface, negative concentrations appear.

Steps to reproduce

Run attached reproducer.py with attached reproducer.yaml. Essential parts are:

INITIAL_COMPOSITION = "H2:1,HN2+:0.01,N2:0.01"
file_name = "reproducer.yaml"

print(f"Loading mechanism '{file_name}' ...")
gas = ct.Solution(file_name, "gas")

print("Setting initial conditions ...")
gas.TPX = 300.0, 5, INITIAL_COMPOSITION

print("Creating reactor ...")
reactor = ct.IdealGasReactor(gas, volume=1.0, energy="off")

print("Creating surface ...")
surface_kin = ct.Interface(file_name, "surface")
surface = ct.ReactorSurface(surface_kin, reactor, A=0.1)
print(reactor.surfaces)

print("Creating network ...")
sim = ct.ReactorNet([reactor])
sim.verbose = True
reactor.thermo()

print("Integrating ...")
t_min = 1e-07
t_max = 1
time = np.geomspace(t_min, t_max, int(10*np.log(t_max / t_min)))
states = ct.SolutionArray(gas, extra=['t'])

for t in time:
    sim.advance(t)
    states.append(reactor.thermo.state, t=sim.time)

Where reactions:

reactions:
  - equation: H3+ + N2 => HN2+ + H2
    rate-constant: { A: 1.86e-9, b: 0.0, Ea: 0.0 }

surface-reactions:
  - equation: H3+ => H2 + H
    sticking-coefficient: { A: 1.0, b: 0.0, Ea: 0.0 }

Notice that both reactions require H3+ which is not present in the initial mixture.

Behavior

At some point, molar fraction of "HN2+" becomes negative, and molar fraction of "N2" grows to 1. See the plot

Image

If energy equation is enabled, this also leads to negative temperature.

System information

  • Cantera version: 3.1.0 from PyPI
  • OS: Ubuntu 25.04
  • Python: 3.13.3

Attachments

reproducer.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions