"This is a chemical equilibrium combustion solver"

"Test Version -- has some convergence problems. You can get this rolling
 by setting EES variable limits on the y's 0 lower and 1 upper.  Set the
 initial guesses to say 0.5 for major stuff like CO2 H2O and N2 and 0.01
 for the rest of the stuff "

"Put in temperature and pressure"

T = 2500
P = 3000/101.3

"Fuel composition"

alpha = 7
beta = 17
gam = 0
del = 0
mfuel =alpha*12. + beta*1.009 + gam*16 + del*14

"Put in fuel air equivalence"

phi = 0.6
as = alpha + beta/4
mair = as/phi*(32 + 3.76*28)
rat = (mair+mfuel)/mair


"See pages 72-73 in Ferguson and Kirkpatrick.  Borman and Olikara coefficients"

A1 =   0.432168E0
A2 =  0.310805E0
A3 =-0.141784E0
A4 = 0.150879E-01
A5 =-0.752364E0
A6 =-0.415302E-02

B1 = -0.112464E05
B2 = -0.129540E05
B3 = -0.213308E04
B4 =-0.470959E04
B5 =0.124210E05
B6 = 0.148627E05

C1 = 0.267269E01
C2 = 0.321779E01
C3 = 0.853461E0
C4 =0.646096E0
C5 =-0.260286E01
C6=-0.475746E01

D1 = -0.745744E-04
D2 = -0.738336E-04
D3 =  0.355015E-04
D4 = 0.272805E-05
D5 = 0.259556E-03
D6 = 0.124699E-03

E1 =0.242484E-08
E2 =0.344645E-08
E3 =-0.310227E-08
E4 = -0.154444E-08
E5 = -0.162687E-07
E6 = -0.900227E-08

"Calculation of Equilibrium Constants, Ki"

K1=10^(A1*ln(T/1000)+B1/T+C1+D1*T+E1*T^2)
K2=10^(A2*ln(T/1000)+B2/T+C2+D2*T+E2*T^2)
K3=10^(A3*ln(T/1000)+B3/T+C3+D3*T+E3*T^2)
K4=10^(A4*ln(T/1000)+B4/T+C4+D4*T+E4*T^2)
K5=10^(A5*ln(T/1000)+B5/T+C5+D5*T+E5*T^2)
K6=10^(A6*ln(T/1000)+B6/T+C6+D6*T+E6*T^2)

"Mass Balance Equations"

alpha = (y1+y5)*N
beta = (2*y2+2*y6+y7+y9)*N
gam + 2*as/phi = (2*y1+y2+2*y4+y5+y8+y9+y10)*N
del + 3.76*2*as/phi = (2*y3+y10)*N

y1+y2+y3+y4+y5+y6+y7+y8+y9+y10=1

"Finally relate the equil. constants to the molar fractions"

K1 =( y7 * sqrt(P))/sqrt(y6)
K2 =(y8 * sqrt(P))/sqrt(y4)
K3 = y9/( sqrt(y4) * sqrt(y6))
K4 = y10/(sqrt(y4)*sqrt(y3))
K5 = y2/(sqrt(y4) * y6 * sqrt(P))
K6 = y1/(y5*sqrt(y4)*sqrt(P))