1% -------------------------------------------------------------------------
2% EXAMPLE: DET UNDERDRIVEN REFLECTED
3%
4% Compute pre-shock and post-shock state for a reflected planar underdriven
5% detonation considering Chapman-Jouguet (CJ) theory for a stoichiometric
6% CH4-air mixture at standard conditions, a set of 24 species considered
7% and a set of overdrives contained in (1,10) [-].
8%
9% Soot formation == {'CO2','CO','H2O','H2','O2','N2','Ar','Cbgrb',...
10% 'C2','C2H4','CH','CH3','CH4','CN','H',...
11% 'HCN','HCO','N','NH','NH2','NH3','NO','O','OH'}
12%
13% See wiki or setListspecies method from ChemicalSystem class for more
14% predefined sets of species
15%
16% @author: Alberto Cuadra Lara
17% Postdoctoral researcher - Group Fluid Mechanics
18% Universidad Carlos III de Madrid
19%
20% Last update July 28 2024
21% -------------------------------------------------------------------------
22
23% Import packages
24import combustiontoolbox.databases.NasaDatabase
25import combustiontoolbox.core.*
26import combustiontoolbox.shockdetonation.*
27import combustiontoolbox.utils.display.*
28
29% Get Nasa database
30DB = NasaDatabase();
31
32% Define chemical system
33system = ChemicalSystem(DB, 'soot formation');
34
35% Initialize mixture
36mix = Mixture(system);
37
38% Define chemical state
39set(mix, {'CH4'}, 'fuel', 1);
40set(mix, {'N2', 'O2', 'Ar', 'CO2'}, 'oxidizer', [78.084, 20.9476, 0.9365, 0.0319] / 20.9476);
41
42% Define properties
43mixArray1 = setProperties(mix, 'temperature', 300, 'pressure', 1.01325, 'equivalenceRatio', 1, 'driveFactor', 1:0.1:10);
44
45% Initialize solver
46solver = DetonationSolver('problemType', 'DET_UNDERDRIVEN_R');
47
48% Solve problem
49[mixArray1, mixArray2, mixArray3] = solver.solveArray(mixArray1);
50
51% Plot Hugoniot curves
52ax1 = plotFigure('\rho_1 / \rho_i', [mixArray1.rho] ./ [mixArray2.rho], 'p_i / p_1', [mixArray2.p] ./ [mixArray1.p], 'xScale', 'log', 'yScale', 'log', 'linestyle', '-');
53ax1 = plotFigure('\rho_1 / \rho_i', [mixArray1.rho] ./ [mixArray3.rho], 'p_i / p_1', [mixArray3.p] ./ [mixArray1.p], 'xScale', 'log', 'yScale', 'log', 'linestyle', '--', 'ax', ax1);
54legend(ax1, {'Incident', 'Reflected'}, 'Interpreter', 'latex', 'FontSize', ax1.FontSize);
55
56% Plot post-shock temperature
57ax2 = plotFigure('driveFactor', mixArray1, 'T', mixArray2, 'linestyle', '-');
58ax2 = plotFigure('driveFactor', mixArray1, 'T', mixArray3, 'linestyle', '--', 'ax', ax2);
59legend(ax2, {'Incident', 'Reflected'}, 'Interpreter', 'latex', 'FontSize', ax2.FontSize);
60
61% Plot molar fractions
62plotComposition(mixArray2(1), mixArray1, 'driveFactor', 'Xi', 'mintol', 1e-14, 'y_var', mixArray2);
63plotComposition(mixArray3(1), mixArray1, 'driveFactor', 'Xi', 'mintol', 1e-14, 'y_var', mixArray3);