Challenge

Week 4.1- Handling Mixtures with Cantera

stoichiometric Equation for Methane combustion is-

#Methane
CH4 + 2(O2 + 3.76N2) = CO2 + 2H2O + 7.5N2

Question 1. Use the "moles" method/function, calculate the number of moles of object A and explain how it is calculated analytically.

The formula for calculating mole fraction is

`X_(O2) = m_(O2)/(m_(O2)+m_(N2))`

Moles of O2 = 2

Moles of N2 = 7.52

Molar mass of O2 = 0.21

Molar mass of N2 = 0.79

Question 2. Use the method mass_fraction_dict() of the A object and explain it analytically

A.mass_fraction_dict() gives the mass fraction of Constituents of A.

Analytically it is calculated as:

Mass fraction of O2 & N2:

Moles of O2 = 2

Molar mass of O2 = 32

Mass of O2 = 32*2 = 64

Moles of N2 = 7.54

Molar mass of N2 = 28

Mass of N2 = 7.54*28 = 211.12

Mass fraction of O2 = 0.2326

Mass fraction of N2 = 0.7673

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

Line 15 explains the necessary inputs made to run the analysis by taking methane as one of the constituent. B.TPX describes the inlet conditions of B viz temperature, Pressure and Mole fraction. And on the right hand side it is clearly mentioned that temperature is 298.15K and taking pressure as 1 atm. Further CH4:1546 just denotes the mole fraction and 1546 has no value as here only 1 constituent is there so automatically it is taken as 1 in spite of filling any value.

In line 16 number of moles of B is specified as 1.

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

In order to get a accurate value the total number of moles of A is required to be input which can be done as:

A.moles=9.52

It is also understood by the stoichiometric equation. The final code becomes

import cantera as ct

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

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

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

M=A+B
M.equilibrate('HP')
print(M.T)

The calculated AFT now becomes:

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.