Challenge

Week 4.1- Handling Mixtures with Cantera

Quantity Class in Cantera for Mixing the Species

Question 1: - Use the "Moles" method/function of the A object and explain how it was calculated. Need to use this after line number 9.

Answer: - The mole is unit of measurement of large quantity of small entities such as atoms and molecules. As in line number 9 the object moles defines the number of moles present A. The number of moles of A can be calculated as:

`x_(O2) = (n_(O2)/((n_(O2) + n_(N2)))) = (n_(O_2))/(n_(air))`

We know that air contain 21% of oxygen and 79% of nitrogen at standard presseure and temperature conditions. So if we are considering a chemical reaction air + methane combustion which is given as below:

`CH_4 + 2(O_2 + 3.76N_2) --> CO_2 + 2H_2O+ 7.52N_2`

To calculate the number of moles of air from the chemical reaction for correct stoichiometric combustion of methane and air is given as:

`0.21 = 2/(n_(air)`

`n_(air) = 9.52`

Question 2: - Use the method mole_fraction_dict() of the A object and explain the result that you get?

Answer: - The mole_fraction_dict() calculates the mole fraction(mass fraction) of species in the chemical reaction. The calculation of mole fraction is done using multiplication of number of moles of the compound with the molecular weight of species.

Species

Mole Fraction

Number of Moles

Mass of Species

Mass Fraction

O2

0.21

0.21*9.52 = 2

2*32 = 64

64/274.56 = 0.233

N2

0.79

0.79*9.52 = 7.52

7.52*28 = 210.56

210.56/274.76 = 0.7668

The mass fraction calculated arithematically need to comapre with python code in which cantera is used to calculate the mass fraction of species.

From the above image it is seen that, the calculated mass fraction is correct with arithematic calculations.

Question 3: - What is happening in line 15 and 16? Make sure you explain what 1546 is meant?

Answer: - The line number 15 defines the fuel properties at standard pressure and temperature which are used in combustion. The line number 16 defines the number of mole of fuel taking part in the combustion process. As there is only methane in the combustion there is only one mole required for complete combustion process. The number 1546 is just an arbitary in nature. It is necessary to define the number which should be non-zero in nature so that there should not be any error in cantera.

Question 4: - What changes do you need to put in place to get the right value of AFT in line 22?

Answer: - To find the Adiabatic temperature it is necessary to have number of moles of fuel and oxidizer at the standard operating conditions. In the program for line number 22 it is required to define the number of moles for oxidizer which 9.52.

Program for Calculation AFT (Redefined for Reading)

"""
Code to demonstrate the mixing of Air & Fuel in Cantera Using Quantity Class
Written by: Shubham Chaudhari
"""

import cantera as ct

# Consideration of Temperature of Air
T_air = 298.15

# Consideration of Initial Pressure for Air
P_air = 101325

# Similarly, Temperature & Pressure of Fuel
T_fuel = 298.15
P_fuel = 101325

# Taking gas object from Cantera for solution
gas = ct.Solution('gri30.cti')

# Use of Quantity class from Cantera for Defining properties
air = ct.Quantity(gas)
air.TPX = T_air,P_air,{'O2':0.21,'N2':0.79}

# Air moles calculated from mole balance
air.moles = 9.52

# Defining Fuel properties
fuel = ct.Quantity(gas)
fuel.TPX = T_fuel,P_fuel,'CH4:1546'
fuel.moles = 1

# Mixture of Two Quantities
mix = air+fuel
print('Mole Fraction of Species in Oxidizer is \n',air.mole_fraction_dict())
print('------------------------------------------------------------------------------')
print('Mass Fraction of Species in Oxidizer is \n',air.mass_fraction_dict())
print('------------------------------------------------------------------------------')
mix.equilibrate('HP','auto')
print('AFT for Constant pressure combustion process',mix.T)
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.