1% -------------------------------------------------------------------------
2% EXAMPLE: JUMPCONDITIONS_THERMO
3%
4% Influence of caloric models on jump conditions in normal shocks
5%
6% This script examines the effects of different caloric models on the jump
7% conditions (changes in temperature, density, adiabatic index, and the
8% dimensionless Rankine-Hugoniot slopes) encountered in normal shock waves.
9% The models under consideration are:
10%
11% 1. Thermochemical frozen: assumes a calorically perfect gas, where
12% specific heat values remain constant.
13%
14% 2. Frozen: assumes a thermally perfect gas, where specific heat values
15% vary with temperature.
16%
17% 3. Equilibrium: assumes a calorically imperfect gas, where both
18% thermal and caloric properties vary, accounting for chemical
19% reactions in equilibrium.
20%
21% @author: Alberto Cuadra Lara
22%
23% Last update Dec 16 2025
24% -------------------------------------------------------------------------
25
26% Import packages
27import combustiontoolbox.databases.NasaDatabase
28import combustiontoolbox.core.*
29import combustiontoolbox.shockdetonation.*
30import combustiontoolbox.utils.display.*
31
32% Definitions
33FLAG_PAPER = true;
34
35% Get Nasa database
36DB = NasaDatabase();
37
38% Define chemical system
39system = ChemicalSystem(DB, 'air_ions');
40
41% Initialize mixture
42mix = Mixture(system);
43
44% Define chemical state
45set(mix, {'N2', 'O2'}, [79, 21] / 21);
46
47% Initialize figure
48plotConfig = PlotConfig();
49plotConfig.innerposition = [0.05, 0.05, 0.45, 0.55];
50plotConfig.outerposition = [0.05, 0.05, 0.45, 0.55];
51ax1 = setFigure(plotConfig); ax2 = setFigure(plotConfig);
52ax3 = setFigure(plotConfig); ax4 = setFigure(plotConfig);
53ax5 = setFigure(plotConfig); ax6 = setFigure(plotConfig);
54
55% Calculations
56for i = 1:3
57
58 switch i
59 case 1
60 caloricGasModel = CaloricGasModel.perfect;
61 linestyle = ':';
62 case 2
63 caloricGasModel = CaloricGasModel.thermallyPerfect;
64 linestyle = '--';
65 case 3
66 caloricGasModel = CaloricGasModel.imperfect;
67 linestyle = '-';
68 end
69
70 % Define properties
71 mixArray1 = setProperties(mix, 'temperature', 300, 'pressure', 1, 'M1', 1:0.05:20);
72
73 % Initialize solver
74 solver = JumpConditionsSolver('caloricGasModel', caloricGasModel, 'FLAG_PAPER', FLAG_PAPER, 'FLAG_RESULTS', false);
75
76 % Solve problem
77 jumpData = solver.solve(mixArray1);
78
79 % Plots
80 ax1 = plotFigure('M1', jumpData.M1, 'Tratio', jumpData.Tratio, 'linestyle', linestyle, 'color', [0 0 0], 'ax', ax1);
81 ax2 = plotFigure('M1', jumpData.M1, 'Rratio', jumpData.Rratio, 'linestyle', linestyle, 'color', [0 0 0], 'ax', ax2);
82 ax3 = plotFigure('M1', jumpData.M1, '\gamma_s', jumpData.gamma2, 'linestyle', linestyle, 'color', [0 0 0], 'ax', ax3);
83 ax4 = plotFigure('M1', jumpData.M1, '-Gammas1', -jumpData.Gammas1, 'linestyle', linestyle, 'color', [0 0 0], 'ax', ax4);
84 ax5 = plotFigure('M1', jumpData.M1, 'Gammas2', jumpData.Gammas2, 'linestyle', linestyle, 'color', [0 0 0], 'ax', ax5);
85 ax6 = plotFigure('M1', jumpData.M1, 'Gammas3', jumpData.Gammas3, 'linestyle', linestyle, 'color', [0 0 0], 'ax', ax6);
86
87 if i ~= 3
88 continue
89 end
90
91 ax1 = plotFigure('M1', [5 5], 'Tratio', [ax1.YLim(1), ax1.YLim(2)], 'linestyle', '--', 'color', [0.5 0.5 0.5], 'ax', ax1);
92 ax2 = plotFigure('M1', [5 5], 'Rratio', [ax2.YLim(1), ax2.YLim(2)], 'linestyle', '--', 'color', [0.5 0.5 0.5], 'ax', ax2);
93 ax3 = plotFigure('M1', [5 5], '\gamma_s', [ax3.YLim(1), ax3.YLim(2)], 'linestyle', '--', 'color', [0.5 0.5 0.5], 'ax', ax3);
94 ax4 = plotFigure('M1', [5 5], '-Gammas1', [ax4.YLim(1), ax4.YLim(2)], 'linestyle', '--', 'color', [0.5 0.5 0.5], 'ax', ax4);
95 ax5 = plotFigure('M1', [5 5], 'Gammas2', [ax5.YLim(1), ax5.YLim(2)], 'linestyle', '--', 'color', [0.5 0.5 0.5], 'ax', ax5);
96 ax6 = plotFigure('M1', [5 5], 'Gammas3', [ax6.YLim(1), ax6.YLim(2)], 'linestyle', '--', 'color', [0.5 0.5 0.5], 'ax', ax6);
97end