When I run the code the below using Python 3.5 I get the following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-20-6c59b4df68d5> in <module>()
10 for i in range(len(phi)):
11 gas1.TP = 300, ct.one_atm
---> 12 gas21.set_equivalence_ratio(phi[i], 'CH4', 'O2:1, N2:3.76')
13 gas1.equilibrate('HP')
14 T_complete[i] = gas1.T
AttributeError: 'Solution' object has no attribute 'set_equivalence_ratio'
I have looked up the "set_equivalence_ratio" and it is an object in the ThermoPhase Class which is a base class for the Solution class used in the code. For reference this is the flame_temperature.ipynb tutorial file from
here.
%matplotlib notebook
import cantera as ct
import numpy as np
import matplotlib.pyplot as plt
# Get all of the Species objects defined in the GRI 3.0 mechanism
species = {S.name: S for S in ct.Species.listFromFile('gri30.cti')}
# Create an IdealGas object with species representing complete combustion
complete_species = [species[S] for S in ('CH4','O2','N2','CO2','H2O')]
gas1 = ct.Solution(thermo='IdealGas', species=complete_species)
phi = np.linspace(0.5, 2.0, 100)
T_complete = np.zeros(phi.shape)
for i in range(len(phi)):
gas1.TP = 300, ct.one_atm
gas21.set_equivalence_ratio(phi[i], 'CH4', 'O2:1, N2:3.76')
gas1.equilibrate('HP')
T_complete[i] = gas1.T