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