Handling Mixtures with Cantera Week 4
1. Use the \"moles\" method/function of the A object and explain how it was calculated.
From the reaction of methane CH`CHunderset(4)() +2(Ounderset(2)()+ 3.76Nunderset(2)())=COunderset(2)() +2Hunderset(2)()O+ 2(3.76Nunderset(2)())`
We defined O2=0.21 and N2=0.71 that equal to 1.
A= mixture of O2 and N2, so A is contain 2 Moles
Knowing that mole fraction=(number of moles of that species)/(Total number of moles)
O2-->mole fraction=`(2/(2+2*3.72))=0.21`
N2-->mole fraction=`((2*3.72)/(2+2*3.72))=0.79`
define A Moles=(number of moles)/(species Mole fraction)
(1) Moles of O2=`(2/0.21)=9.52`
(2) Moles of N2=`((2*3.76)/0.79)=9.52`
As (1) is equal to (2), we can use either.
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())
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 = (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 the right molar balance\"\"\"
M=A+B
M.equilibrate(\'HP\')
print(M.T)
Using A.mass_fraction_dict() gave us the following output:
{\'N2\':0.7670829987741036, \'O2\':0.23291700122589645}
These values are the mass fraction on N2 and O2 respectively
3. What is happenging in lines 15 and 16? Make sure you explain what 1546 means? Is that reasonable?
In the code line 15 gives the values of TPX(Temperature,Pressure,Mole fraction(s) values for gas B), the number 1546 represents the number of moles of the object. This value can be any value mayor than 0, because B.moles=1 indacates that only one mole of B is taken in consideration.
4. What changes do you need to put in place to get the right value of AFT in line 22?.
To get the right value of AFT, we need to set A.moles to 9.52, we calculated this value previously.