Challenge

Week 4 - Handling Mixtures with Cantera

OBJECTIVES :- To handling mixtures with quantity class of cantera .

PROBLEM STATEMENT :-

In this challenge, I work on the quantity class of cantera to create various mixtures. In this process, you will explain how the mixture calculations are performed.

  • Use the “moles” method/function of the A object and explain how it was calculated.

  • Use the method mole_fraction_dict() of the A object and explain the results that we get.

  • What do you mean by “CH4:1546” ? Is that reasonable ?

  • What changes do we need to get the right value of AFT ? The right answer is 2224K.

ITRODUCTION & THEORY :-

The majority of substances that we see in our surrounding neighborhoods are actually not pure substances.

Mixture are substances composed of two or more forms of matter. We can separate them by physical methods. Example include a solution of salt and water, a mixture of sugar and water, different gasses, air, ...etc. In any mixtres, the various components do not combine through any kind of chemical changes. Therefore, the components do not loose their individual proparties.

Types of mixtures :-

Based on their composition, they can be divided into two types-

1. Homogeneous mixture

2. Heterogeneous mixture

IMPORTANCE OF PRACTICAL APPLICATIONS :-

  1. Application of acrylic materials :- they make tough flexible plastics or sticky resins that can solidified in context. e.g. paints, moduled bone substitute. These resins and plastics have a huge range of uses.

  2. Application of alkenes :- alkenes are not use directly for anything but they are readily converted to other very useful organic molecules. e.g. We can add water to make ethanol.

  3. Application of aluminium :- It is used for electrical power lines cable, saucepans many alloys e.g. with magnesium to make strong light metal fabrication products like aircraft wings, foods and drink containers and kitchen foil.

  4. Application of aluminium hydroxide :- It is used in antacid mixtures because it will neutralise acids.

  5. Application of amalgam :- Initialy prepared by the dentist as a paste which solidifies to make a dental filling.

CODE :-

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/0.21 	# or or 2/0.21 = 9.52
print("Mole fraction in air = ", A.mole_fraction_dict())
print("Mass fraction in air = ", A.mass_fraction_dict())

B = ct.Quantity(gas)
B.TPX = 298.15, ct.one_atm, "CH4 : 1546"
B.moles = 1  	

#Following steps is used to apply the right molar balance
M = A+B

M.equilibrate("HP")
#print(M.report())
print("right balance temperature i.e. AFT = ",M.T)

STEPWISE PROCEDURE :-

  1. For writing the script in cantera we need to import cantera in python

  2. Then define the class of gasseous solution i.e. “gri30.cti”.

  3. Generally first letter of class is capital in nature but not mandatory.

  4. Defined two solution A & B.

  5. Use the quantity function for both the solution to find the mass fraction and mole fraction.

  6. Defined “TPX” i.e. Temperature, pressure and mole fraction.

  7. Temperature and pressure are constant for both the solutions i.e. 298.15K (i.e. room temperature) and 1 atmphere (i.e. 101325Pa).

  8. Defined mole fraction of oxygen and nitrogen for A and methane for B.

  9. Takes correct number of moles so that we get right temperature.

  10. Print mole fraction and mass fraction of air.

  11. Then for right molar balancing add A & B in M i.e. mixture.

  12. Use the function as equilibrate and solver as “HP” i.e. Constant enthalpy and pressure in mixture. Then print right temperature and any other values which we like to find.

RESULTS :-

QUE.1 :- Use the “moles” method/function of the A object and explain how it was calculated ?

ANS.:- The object A is air. Consider any fuel (i.e. hydro carbon) reaction with air. The equation is written in the following form-

CxHy + b(O2 + 3.76N2) => xCO2 + y/2(H2O) + 3.76bN2

So the mole fraction of air is = b/(b + 3.76b) = 0.21. One mole of air cantains 0.21 moles of oxygen. Hence the methane at stoichometric condition b= 2 and 2/0.21 = 9.52 moles of air takes part in the combustion.

QUE.2 :- Use the method mole_fraction_dict() of the A object and explain the results that we get.

ANS. :- To calculate mass fraction we just need to multiply by no. of moles of the compound with molecular weight.

For O2 no. of moles = 2 & mass in gms = 2*32 = 64 gms

For N2 no. of moles = 7.52 & mass in gms = 7.52*28 = 210.56gms

Mole fraction of O2 = 64/(64+210.56) = 0.23 and

Mole fraction of N2 = 210.56/(64+210.56) = 0.77 approximately.

QUE.3 :- What do you mean by “CH4:1546”? Is that reasonable?

ANS.:- Basically here in these lines we are defining the fuel i.e. methane CH4 with pressure, temperature and mole fraction values and no. of moles are defined so as to avoid any pre-defined values assumed by the software.

Also, as methane is only the gas defined hence it has no. of moles and mole fraction as 1. Therefore defining 1546 has no effect as it gives the value of mole fraction as one.

QUE.4 :- What changes do we need to get the right value of AFT ? The right answer is 2224K.

ANS. :- As the mole fraction is known we just need to defined the no. of moles gas object A has i.e. 2/0.21 each for O2 and N2 = 9.52 with command as A.moles = 2/0.21 as written in the programm.

CONCLUSIONS :-

From above challenge we can conclude following points are-

  1. TPX values are depends on no. of moles. If no. of moles changes TPX value changes, we can see in our code.

  2. Quantity function is used to find mole fraction and mass fraction of given class.

  3. Number of moles we can calculated from general hydro carbon reactions.

  4. As the methane is only gas defined and hence it has no. of moles and mole fraction as 1. Therefore defining 1546 has no effect as it gives the values of moles fraction as one.

  5. The right temperature value is 2224K which we need to calculate by balancing entering air into the chamber.

In this way, I complete this challenge by defining, coding, plotting results and final conclussions.

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.