1% -------------------------------------------------------------------------
2% EXAMPLE: DET_POLAR
3%
4% Compute detonation polar curves at standard conditions, a set of 30 species
5% considered, and a set of pre-shock Mach numbers M1 = [5, 6, 7, 8, 10], or
6% what is the same, drive factors M1/M1_cj = [1.0382, 1.2458, 1.4534,...
7% 1.6611, 2.0763]
8%
9% Hydrogen == {'H2O','H2','O2','N2','He','Ar','H','HNO',...
10% 'HNO3','NH','NH2OH','NO3','N2H2','N2O3','N3','OH',...
11% 'HNO2','N','NH3','NO2','N2O','N2H4','N2O5','O','O3',...
12% 'HO2','NH2','H2O2','N3H','NH2NO2'}
13%
14% See wiki or setListspecies method from ChemicalSystem class for more
15% predefined sets of species
16%
17% @author: Alberto Cuadra Lara
18% Postdoctoral researcher - Group Fluid Mechanics
19% Universidad Carlos III de Madrid
20%
21% Last update Aug 02 2024
22% -------------------------------------------------------------------------
23
24% Import packages
25import combustiontoolbox.databases.NasaDatabase
26import combustiontoolbox.core.*
27import combustiontoolbox.shockdetonation.*
28import combustiontoolbox.utils.display.*
29
30% Get Nasa database
31DB = NasaDatabase();
32
33% Define chemical system
34system = ChemicalSystem(DB, 'hydrogen');
35
36% Initialize mixture
37mix = Mixture(system);
38
39% Define chemical state
40set(mix, {'H2'}, 'fuel', 1);
41set(mix, {'N2', 'O2'}, 'oxidizer', [79, 21] / 21);
42
43% Define properties
44mixArray1 = setProperties(mix, 'temperature', 300, 'pressure', 1.01325, 'equivalenceRatio', 1, 'driveFactor', [1.0382, 1.2458, 1.4534, 1.6611, 2.0763]);
45
46% Initialize solver
47solver = DetonationSolver('problemType', 'DET_POLAR', 'numPointsPolar', 300);
48
49% Solve problem
50[mixArray1, mixArray2] = solver.solveArray(mixArray1);
51
52% Plot polars
53[ax1, ax2, ax3] = plotPolar(mixArray1, mixArray2);