The FlowReactor can produce output that does not satisfy the constraint that $\sum Y_k = 1$ when the last species in the mechanism has a non-zero net rate of production from surface reactions. It's a little surprising that the last gas phase species is special here. While there is special handling of the last surface phase species for each attached surface related to this constraint, since the coverages are algebraic variables, there is no corresponding treatment for the gas, where the variables are differential.
Steps to reproduce
Run the following simplification / modification of the surf_pfr.py example, which swaps the last two gas phase species (CO2 and AR).
import cantera as ct
cm = 0.01
minute = 60.0
T0 = 1073.0
length = 0.3 * cm # Catalyst bed length
area = 1.0 * cm**2 # Catalyst bed area
cat_area_per_vol = 1000.0 / cm # Catalyst particle surface area per unit volume
velocity = 40.0 * cm / minute # gas velocity
porosity = 0.3 # Catalyst bed porosity
gas_def = """
phases:
- name: gas
thermo: ideal-gas
elements: [O, H, C, N, Ar]
species: [{methane_pox_on_pt.yaml/species: [H2, O2, H2O, CH4, CO, AR, CO2]}]
skip-undeclared-elements: true
state:
T: 300.0
P: 1.01325e+05
X: {CH4: 0.095, O2: 0.21}
"""
gas = ct.Solution(yaml=gas_def)
surf = ct.Interface('methane_pox_on_pt.yaml', 'Pt_surf', adjacent=[gas])
surf.TP = T0, ct.one_atm
gas.TPX = T0, ct.one_atm, 'CH4:1, O2:1.5, H2:0.1, CO2:0.5'
# create a new reactor
r = ct.FlowReactor(gas)
r.area = area
r.surface_area_to_volume_ratio = cat_area_per_vol * porosity
r.mass_flow_rate = velocity * gas.density * area * porosity
r.energy_enabled = False
# Add the reacting surface to the reactor
rsurf = ct.ReactorSurface(surf, r)
sim = ct.ReactorNet([r])
n = 0
print(' distance Y_CH4 Y_H2 Y_CO Y_CO2 sum(Y)')
print(' {:10f} {:10f} {:10f} {:10f} {:10f} {:10f}'.format(
0, *r.thermo['CH4', 'H2', 'CO', 'CO2'].Y, sum(r.thermo.Y)))
while sim.distance < length:
dist = sim.distance * 1e3 # convert to mm
sim.step()
if n % 500 == 0 or (dist > 1 and n % 20 == 0):
print(' {:10f} {:10f} {:10f} {:10f} {:10f} {:10f}'.format(
dist, *r.thermo['CH4', 'H2', 'CO', 'CO2'].Y, sum(r.thermo.Y)))
n += 1
Problem description
The
FlowReactor
can produce output that does not satisfy the constraint that $\sum Y_k = 1$ when the last species in the mechanism has a non-zero net rate of production from surface reactions. It's a little surprising that the last gas phase species is special here. While there is special handling of the last surface phase species for each attached surface related to this constraint, since the coverages are algebraic variables, there is no corresponding treatment for the gas, where the variables are differential.Steps to reproduce
Run the following simplification / modification of the
surf_pfr.py
example, which swaps the last two gas phase species (CO2 and AR).Behavior
The above code outputs the following:
Modifying the species definition to be:
instead produces output that satisfies the $\sum Y_k = 1$ constraint:
System information
Additional context
Based on an issue posted in the Cantera Users' Group.