1% -------------------------------------------------------------------------
2% EXAMPLE: SP
3% Compute Isentropic compression/expansion and equilibrium composition at
4% a defined set of pressure (p = 1:100 atm) for a rich CH4-air mixture
5% at defined specific entropy, and an equivalence ratio phi 1.5 [-]
6%
7% See wiki or setListspecies method from ChemicalSystem class for predefined
8% sets of species
9%
10% @author: Alberto Cuadra Lara
11%
12% Last update October 16 2025
13% -------------------------------------------------------------------------
14
15% Import packages
16import combustiontoolbox.databases.NasaDatabase
17import combustiontoolbox.core.*
18import combustiontoolbox.equilibrium.*
19
20% Get Nasa database
21DB = NasaDatabase();
22
23% Define chemical system
24system = ChemicalSystem(DB);
25
26% Initialize mixture
27mix = Mixture(system);
28
29% Define chemical state
30set(mix, {'CH4'}, 'fuel', 1);
31set(mix, {'N2', 'O2', 'Ar', 'CO2'}, 'oxidizer', [78.084, 20.9476, 0.9365, 0.0319] / 20.9476);
32
33% Define properties
34mixArray = setProperties(mix, 'entropySpecific', mix.sSpecific, 'pressure', 1.01325 * logspace(0, 1, 200), 'equivalenceRatio', 1.5);
35
36% Initialize solver
37solver = EquilibriumSolver('problemType', 'SP');
38
39% Solve problem
40solver.solveArray(mixArray);
41
42% Generate report
43report(solver, mixArray);