Week 4.1- Handling Mixtures with Cantera
Answer:
1. Calculate the number of moles using Moles method:
Simple way to calculate the number of moles of the species is just consider the balanced stoichiometric combustion reaction.
Here, I consider the methane combustion stoichiometric reaction
CH4 + 2(O2 + 3.76N2) → CO2 + 2H2O + 7.52N2
Then, look for the number in front of the species which is the number of moles of the species. If any number is not present in front of the species, then consider it as 1.
In my considered reaction, CH4 has 1 mole at reactant side & CO2 has 1 mole at product side. Then, species O2 has 2 moles & N2 has 7.52 moles at both reactant and product side. The mixture of these two is the species air. So, the number of moles of air in this reaction is 9.52.
Another way to calculate the number of moles of the species is
Mole fraction of either O2 or N2 (X) = (Number of moles of either O2 or N2) / (Number of moles of air (O2 + N2))
Nair = NO2/N2 / XO2/N2 = (2 or 7.52)/(0.21 or 0.79) = 9.52
2. Mass fraction/Mole fraction calculation method using dictionary:
If we print the following (print(B.mole_fraction_dict()/B.mass_fraction_dict()), it calculates the mass/mole fraction for the species which we provided initially.
Analytical calculation for the species O2:
Mole fraction (X) = (2/9.52) = 0.21
Number of moles (N) = 0.21 * 9.52 = 2
Mass (in grams) = N * weight of the species = 2 * 32 = 64
Mass fraction (Y) = Mass of O2 / Mass of air = 64/(64+(7.52*28)) = 64/274.56 = 0.2331
Analytical calculation for the species N2:
Mole fraction (X) = (7.52/9.52) = 0.79
Number of moles (N) = 0.79 * 9.52 = 7.52
Mass (in grams) = N * weight of the species = 7.52 * 28 = 210.56
Mass fraction (Y) = Mass of N2 / Mass of air = 210.56/(64+(7.52*28)) = 210.56/274.56 = 0.7668 = 0.767
3. Line 15: In this line, we just assigning the initial condition of the methane (CH4- Fuel) as per the inbuilt function TPX which is Temperature (K), Pressure (pascal), Mole fraction (X). Then, ct.one_atm is the pressure value in pascal which is imported from the cantera file n
"""
Code to vary the temperature of air and oxidizer individually
"""
import cantera as ct
gas = ct.Solution('gri30.cti')
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
B.moles = 9.52
print('Mass fraction of B is', B.mass_fraction_dict())
print('Mole fraction of B is', B.mole_fraction_dict())
C = ct.Quantity(gas)
C.TPX = 298.15,ct.one_atm,'CH4:1546'
C.moles = 1
# Step to apply right molar balance
M = B+C # Mixing fuel and air at constant pressure
M.equilibrate('HP')
print(M.T)
.
Here, ‘CH4:1546’ doesn’t means anything. It’s just an arbitrary number which is nothing but not to choose specific values.
Line 16: Just feeding the number of moles of the fuel.
4. Calculation to get right AFT value:
To get the right AFT value, need to add the right number of moles of air in line 10 by calculate it in predefined function ‘B.moles’.
Code:
"""
Code to vary the temperature of air and oxidizer individually
"""
import cantera as ct
gas = ct.Solution('gri30.cti')
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
B.moles = 9.52
print('Mass fraction of B is', B.mass_fraction_dict())
print('Mole fraction of B is', B.mole_fraction_dict())
C = ct.Quantity(gas)
C.TPX = 298.15,ct.one_atm,'CH4:1546'
C.moles = 1
# Step to apply right molar balance
M = B+C # Mixing fuel and air at constant pressure
M.equilibrate('HP')
print(M.T)