Challenge

Week 4.1- Handling Mixtures with Cantera

Handling Mixtures with Cantera

Objectives:

To use the Quantity class of Cantera and calculate the number of moles and validate them analytically.

Class - Quantity:

The quantity class of Cantera helps to create mixtures with different compositions and conditions such as Temperature and Pressure.

1.Estimation of number of moles of Mixture A:

  • General equation for any Hydrocarbon based Stoichiometric combustion:

Here x=1 and y=4 (Methane)

equating the coefficients of O: 2a=2x+(y/2) =>a=2

Number of moles of O2=2

Number of moles of N2=2*3.76=7.52

Total number of moles of Mixture A = 7.52 + 2 = 9.52

  • Analytical Solution:

In the above given snippet, O2 mole fraction is 0.21

Mixture Moles = Species Moles/ Mole Fraction = 2/0.21 = 9.52

In the above given snippet, N2 mole fraction is 0.79

Mixture Moles = Species Moles/ Mole Fraction = 7.52/0.79 = 9.52

Here both mass fractions of N2 and O2 lead to 9.52 moles of Mixture A which is in accordance wih stoichiometric reaction based calculation performed above.

2. Analytical estimation of Mass fraction of Mixture A and B:

For O2, Molfrac = 0.21, Molecular Weight = 16*2=32.

For N2,Molfrac = 0.79, Molecular Weight = 14*2=28.

Molfrac of Mixture = (0.21*32) + (0.79*28) = 28.84.

Massfrac(O2) = 0.21*(32/28.84) = 0.767

Massfrac(N2) = 0.79*(28/28.84) = 0.233

3. Estimation of number of moles of Mixture B:

In the above snippet of code, the line 15 takes Temperature, Pressure, Moles/Mole fraction (TPX) as input. Here T=298.15, P= 1 atm, Mole fraction = 1536.

In line 16, the total moles is equal to 1 and since there is only one species CH4, mole fraction has to be 1 by default. Any higher value has no significance and the value 1546 can be replaced as 1.

4. Computation using Cantera:

"Script to compute temperature of Mixtures"
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
print(A.mass_fraction_dict())

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

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

Output:

{'N2': 0.7670829987741036, 'O2': 0.23291700122589645}
{'CH4': 1.0}
2224.4118993147463

The mass fractions of N2 and O2 are in accordance with section 2 analytical calculation and the temperature of the mixture is 2224.42 K. A correct estimation of moles of mixture A is essential to obtain a correct temperature.

References:

[1] Mole Fraction and Mole Percent | Introduction to Chemistry (lumenlearning.com)

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.