Challenge

Week 4.1- Handling Mixtures with Cantera

Handling Mixtures in Cantera

Objective

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.

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

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

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.

Theory

Cantera seems to follow Meter-Kilogram-second(MKS) system.i.e cantera seems to assume the mass of quantity to be 1 kg if the mass of quantity is not defined yet.Also for example when we use mole function cantera returns the result in no. of kilomoles present in a kilogram of quantity(k-Mol/Kg) can also be shorted down to (mol/g)

Solutions:

1.Using moles function to find out no. of moles in 1g the number of moles/g is 0.0346612761450006

to get the number of moles in 1g theoretically we have to calculate using the atomic weights of the individual elements

mass of O2=15.999*2=31.998g

mass of N2=14.0067*2=28.01348g

so per gram,no.of moles in A will be

(0.21*( 1/31.998) )+(0.79*(1/28.01348))

= 0.03476345518 theoretically

2.using mole fraction dict in A to find mole fraction and to find mass fraction

Theoretically we have

mass of 1 mole of O2 is 31.998g and similarly N2 is 28.01348g

mass of A=(0.21*31.998+0.79*28.01348)g=28.8503972g

there for mass fraction of O2 is (0.21*31.998)/(28.8503972)

=0.23291700122

ands for N2 (0.79*28.01348)/(28.8503972)

=0.76708299877

almost correct with cantera

3.In code line 15-16

  • since we are defining temperature,pressure and mole fraction in order the line 15 has a mole fraction for CH4 to be 1546 which is impossible, mole fractions should always be less than 1.if the mole fraction was below 1 we should follow the dict rule which is make a dictionary to specify the mole fraction of CH4.In ine 15 the "{} " dict is missing too.
  • in line 16 we are specifiying the number of moles CH4 in the reactiion,if not specified cantera might ssume different values..

4.Changes to put in place

from these 3 question we found out that we need to specify the number of moles for the species and we need to follow the rules of python and cantera coding

from my perspective i figured this as an combustion process where A(oxygen and nitrogen mixture) and B (CH4) is equilibrated in constant pressure | enthalpy environment to determine AFT

we have :

therefore number of moles in CH4=1

in O2 and N2=(2+3.76*2)=9.52

complete code is given below

results;

AFT is 2224.4118993147486k

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.