Skip to content

Cannot create Reactor object with clone=True #2100

@sevyharris

Description

@sevyharris

I'm trying to make a PFR from a chain of CSTRs according to this example https://cantera.org/dev/examples/python/reactors/surf_pfr_chain.html but it fails when I try to make the IdealGasReactor, giving me this error:

---------------------------------------------------------------------------
CanteraError                              Traceback (most recent call last)
Cell In[5], line 1
----> 1 r = ct.IdealGasReactor(gas, energy='off')

File build/python/cantera/reactor.pyx:22, in cantera.reactor.ReactorBase.__cinit__()

CanteraError: 
*******************************************************************************
CanteraError thrown by getElementWeight:
element not found: T
*******************************************************************************

I can set clone=False to silence the error, but then later it gives me trouble creating the upstream Reservoir. I have also tried deleting the problem elements listed in the yaml file, but eventually it complains about X and at that point I'd have to change the whole yaml file to use Pt specifically which is not something I want to do.

Steps to reproduce

This is the code I'm running (mechanism attached below):

import cantera as ct

# import the phase models and set the initial conditions
yaml_file = './chem_4p0.yaml'
surf = ct.Interface(yaml_file, 'surface1')
gas = surf.adjacent['gas']

r = ct.IdealGasReactor(gas, energy='off')

# r = ct.IdealGasReactor(gas, energy='off', clone=False)

On 4.0.0a1: run as is
On 3.2.0: set clone=True

Behavior

Cantera crashes when I try to make the IdealGasReactor, which is surprising because this mechanism worked fine for me on Cantera 3.2.0 and older, but I also wasn't using clone=True back then.

System information

  • Cantera version: 4.0.0a1, commit d13048d
  • OS: Ubuntu 24.04.4 LTS
  • Python/MATLAB/other software versions: Python 3.14.3

Attachments
This is my mechanism file:
chem_4p0.yaml

Additional context
This mechanism was generated in RMG and then converted to Cantera using the ck2yaml executable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions