Chemical equilibrium at constant temperature and pressure#
Following the example used in the preciding section, let’s compute the equilibrium composition of a stoichiometric CH\(_4\)-ideal air mixture at 3000 K and 1.01325 bar (1 atm). To obtain the equilibrium composition, we have to define the chemical species that can appear in the final state. The combustion of typical hydrocarbon fuels, such as methane, is a complex process that involves hundreds of chemical species. However, the number of species that have a significant impact on the properties of the final mixture is much smaller. Combustion Toolbox provides a list of predefined species that can be used to compute the equilibrium composition of a mixture. The list of predefined species can be found in the routine setListSpecies()
. Alternatively, refer to the Using predefined chemical systems tutorial section.
For a preliminary analysis, we will consider a set of 23 species:
CO\(_2\), CO, H\(_2\)O, H\(_2\), O\(_2\), N\(_2\), Cgr,
C\(_2\), C\(_2\)H\(_4\), CH, CH\(_3\), CH\(_4\), CN, H,
HCN, HCO, N, NH, NH\(_2\), NH\(_3\), NO, O, OH,
which typically appear in the combustion of hydrocarbon fuels with air. This set of species is defined in the routine setListSpecies()
as Soot formation
, which also includes Ar.
Import packages#
import combustiontoolbox.databases.NasaDatabase
import combustiontoolbox.core.*
import combustiontoolbox.equilibrum.*
import combustiontoolbox.utils.display.*
Define database#
To define the database type the following at the MATLAB prompt:
DB = NasaDatabase()
Here DB is a NasaDatabase
object that inherits from the superclass Database
.
Note
This section is under development. Stay tuned!
Defining chemical system#
To initialize the Combustion Toolbox (CT) with this set of species, type the following at the MATLAB prompt:
chemicalSystem = ChemicalSystem(DB, 'soot formation');
chemicalSystem = ChemicalSystem(DB, {'CO2', 'CO', 'H2O', 'H2', 'O2', 'N2', 'Cbgrb', ...
'C2', 'C2H4', 'CH', 'CH3', 'CH4', 'CN', 'H', ...
'HCN', 'HCO', 'N', 'NH', 'NH2', 'NH3', 'NO', 'O', 'OH'});
Note
This section is under development. Stay tuned!
Setting the initial chemical composition#
To indicate the species and chemical composition in the initial mixture:
For a stochiometric CH\(_4\)-ideal air mixture:
set(mix, {'CH4'}, 'fuel', 1);
set(mix, {'N2', 'O2'}, 'oxidizer', [7.52, 2]);
This is the same as specifying a unit value for the equivalence ratio:
set(mix, {'CH4'}, 'fuel', 1);
set(mix, {'N2', 'O2'}, 'oxidizer', [79/21, 1]);
setEquivalenceRatio(mix, 1);
For a lean-to-rich CH\(_4\)-ideal air mixtures:
set(mix, {'CH4'}, 'fuel', 1);
set(mix, {'N2', 'O2'}, 'oxidizer', [79/21, 1]);
mixArray = setProperties(mix, 'equivalenceRatio', 0.5:0.01:4);
Note
This section is under development. Stay tuned!
Setting the initial thermodynamic state#
To indicate the temperature [K] and pressure [bar] of the initial mixture, type:
mix = Mixture(chemicalSystem);
setTemperature(mix, 3000);
setPressure(mix, 1 * 1.01325);
Note
This section is under development. Stay tuned!
Define solver#
In this example, we have a constant temperature and pressure (TP) problem. To solve it, we need to use the EquilibriumSolver
class, which is defined as follows:
solver = EquilibriumSolver('TP');
Note
This section is under development. Stay tuned!
Perform chemical calculations#
To solve parametrics studies, all the solvers implemented in CT have a method called solveArray()
, which allows you to solve a set of cases at once. To solve the parametric study defined above, run
solver.solveArray(mixArray);
Note
This section is under development. Stay tuned!
Results#
The mixArray handle will be updated with the new state. By default, all the solvers implemented the Combustion Toolbox print the results through the command window, which gives for the stoichiometric case (\(\phi\) = 1):
****************************************************
----------------------------------------------------
Problem type: TP | Equivalence ratio = 1.0000
----------------------------------------------------
| MIXTURE 1
T [K] | 3000.0000
p [bar] | 1.0132
r [kg/m3] | 0.1029
h [kJ/kg] | 2574.2794
e [kJ/kg] | 1589.5140
g [kJ/kg] | -30246.9319
s [kJ/(kg-K)] | 10.9404
W [g/mol] | 25.3293
(dlV/dlp)T [-] | -1.0285
(dlV/dlT)p [-] | 1.5830
cp [kJ/(kg-K)] | 5.5609
gamma [-] | 1.1680
gamma_s [-] | 1.1357
sound vel [m/s]| 1057.5349
----------------------------------------------------
MIXTURE 1 Xi [-]
N2 6.4771e-01
H2O 1.1162e-01
CO 5.8485e-02
OH 3.5936e-02
H2 3.0822e-02
CO2 2.8615e-02
H 2.7583e-02
O2 2.5914e-02
O 1.8096e-02
NO 1.5206e-02
N 1.1123e-05
NH 9.5804e-07
HCO 1.2464e-07
NH2 1.1860e-07
NH3 3.0265e-08
HCN 4.4103e-09
CN 4.0110e-10
CH 5.7109e-13
CH3 1.5595e-13
CH4 1.1358e-14
MINORS[+4] 0.0000e+00
TOTAL 1.0000e+00
----------------------------------------------------
****************************************************
Note
The solve and solveArray methods of all the solvers implemented in CT print the results in the command window by default. To avoid this, during the definition write:
solver = EquilibriumSolver('TP', 'FLAG_RESULTS', false);
or alternatively
set(solver, 'FLAG_RESULTS', false);
Note
This section is under development. Stay tuned!
Postprocessed results (predefined plots for several cases)#
There are some predefined charts based on the selected problem, in case you have calculated multiple cases. Just calling the solvers method report()
, namely
report(solver, mixArray);
will reproduce Figure 1, which represents the variation of the molar fraction with the equivalence ratio for lean to rich CH\(_4\)-ideal air mixtures at 3000 [K] and 1.01325 [bar].
Figure 1: Example TP: variation of molar fraction for lean to rich CH$_4$-ideal air mixtures at 3000 [K] and 1.01325 [bar], a set of 26 species considered and a total of 451 case studies. The computational time was of 2.39 seconds using a Intel(R) Core(TM) i7-11800H CPU @ 2.30GHz.
Note
This section is under development. Stay tuned!
Summary#
% Import packages
import combustiontoolbox.databases.NasaDatabase
import combustiontoolbox.core.*
import combustiontoolbox.equilibrium.*
import combustiontoolbox.utils.display.*
% Get Nasa database
DB = NasaDatabase();
% Define chemical system
system = ChemicalSystem(DB, 'soot formation');
% Initialize mixture
mix = Mixture(system);
% Define chemical state
set(mix, {'CH4'}, 'fuel', 1);
set(mix, {'N2', 'O2'}, 'oxidizer', [79/21, 1]);
% Define properties
mix = setProperties(mix, 'temperature', 3000, 'pressure', 1 * 1.01325, 'equivalenceRatio', 1);
% Initialize solver
solver = EquilibriumSolver('problemType', 'TP');
% Solve problem
solver.solveArray(mix);
% Import packages
import combustiontoolbox.databases.NasaDatabase
import combustiontoolbox.core.*
import combustiontoolbox.equilibrium.*
import combustiontoolbox.utils.display.*
% Get Nasa database
DB = NasaDatabase();
% Define chemical system
system = ChemicalSystem(DB, 'soot formation');
% Initialize mixture
mix = Mixture(system);
% Define chemical state
set(mix, {'CH4'}, 'fuel', 1);
set(mix, {'N2', 'O2'}, 'oxidizer', [79/21, 1]);
% Define properties
mixArray = setProperties(mix, 'temperature', 3000, 'pressure', 1 * 1.01325, 'equivalenceRatio', 0.5:0.01:5);
% Initialize solver
solver = EquilibriumSolver('problemType', 'TP');
% Solve problem
solver.solveArray(mixArray);
% Automatically postprocess results
report(solver, mixArray);