Week 4.1- Handling Mixtures with Cantera
for question
4.(1)
import cantera as ct
gas = ct.Solution("gri30.yaml")
A =ct.Quantity(gas)
A.TPX =298.15,ct.one_atm,'O2:1,N2:3.76'
print("cantera ",A.moles)
A.moles =8.875
"""
Analytical method , here we are assuming for 1 g of air , mass of air is 1 g and mass per one mole is given by molar mass of the mixture, where air consists 21% O2 and 79% N2 by volume , hence the molarmass is given by
Xm = 0.21*(32)+0.79*(28)~= 28.96 g/mol
which gives the number of moles of air per 1 g as
Ym = 1/(28.96)
"""
x =1/28.96
print("analytical",x)
#print("mass fraction of the mixture in analytical Y =", [,] )
print("mass fraction of the mixture in cantera Y",A.mass_fraction_dict() )
print("mass fraction of mixture analytically for O2 and N2 ",(0.21*32)/(28.96),(0.79*28)/(28.96))
B =ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,'CH4:1547'
B.moles =1
M =A+B
M.equilibrate('HP',solver ='auto' )
print(M.T)
that gives the output as
cantera 0.034660873931702356
analytical 0.034530386740331494
4.(2)
print("mass fraction of the mixture in cantera Y",A.mass_fraction_dict() )
print("mass fraction of mixture analytically for O2 and N2 ",(0.21*32)/(28.96),(0.79*28)/(28.96))
The mass fraction is given by the mass of the element by total elements mass ; mole fraction of O2 is given by mass of O2 in the air that is 0.21 , where as for the N2 is 0.79
hence the mass fractions
`Yi=x_i*(MW_i)/(MW_mixture)`
gives the following output
mass fraction of the mixture in cantera Y {'N2': 0.7670002848599555, 'O2': 0.23299971514004453}
mass fraction of mixture analytically for O2 and N2 0.23204419889502761 0.7638121546961326
4.(3) in 15 and 16 we have defined a quantity instance called B , where the member function
B.TPX lets us enter the temperature :298 K , P -one_atm, X - no of elements , though we have mentioned X as 1546, by using the variable M we can balance it by not declaring the number of moles to it , by that our chemical equation is balanced.
4.(4)
By changing the values of A.moles upto 8.875 we have got the AFT value closer to the actual value