Challenge

Week 4 - Handling Mixtures with Cantera

* Codes to be considered:

Q1. To start with given in line number 10 and line number 11:

A.TPX = 298.15,ct.one_atm{'O2':0.21, 'N2':0.79}

print(A.moles)

Executing the above commands we get the output as follows,

from the above line number 10 it is understood that the mole fraction of O2 = 0.21

mole fraction of N2 = 0.79

executing the command print(A.moles) gives a o/p of 0.0346615, the calculation concerned with moles method/function as follows,

1 mole of `O_2 =`15.99*2 = 31.98 grams

1 mole of `N_2 =` 14.0067 * 2 = 28.0134

therefore 1 gram of `O_2` = 1/31.98 = 0.0312695 moles of `O_2`

1 gram of `N_2 =` 1/28.0314 = 0.035697 moles of `N_2`

we have from the problem statement that mass fraction of `O_2` = 0.21

mass fraction of `N_2` = 0.79

Taking a weighted average = 0.21 * 0.0312695 + 0.79 * 0.035697 = 0.034767

and hence 0.034767 moles of mixture is present.

Q2. If we provide command print(A.mole_fraction_dict()) in line number 12

executing the above code we get an o/p as follow:

executing the command has provided the mole fraction of `O_2` and `N_2`which is nothing but the mole fractions which is provided as the input.

* Adding a command print(A.mass_fraction_dict()) in line number 13 as shown below,

gives a o/p as,

where mass_fraction_of_O2 = 0.23291

mass_fraction_of_N2 = 0.767082

Calculations concerned with the mass fraction as follows,

Molecular weight of `O_2` = 2*15.99 = 31.98

Using the command line A.moles we have the moles for mixture A = 0.03466

No. of moles of `O_2` = 0.21*0.03466 = 0.00727

therefore mass fraction of 0.00727 moles of `O_2` = 0.00727*31.98 = 0.23249

similarly, Molecular weight of `N_2` = 2*14.0067 = 28.0134

Therefore No.of moles of `N_2` = 0.79*0.03466 = 0.027814

Therefore mass fraction of 0.0027814 mole of `N_2` = 0.027814*28.0134 = 0.7796

Q3. In line 15 we are defining a instance B for the quantity class and on line 16 we define the mixture which the B instance represents. In here instance B represents fuel CH4 which is defined using .TPX, which implies the temperature, pressure and mole fraction. Since we are only defining CH4 in the mixtures the mole fraction gets auto assigned as 1 and hence it does not matter whatever the number we provide be it 1546 or anything as such

Q4. To calculate the AFT of CH4 correct, we need to define the number of moles of CH4 in line 22 also we need to define the number of moles of mixture A.

Considering the mixture A, mole fraction of O2 is defined as 0.21 and that of N2 is defined as 0.79, considering the stoichometric equation of cobustion of CH4 we have,

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

so from the above stoichometric equation we have Total number of moles of O2 and N2 = 2 + (3.76*2) = 9.52

so in line 11 A.mole = 9.52 is defined.

Executing the above commands gives us the AFT, as shown below

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.