Skip to content

Python ReactorNet advance function providing convoluted error message #1195

@chinahg

Description

@chinahg

Problem description

When calling the advance function for a reactor network, the time to advance may be set to a value smaller than the current reactor time. The error message produced is unhelpful to the user for troubleshooting.

Steps to reproduce

gas = ct.Solution("gri30.yaml")
gas.TPX = 5000, 301325, "O2:0.75, CH4:0.25"
reactor = ct.IdealGasReactor(gas)
reactorNet = ct.ReactorNet([reactor])

t_final = 2
t = 0
del_t = 0.5

while t <= t_final:
t = t + del_t
reactorNet.advance(t)

gas.TPX = 2000, 101325, "O2:0.5, CH4:0.5"
reactor.syncState()

t_final = 1
time = 0
del_t = 0.5

while time <= t_final:
time = time + del_t
print(time)
reactorNet.advance(time)

  1. Open '...'
  2. Run '....'
  3. See error '....'

Behavior
Expected an error, but output is not helpful in determining issue.
CanteraError:


CanteraError thrown by CVodesIntegrator::integrate:
CVodes error encountered. Error code: -1
At t = 1.5, mxstep steps taken before reaching tout.

Exceptions caught during RHS evaluation:


CanteraError thrown by checkFinite:
ydot contains non-finite elements:

ydot[2] = -nan
ydot[4] = -nan
ydot[7] = -nan
ydot[17] = -nan
ydot[38] = -nan
ydot[49] = -nan


System information

  • Cantera version: 2.5.0
  • OS: Windows 10
  • Python/MATLAB/other software versions: Python 3.8

Attachments

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions