All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
HANDLING COMBUSTION MIXTURE WITH CANTERA l. OBJECTIVE: Write the code to calculate the properties of Air-Fuel Mixture by varying…
Himanshu Chavan
updated on 02 Jul 2021
HANDLING COMBUSTION MIXTURE WITH CANTERA
l. OBJECTIVE:
Write the code to calculate the properties of Air-Fuel Mixture by varying the properties of air and fuel individually.
ll. EXPLANATION:
1)
For the combustion of methane in the air, we know that the ideal reaction must be:
CH4+2(O2+3.76N2)→CO2+2H2O+7.52N2
Generally, the air and fuel are mixed at the same conditions before entering into the furnace. However, sometimes they are mixed at different conditions. One such condition includes preheating the air before the combustion. For such a scenario, we need to model the fuel(methane) and the oxidizer(air) individually at their respective specified conditions. For This Purpose, we use the Quantity class in Cantera to create the mixture. The starting code (before debugging) is shown below:
The above code returns the AFT as 374.14 K which is clearly wrong. This is because the number of moles of quantity A is not specified. For specifying the number of moles, we look at the stoichiometric reaction-we need 2 moles of O2 for 1 mole of CH4. Now,O2 being part of the air with a mole fraction of 0.21, we can use the definition of mole fraction as:
Mole Fraction of O2=Moles of O2Total moles of air
0.21=2Total moles of air
Total moles of air=20.21
The above can be applied more generally by using the mole_fraction_dict() method of A. If we use the following 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}
print(A.mole_fraction_dict())
we get output as:
{'N2': 0.79, 'O2': 0.21}
[Finished in 1.8s]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2)
The mole_fraction_dict() is a dictionary object and we can use it to call the mole fraction of any element specified in the mixture. Hence, instead of using 0.21 directly as the mole fraction ofO2, we will use the dictionary object to call the mole fraction of O2 from the quantity A as:
A.moles = 2/A.mole_fraction_dict()['O2']
Now, looking at quantity B, we see that it contains only one compound in the mixture- CH4. We need 1 mole of CH4 for the reaction, which is specified with the B.moles function.
On line 15, we can see the dictionary of the mole fraction as {'CH4':1546}. Technically, this is correct because Cantera will reduce the numbers provided in this dictionary to their respective mole fractions by dividing the quantity on the RHS of each compound in the mixture by the total sum of RHS of all the compounds. SO if you enter
A.TPX = 298.15,ct.one_atm,{'O2':2,'N2':7.52}
the above statement is equivalent to:
A.TPX = 298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
Because,
mole fraction ofO2=22+7.52=0.21
mole fraction ofN2=7.522+7.52=0.79
So looking at the B quantity, we have only one compound. Hence, any number we enter in the RHS of 'CH4' will be equivalent to:
B.TPX = 298.15,ct.one_atm,{'CH4':1}
However, it is a good practice to use the mole fraction of the compounds whose total suns up to 1. This makes it easier for other people to understand your code and can lead to consistent calculations when working in a team.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3)
Now, after making the necessary changes to the starting code, mainly:
Line 10: Specifying A.moles
Line 15: Changing mole fraction of 'CH4' from 1546 to 1
"""
Code to vary the temperature of fuel and oxidizer individually
"""
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/A.mole_fraction_dict()['O2']
print(A.mole_fraction_dict())
B = ct.Quantity(gas)
B.TPX = 298.15,ct.one_atm,{'CH4':1}
B.moles = 1
# The following step is used to apply the right molar balance
M=A+B
M.equilibrate('HP')
print(M.T)
we get the correct AFT as 2224.22 K in output
{'N2': 0.79, 'O2': 0.20999999999999996}
2224.224370856457
[Finished in 0.9s]
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Simulation Of A 1D Super-sonic Nozzle Using Macormack Method
AIM: To simulate the isentropic flow through a Quasi 1D subsonic - supersinic nozzle by deriving both the conservation and non-conservation forms of the governing equations and solve them by implementing Macormacks's technique using MATLAB. Objective: Determine the steady-state temperature distribution for the flow field…
19 Oct 2021 11:02 AM IST
Project 1 : CFD Meshing for Tesla Cyber Truck
ADVANCED CFD MESHING OF THE TESLA CYBER TRUCK l. OBJECTIVE 1. Geometry Clean-up of the model 2. Generation of surface mesh on the model. 3. Analyze and correct the quality of the mesh. 4. Setting…
08 Oct 2021 10:34 PM IST
Week 4 Challenge : CFD Meshing for BMW car
ADVANCED CFD MESHING OF THE BMW M6 MODEL USING ANSA l. OBJECTIVE 1. Detailed geometry clean-up of the BMW M6 Model. 2. Generation of a surface mesh on the model. 3. Analyze and correct the quality of the mesh. 4. Setting up a wind…
29 Sep 2021 10:51 PM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.