Challenge

The calculation of the Adiabatic Flame Temperature of an air-fuel mixture using the Quantity class of the Cantera library.

Aim: To obtain the adiabatic flame temperature of Methane, using 'Quantity' class to specify the number of moles.

Introduction:

The 'Quantity' class in the Cantera library is used to define various characteristics such as the mass and the number of moles, of the gas that has been considered. The object created by using the 'Quantity' class is a part of the Solution class. This is useful when it comes creating mixtures of different species,and can be easily added to each other in order to observe the effect of said mixture, under various conditions.

Theory:

The Adiabatic Flame Temperature(AFT) of a fuel is the maximum temperature that can be achieved after complete combustion of all of the reactants in the system, with no heat transfer at the boundary. This means that the heat generated from combustion is utilized for the combustion products only, and there are no losses due to heat transfer at the boundaries. There are two types of Adiabatic Flame temperature:

(a) Constant Volume AFT

(b) Constant Pressure AFT

In the constant volume process, there is no heat transfer at the boundaries(Q=0) as the process is adiabatic and does not interact with the surroundings, and the work done in gas expansion post-combustion, is zero as well. This means that, if combustion took place inside a piston-cylinder arrangement, the piston would not move, as there is no work being done in order to move it. In this case, the difference between the internal energies of the products and the reactants, or vice versa, will be zero.

In the constant pressure process, the pressure is held constant, but unlike the constant volume process, work is done during gas expansion post-combustion, and the volume of the gas changes. A point to note is the fact that the constant volume adiabatic flame temperature should be higher than the constant temperature adiabatic flame temperature, because of the lack of work done in the constant volume process.

Coding approach:

Step 1:

The Cantera library is imported into Python by using the 'import' command, and is invoked using 'ct'.

An object named 'gas' is created using the 'Solution' class. The 'Solution' class is used to import the thermodynamic properties of various species within the input file 'gri30.cti', and is used to perform chemical reactions.

Lines of code:

import cantera as ct

gas = ct.Solution('gri30.cti')

Step 2:

Two separate objects of air and methane are created using the 'Quantity' class. The 'Quantity' class utilizes the solution class to create these objects, and we can specify the number of moles and the mass of the species of the objects. The objects have been named A and B,and are air and methane respectively.

The 'Quantity' class has utilized the gas object mentioned at the beginning, in order to create two separate quantities of air and methane.

The temperature and pressure have been set at STP(298.15K and 101325 Pa respectively), and the mole fraction for 'A' is set as, O2 : 0.21 and N2 : 0.79. The explanation behind setting these values will be given in the result section.

The temperature and pressure for object 'B' have been set at STP, and the mole fraction is set as CH4:1546. This again, will be discussed in the result section.

The number of moles for both 'A' and 'B' are given using the parameter 'moles', mentioned in the 'Quantity' class.

Lines of code:

A = ct.Quantity(gas)
A.TPX = 298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
A.moles = 2*(1+3.76)


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

Step 3:

An object 'M' is created, which combines the two species, hence creating a mixture of air and methane.

The 'equilibrate' function is used on 'M', in order to obtain the constant pressure adiabatic flame temperature of the mixture.

Finally, the adiabatic flame temperature, along with the mole fractions of both 'A' and 'B' are printed.

Lines of code:

M = A + B
M.equilibrate('HP')

print(M.T)
print(A.mole_fraction_dict())
print(B.mole_fraction_dict())

Code:

Given program:

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*(1+3.76) 


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

M = A + B
M.equilibrate('HP')

print('AFT=',M.T)
print(A.mole_fraction_dict())
print(B.mole_fraction_dict())

Corrected program:

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*(1+3.76) 


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

M = A + B
M.equilibrate('HP')

print('AFT=',M.T)
print(A.mole_fraction_dict())
print(B.mole_fraction_dict())

Results and explanation:

Main result:

The adiabatic flame temperature of the mixture is 2224.41 Kelvin.

1)The 'moles' function, and selection of the value of the number of moles:

(a)The 'moles' function is used to specify the number of moles of the species. The "Quantity' class has a default value for the number of moles of an object. So, if this value is not specified by the 'moles' function, the number of moles assumed is set to that default value. In order to show this, the image below displays the value of AFT and the number of moles of object 'B', when the specified number of moles of moles has been commented out.

It can be seen that the default number of moles in the 'Quantity' class is 0.0623341.

This value must be replaced by specifying the required number of moles.

(b)The number of moles of air in this case,for the combustion of methane, is 9.52 moles. This has been shown slightly differently in the code. The reason behind this is that, while using the 'Quantity' class, we must specify the number of moles by adding the number of moles of the two species, O2 and N2. The mole fraction mentioned does not specify the number of moles.

Two moles of air are required for the stoichiometric combustion of methane. Hence, one can easily make the mistake of specifying the number of moles as two. But, this will result in an incorrect value. Air is composed of approximately 21% of oxygen, and 79% of nitrogen, i.e. Air = (0.21*O2 + 0.79*N2). If this were to be written in terms of the amount of nitrogen that is associated with 1 mole of oxygen, the fraction composition of nitrogen(0.79) is simply divided by the fraction composition of oxygen(0.21), hence getting 3.76 moles of nitrogen, with 1 mole of oxygen.

Hence,air is composed of 1 mole of oxygen and 3.76 nitrogen. Adding the number of moles of oxygen and nitrogen, and multiplying them with the number of moles of air required for stoichiometric combustion, will give us the following value.

2*(1+3.76) = 9.52 moles

2) Usage of mole_fraction_dict:

The function 'mole_fraction_dict' is used to display the mole fraction of the species in dictionary format. Even if the mole fractions of the species are written as strings, the function will return the mole fraction of the species as a dictionary. The function will calculate the mole fraction based on the values provided for the species. To clarify, this does not directly paste the values of mole fractions provided. The mole fractions provided in 'TPX' are actually relative mole numbers.

In the image shown below, the mole fraction values fed into 'TPX' are the actual number of moles present in air.

It can be observed that the mole fractions returned by 'mole_fraction_dict' gives more or less the same values, despite not being fed the mole fraction values given.

The following displays the adiabatic flame temperature without changing the mole fraction values(O2:0.21,N2:0.79).

3)The mole fraction of CH4 in object B:

The given value of the mole fraction(X) of CH4 in 'B.TPX' is set as 1546. But, a point to note is that 'X' is not exactly the mole fraction, but the relative mole number of the species. Such values are used to scale the number of moles in the reactants. This value does not affect the value of the adiabatic flame temperature in any manner, because it is the only species present in the object. The object Another point to note is that the total number of moles and the number of moles of CH4 are equal, and hence when the mole fraction is calculated using 'mole_fraction_dict', the value returned will always be 1.

The function 'moles' is used on object B, and the number of moles is set to 1. Hence, the value present in the string does not affect the number of moles in any manner. However, if the number of moles were not specified using the function, the number of moles would revert to the default value given in the class, as shown above. And even if in this instance,he value of the relative mole number was changed,it would still have no effect on the adiabatic flame temperature. The mole fraction remains one, regardless of the value of the relative mole number in this case.

That being said, the value for relative mole number set as 1546 has no significance, is not a sensible value and is arbitrary in nature. Instead, a relative mole number value of 1 for methane would make more sense, for the sake of understanding and to avoid confusion.

The results of the given code and corrected code have been displayed below, and display no change in the adiabatic flame temperature.

Given program:

Corrected program:

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.