Challenge

Week 4.1- Handling Mixtures with Cantera

HANDLING MIXTURES WITH CANTERA

AIM:

The main aim of the project is to understand the Quantiy class of Cantera and also explain the mixture calculations performed using different methods.

OBJECTIVES:

The main objectives of this assigment is to

1. Calulate the number of moles anaytically and verify that using coles

2. Calculate the mass fraction of the mixture and verify that using code

3. Find out the required number of moles to obtain correct AFT temperature as given in the question

4. Explain the given code and changes required in that.

SOLUTION:

Question-1

The Equation we considered here for the equlibrum process is

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

In the code given below the mole fraction for oxygen and nitrogen are given as

Mole fraction of `O_2` = 0.21

Mole fraction of `N_2` = 0.79

The analytical forms to calculate the total number of moles and mole fractions of oxidizer

`A_(speices) = N_(species)/N_T`

where,

`A_(species)`= mole fraction of species in object A

`N_(species)`= moles of individual species

`N_T` = Total number of moles in object A

Calculation of mole fraction:

`A_(O_2)`= `2/(2+2*376) = 0.21`

`A_(N_2)= (2*3.76)/(2+2*376) = 0.79`

Calculation of number of moles:

Moles = Total number of moles/ mole fraction species

Moles of `O_2`= `2/0.21 = 9.52`

Moles of `N_2`= `(2*3.76)/(0.79)= 9.52`

From this we can understand that the total number of moles of A requried in this solution to obatin correct resukts in 9.52

Question-2

The mole fraction and the mass fraction of the species can be converted into each other . The formulation is given below.

Mass fraction `Y_i= X_i*(MW)_i/(MW)_(mix)`

Mole fraction `X_i= Y_i*(MW)_(mix)/(MW)_i`

where `MW` is the molecular weight

`Y_i` is the mass fraction and

`X_i`is the mole fraction

From the given code we know that the mole fraction of `O_2`and `N_2` are 0.21 and 0.79 respectively

We already know that the moleculat weights of `O_2` and `N_2`are 32 and 28

From these details we can obtain the mass fraction of oxygen and nitrogen

`Y_(O_2) = 0.21* 32/(0.21*32+0.79*28) = 0.233`

`Y_(N_2) = 0.79* 28/(0.21*32+0.79*28) = 0.76`

We can verify the mass fraction of the oxygyen and nitrogen in reactants by using mass_fraction_dict command.

Question-3

In line 15 we are setting the temperature , pressure and the mole fraction values of the fuel `CH_4`. The symbol `X` in the code represnts the mole fraction which varies between 0 and 1. However, in the code the value is 1546 which is much greater than 1 and is pratically wrong. So in order to aviod that mistake of using 1546 as mole fraction in line 16 the number of moles of fuel is explicilty mentioned as 1. We can directly change the value of X to 1 in line 15 to avoid the code in line 16.

Question-4

To obtain the right adiabatic flame temperature we need to make small change in the code by inserting an extra code after line 9 as mentioned below. By providing the right number of moles of the oxidizer(`A`) or gas the value of `M`(`A+B`)in line 20 changes and we can obtain the AFT of 2224K.

CODE:

import cantera as ct 

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

A = ct.Quantity(gas)

#help(A)

A.TPX = 298.15,ct.one_atm, {'O2':0.21, 'N2': 0.79}
A.moles= (2/0.21)
print(A.moles)
print(A.mass_fraction_dict())
#print(A.X)


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


# The following step is used to mintain right molar balance 
M= A+B
M.equilibrate('HP')
print(M.T)

OUTPUT:

9.523809523809524
{'N2': 0.7670907820415769, 'O2': 0.2329092179584231}
1.0
{'CH4': 1.0}
2224.224370856443

CONCLUSION:

From this asssigment it was understood that one mole of fuel require 9.52 moles of oxidizer and also the mole fraction is different from the mass fraction of mixture.Quantity class is used when there are seperate mixtures and it is defined either my number of moles or by mass of the species.

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.