Week 4.1- Handling Mixtures with Cantera
HANDLING THE MIXTURE WITH CANTERA
In this project, the program is modified and required steps were given in the program itself in form of comments.
# handlig mixtures with cantera
import cantera as ct
gas=ct.Solution('gri30.yaml')
#A=ct.Quantity(gas) # we can use general notation for understanding the programme simply
Air=ct.Quantity(gas)
Air.TPX=298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
"""here we have provided mole fraction of O2 and N2, but our oxidiser is air and
for the solution purposr we have to provide the moles of air
so here is the way to calculate the moles of air
xO2=nO2/(nO2+nN2)
0.21=2/n_air # here we assume the stoichiometric combustion of methane so nO2=2
n_air=9.52
"""
Air.moles=9.52
print(Air.mass_fraction_dict()) # this will give the mass fraction of N2 and O2 at 298.15 K and one atm pressure
#B=ct.Quantity(gas)
Methane=ct.Quantity(gas)
Methane.TPX=298.15,ct.one_atm,'CH4:1546' #here we have one species and x is takes input in mole fraction so it does not make sense
Methane.moles=1 # defining the moles of ch4
# the following step is used to apply right molar balance
M=Air+Methane
M.equilibrate('HP')
print(M.T)
output screen view
