Challenge

Week 4.1- Handling Mixtures with Cantera

AIM and Tasks to perform:-

Mixture Calculations are performed by Quantity class

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

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

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

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.

CODE and EXPLANATION:-

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

The stiochipometric reaction taken for the ixture is as below

CH4+2(O2+3.76N2)------>CO2 +2H20+7.52N2

The moles value will be for oxygen and nitrogen as they are from reactants (Natural conditions or initial stages)

O2 = 0.21 and N2 = 0.79

The Object A is a mixture of O2 and N2, so a number of moles in the object A is 2

A_species=(N_species/N_T)

where A_species = Mole fraction of species in object A

N_species = Number of moles of species of interest

N_T - Total number of species in object A (mixture)

A_O2 = 2/2+2.372 = 0.21

A_N2 = 2.372/2+2.372 = 0.79

Moles = total number of moles / Mole fraction of species

Moles of O2 = 2/001=9.52

Moles of N2 = 2.376/0.79 = 9.52

The analytical calculation is done.

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

import cantera as ct
import matplotlib as plt
import math

gas = ct.Solution('gri30.cti')
A= ct.Quantity(gas)
A.TPX=298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
A.moles = 2/0.21
print(A.mass_fraction_dict())



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

Mixture = A+B 
Mixture.equilibrate('HP','auto')
print(Mixture.T)




Th eabove result describes the mass function of species N2 and O2.

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

  • In line 15 and 16, we include TPX command. TPX mean Get the temperature[k], pressure[Pa] and mole fraction

Refer snap below (Code:- help(gas))

  • The number 1546 represents the no.of moles of the object. Since only one compound is given the molar fraction plays no role here.
  • The value may be any number but not 0. Beacause the moles of the object B is given as 1.
  • We have taken one mole in the B object into consideration.

4. Changes to get the right value

  • Here we are using the equilibrate command for the mixture object.
  • A solver has to be applied and it is the Auto solver used. It uses the element potential method first and if it fails to solve, then Gibbs solver is used automatically.
  • The following will gove the correct AFT value as below.

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.