hi Ray
i have changed it to suit just one equivalence ratio, and now i get a new error!
code
from time import clock
import numpy as np
import cantera as ct
t0=clock()
initial_grid = [0.0, 0.001, 0.02, 0.03, 0.04, 0.05] #grid chosen as a pipe of length 50 cm
tol_ss = [1.0e-13, 1.0e-9] #abs and rel tolerances for steady state problem
tol_ts = [1.0e-13, 1.0e-9] #abs and rel tie tolernces for time step function
loglevel = 1 #amount of diagonistic output
refine_grid = False #true to turn it on
T1 = 300.0
P1 = ct.one_atm
rxn = 'gri30_highT.cti' #reaction mechanism
mix = 'gri30_mix' # produces an ideal gas object
################ create the gas object ########################
gas = ct.Solution(rxn,mix)
WMF = 0.0 #[(y*0.01) for y in range(1,14)] #water mass fraction
phi = 0.55 #[(0.+x*0.05) for x in range(18,27)]
nCH4= phi/(phi+(0.791/0.209+1)*2) #mole fraction of methane definition
nO2 = (1-nCH4)*0.209 #mole fraction of air then becomes (1-nCH4)
nN2 = (1-nCH4)*0.791 #mole fractions of N O according to 79.1 and 20.9 % by mole in air
q ='CH4:%f,O2:%f,N2:%f' %(nCH4, nO2, nN2)
f=ct.FreeFlame(gas,initial_grid)
f.flame.set_steady_tolerances(default=tol_ss) #set tolerances
f.flame.set_transient_tolerances(default=tol_ts)
f.inlet.T = T1 # inlet Temperature set
f.inlet.X = q # inlet composition by mole
f.show_solution
f.energy_enabled = False #disable energy
print '================================'
print 'the energy equation is turned off'
print '================================'
f.set_max_jac_age(50,50)
f.set_time_step(5.0e-6,[2,5,10,20,50,80,120,150])
f.solve(loglevel=loglevel, refine_grid=False)
f.energy_enabled = True #enable energy
print '================================'
print 'the energy equation is turned on'
print '================================'
f.set_refine_criteria(ratio = 3.0, slope = 1.0, curve = 0.8, prune = 0.05)
f.solve(loglevel=loglevel, refine_grid=False)
f.show_solution
u=f.u
Ufs0= u[0]
f.show_stats
print 'flamespeed w/o H2O = %f' % Ufs0,'m/s'
#print 'old mfCH4 = %f ' % gas["CH4"].Y
#print q
#print 'old nfCH4 = %f ' % nCH4
massfrac = gas["CH4","O2","N2"].Y
mfH2O = WMF
mfCH4 = massfrac[0]*(1-mfH2O)
mfO2 = massfrac[1]*(1-mfH2O)
mfN2 = massfrac[2]*(1-mfH2O)
#gas()
q2 ='CH4:%f,O2:%f,N2:%f,H2O:%f' %(mfCH4, mfO2, mfN2,mfH2O)
#print q2
#print 'new mfCH4 = %f new mfO2=%f new mfN2=%f' % (mfCH4 ,mfO2,mfN2)
#print 'total moles %f' %(mfCH4+mfO2+mfN2+mfH2O)
gas.TPY = T1, P1, q2
#gas() gas defined by mass fractions
molefrac = gas["CH4","O2","N2","H2O"].X
#print molefrac
f2=ct.FreeFlame(gas,initial_grid)
f2.flame.set_steady_tolerances(default=tol_ss) #set tolerances
f2.flame.set_transient_tolerances(default=tol_ts)
f2.inlet.T = T1 # inlet Temperature set
f2.inlet.X = q # inlet composition by mole
f2.show_solution
f2.energy_enabled = False #disable energy
print '================================'
print 'the energy equation is turned off'
print '================================'
f2.set_max_jac_age(50,50)
f2.set_time_step(5.0e-6,[2,5,10,20,50,80,120,150])
f2.solve(loglevel=loglevel, refine_grid=False)
f2.energy_enabled = True #enable energy
print '================================'
print 'the energy equation is turned on'
print '================================'
f2.set_refine_criteria(ratio = 3.0, slope = 1.0, curve = 0.8, prune = 0.05)
f2.solve(loglevel=loglevel, refine_grid=False)
f2.show_solution
u2=f2.u
Ufs2= u2[0]
f2.show_stats
print 'flamespeed w H2O = ',Ufs2,'m/s'
error
Attempt Newton solution of steady-state problem...
the energy equation is turned off
================================
Traceback (most recent call last):
File "C:\Users\Ja\Desktop\assign.py", line 38, in <module>
f.solve(loglevel=loglevel, refine_grid=False)
File "C:\Python27\Lib\site-packages\cantera\_cantera.pyd", line 662, in cantera._cantera.Sim1D.solve (cantera/_cantera.cpp:43710)
I‹U I‹ÍÿR0A‹Äë A‹ÄL \$`I‹[0I‹s8 (t$P (|$@I‹ãA_A^A]A\_ÃÌÌÌÌÌÌÌÌÌÌÌÌH‰\$ H‰l$ WHƒì H‹A 3ÛH‹ùL‹€ \000\000\000M
Àt H‹
)R\000AÿÐH‹èë,L‹@@M
Àt H‹ )R\000HƒÂ AÿÐH‹èë H‹ ò(R\000ÿ ll=\000H‹èH‰t$0L‰d$8H
íu H‹=óŸO\000A¼ 0\000\000é, \000\000H‹G L‹€ \000\000\000M
Àt H‹ I,R\000H‹ÏAÿÐH‹ðë2L‹@@M
Àt H‹ .,R\000H‹ÏHƒÂ AÿÐH‹ðë H‹ ,R\000H‹Ïÿ ÷k=\000H‹ðH
öu H‹=ˆŸO\000A¼ 0\000\000é
\000\000\000H‹G L‹€ \000\000\000M
Àt H‹ ®#R\000H‹ÏAÿÐH‹Øë2L‹@@M
Àt H‹ “#R\000H‹ÏHƒÂ AÿÐH‹Øë H‹ }#R\000H‹Ïÿ Œk=\000H‹ØH
Ûu H‹=
ŸO\000A¼ 0\000\000ë
¹ \000\000\000ÿ ’h=\000H
ÀueH‹=þžO\000A¼ 0\000\000HƒE\000ÿu
Exception:
***********************************************************************
CanteraError thrown by MultiNewton::step:
Jacobian is singular for domain flame, component V at point 1
(Matrix row 60)
see file bandmatrix.csv
***********************************************************************
'''
for i in range(0,len(phi)):
nCH4= phi[i]/(phi[i] + (0.791/0.209+1)*2) #mole fraction of methane definition
nO2 = (1-nCH4)*0.209 #mole fraction of air then becomes (1-nCH4)
nN2 = (1-nCH4)*0.791 #mole fractions of N O according to 79.1 and 20.9 % by mole in air
nH2O = 0.0 #assuming dry combustion so we neglect moles of water and mass as well
phidry =phi[i] #store the value of the stoichiometric coefficient
#q = 'CH4:'+str(nCH4)+' O2:'+str(nO2)+' N2:'+str(nN2)+''; #composition by moles defined above
#print q
q ='CH4:%f,O2:%f,N2:%f' %(nCH4, nO2, nN2)
print q
gas.TPX = T1, P1, q #set the gas
gas()
mfH2O
'''