Shocks
- gas_dynamics.shocks.shocks.shock_mach(mach: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns the Mach number after a standing normal shock
Notes
Given a starting Mach number M1 and the ratio of specific heats, return the Mach number M2 that immediately follows the shock. The default fluid is air.
- Parameters
mach (float) – The Mach number before the shock
gas (fluid) – A user defined fluid object. Default is air
- Returns
The Mach number after the shock
- Return type
float
Examples
>>> M2 = gd.shock_mach(mach=1.5) >>> M2 0.7010887416930995 >>>
- gas_dynamics.shocks.shocks.shock_mach_before(mach: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns the Mach number before a standing normal shock
Notes
Given the Mach number after the shock and the ratio of specific heats, return the Mach number that immediately precedes the shock. Default fluid is air.
- Parameters
M (float) – The Mach number after the shock
gas (fluid) – A user defined fluid object. Default is air
- Returns
The mach number before the shock
- Return type
float
Examples
>>> import gas_dynamics as gd >>> M2 = 0.7010887416930995 >>> M1 = gd.shock_mach_before(mach = M2) >>> M1 1.4999999999999998 >>>
- gas_dynamics.shocks.shocks.shock_pressure_ratio(mach: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns the pressure ratio after a standing normal shock for a given Mach number
Notes
Given a starting Mach number and a ratio of specific heats, this function returns the ratio of pressure 2 over pressure 1 across a standing normal shock.
- Parameters
mach (float) – The starting Mach number
gas (fluid) – A user defined fluid object. Default is air
- Returns
The pressure ratio p2/p1
- Return type
float
Examples
>>> import gas_dynamics as gd >>> p2_p1 = gd.shock_pressure_ratio(mach=1.5) >>> p2_p1 2.4583333333333335 >>>
- gas_dynamics.shocks.shocks.shock_mach_from_pressure_ratio(pressure_ratio: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns the mach number across a standing normal shock given a pressure ratio
Notes
Given the ratio of pressure behind the shock over pressure before the shock and the ratio of specific heats, this function returns the Mach number before the shock. Default fluid is air.
- Parameters
pressure_ratio (float) – The pressure ratio p2 / p1
gas (fluid) – A user defined fluid object. Default is air
- Returns
The mach number prior the shock
- Return type
float
Examples
>>> import gas_dynamics as gd >>> p2_p1 = 6 >>> M1 = gd.shock_mach_from_pressure_ratio(pressure_ratio = p2_p1) >>> M1 2.29906813420444 >>>
- gas_dynamics.shocks.shocks.shock_temperature_ratio(mach: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns the temperature ratio after a standing normal shock for a given Mach number
Notes
Given a starting Mach number and a ratio of specific heats, this function returns the ratio of temperature 2 over temperature 1 across a standing normal shock. Default fluid is air.
- Parameters
mach (float) – The starting Mach number
gas (fluid) – A user defined fluid object. Default is air
- Returns
The temperature ratio T2/T1
- Return type
float
Examples
>>> import gas_dynamics as gd >>> T2_T1 = gd.shock_temperature_ratio(mach=1.5) >>> T2_T1 1.320216049382716 >>>
- gas_dynamics.shocks.shocks.shock_dv_a(mach: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns change in velocity over the local speed of sound after a normal shock.
Notes
Given a starting Mach number and a ratio of specific heats, this function returns the velocity change across a standing normal shock divided by the local speed of sound. Default fluid is air
- Parameters
mach (float) – The starting Mach number
gas (fluid) – A user defined fluid object. Default is air
- Returns
The change in Mach number
- Return type
float
Examples
- gas_dynamics.shocks.shocks.shock_stagnation_pressure_ratio(mach: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns stagnation pressure ratio after a normal shock.
Notes
Given a starting Mach number and a ratio of specific heats, this function returns the ratio of stagnation presure 2 over stagnation pressure 1 across a standing normal shock. Default fluid is air.
- Parameters
mach (float) – The starting Mach number
gas (fluid) – A user defined fluid object. Default is air
- Returns
The stagnation pressure ratio pt2/pt1
- Return type
float
Examples
>>> pt2_pt1 = gd.shock_stagnation_ratio(mach=2) >>> pt2_pt1 0.7208738614847454 >>>
- gas_dynamics.shocks.shocks.shock_tables(range=[1, 5], step=0.01, gas=<gas_dynamics.fluids.fluid object>) str
Returns shock tables for a range of Mach numbers.
Notes
Given a range of Mach numbers and a ratio of specific heats, generate the standing normal shock tables for every incremental Mach number in between.
- Parameters
range (list) – The starting and ending Mach # in a list, ie: [1,5].
step (float) – The step size for the tables.
gas (fluid) – A user defined fluid object. Default is air
- Returns
The shock table
- Return type
str
Examples
>>> import gas_dynamics as gd >>> gd.shock_tables(range=[1,2], step=.1) Normal Shock Parameters for γ = 1.4 M: 1.00 | M2: 1.0000 | p2/p1: 1.0000 | T2/T1: 1.0000 | dV/a: 0.0000 | pt2/pt1: 1.000000 M: 1.10 | M2: 0.9118 | p2/p1: 1.2450 | T2/T1: 1.0649 | dV/a: 0.1591 | pt2/pt1: 0.998928 M: 1.20 | M2: 0.8422 | p2/p1: 1.5133 | T2/T1: 1.1280 | dV/a: 0.3056 | pt2/pt1: 0.992798 M: 1.30 | M2: 0.7860 | p2/p1: 1.8050 | T2/T1: 1.1909 | dV/a: 0.4423 | pt2/pt1: 0.979374 M: 1.40 | M2: 0.7397 | p2/p1: 2.1200 | T2/T1: 1.2547 | dV/a: 0.5714 | pt2/pt1: 0.958194 M: 1.50 | M2: 0.7011 | p2/p1: 2.4583 | T2/T1: 1.3202 | dV/a: 0.6944 | pt2/pt1: 0.929787 M: 1.60 | M2: 0.6684 | p2/p1: 2.8200 | T2/T1: 1.3880 | dV/a: 0.8125 | pt2/pt1: 0.895200 M: 1.70 | M2: 0.6405 | p2/p1: 3.2050 | T2/T1: 1.4583 | dV/a: 0.9265 | pt2/pt1: 0.855721 M: 1.80 | M2: 0.6165 | p2/p1: 3.6133 | T2/T1: 1.5316 | dV/a: 1.0370 | pt2/pt1: 0.812684 M: 1.90 | M2: 0.5956 | p2/p1: 4.0450 | T2/T1: 1.6079 | dV/a: 1.1447 | pt2/pt1: 0.767357 M: 2.00 | M2: 0.5774 | p2/p1: 4.5000 | T2/T1: 1.6875 | dV/a: 1.2500 | pt2/pt1: 0.720874 >>>
- gas_dynamics.shocks.shocks.shock_flow_deflection(mach: float, shock_angle: float, gas=<gas_dynamics.fluids.fluid object>) float
Returns flow deflection angle from Mach number and oblique shock angle
Notes
Given the Mach number prior to the oblique shock, the angle of the oblique shock in degrees, and the ratio of specific heats, this function returns the angle that the flow is turned. Default fluid is air.
- Parameters
mach (float) – The Mach number before the shock
shock_angle (float) – The shock angle in degrees
gas (fluid) – A user defined fluid object. Default is air
- Returns
The deflection angle
- Return type
float
Examples
>>> import gas_dynamics as gd >>> deflect = gd.shock_flow_deflection(mach=2, shock_angle = 157.5) >>> deflect 10.856560004139958 >>>
- gas_dynamics.shocks.shocks.shock_angle(mach: float, flow_deflection: float, gas=<gas_dynamics.fluids.fluid object>) float
Return the shock angle given the Mach number prior to the shock and the deflection angle
Notes
Given the Mach number prior to the oblique shock, the angle of the flow deflection, and the ratio of specific heats, this functions returns the angle that is formed by the shock. Default ratio of specific heats is for air
- Parameters
mach (float) – The Mach number before the shock
flow_deflection (float) – The flow deflection angle in degrees
gas (fluid) – A user defined fluid object. Default is air
- Returns
The shock angle
- Return type
float
Examples
>>> import gas_dynamics as gd >>> shocks = gd.shock_angle(mach=2, flow_deflection = 10) >>> shocks [23.014012220565785, 96.29991962425305] >>>
- gas_dynamics.shocks.shocks.shock_mach_given_angles(shock_angle: float, flow_deflection: float, gas=<gas_dynamics.fluids.fluid object>) float
Return the Mach number before a shock given shock angle and flow deflection
Notes
Given the angle of the shock and the angle that the flow has turned, return the mach number that preceded the shock.
- Parameters
theta (float) – The shock angle in degrees
delta (float) – The flow deflection angle in degrees
gas (fluid) – A user defined fluid object. Default is air
- Returns
The mach number
- Return type
float
Examples
>>> import gas_dynamics as gd >>> M = gd.shock_mach_given_angles(theta=22.5, delta=10) >>> M 3.9293486839798955 >>>
- gas_dynamics.shocks.shocks.shock_oblique_charts(mach_max=6, gas=<gas_dynamics.fluids.fluid object>, points=40000, dark=True)
Generate 2-D Oblique Shock Charts
Notes
Displays two plots, 1) Mach number versus oblique shock wave angle and the corresponding deflection angles for each case. 2) Mach number versus resulting Mach number after an oblique shock and the corresponding deflection angles for each case. Default ratio of specific heats is for air.
- Parameters
mach_max (float) – The upper limit Mach number for the chart
gas (fluid) – A user defined fluid object. Default is air
points (int) – The number of points to evaluate on the mesh
dark (bool) – Dark mode for the plots. Default is true.
Examples
>>> gd.shock_oblique_charts() >>>
- gas_dynamics.shocks.shocks.shock_flow_deflection_from_machs(mach_initial: float, mach_final: float, gas=<gas_dynamics.fluids.fluid object>) float
Return the flow deflection angle given the mach number before and after the oblique shock
Notes
Given two mach numbers, iteratively solve for the shock angle and flow deflection to satisfy the system.
- Parameters
mach_initial (float) – The initial mach number
mach_final (float) – The mach number after the event
gas (fluid) – A user defined fluid object. Default is air
- Returns
The flow deflection angle
- Return type
float
Examples
>>> import gas_dynamics as gd >>> flow_deflect = gd.shock_flow_deflection_from_machs(M1=3, M2=1.5) >>> flow_deflect 28.589471710648365 >>>