Challenge

Week 4.1- Handling Mixtures with Cantera

Objective

The objective in this assignment is to use Quantity class of Cantera to create various mixtures. For that, we will explain how the mixture calculations are performed by answering the given questions.

1.Mole’s method and its calculation approach

Mole Fraction describes the number of molecules contained within one component divided by the total number of molecules in a given mixture. In other words, mole fraction is the ratio of the number of moles of one component of a solution or other mixture to the total number of moles representing all of the components.

Formula Related to the Mole Fraction

Consider a solution that consists of two substances A and B, then the mole fraction of each substance is:

Mole fraction of solute = (Moles of Solute) / (Total number of moles of the solutes and the solvent)

`X_A=(mol A)/(mol A+mol B)`

`X_B=(mol B)/(mol A+mol B)`

In our case, the mixture is composed of fuel that is methane and air. Moreover, air comprises Oxygen and Nitrogen. The problem is to determine the number of moles of the object A which is air in the given piece of code.

The number of moles of each species composing air namely oxygen and Nitrogen are given as follows: mol O2 = 0.21 and mol N2 = 0.79.

By considering the mixture to be at stoichiometric conditions, we have the following equation:

`CH_4+2(O_2+3.76N_2 )⟹CO_2+2H_2+7.52N_2`

As per the definition given above, and using the balanced equation above, we have:

`X_O2=(mol O2)/(mol O2+mol N2)= (mol O2)/(mol_air)`

`⇒mol_A= mol_air= (mol O2)/(X_O2 )`

`mol_A= 2/0.21=9.52`

Or `mol_A= (2*3.76)/0.79=9.52`

2.mole_fraction_dict () or mass_fraction_dict ()

In this question we have to use the mass_fraction_dict () method to compute the mass fraction of the object A. We are also asked to show the analytical method to achieve the same objective.

The mass fraction of a substance in a mixture is the ratio of the mass of the substance to the total mass of the mixture. It is also known as mass per cent or percentage by mass when expressing in percentage. Since the mass fraction is a ratio of mass to mass, it is a dimensionless quantity.

For a mixture,

`w_i=m_i/m_T`

Here, `w_i` is the mass fraction of the `i^th` component, `m_i` is the mass of the `i^th` component, and `m_T` is the total mass of the mixture.

The total mass of a mixture is the sum of the mass of each component

`m_T=m_1+m_2+⋯m_n= ∑m_i`

For analytical method, the following formula is used:

`Number _of Mol es = (Mass of s_ubstance)/(Mass_of on_e mol_e)`

`⟹Mass of su_bstance= Number of Mol__es*Mass of on_e mol_e`

All the calculations are summarized in the following table.

Species

Mole fraction

Number of moles

Mass of species

Mass fraction

O2

0.21

0.21*9.52=2

2*32=64

64/ (64+210.56) =0.2331

N2

0.79

0.79*9.52=7.52

7.52*28=210.56

210.56/(64+210.56)=0.7668

The mass fraction of each species is then computed and the same results are obtained from Cantera after putting the correct number of moles of object A. This can be seen in the output part below.

3.Regarding line 15 and 16 of the given code

In line 15, the initial conditions of the object B are defined. The TPX command used enable us to get the temperature in [K], the pressure in [Pa] and mole fraction. The number 1546 represents the number of moles of the object B. But it is important to precise that by commenting the line 16 and changing the value 1546, we came to know that value does not play any role. Moreover, the value may be any number except zero. In line 16, the number of moles of the object B is defined as 1. The code will then consider that value.

4. Right value of AFT

Since the “equilibrate” command is used for the mixture and HP thermophase to get the enthalpy in [J/Kg or J/Kmol] and pressure in [Pa], we have to use a solver in order to solve the whole case. We then chose the ‘auto’ solver which employs the element potential method. By setting all these tools and modifications, the correct adiabatic flame temperature is obtained as 2224 K as shown in the output part below.

Program

"""
sample cod eto vary the temperature of air and oxidizer individually
"""
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.5238
print(A.mass_fraction_dict())



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

# The following step is used to apply the right molar balancce
M = A+B
#Calculating AFT
M.equilibrate('HP','auto')
print(M.T)

Output

REFERENCES

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.