Challenge

Week 4.1- Handling Mixtures with Cantera

AIM: To work with the Quantity class of Cantera to create various mixtures and also to explain how the mixture calculations are

performed.

As we know stoichiometry combustion reaction between methane and air is given by:

`CH4+2*(O2+3.76N2)=CO2+2H2O+7.52N2`

1. Number of moles of air=2*(number of moles of oxygen+number of moles of nitrogen)

=2*(1+3.76)=2*4.76=9.52

2. Mole fraction of O2=2/9.52=0.21

3. Mole fraction of N2=7.52/9.52=0.79

4.Mass of O2/mole=2*32=64gm/mol

5.Mass of N2/mole=7.52*28=210.56gm/mol

import cantera as ct
gas=ct.Solution('gri30.cti')

# for air
A=ct.Quantity(gas)
A.TPX=298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
A.moles=9.52
print('Mole Fraction in air=',A.mole_fraction_dict())
print('Mass_fraction in air=',A.mass_fraction_dict())

# for fuel
B=ct.Quantity(gas)
B.TPX=298.15,ct.one_atm,{'CH4':1546}
B.moles=1
print('Mole Fraction of fuel',B.mass_fraction_dict())

#The following step is used to apply the right molar balance 
M=A+B

#calculate adiabatic flame temperature( constant emthapy,constant pressure,)
M.equilibrate('HP')
print(M.T)
  • In this program we have defined object as air and fuel and class Quantity is used to define mixture.
  • A class is used in object-oriented programming to describe one or more objects or 'blueprint' for creating objects.

Output

Mole Fraction in air= {'N2': 0.79, 'O2': 0.20999999999999996}
Mass_fraction in air= {'N2': 0.7670907820415769, 'O2': 0.2329092179584231}
Mole Fraction of fuel {'CH4': 1.0}
2224.4118993147486
[Finished in 2.4s]
  • In line 15 and 16 it is defined for object B as temperature ,pressure and mole fraction is 298k,101325pa and 1546.
  • A.mass_fraction_dict() is used in cantera to get the molar composition of species.
  • We need to assign the number of moles for air as 9.52 in above program to get right value of AFT.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.