Example_DET_OBLIQUE_BETA.m#

 1% -------------------------------------------------------------------------
 2% EXAMPLE: DET_OBLIQUE_BETA
 3%
 4% Compute pre-shock and post-shock state for a oblique detonation
 5% considering Chapman-Jouguet (CJ) theory for a stoichiometric CH4-air
 6% mixture at standard conditions, a set of 24 species considered, an 
 7% overdrive of 4 and a set of wave angles [15:5:80] [deg].
 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 Jul 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', 4, 'beta', 15:5:80);
44
45% Initialize solver
46solver = DetonationSolver('problemType', 'DET_OBLIQUE');
47
48% Solve problem
49[mixArray1, mixArray2_1, mixArray2_2] = solver.solveArray(mixArray1);
50
51% Plot Hugoniot curves
52ax1 = plotFigure('\rho_1 / \rho_2', [mixArray1.rho] ./ [mixArray2_1.rho], 'p_2 / p_1', [mixArray2_1.p] ./ [mixArray1.p], 'xScale', 'log', 'yScale', 'log', 'linestyle', '-');
53ax1 = plotFigure('\rho_1 / \rho_2', [mixArray1.rho] ./ [mixArray2_2.rho], 'p_2 / p_1', [mixArray2_2.p] ./ [mixArray1.p], 'xScale', 'log', 'yScale', 'log', 'linestyle', '--', 'ax', ax1);
54legend(ax1, {'Underdriven', 'Overdriven'}, 'Interpreter', 'latex', 'FontSize', ax1.FontSize);
55
56% Plot molar fractions
57plotComposition(mixArray2_1(1), mixArray1, 'beta', 'Xi', 'mintol', 1e-3, 'y_var', mixArray2_1);
58plotComposition(mixArray2_2(1), mixArray1, 'beta', 'Xi', 'mintol', 1e-3, 'y_var', mixArray2_2);
59
60% Plot properties
61properties = {'T', 'p', 'rho', 'h', 'e', 'g', 's', 'gamma_s'};
62propertiesBasis = {[], [], [], 'mi', 'mi', 'mi', 'mi', []};
63ax2 = plotProperties(repmat({'beta'}, 1, length(properties)), mixArray2_1, properties, mixArray2_1, 'basis', propertiesBasis);
64ax2 = plotProperties(repmat({'beta'}, 1, length(properties)), mixArray2_2, properties, mixArray2_2, 'basis', propertiesBasis, 'ax', ax2);