All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Objective: Use of 'mole' function on an object and explain. Use mole_fraction_dict() and mass_fraction_dict() of object. Explain line no. 17 & 18 Compute moles of A to get the right value of AFT Results: Mole & Mass function: Here, using this function we can change the size of 'quantity' by setting…
GAURAV KHARWADE
updated on 25 Sep 2020
Objective:
Results:
Mole & Mass function:
Here, using this function we can change the size of 'quantity' by setting the mass or nos. of moles. Mass and mole fractions can also be set using 'dict
' objects, which is convenient in cases where the composition is stored in a variable or is computed.
Python Code:
"""
Program to understand the Quantity class of Cantera
By- GAURAV V. KHARWADE|| Skill-Lync 2020
"""
import cantera as ct
gas= ct.Solution('gri30.cti')
# To define the composition of AIR
A= ct.Quantity(gas)
A.TPX= 298.15,ct.one_atm,{'O2':0.21,'N2':0.79}
A.moles= 9.52
# To define the composition of OXIDIZER
B= ct.Quantity(gas)
B.TPX= 298.15,ct.one_atm,'CH4:1546'
B.moles= 1
M= A + B
M.equilibrate('HP', solver='auto')
print(A.report())
print(B.report())
# To Know the mass fraction of object A & B
print('Mass fraction of AIR is=',A.mass_fraction_dict())
print('Mass fraction of OXIDIZER is=',B.mass_fraction_dict())
# To Know the relative mole fraction of object A & B
print('Mole fraction of AIR is=',A.mole_fraction_dict())
print('Mole fraction of OXIDIZER is=',B.mole_fraction_dict())
print('AFT is=',M.T)
When the composition alone is changed, the temperature and density are held constant. This means that the pressure and other intensive properties will change. The composition can also be set in conjunction with the intensive properties of the mixture
The mole numbers will be normalized to produce the mole fractions, and therefore they are “relative” mole numbers. Mass fractions can be set in this way too by changing X
to Y
in the above statements.
As we can see in the output of this program, we have seen both mass fraction and mole fraction of objects A & B. Moles of air is set to 9.52 as we know for 2 moles of N2 2/0.79=9.52 to achieve an accurate AFT of 2224.41K.
For object B, we have already defined mole number to 1 hence using 1546 will not be reasonable. The state of object B is initialized by a temperature of 298.15 K, 101325 pa of Pressure, and composition on a mole basis (CH4:1546).
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...
Week 9 - Senstivity Analysis Assignment
Objective: To write the code which will take entire reactions of GRI mechanism 3.0 and take out the most sensitive top 10 reactions. The main parameters are as follows: Write code to list out the top 10 most sensitive reactions from a list of all reactions from the GRI mechanism. The sensitivity parameters should be with…
04 Jan 2021 05:51 PM IST
Auto ignition analysis of combustible mixture methane under different conditions using Cantera and Python
Objective: To study auto-ignition using Cantera. Following are the tasks to perform using Cantera: Plot the variation of Auto Ignition time of Methane with a constant temperature of 1250K and pressure varying from 1 to 5 atm. Plot the variation of Auto Ignition time…
06 Dec 2020 04:55 AM IST
Week 6 - Multivariate Newton Rhapson Solver
Objective: To solve a given set of Ordinary Differential equations using the Multi-Variate Newton Raphson Method. Given: The set of ODE's are given below: `dy_1/dt= - 0.04*y_1+10^4*y2*y3` `dy_2/dt=0.04*y_1-10^4*y_2*y_3-3*10^7*y_2^2` `dy_3/dt=3*10^7*y_2^2` The jacobian should be estimated numerically and not analytically.…
01 Nov 2020 03:50 AM IST
Week 5 - Literature review: ODE Stability
Objective: To review the literature about ODE and to write the python program to substantiate our results. Theory: …
20 Oct 2020 03:52 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.