Week 4.1- Handling Mixtures with Cantera
Here from the equation of Methane:
`CH_4 + 2(O_2 + 3.76N_2) to CO_2 + 2H_2O + 2(3.76N_2)`
we mentioned that `O_2` = 0.21 and `N_2`= 0.79 which equals to 1.
A contains 2 moles, which is a mixture of `O_2` and `N_2`.
1) Mole fraction = (Number of moles of particular species) / (Total number of moles)
Number of moles of `N_2` = 2*3.76 = 7.52
Number of moles of `O_2` = 2
Total number of moles = 2+2*3.76 = 9.52
Mole fraction of `O_2` = `2/9.52` = 0.21008
Mole fraction of `N_2` = `7.52/9.52` = 0.78991
2) Use the method mole_fraction_dict() of the A object and explain the result that you get. Here is how you need to use it. print(A.mass_fraction_dict())
Code:
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 = (2*3.76)/0.79
print(A.mass_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1546'
B.moles = 1
print(B.mass_fraction_dict())
# The following step is used to apply
M = A+B
M.equilibrate('HP')
print(M.T)
By using a line A.mass fraction dict(), we can the following output:
N2: 0.76708299877410; and O2: 0.232917001225896.
3) What is happening in lines 15 and 16? Make sure you explain what 1546 means? Is that reasonable?
In this code line 15, we are defining the fuel(methane) with the values of TPX(Temperature, Pressure, and Mole-fraction for gas B) values of gas B. The value 1546 represents the number of moles of the object. The value should be greater than 0. And the B.moles is equal to 1.
4) What changes do you need to put in place to get the right value of AFT in line 22?. The right answer is 2224K.
To get the right value of AFT, we need to set the A.moles to 9.52 as shown in the above calculation.