Week 4.1- Handling Mixtures with Cantera
Program to make Stochiometric Mixture Of Air-Fuel Mixture and Calculate its AFT
"""
Program to make an stochiometric Mixture of fuel and gases
"""
import cantera as ct
gas= ct.Solution('gri30.xml')
A = ct.Quantity(gas)
A.TPX = 298.15,ct.one_atm,{'O2': 0.21, 'N2': 0.79}
A.moles = 9.52
print(A.mass_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1546'
B.moles = 1
# to mix and form Air_fuel mixture and calculate it AFT
M = A + B
M.equilibrate('HP')
print(M.T)
1. stoichiometric mixture: CH4 + 2(O2+3.76N2) --> CO2 + 2H2O + 7.52N2
It is of the Form: A + B -----> M
--> 1 mole of CH4 reacts with 2 mole of O2 and 2*3.76 Mole Of N2
--> 1 mole of CH4 reacts (2+2*3.76 = ) 9.52 moles of Air
Hence A.moles = 9.52
2. Result of Mass Fraction of A: 
Mole = "O2": 2 & "N2": 7.52
mole fraction= "O2": 0.21 & "N2": 0.79
M.wt = "O2": 16 g/mol & "N2": 14 g/mol
Mass = "O2": 2*0.21*16 g & "N2": 7.52*0.79*14 g
Mass Fraction = "O2": 0.233 & "N2": 0.767
3. In line 15: Temperature, Pressure And Mole Fraction are set for the gas B
As mole fraction can have maximum limit to 1 which means single species hence more than 1 does not signifies any change and takes it as unity mole fraction,
In ine 16: we input the Number of Moles of B which is 1.
4. Only one change is sufficient to get the result ie TO Input the Number o Moles of A (Air ) which is 9.52
Result: