Chemical equilibrium at constant enthalpy and pressure with different species temperature#

 1% -------------------------------------------------------------------------
 2% EXAMPLE: HP MIXTEMP
 3%
 4% Compute adiabatic temperature and equilibrium composition at constant
 5% pressure (p = 1.01325 bar) for lean to rich CH4-air mixtures with fuel 
 6% temperature T_fuel = 300 K and air temperature T_air = 380 K. Also, a set
 7% of equivalence ratios phi contained in (0.5, 5) [-]
 8%   
 9% See wiki or setListspecies method from ChemicalSystem class for predefined
10% sets of species
11%
12% @author: Alberto Cuadra Lara
13%
14% Last update October 06 2025
15% -------------------------------------------------------------------------
16
17% Import packages
18import combustiontoolbox.databases.NasaDatabase
19import combustiontoolbox.core.*
20import combustiontoolbox.equilibrium.*
21
22% Get Nasa database
23DB = NasaDatabase();
24
25% Define chemical system
26system = ChemicalSystem(DB);
27
28% Initialize mixture
29mix = Mixture(system);
30
31% Define chemical state
32set(mix, {'CH4'}, 'fuel', 1);
33set(mix, {'N2', 'O2', 'Ar', 'CO2'}, 'oxidizer', [78.084, 20.9476, 0.9365, 0.0319] / 20.9476);
34
35% Set specifc-species tempearature
36setTemperatureSpecies(mix, [300, 380, 380, 380, 380]);
37
38% Define properties
39mixArray = setProperties(mix, 'pressure', 1 * 1.01325, 'equivalenceRatio', 0.5:0.01:5);
40
41% Initialize solver
42solver = EquilibriumSolver('problemType', 'HP');
43
44% Solve problem
45solver.solveArray(mixArray);
46
47% Generate report
48report(solver, mixArray);