#Gas Composition and Physical Conditions
#gas.X = {'CH4':1.0, 'O2':2, 'N2':2*3.76}gas.X = {'CH4':0.45, 'O2':1}gas.TP = 300, ct.one_atm
#Numerical knobs
initial_grid = np.linspace(0.0, 0.05, 10) # m
tol_ss = [1.0e-9, 1.0e-14] # [rtol atol] for steady-state problem
tol_ts = [1.0e-5, 1.0e-14] # [rtol atol] for time stepping
loglevel = 1 # amount of diagnostic output (0 to 8)
#Flame object
f = ct.FreeFlame(gas, initial_grid)
f = ct.FreeFlame(gas, initial_grid)
##### - The above is executed twice
##### - Only then the code works, for this and other conditions
##### - For gas compositions such as phi=0.5 (methane/air), no need
##### - to include the above line twice.
#Assign numerical knobs, etc
f.flame.set_steady_tolerances(default=tol_ss)
f.flame.set_transient_tolerances(default=tol_ts)
f.set_refine_criteria(ratio=2, slope=0.1, curve=0.1)
f.set_max_jac_age(10, 10)
f.set_time_step(1e-5, [2, 5, 10, 20, 30])
#Model details
f.energy_enabled = True
f.transport_model = 'Multi'
#Point where we start praying
f.solve(loglevel=loglevel, refine_grid=True)
#Did the prayer work
print f.u[0]*100
So for Simon_thermo's initial conditions, the last few lines output is:
..............................................................................
Attempt Newton solution of steady-state problem... success.
Problem solved on [178] point grid(s).
..............................................................................
no new points needed in flame
318.901701685
I see the same issue if I run the file named adiabatic_flame.py substituting CH4/air mixtures for H2/O2 and changing the mechanism file...
Whether I initialize f once or twice, the output of f.show_solution() is the same.