1% -------------------------------------------------------------------------
2% EXAMPLE: HP MIXTEMP
3%
4% Compute adiabatic temperature and equilibrium composition at constant
5% pressure (e.g., 1.01325 bar) for lean to rich CH4-air mixtures at
6% standard conditions except for the air which is at 380 K. Also, a set
7% of 24 species considered and a set of equivalence ratios phi contained
8% in (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 February 05 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'}, 'fuel', 1);
41set(mix, {'N2', 'O2', 'Ar', 'CO2'}, 'oxidizer', [78.084, 20.9476, 0.9365, 0.0319] / 20.9476);
42
43% Set specifc-species tempearature
44setTemperatureSpecies(mix, [300, 380, 380, 380, 380]);
45
46% Define properties
47mixArray = setProperties(mix, 'pressure', 1 * 1.01325, 'equivalenceRatio', 0.5:0.01:5);
48
49% Initialize solver
50solver = EquilibriumSolver('problemType', 'HP');
51
52% Solve problem
53solver.solveArray(mixArray);
54
55% Plot adiabatic flame temperature
56plotFigure('equivalenceRatio', mixArray, 'T', mixArray);
57
58% Plot molar fractions
59plotComposition(mixArray(1), mixArray, 'equivalenceRatio', 'Xi', 'mintol', 1e-14);