How to get creation rate or molar fraction of species along flame grid

42 views
Skip to first unread message

Débora Ginara Madeira de Almeida

unread,
Jun 27, 2024, 1:17:46 PM (5 days ago) Jun 27
to Cantera Users' Group
Hello,
I am using the FreeFlame class to simulate a flat flame (using python). I would like to obtain the creation rate or molar fraction (or any kind of quantity measure) for certain species along the flame. However, these properties are point values.
This example with the Interface class seems to be able to do this, however I cannot understand it at all:

Has anybody done this or do you know if it can be done in the FreeFlame class?

Thank you!

Reginaldo Gonçalves Leão Junior

unread,
Jun 28, 2024, 7:46:28 AM (5 days ago) Jun 28
to Cantera Users' Group
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.

Débora Ginara Madeira de Almeida

unread,
10:27 AM (13 hours ago) 10:27 AM
to Cantera Users' Group
Thank you so much, this worked perfectly.
(Just one thing, the species are saved in Y, not X).
Reply all
Reply to author
Forward
0 new messages