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