Hello Débora!
If I've understood your question correctly, you want to be able to access the molar fraction values determined during the simulation.
The
cantera._onedim module has a
save method, which allows you to save the simulation data persistently. This method can be accessed from
FreeFlame instances.
For example, if you created a flame like the following:
reactants = 'CO:44.6, H2: 154.0, H2O:31.0, CH4:3.6, N2:2026.4, CO2:18.9, O2:513.9'
gas = ct.Solution('gri30.yaml')
p = ct.one_atm
T0 = 300
gas.TPX = T0, p, reagentes
flame1 = ct.FreeFlame(gas, width=0.05) # FreeFlame instance
flame1.transport_model = 'multicomponent'
#solving
flame1.solve(loglevel = 0, auto=True)
Then the data can be saved as a csv file as follows:
flame1.save('filename.csv')
I particularly prefer this method and not displaying results directly in the simulation script, since they can be accessed independently, using something like this, for example:
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('filename.csv')
fig, ax = plt.subplots(figsize=(6,6), dpi=150)
ax.plot(data["grid"], data["X_H2"], '.-', label="H2")
Best regards;
R. G. Leão Jr.