-
-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Description
In function restore_data() in onedim.pyx the pressure is restored simply setting
self.P = P[0]
However, prior to that call, P is defined as T, P, Y = states where states is the function argument. If user has created the states by using f.collect_data() function, P is not an array but a float, hence evoking an error TypeError: 'float' object is not subscriptable
Steps to reproduce
import cantera as ct
import numpy as np
# Simulation parameters
p = ct.one_atm # pressure [Pa]
Tin = 300.0 # unburned gas temperature [K]
reactants = 'H2:1.1, O2:1, AR:5' # premixed gas composition
width = 0.03 # m
loglevel = 1 # amount of diagnostic output (0 to 8)
# IdealGasMix object used to compute mixture properties, set to the state of the
# upstream fuel-air mixture
gas = ct.Solution('h2o2.xml')
gas.TPX = Tin, p, reactants
# Set up flame object
f = ct.FreeFlame(gas, width=width)
f.set_refine_criteria(ratio=3, slope=0.06, curve=0.12)
f.show_solution()
# Solve with mixture-averaged transport model
f.transport_model = 'Mix'
f.solve(loglevel=loglevel, auto=True)
fdata_tmp = f.collect_data('flame', ['grid'])
f.restore_data('flame', fdata_tmp[0], fdata_tmp[1], fdata_tmp[2])
System information
- Cantera version: development version installed by conda
- OS: Centos 7
- Python 3.8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels