"LEAN MIXTURE Composition Calculations - Unburned Mixture and low Temperature Burned Mixture"

"Reference:  Heywood.  Section 4.2"

"Hydrocarbon fuels -- Start with Data on Fuel"

alpha = 8
beta = 18
M_f = MOLARMASS(C8H18)
y = beta/alpha										"H/C ratio for the fuel"
epsilon = 4/(4+y)

"Fuel air equivalence ratio - also air composition"

phi = 0.8
psi = 3.773

"Fraction of burned gas in the mixture"

x_b = 0.15


"Molar balance equations - per mole of O2"

epsilon*phi = n_CO2b 

2*(1-epsilon)*phi = n_H2Ob

1 = n_CO2b  + 1/2 * n_H2Ob + n_O2b

psi = n_N2b


"At this point the exhaust gas composition is calculated."

n_b = n_CO2b + n_N2b + n_H2Ob + n_O2b

"This is test code to check vs. the text.  See table 4.3"
{
n_bt = (1-epsilon)*phi+1+psi
n_CO2t = epsilon*phi
n_O2t= 1-phi
n_H2Ot = 2*(1-epsilon)*phi
}
"Molar Ratios - Per Mole Air - Product - Put in to Compare with CSU Applet"

moles_air = 1 + psi
yr_O2 = n_O2b / moles_air
yr_N2 = n_N2b / moles_air
yr_CO2 = n_CO2b / moles_air
yr_H2O = n_H2Ob/ moles_air

"Mass ratios - Per Kg Air - Product - Put in to Compare with CSU Applet"

mass_air = moles_air * MOLARMASS(Air)
xr_O2 = n_O2b * MOLARMASS(O2) / mass_air
xr_N2 = n_N2b * MOLARMASS(N2) / mass_air
xr_CO2 = n_CO2b * MOLARMASS(CO2) / mass_air
xr_H2O = n_H2Ob * MOLARMASS(H2O) / mass_air

"The number of moles of mixture is now calculated"

n_fuel = (12*epsilon*phi+2*(1-epsilon)*phi*MOLARMASS(H2))/M_f

{n_fuelt = (4/M_f )*(1+2*epsilon)*phi}					"Another Text Comparison"

n_mix = n_fuel + 1 + psi

"Finally the numberof moles of unburned gas is calculated"

n_u = (1-x_b)*n_mix + x_b*n_b

n_f = (1-x_b)*n_fuel
n_O2 = (1-x_b) + x_b*n_O2b
n_CO2 =  x_b*n_CO2b
n_H2O =  x_b*n_H2Ob
n_N2 = psi

	"More comparison - Table 4.4"

{													
n_f1 = 4*(1-x_b)*(1+2*epsilon)*phi/M_f
n_O21 = 1-x_b*phi
n_N21= psi
n_CO21 = x_b*epsilon*phi
n_H2O1 = x_b*2*(1-epsilon)*phi
}

"Molar Fractions based on moles mixture"

y_f = n_f /n_u
y_O2 = n_O2 / n_u
y_N2 = n_N2 / n_u
y_CO2 = n_CO2 / n_u
y_H2O = n_H2O / n_u


"Mass fractions"

mass = n_f * MOLARMASS(C8H18) + MOLARMASS(O2)+psi*MOLARMASS(N2)

x_f = y_f * MOLARMASS(C8H18) / mass
x_O2 = y_O2 * MOLARMASS(O2) / mass
x_N2 = y_N2 * MOLARMASS(N2) / mass
x_CO2 = y_CO2 * MOLARMASS(CO2) / mass
x_H2O = y_H2O * MOLARMASS(H2O) / mass