Cantera / cantera-website

Official Cantera Website
https://cantera.org
Other
14 stars 26 forks source link

Attribute Error #256

Closed bliboalbert closed 5 months ago

bliboalbert commented 11 months ago

Problem description

The ct.Solution().is_reversible() returns an error message. The error message was AttributeError: 'Solution' object has no attribute 'is_reversible'

Steps to reproduce

  1. Open 'import cantera as ct g = ct.Solution('gri30.yaml') g.TPX = 300.0, ct.one_atm, 'CH4:0.95,O2:2,N2:7.52' g.equilibrate('TP') g.TPX = 300.0, ct.one_atm, 'CH4:0.95,O2:2,N2:7.52' g.equilibrate('HP')

rf = g.forward_rates_of_progress rr = g.reverse_rates_of_progress for i in range(g.n_reactions): if g.is_reversible(i) and rf[i] != 0.0: print(' %4i %10.4g ' % (i, (rf[i] - rr[i])/rf[i]))'

  1. Run '....'
  2. See error 'Traceback (most recent call last): File "C:\Users\Albert\PycharmProjects\chemEngProject\equilibrium.py", line 11, in if gas.is_reversible(i) and forwardRxn[i] != 0.0: ^^^^^^^^^^^^^^^^^ AttributeError: 'Solution' object has no attribute 'is_reversible''

Behavior

File "C:\Users\Albert\PycharmProjects\chemEngProject\equilibrium.py", line 11, in if gas.is_reversible(i) and forwardRxn[i] != 0.0: ^^^^^^^^^^^^^^^^^ AttributeError: 'Solution' object has no attribute 'is_reversible''

System information

Attachments

Additional context

Discovered when learning from Getting started tutorials.

speth commented 11 months ago

This method was deprecated and removed in Cantera 2.6. The new way of writing this is:

gas.reaction(i).reversible

I'm going to transfer this to the cantera-website repository, since the error here is an out-of-date tutorial. Thanks for reporting this issue.