Challenge

Week 4 - Handling Mixtures with Cantera

1. Use the "moles" method/function of the A object and explain how it was calculated. You need to use this after line number 9.

`CH_4 + 2(O_2 + 3.76N_2) -> CO_2 + 2H_2O + 2 \times3.76N_2`

The mole fraction of oxygen `\chi_{O_2} =0.21` and the mole fraction of nitrogen `\chi_{N_2} = 0.79`

`\chi_{O_2) + \chi_{N_2) =1`

Mole fraction = number of moles of a species/ Total number of moles

therefore the Total number of moles = number of moles of a species/Mole fraction

So we can say A.moles = 2/0.21 = 2*3.76/0.79

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())

import cantera as ct

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

# Stream A (air)
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())

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



# Compute the mixed state
M = A + B


M.equilibrate('HP')
print(M.T)

The method in which the number of moles of air is calculated as mentioned above.

The output of print(A.mass_fraction_dict()) is {'N2':0.7670829987741036, 'O2':0.23291700122589645}. This outputs the mass fraction of oxygen and nitrogen in the air stream.

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

In line 15 B.TPX is used to initialize the temperature, pressure, and mole fraction values of the gas B. The value 1546 doesn't cause any harm since the maximum value of the mole fraction of a single component system will not be greater than 1.

In line 16 B.moles is used to set the number of moles of gas B.

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. Hint: The change needs to be done in line number 10. You have to compute the right number of moles of A.

The right value of the AFT can be calculated by specifying the correct number of moles of stream A.

That is A.moles = 2/0.21, the calculation of this is shown in the first section.

The calculated value of AFT is found to be 2224.22K

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.