Introduction to compressible flow

This module will introduce the fundamentals of compressible fluid flows, which can behave a bit differently than what you have learned for incompressible flows.

%matplotlib inline
from matplotlib import pyplot as plt

import numpy as np

# Pint gives us some helpful unit conversion
from pint import UnitRegistry
ureg = UnitRegistry()
Q_ = ureg.Quantity # We will use this to construct quantities (value + unit)
# these lines are only for helping improve the display
import matplotlib_inline.backend_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('pdf', 'png')
plt.rcParams['figure.dpi']= 300
plt.rcParams['savefig.dpi'] = 300
plt.rcParams['mathtext.fontset'] = 'cm'

First, let’s consider how a disturbance passes through an elastic medium (solid, liquid, or gas). If we consider the medium to be composed of molecules, then a disturbance on one side will compress the molecules, and this information will be passed along to neighboring molecules, and so on, forming a traveling wave that moves at a particular wave speed. The stronger the traveling wave, the faster it will propagate.

Shock waves

Large amplitude waves, that involve a large change in pressure and density of the fluid. Speed depends on strength of the wave.

Sound waves

Small amplitude waves, where the speed only depends on the medium and its state. Moves at the sonic velocity.

Sonic velocity

The velocity by which waves travel in an elastic medium (like a fluid) to propagate information about an object’s presence.

Sound wave propagation

Consider a piston inside a cylinder, where everything is initially at rest. The fluid properties are velocity \(V = 0\), pressure \(p\), and density \(\rho\).

Then, instantaneously, the piston starts moving with velocity \(dV\) to the left. This compresses the adjecent fluid molecules a small amount. Continued motion will compress more molecules, and a wave front will propagate to the left at the sonic velocity with magnitude \(a\).

However, analyzing this problem is hard, because it is unsteady. Instead, we can change our frame of reference to create a stationary, standing wave by adding a constant velocity of \(+a\) (pointing to the right). Then, we’ll do a control volume analysis of the one-dimensional steady flow around the wave.

First, we can apply the continuity equation (conservation of mass), recognizing that area is constant for our control volume:

\[\begin{gather*} \dot{m} = \rho A V = \text{constant} \\ \rho V = \text{constant} \\ \rho a = (\rho + d\rho)(a - dV) \\ \rho a = \rho a - \rho \, dV + a \, d\rho - d\rho \, dV \\ \rho \, dV = a \, d\rho \end{gather*}\]
(3)\[ \therefore dV = \frac{a \, d\rho}{\rho} \;, \]

where \(d\rho \, dV = 0\) because it is the product of two differential terms.

Next, we can apply conservation of momentum, where we can neglect any shear stresses due to the control volume being infinitesimally small:

\[\begin{gather*} \sum F_x = \dot{m} \left( V_{\text{out},x} - V_{\text{in}, x} \right) \\ p A - (p + dP) A = \rho A a \left[ (a - dV) - a \right] \\ -A \, dP = -\rho A a \, dV \\ \end{gather*}\]
(4)\[ \therefore dV = \frac{dp}{\rho a} \;. \]

We can then combine Equations (3) and (4):

\[\begin{gather*} \frac{dp}{\rho a} = \frac{a \, d\rho}{\rho} \\ \therefore a^2 = \frac{dp}{d\rho} \;. \end{gather*}\]

However, this result is process-dependent. Let’s consider what we can assume/approximate for the current process. If we assume negligible losses, by assuming the wave is relatively weak, then the process is reversible. We can also assume there is negligible heat transfer in such a small region, so the process is adiabatic. With both of these assumptions, the process is isentropic:

(5)\[ a^2 = \left( \frac{\partial p}{\partial \rho} \right)_s \;. \]

This result applies in general to wave propagation through any medium.

We can take it further if we assume we are dealing wtih a perfect (i.e., ideal) gas. In that case, recall our polytropic relations for an isentropic process:

\[\begin{gather*} p v^{\gamma} = \text{constant} \rightarrow p = \rho^{\gamma} \cdot \text{constant} \\ \left( \frac{\partial p}{\partial \rho} \right)_s = \gamma \rho^{\gamma - 1} \cdot \text{constant} \\ = \gamma \rho^{\gamma - 1} \left( \frac{p}{\rho^{\gamma}} \right) = \gamma \frac{p}{\rho} \\ \left( \frac{\partial p}{\partial rho} \right)_s = \gamma R T \therefore a^2 = \gamma R T \end{gather*}\]
(6)\[ a = \sqrt{\gamma R T} \;. \]

So, we see that for a perfect (i.e., ideal) gas, the sonic velocity is a function of the gas and its local temperature only.

Example: air at room temperature

We can calculate the sonic velocity for air at room temperature:

\[\begin{gather*} a = \sqrt{1.4 \cdot 287 \frac{\text{N m}}{\text{kg K}} \cdot 293 \, \text{K} } \\ a = 343.1 \, \text{m}/\text{s} \;. \end{gather*}\]
# Sonic velocity for air at room temperature
gamma = 1.4
gas_constant = Q_(287, 'N*m/(kg K)')
temperature = Q_(293, 'K')

speed_sound = np.sqrt(gamma * gas_constant * temperature)
print(f'Speed of sound: {speed_sound.to("m/s"): .2f}')
Speed of sound: 343.11 meter / second

Important

The sonic velocity is always a property of the fluid and varies with the local state.

Mach number

With the speed of sound defined, we can now introduce a useful nondimensional quantity, the Mach number:

\[ M = \frac{V}{a} \;, \]

with different regimes:

(7)\[\begin{align} M &< 1 : \text{ subsonic} \\ M &= 1 : \text{ sonic} \\ M &> 1 : \text{ supersonic} \end{align}\]

Equations for perfect gases

By taking our new relationships for Mach number (\( V = M a \)), the speed of sound (\( a = \sqrt{\gamma R T} \)), and the ideal gas law (\( p = \rho R T \)), we can get convenient equations that apply to ideal/perfect gases.

Continuity equation:

\[ \dot{m} = p A M \sqrt{\frac{\gamma}{RT}} = \text{constant} \]

Stagnation relationships:

(8)\[\begin{align} h_t &= h \left( 1 + \frac{\gamma - 1}{2} M^2 \right) \\ T_t &= T \left( 1 + \frac{\gamma - 1}{2} M^2 \right) \\ p_t &= p \left( 1 + \frac{\gamma - 1}{2} M^2 \right)^{\frac{\gamma}{\gamma - 1}} \;, \end{align}\]

where the subscript \(t\) indicates the stagnation or “total” property.

Stagnation-pressure energy equation:

\[ \frac{dp_t}{p_t} + \frac{ds_e}{R} \left( 1 - \frac{T}{T_t} \right) + \frac{ds_i}{R} + \frac{\delta w_s}{R T_t} = 0 \]

For adiabatic, no-work flows:

\[ \frac{p_{t2}}{p_{t1}} = e^{-\Delta s/R} \]

Important

This last relation shows that, for a no-work adiabatic process, stagnation pressure \(p_t\) is constant if there are no losses (i.e., \( \Delta s = 0 \)), or drops if there are any losses/irreversibilities in the system (i.e., \( \Delta s > 0 \)).