Project

handling mixture

AIM: Study of Quantity class of Cantera to create various mixtures.

In the given sample code we need to insert mole fraction (calculated) in lines 10 and 11 to get the quantity class using cantera which is as follows

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 = (2*3.76)/0.79
print(A.mass_fraction_dict())

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


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

#1 mole fraction of O2 from combustion reaction can be calculated as 0.21 which is shared between 2 atoms of oxygen as O2

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

moles fraction = (moles of species/total number of moles)

From theory, total mole fraction should be 1

Hence, mole of oxygen is 2/0.21

or, mole of nitrogen is 2x3.72/0.79

#2 Use the method mole_fraction_dict()

outcome

\"\"

print(A.mass_fraction_dict()) gives the calculated mole fraction which is inbuild method on cantera library.

#3 TPX (Temperature, Pressure, mole fraction) values for specie B . 1546 represents the number of moles of the CH4. Since the gas object (either A or B) mole fraction already known only CH4 is needed to considered.

#4 In line 21, we are using the equilibrate function for M object. The state of chemical equilibrium holding property pair \'HP\' enthalpy and pressure. It will first auto solve the using auto function, if fails uses Gibbs solver.

For getting right AFT answer of 2224 K we need to add A.moles = 2/0.21 = 9.52 or (B.moles= 2x3.72/0.79 = 9.52)

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.