Challenge

Week 4.1- Handling Mixtures with Cantera

Aim :

To work with Cantera's quantity class on a variety of projects and to demonstrate how mixture calculations are done

Solution :

1. Use of moles method or function of A object and explain how it was calculated

The mole's function determines the number of moles if the object (consisting of the two species O2 and N2) can be calculated using basic chemistry. we can arrive that the number of moles of A by

`x_(O_2) = frac(n_(O_2))(n_(O2)+n_(N_2)) = frac(n_(O2))(n_(air))`

The oxidizer air at STP includes 21 percent 02 and 79 percent N2. The TPX method has been given this as an input. We assume stoichiometric methane combustion to compute the number of moles of air required for mixture processing. As a result of inserting the constants in the equation above, we obtain

`0.21 = frac(2)(n_(air)`

`implies n_(air) = 9.52`

This can also be deduced using the stoichiometric methane combustion balancing equation, i.e.

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

2. Use the method mole_fraction_dict() of the A object and explain the result that you get. Here is how you need to use it. print(A.mass_fraction_ dict())
This function estimates the species' mole fraction (mass fraction) of the species. This function estimates the species' mole fraction (mass fraction). It determines the mass fraction of the species in object A when used as a print(A.mass fraction dict()). This is calculated as shown in the table below.

SPECIES MOLE FRACTION NUMBER OF MOLES MASS MASS FRACTION
`O_2` 0.21 `0.21**9.52 = 1.9992 approx2` `2**32=64` `64/(64+210.56)=0.2331`
`N_2` 0.79 `0.79**9.52=7.52` `7.52**28=210.56` `210.56/(64+210.56)=0.7668`

As a result, the mass fractions are calculated using the number of moles of air supplied as an input.


3. What is happening in lines 15 and 16? Make sure you explain what 1546 means? Is that reasonable?
In line 15, we are assigning the initial conditions of object B (fuel).

Temperature (in Kelvin), pressure (in Pascals), and mole fractions are the formats for this. We may use a dictionary to define numerous species in object B using their mole fractions if there are multiple species to be declared. We don't need to utilize dictionary format because we're just considering one species (CH4). Furthermore, because there are only one species, the mole fraction of CH4 is set to 1. The number 1546 is just coincidental. It is important to notice that the O is not permitted. The number of moles of object B is assigned on line 16.


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. AFT temperature depends on the number of moles of fuel (object B) and oxidizer(object A) which react at constant pressure. Thus, we need to provide the correct number of moles for both objects. The number of moles of object A is thus defined at line 10 as

A moles = 9.52
This gives the correct value of AFT for Methane combustion.

Code :

import cantera as ct 

gas  =  ct.Solution('gri30.cti') #Creating Gas Object which inherits the information from the solution class of cantera library

A= ct.Quantity(gas) #Creating a object which inherits the Quantity class from the cantera library which provides additional information 
A.TPX = 298.15, ct.one_atm, {'O2' : 0.21 , 'N2': 0.79} #Setting Reactants side temperature , Presure and mole fraction (O2 and N2)

'''
n - Numbe of moles 
x - mole fraction 
n_air = n_O2 + n_N2
x_O2 = n_O2/(n_O2 + n_air) = n_O2/n_air
Therefore.,
n_O2 = 2
n_air = 2/0.21 = 9.52
'''

A.moles = 9.52 #setting Number of moles of reactants

B= ct.Quantity(gas) #Creating a object which inherits the Quantity class from the cantera library which provides additional information 
B.TPX = 298.15, ct.one_atm, 'CH4 : 1546' #Setting Fuel side temperature , Presure and mole fraction (CH4)
B.moles = 1 #Setting number of moles of fuel 

A.constant = B.constant = 'HP' 
M=A+B #Creating a Mixture of air and Fuel

M.equilibrate('HP')
print('Adiabatic Fame Temperature at constant presure combustion: ' ,M.T)

# We can get mole and mass fraction of individual species in air which also called oxidizer 
print('Mole fraction of Individual species of air : ', A.mole_fraction_dict())
print('Mass fraction of Individual species of air : ' ,A.mass_fraction_dict())

OutPut :

Conclusion and discussion :

The temperature value has been derived using Quantity class for creating the Mixture of air and fule using Cantera

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.