Week 4.1- Handling Mixtures with Cantera
Introduction:
The following report describes the learning outcome for use of Cantera to perform simple combustion simulations.
The topic addressed in this report is to use the class 'Quantity' for describing the reactants and their flexibility to vary Oxidiser and fuel quantities individually, for a reacting mixture.
Code :
"""
Program to vary the temperature of air and fuel individually
"""
import cantera as ct
gas = ct.Solution('gri30.xml')
A = ct.Quantity(gas)
A.TPX = 298.15, ct.one_atm, {'O2':0.21, 'N2':0.79}
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1546'
B.moles = 1
A.moles = 9.52
# To apply right molar balance
M = A+B
M.equilibrate('HP')
print(M.T)
print(A.mass_fraction_dict())
print(B.mass_fraction_dict())
Coding logic :
Line#9: describes TPX (Temperature, pressure, volume fraction.) of gas object A. (initially considers as one mole, of the mixture by default)
Line#14: describes TPX (Temperature, pressure, mole fraction.) of gas object B.
Line#15: changes object B's molar quantity (B.moles = 1, describing one mole of CH4)
Line#16: changes object B's molar quantity (A.moles = 9.52, describing 9.52 moles O2-N2 mixture (air))
Answers & explanation :
Questions 1,2& 4:
Stoichiometric combustion of methane requires one part of CH4 to two parts of air by quantity. This implies,
for one part of CH4 (one mole) requires, two parts of air: -->1 mole of O2+ 3.76 moles of N2 = 2*(4.76) = 9.52 moles of oxidizer mixture.
print(A.mass_fraction_dict()) - provides mass fraction dictionary of 'A'. It can be noticed that the mass fraction of A will be 0.767 -N2 and 0.232 O2, whereas input provided in the code was in volume fraction (0.21 O2 and 0.79 N2)
The maximum AFT is achieved at stoichiometric conditions, hence 9.52 moles of 'A' object will provide almost 2224 K AFT for one mole of CH4.
Question 3:
By trial and error, it was noticed that Line#14- 'CH4:1546' does not make an impact in the output as long as the value is non-zero. It implies, that as long as the mole fraction is defined as non zero, and the quantity is described as B.moles (line#15), the most recent value of the attribute will be used for calculation.
Result :
2224.4118993147486
{'N2': 0.7670907820415769, 'O2': 0.2329092179584231}
{'CH4': 1.0}
[Finished in 1.3s]