Challenge

Week 4.1- Handling Mixtures with Cantera

Objective:- 

To calculate adiabetic flame temperature of the gas mixture using the quantity of class.

Python code for calculation mass and mole fraction of air:-

"""
Python code for calculation mass and mole fraction of air
"""
import cantera as ct 

gas = ct.Solution('gri30.xml')

air = ct.Quantity(gas)
air.TPX = 298.15,ct.one_atm,{'O2':0.21, 'N2':0.79}

print('No of moles of air = ',air.moles)
print('Mole fraction of air = ',air.mole_fraction_dict())
print('Mass fraction of air = ',air.mass_fraction_dict())

The output of the above program:-

Reaction for methane,

CH4 + 2( O2 + 3.76N2) = Co2 + 2H2o + 7.5N2

If we consider one mole of oxygen, we can say that

Mass of one mole of diatomic oxygen O2 = 32grams

Mass of one mole of diatomic nitrogen N2 = 28grams

The mass of air can be defined as the 

mass of air = 0.21*32 + 0.79*28 =28.84

Mass fraction of oxygen = 0.21*32/28.84 =0.23

Mass fraction of nitrogen  = 0.79*28/28.84 = 0.77

Moles of O2 = 2/0.21 = 9.52

Moles of N2 = 2*3.76/0.79 = 9.52

Python code:-

"""
Handling Mixtures with Cantera

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

air = ct.Quantity(gas)
air.TPX = 298.15,ct.one_atm,{'O2':0.21, 'N2':0.79}
air.moles = 9.52
print(air.mole_fraction_dict())

fuel = ct.Quantity(gas)
fuel.TPX = 298.15,ct.one_atm,'CH4:1546'
fuel.moles = 1
print(fuel.mole_fraction_dict())

M = air + fuel
air.constant = 'HP'
fuel.constant = 'HP'
M.equilibrate('HP')
print(M.T)

Program Output:-

What is happening in lines 15 and 16? Make sure you explain what 1546 means? Is that reasonable?

In line number 15, We are setting the temperature (298.15k), Pressure(1 atm), and mole fraction of C H(1546) of object B which belongs to the gas object created. 1546 indicates the mole fraction of ch4. Since the moles of the B object is already specified there is no need to calculate it.  

What changes do you need to put in place to get the right value of AFT in line 22?. The right answer is 2224K. 

To get an accurate value of AFT, We need to set air.moles to 9.52, we calculated this value previously.

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.