import cantera as ct import matplotlib.pyplot as plt # Parameters of the solver loglevel = 1 refine_grid = 'refine' # Setting up the gas object (operating conditions) gas = ct.Solution('GRI-Mech3.0.yaml') p = 1e5 tin = 300.0 phi = 1.0 fuel = {'CH4':1} oxidizer = {'O2': 1, 'N2': 3.76} gas.TP = tin, p gas.set_equivalence_ratio(phi, fuel, oxidizer) # Setting up the flame object f = ct.FreeFlame(gas, width=0.02) f.inlet.X = gas.X f.inlet.T = gas.T f.energy_enabled = True f.set_refine_criteria(ratio=2.0, slope=0.05, curve=0.05, prune=0.01) f.set_max_jac_age(10, 10) f.set_time_step(1e-8, [10, 20, 40, 80, 100, 100, 150]) f.max_time_step_count = 500 f.solve(loglevel, refine_grid) # Checking the results plt.plot(f.flame.grid, f.velocity) plt.xlabel('Flame grid [m]') plt.ylabel('Velocity [m/s]') plt.show()