Project

Handling Mixtures with Cantera

The objective of this challenge is to determine the Adiabatic Flame Temperature for the combustion of methane and air at the stoichiometric conditions and constant pressure by handling mixtures of methane and air as two separate quantities using the \"Quantity Class\" in Cantera.

Here, the code given in the challenge considers mixture \'A\' as air and \'B\' as Methane.

The stoichiometric equation for methane is as below:

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

1. Providing Number of Moles of air:

By using A.TPX, we provide the initial conditions of the air.

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

which stands for the temperature of the air at the inlet is 298.15K, the pressure of air is 1 atm and X stands for the mole fraction of O2 and N2 in the air which is provided as a dictionary. Oxygen and Nitrogen in the air are at 21% and 79% by molar percentage, respectively.

Until now we have just defined the mole fraction of air being used, Now we determine the number of moles of air involved in the stoichiometric equation by using a variable A.moles through the quantity class.

Number of moles of Oxygen in Air = 2

Number of moles of Nitrogen in Air = 2*3.76 = 7.52

Total Number of Moles in Air = 9.52 (i.e., 2+7.52)

Now to define A.moles we can put it as 9.52 or 2/0.21 or 7.52/0.79.

In the above to determine the total number of moles following formula is used. (Total number of moles = moles of individual compound/mole fraction of individual compound)

`Total Number of Mol es = (Mol es of I nd ividual Compound)/(Mol e F ra ction of I nd ividual Compound)`

`A.mol es = 9.52 or 2/0.21 or 7.52/0.79`

if we do not define the total number of moles of the compound (i.e., A.moles), Cantera by default assumes the number of moles per gram or (k-mol/kg) of compound which leads to wrong results. For example,

Mass of 1 mole of O2 = 31.9988 gm

Mass of 1 mole of N2 = 28.01348 gm

Number of moles in 1 gm of O2 = 1/31.9988 = 0.03125117191

Number of moles in 1 gm of N2 = 1/28.01348= 0.0356971011

Number of moles in 1 gm of air = 0.21*0.03125117191+0.79*0.0356971011=0.03476345518

Similarly for CH4

Mass of 1 mole of CH4 = 16.04 gm

Number of moles in 1 gm of CH4 = 0.06234413965

If we do not define the A.moles and B.moles, and print the values of A.moles and B.moles we get the above-calculated values of the number of moles per gm.

\"\"

Hence we need to define A.moles and B.moles according to the stoichiometric equation considered.

2. Determining mass fraction or mole fraction using Dictionary:

To determine mass fraction or mole fraction a dictionary is defined as follows:

A.mass_fraction_dict() to determine the mass fraction of compounds in the air.

A.mole_fraction_dict() to determine the mass fraction of compounds in the air.

To print the same in the console the following command is used

print(A.mass_fraction_dict()) to print the mass fraction of compounds in the air.

print(A.mole_fraction_dict()) to print the mole fraction of compounds in the air.

Calculation Procedure:

Species Moles Mole Fraction Molecular Weight (gm/mol) Mass (gms) Mass Fraction
O2 2 0.210084034 32 64 0.233100233
N2 7.52 0.789915966 28 210.56 0.766899767

Mass is obtained from the product of moles and molecular weight.

\"\"

3. 15th and 16th Line:

In the 15th Line, fuel and its initial conditions are defined using another instance \'B\' of class \'Quantity\' B.TPX by defining temperature, pressure and mole fraction of species.

In the 16th Line, moles of fuel are defined for the given stoichiometric conditions of methane in order for Cantera not to assume the default mol/gram value for fuel.

Strictly, for Methane mole fraction and moles are 1 as it is a single compound in the mixture \'B\'. Anyhow moles are defined by B.moles but mole fraction can be any number greater than zero. As it is a single compound by default Cantera sets its value to 1. Thus, 1546 is not significant and does not affect the solution.

4. Right Calculation of AFT:

In order to calculate the right value of AFT, the number of moles of air in line10 has to be according to the stoichiometric conditions as mention in the solution of question number 1.

i.e., A.moles = 9.52 or 2/0.21 or 7.52/0.79

\"\"

Thus the right AFT of methane at constant pressure is obtained as 2224.411899K.

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.