Skip to content

Access violation dealing with Wall between empty Reactors #1623

@Naikless

Description

@Naikless

Problem description
Trying to access heat_rate (and probably other stuff too) from a Wall connecting two empty Reactors (i.e. with no defined phase) crashes the interpreter.

Clearly, there should be no proper result without defined phases in the reactors, but an access violation seems a bit drastic to me.

Steps to reproduce

import cantera as ct

r1 = ct.Reactor()
r2 = ct.Reactor()

w = ct.Wall(r1,r2)

w.heat_rate

Behavior
The result for me is

Windows fatal exception: access violation

I suppose there is just a check missing on the C++ side of the object, because the conceptually similar MassFlowController handles the same situation by throwing

CanteraError: 
*******************************************************************************
CanteraError thrown by ReactorBase::contents:
Reactor contents not defined.
*******************************************************************************

I suppose copying this behavior to the Wall object would be enough.

System information

  • Cantera version: 3.1.0a1
  • OS: Windows 10
  • Python/MATLAB/other software versions: Python 3.11.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions