1% -------------------------------------------------------------------------
2% EXAMPLE: HP_NATURAL_GAS
3%
4% Compute adiabatic temperature and equilibrium composition at constant
5% pressure (e.g., 1.01325 bar) for lean to rich natural gas (0.85% CH4, ...
6% 0.10% C2H6, 0.0035% CO2)-air mixtures at standard conditions, a set of
7% 24 species considered and a set of equivalence ratios phi contained in
8% (0.5, 5) [-]
9%
10% Soot formation == {'CO2','CO','H2O','H2','O2','N2','Ar','Cbgrb',...
11% 'C2','C2H4','CH','CH3','CH4','CN','H',...
12% 'HCN','HCO','N','NH','NH2','NH3','NO','O','OH'}
13%
14% See wiki or setListspecies method from ChemicalSystem class for more
15% predefined sets of species
16%
17% @author: Alberto Cuadra Lara
18% Postdoctoral researcher - Group Fluid Mechanics
19% Universidad Carlos III de Madrid
20%
21% Last update April 02 2024
22% -------------------------------------------------------------------------
23
24% Import packages
25import combustiontoolbox.databases.NasaDatabase
26import combustiontoolbox.core.*
27import combustiontoolbox.equilibrium.*
28import combustiontoolbox.utils.display.*
29
30% Get Nasa database
31DB = NasaDatabase();
32
33% Define chemical system
34system = ChemicalSystem(DB, 'soot formation');
35
36% Initialize mixture
37mix = Mixture(system);
38
39% Define chemical state
40set(mix, {'CH4', 'C2H6', 'CO2'}, 'fuel', [0.85, 0.1, 0.05]);
41set(mix, {'N2', 'O2', 'Ar', 'CO2'}, 'oxidizer', [78.084, 20.9476, 0.9365, 0.0319] / 20.9476);
42
43% Define properties
44mixArray = setProperties(mix, 'temperature', 300, 'pressure', 1 * 1.01325, 'equivalenceRatio', 0.5:0.01:5);
45
46% Initialize solver
47solver = EquilibriumSolver('problemType', 'HP');
48
49% Solve problem
50solver.solveArray(mixArray);
51
52% Plot adiabatic flame temperature
53plotFigure('equivalenceRatio', mixArray, 'T', mixArray);
54
55% Plot molar fractions
56plotComposition(mixArray(1), mixArray, 'equivalenceRatio', 'Xi', 'mintol', 1e-14);