Incident shock waves#
In this tutorial, we will cover how to solve the Rankine-Hugoniot equations for a planar incident shock wave, namely
where \(p\), \(\rho\), \(u\), and \(h\) represent pressure, density, velocity, and specific enthalpy, respectively, and the subscripts 1 and 2 refer to the upstream and downstream states of the shock wave. This equation must be supplemented by the equation of state, which for an ideal gas reads
where \(R\) is the universal gas constant, \(T\) is the temperature, and \(W\) is the molecular weight of the gas.
To solve these equations using the Combustion Toolbox, we will use the ShockSolver()
class, part of the +combustiontoolbox.+shockdetonation
(CT-SD) subpackage (module). Below is an example that solves the Rankine-Hugoniot equations for a planar incident shock wave in air, with an initial temperature \(T_1 = 300\) K, pressure \(p_1 = 1\) bar, and a pre-shock Mach number \(\mathcal{M}_1 \in [1, 10]\):
% Import packages
import combustiontoolbox.databases.NasaDatabase
import combustiontoolbox.core.*
import combustiontoolbox.shockdetonation.ShockSolver
% Get NASA's database
DB = NasaDatabase();
% Define chemical system
system = ChemicalSystem(DB);
% Initialize mixture
mix = Mixture(system);
% Define chemical state
set(mix, {'N2', 'O2'}, [79/21, 1]);
% Define properties
mixArray1 = setProperties(mix, 'temperature', 300, 'pressure', 1, 'Mach', 1:0.1:10);
% Initialize shock solver
solver = ShockSolver();
% Perform shock calculations
[mixArray1, mixArray2] = solveArray(solver, mixArray1);
% Generate report
report(solver, mixArray1, mixArray2);
This code snippet will generate two figures: Molar fraction of species in the mixture as a function of the pre-shock Mach number and the variation of the thermodynamic properties (e.g., temperature, pressure) as a function of the pre-shock Mach number.
Tip
The Combustion Toolbox allows to consider different caloric models regarding the final gas mixture, including calorically perfect gas, calorically imperfect gas with frozen chemistry, or calorically imperfect gas with equilibrium chemistry, including dissociation and ionization.
For example, to consider the calorically perfect gas approximation, initialize the ShockSolver()
class as follows
solver = ShockSolver('FLAG_TCHEM_FROZEN', true);
For the calorically imperfect gas with frozen chemistry model, also known as the thermally perfect gas model, use
solver = ShockSolver('FLAG_FROZEN', true);
Congratulations!#
Congratulations you have finished the Combustion Toolbox MATLAB tutorial! You should now be ready to begin using the Combustion Toolbox on your own (see the examples
folder).