Example_HP_PROPELLANTS.m#

 1% -------------------------------------------------------------------------
 2% EXAMPLE: HP PROPELLANTS
 3%
 4% Compute adiabatic temperature and equilibrium composition at constant
 5% pressure (e.g., 1.01325 bar) for lean to rich LH2-LOX 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% HYDROGEN_L == {'H','H2O','OH','H2','O','O3','O2','HO2','H2O2',...
10%                'H2bLb','O2bLb'}
11%   
12% See wiki or setListspecies method from ChemicalSystem class for more
13% predefined sets of species
14%
15% @author: Alberto Cuadra Lara
16%          Postdoctoral researcher - Group Fluid Mechanics
17%          Universidad Carlos III de Madrid
18%                 
19% Last update April 02 2024
20% -------------------------------------------------------------------------
21
22% Import packages
23import combustiontoolbox.databases.NasaDatabase
24import combustiontoolbox.core.*
25import combustiontoolbox.equilibrium.*
26import combustiontoolbox.utils.display.*
27
28% Get Nasa database
29DB = NasaDatabase();
30
31% Define chemical system
32system = ChemicalSystem(DB, 'HYDROGEN_L');
33
34% Initialize mixture
35mix = Mixture(system);
36
37% Define chemical state
38set(mix, {'H2bLb'}, 'fuel', 1);
39set(mix, {'O2bLb'}, 'oxidizer', 1);
40
41% Define properties
42mixArray = setProperties(mix, 'temperature', 300, 'pressure', 1 * 1.01325, 'equivalenceRatio', 0.2:0.05:5);
43
44% Initialize solver
45solver = EquilibriumSolver('problemType', 'HP');
46
47% Solve problem
48solver.solveArray(mixArray);
49
50% Plot adiabatic flame temperature
51plotFigure('phi', [mixArray.equivalenceRatio], 'T', [mixArray.T]);
52
53% Plot molar fractions
54plotComposition(mixArray(1), mixArray, 'equivalenceRatio', 'Xi', 'mintol', 1e-14);