Week 4.1- Handling Mixtures with Cantera
AIM:
To write a python code to vary the temperature of air and oxidizer individually.
1.Use the "moles" method/function of the A object and explain how it was calculated.
- The object A is air.
- The fuel air reaction considered is given below
CH4 + 2*(O2 +3.76N2) = CO2 + 2H20 + 7.52N2
- The mole fraction of air contains mole of oxygen and mole of nitrogen.
- One mole of air contains 0.21 moles of O2 and 0.79 moles of N2.
- The no of moles of O2 = 2/0.21 = 9.52.
- The no of moles of N2 = 7.52/0.79 = 9.52
- Hence for methane at stoichiometric condition 9.52 moles of air takes part in the combustion.
CODE:
"""
sample code to vary temperature of air and oxidiser 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/A.mole_fraction_dict()['O2']
print('Mass fraction in air =',A.mass_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1546'
B.moles = 1
print('Mass fraction of fuel =',B.mass_fraction_dict())
#the following step is used to apply the right molar balance
M = A + B
M.equilibrate('HP')
print(M.T)
RESULT:

2.Use the method mole_fraction_dict() of the A object and explain the result that you get.
To calculate mass fraction the no of moles of compound is multiplied with molecular weight
- For O2, no of moles is 2 and mass in grams = 2*32 = 64gms
- For N2, no of moles is 7.52 and mass in grams = 7.52*28 = 210.56gms
- Mole fraction of O2 = 64/(64 + 210.56) = 0.23
- Mole fraction of N2 = 210.56 / (64 + 210.56) = 0.77
- What is happening in lines 15 and 16? Make sure you explain what 1546 means? Is that reasonable?
- In line number 15 the temperature, pressure and no of moles are defined for methane.
- As only one gas is defined the no of moles and mole fraction is 1. Therefore defining 1546 has no of moles doesn’t have any effect as it takes the value as 1.
- What changes do you need to put in place to get the right value of AFT in line 22 ?
As we know the mass fraction values we need to defined the no of moles of gas object A for O2 and N2 by using the 2/A.mole_fraction_dict().