Handling Mixtures with Cantera
Objectives:
- To find the total number of moles of object A, which takes the inputs temperature (K), pressure (Pa) and a dictionary of reactant species, with their mole fractions
- To find the mole fraction and mass fraction of A using the function mass_fraction_dict()
- To explain the mole fraction input given to the object B
- To get the right Adiabatic Flame Temperature value, which is 2224 K
Theory:
Mole fraction is the ratio of number of moles of a component to the number of moles of all the components in the mixture (including the number of moles of component of intrest). It is used to specify the presence of a component in a mixture with respect to all the components in a mixture, quantitatively.
Similarly, mass fraction is the ratio of mass of a component to the total mass of the components in the mixture (including the mass of component of mixture).
Mole fraction, `X = N_(comp.)/N_(Total)` and mass fraction, `Y = m_(comp.)/m_(Total)`
Mass of a component = Number of moles * Molecular weight of the component
(where number of moles equals number of Avagadro numbers, `6.032 * 10^(23)`. When such number of moles or Avagadro numbers are multiplied with the weight of the molecule, we get mass)
Introduction:
In this the total number of moles of A can be calculated from the mole fraction values given and the stoichiometric reaction equation. The stochiometric equation is,
`CH_4 + 2(O_2 + 3.76N_2) rightarrow CO_2 + 2H_2O + 7.52N_2` + energy
The products side of the above reaction equation can be neglected, as there would be many components considered in Cantera. The area of intrest in this case if of reactants side.
Code:
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 = (7.52/0.79)
print(A.mole_fraction_dict())
print(A.mass_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,{'CH4':1546}
B.moles = 1
print(B.mole_fraction_dict())
print(B.mass_fraction_dict())
M = A+B
M.equilibrate('HP')
print(M.T)
In the above code, the mole fractions of oxygen and nitrogen would be 0.21 and 0.79 respecitvely.
Now, in case of above stoichiometric reaction equation, total number of moles of air is 2 + 7.52 = 9.52. Mole fraction of oxygen then would be, 2/9.52 and similarly mole fraction of nitrogen would be 7.52/9.52.
1. In the code, total number of moles are to be given as input in object A, using the command A.moles. Total number of moles would be, (it can be calculated using oxygen and nitrogen)
Mol. fraction = Nuo. of oles of component/Total no. of moles
Therefore, total number of moles = 7.52/0.79
2. Now, mass of oxygen = No. of moles of `O_2` * Molecular weight of `O_2`
Mass of oxygen = 2*32 = 64 grams and similarly mass of nitrogen = 7.52 * 28 = 210.56
Total mass = 274.56
`Y_(O_2) = 64/274.56 = 0.23331` and `Y_(N_2) = 210.56/274.56 = 0.766899` (These are approximate results as atomic weights are rounded off to one decimal places, actual atomic weights may differ)
This is what is calculated using the command "A.mass_fraction_dict()"
3. In the code, in the object B, there is only one component present i.e CH4. And the mole fraction value is 1546. As there is only one component, total number of moles would also be 1546. Because of which, when we print the mole fraction of it using "B.mole_fraction_dict()" command, as both number of moles of component and total number of moles are same, the result shown would be one. For any value of CH4.
As, in the stoichiometric mixture, the total number of moles of fuel is 1, it is given by using the command B.moles = 1
4. When the stochiometric molar balance is achieved, the right value of Adiabatic Flame Temperature can be achieved. In the code, the total number of moles of air is altered to achieve molar balance
Results:
When the above code is executed, the printed results are,
{'N2': 0.79, 'O2': 0.21} (Mole fraction of N2 and O2)
{'N2': 0.7670829987741036, 'O2': 0.23291700122589645} (Mass fraction of N2 and O2)
{'CH4': 1.0} (Mole fraction of CH4)
{'CH4': 1.0} (Mass fraction of CH4)
2224.461438930544 (Adiabatic Flame Temperature)
Conclusions:
- The total number of moles in object A is 9.5189
- Mass fraction of A, mass fraction of O2 is ~0.2329 and N2 is ~0.76708
- As only one components is there in the dictionary file input, the mole fraction would be one and 1546 has no effect
- To get the given AFT value, total number of moles in A had to be given