Week 4 - Handling Mixtures with Cantera
Aim : We will be using the Quantity Class of Cantera to create various mixtures and explaining how mixture calculations is performed.
1. Use the "moles" method/function of the A object and explain how it was calculated.
In this process we will be considering a mixture of Methane and Air.
CH4+2(O2+3.76N2)→CO2+2H2O+7.52N2">CH4+2(O2+3.76N2)→CO2+2H2O+7.52N2CH4+2(O2+3.76N2)→CO2+2H2O+7.52N2
In the above equation the mole value for oxygen and nitogen are:
- O2 = 0.21
- N2 = 0.79
The summation of both quantities of the moles is equal to 1. An object A is created which is a mixture of O2 and N2. Hence the number of moles in the object A is 2.
Aspecies=(NspeciesNT)">Aspecies=(NspeciesNT)Aspecies=(NspeciesNT)
where
Aspecies">AspeciesAspecies = Mole Fraction of species in object A.
Nspecies">NspeciesNspecies = Number of moles of species of interest.
NT">NTNT = Total number of species in object A (mixture).
Calculation of Mole Fractions:
AO2=22+2⋅3.76=0.21">AO2=22+2⋅3.76=0.21AO2=22+2⋅3.76=0.21
AN2=2⋅3.762+2⋅3.76=0.79">AN2=2⋅3.762+2⋅3.76=0.79AN2=2⋅3.762+2⋅3.76=0.79
Calculation of Moles:
Moles = Total Number of moles / Mole fraction of species
Moles of O2 = 20.21=9.52">20.21=9.5220.21=9.52
Moles of N2 = 2⋅3.760.79=9.52">2⋅3.760.79=9.52
2. Use the method mole_fraction_dict() of the A object and explain the result that you get.
code--->
"""
Sample code to vary the temperature of air and oxidizer individually
"""
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/0.21
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)
We already know the mole fractions of the given oxidizers with which we estimated the total number of moles. Making use of the print(A.mass_fraction_dict()) we get the following output shown below where we compute the values of the mass fractions in oxidizer:
Output:
{'N2': 0.7670829987741036, 'O2': 0.23291700122589645}
{'CH4': 1.0}
2224.224370856459
[Finished in 0.8s]
3. What is happenging in lines 15 and 16? Make sure you explain what 1546 means? Is that reasonable?
The fuel is at standard conditions of temperature and pressure. The mole fraction of Methane(CH4) fuel is provided as 1546. We are only interested in the total number of moles in the fluid object B which is already provided i.e. B.moles = 1.
4. What changes do you need to put in place to get the right value of AFT in line 22?.
The total number of moles of object A needs to be defined. i.e. mole content in the oxidizer. We calculated this value based on the mole fraction which was provided in our code A.moles = 2/0.21. The values are found in the code above.