Challenge

Week 4 - Handling Mixtures with Cantera

# simple code to vary the temparature of air and oxidiser 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.52
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())


#following step is used to find right molar balance

M = A+B
M.equilibrate('HP')
print(M.T)

1:

here total the no of moles of A is 2+7.52 = 9.52,which represented in code as A.moles is 9.52

this is obtained by

moles fraction = no of moles of Particular specie/total no of moles of all species

moles of o2 = 2

total no of moles = 9.52

mole fractin of o2 = 2/(2+2*3.76) = 0.21

mole fraction of n2 = 2*3.76/2+2*3.76 = 0.79

2:

on using print(A.mass_fraction_dict(),folloing output was obtained

{'N2': 0.7670829987741036, 'O2': 0.23291700122589645}
output which obtained are mass fraction values of o2,n2

3:

fuel is at standard temparature and pressure .1546 represents the mole fraction of methane(ch4) and also total no of moles of object B is provided i.e B = 1

4:

To get the right value of AFT at line no 22, we need to define or set the total no of moles of object A i.e 9.52 at line no 10.

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.