Note
Go to the end to download the full example code.
Mixing using Quantity
objects#
In this example, air and methane are mixed in stoichiometric proportions. This is a simpler, steady-state version of the example mix1.py.
Since the goal is to simulate a continuous flow system, the mixing takes place at constant enthalpy and pressure.
Requires: cantera >= 2.5.0
Set up streams#
import cantera as ct
gas = ct.Solution('gri30.yaml')
# Stream A (air)
A = ct.Quantity(gas, constant='HP')
A.TPX = 300.0, ct.one_atm, 'O2:0.21, N2:0.78, AR:0.01'
# Stream B (methane)
B = ct.Quantity(gas, constant='HP')
B.TPX = 300.0, ct.one_atm, 'CH4:1'
# Set the molar flow rates corresponding to stoichiometric reaction,
# CH4 + 2 O2 -> CO2 + 2 H2O
A.moles = 1
nO2 = A.X[A.species_index('O2')]
B.moles = nO2 * 0.5
Compute the mixed state#
gri30:
temperature 300 K
pressure 1.0133e+05 Pa
density 1.1269 kg/m^3
mean mol. weight 27.742 kg/kmol
phase of matter gas
1 kg 1 kmol
--------------- ---------------
enthalpy -2.5351e+05 -7.0327e+06 J
internal energy -3.4342e+05 -9.5271e+06 J
entropy 7221.9 2.0035e+05 J/K
Gibbs function -2.4201e+06 -6.7137e+07 J
heat capacity c_p 1070.4 29695 J/K
heat capacity c_v 770.71 21381 J/K
mass frac. Y mole frac. X chem. pot. / RT
--------------- --------------- ---------------
O2 0.2192 0.19005 -26.334
CH4 0.054952 0.095023 -54.676
N2 0.71281 0.70588 -23.381
AR 0.013032 0.0090498 -23.315
[ +49 minor] 0 0
Show that this state corresponds to stoichiometric combustion#
M.equilibrate('TP')
print(M.report())
gri30:
temperature 300 K
pressure 1.0133e+05 Pa
density 1.1269 kg/m^3
mean mol. weight 27.742 kg/kmol
phase of matter gas
1 kg 1 kmol
--------------- ---------------
enthalpy -3.0024e+06 -8.3292e+07 J
internal energy -3.0923e+06 -8.5786e+07 J
entropy 7204.2 1.9986e+05 J/K
Gibbs function -5.1637e+06 -1.4325e+08 J
heat capacity c_p 1104.2 30633 J/K
heat capacity c_v 804.53 22319 J/K
mass frac. Y mole frac. X chem. pot. / RT
--------------- --------------- ---------------
H2O 0.12341 0.19005 -121.32
CO2 0.15074 0.095023 -185.83
N2 0.71281 0.70588 -23.381
AR 0.013032 0.0090498 -23.315
[ +49 minor] 2.0428e-19 1.7711e-19
Total running time of the script: (0 minutes 0.084 seconds)