Week 4 - Handling Mixtures with Cantera
Aim
To mesure the Adiabatic Flame Temperature of Air and Methane mixture using the Quantity class in Cantera.
Solutions
1. The moles are calculated for air in the major consituents are Nitogen and oxygen. The compostion of air in terms mole fractions are 0.79 of Nitrogen and 0.21 in Oxygen. That is why when print(A.mole_fraction_dict()) command is used, the mole fraction is printed.
2. The print(A.mass_fraction_dict()) gives the mass fraction of Nitogen and Oxygen in the A object. Where the mass fraction is completely diffrent from the mole fraction. when the command is executed it goes the dictionary of the cantera to look at the mass fraction of the paricular species and displays since it defined at the A.
3. In line 15 the object B is set to TPX meaning to Temperature, Pressure and Mole fraction of the species that is in the command line in the single quotes here it is CH4 methane.
The line 16 means the mole fraction of the methane which is set to 1 since it is singular compound the value 1546 has no meaning but moles has to given a values more than the value 0. Therefore the value 1546 is given even if we alter the value for the CH4 species the solution might not change.
4.The value for the AFT is given as 2224 K. We know the reactants species.Now we need to write the chemical reaction in stiochiometric conditions
CH4 + 2(O2 + 3.76N2) -> CO2 + 2H2O+ 7.56N2
No of moles of oxygen = 2
No of moles of Nitrogen = 2*3.76 = 7.56
No of moles for air = 2+7.56 = 9.56 (A.moles)
No of moles for Methane = 1
"""
Week 4 Challenge
"""
import cantera as ct
gas = ct.Solution('gri30.cti')
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())
print(A.mole_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1546'
B.moles = 1
print(B.mass_fraction_dict())
print(B.mole_fraction_dict())
#The following step is used to apply the right molar balance
M=A+B
M.equilibrate('HP')
print(M.T)