Week 4 - Handling Mixtures with Cantera
1. No. of moles of A:
In the given code, mole fractions of oxygen and nitrogen in A are 0.21 and 0.79 respectively.
Cantera considers as 0.21 moles of oxygen and 0.79 moles of nitrogen in one gram of A.
no. of moles of A =mass of A/molecular weight of A
mass of A = 1gm
molecular weight of A = (0.21*molecular weight of oxygen) + (0.79*molecular weight of nitrogen)
= (0.21*32) + (0.79*28)
= 28.84
therefore, no. of moles of A = 1/28.84 = 0.03467


2. Mass fraction of A:
1 mole of oxygen weighs 32 gms.
1 mole of nitrogen weighs 28 gms.
In the given code, there is 0.21 moles of oxygen and 0.79 moles of nitrogen.
So, 0.21 moles of oxygen weighs 0.21*32 = 6.72 gms.
and 0.79 moles of nitrogen weighs 0.79*28 = 22.12 gms.
total mass of 1 mole of oxygen and nitrogen is 28.84 gms.
mass fraction = mass of compound/total mass of mixture
mass fraction of oxygen = 6.72/28.84 = 0.233009
mass fraction of nitrogen = 22.12/28.84 = 0.76699


3. Object B is defined as methane gas and its mole fraction is given as '1546'.
As there is only one species in B, cantera takes the mole fraction as 1 irrespective of whatever number is provided in mole fraction dictionary.
Also, cantera takes as 1 gram of methane. In line 16, if the number of moles are not mentioned, cantera assumes the no. of moles as 'no. of moles present in one gram of methane'.
If no. of moles are not provided, cantera takes as
no. of moles in gram of methane = 1/16 = 0.0625.
The above value is different from what is mentioned in line 16 which is 1 mole of methane.
4. Calculating Adiabatic Flame Temperature:
In the given code, mole fractions of oxygen and nitrogen in A are 0.21 and 0.79 respectively.
The no. of moles of B (methane) mentioned is 1.
Stiochiometric combustion of methane:
CH4 + 2O2 + 7.52N2 ---> CO2 + 2H20 + 7.52N2
So, for onle mole of methane, 2 moles of oxygen and 7.52 moles of nitrogen are required for complete combustion.
So, in order to get 2 moles of oxygen and 7.52 moles of nitrogen, no. of moles of air should be 9.52. (2/0.21 = 7.52/0.79 = 9.52)
using moles function, no. of moles of air is given as
air.moles = 9.52
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 = 9.52
print(A.mass_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1546'
B.moles = 1
M = A+B
M.equilibrate('HP')
print(M.T)
The value of AFT is 2224.411 K
