Throughout the entirety of my commentary before, I dealt solely with fluids whose density was always constant. Although this is usually an excellent approximation, there are in fact situations where the change of a fluid’s density is not only important but useful—in these situations, we unsurprisingly label the flow as compressible.

In Part II, I had mentioned that for fluids in general, a fluid’s density was a function of pressure: . The reason we’re able to make the assumption that most fluids are incompressible is by guessing (and hoping) that this function is relatively “flat”; that is, that large changes in the pressure generate small changes in the density, small enough to ignore. If we wanted to fully understand compressible flow, we would need a full understanding of the function , which is more in the realm of thermodynamics than fluid mechanics. But for many purposes, we only need to understand how the density of a fluid changes when its pressure changes—and if the range of fluid densities in a given scenario we’re studying is sufficiently small, then that density/pressure change ratio is essentially constant and only a property of the fluid in question.

It may seem like we need to overhaul the entire conceptual infrastructure I built up before to analyze compressible flow, but it’s actually surprisingly simple to handle! Consider the construction we were handling in Part V, where we used a control volume analysis inside of a pipe with a changing cross-section to study the key equations that governed steady flow within such a pipe; the fundamental equations of hydraulics. If I make the same assumptions I made in Part IV—the flow is steady, velocity always points directly into the pipe, etc.— but now consider that the densities at the inlet and outlet may be uniform, different values, control volume analysis dictates that the amount of mass flowing into the pipe needs to be the same as the amount of mass flowing out of the pipe. Mathematically, this translates into:

If I integrate this and only focus on average quantities as I did in Part IV, we find something suspiciously similar to the first fundamental law of hydraulics:

This naturally simplifies into the first fundamental law when the densities are the same.

Similarly, a control volume analysis on the momentum within such a pipe returns what is essentially the second fundamental law of hydraulics we derived in Part V, except with the inlet and outlet densities made distinct:

The density in the gravitational term is now the average of the densities at the inlet/outlet, and the momentum flux contributions into/out of the pipe now depend on their respective densities. So far, so good! But I’ll quickly mention that there’s another convenient but essentially equivalent formulation of these equations that will prove very useful—consider what happens if I take the compressible conservation of mass equation, move everything to one side, and divide both sides by the length of the pipe in question:

In the limit where the pipe length becomes very, very small, the term in the above equation behaves like a derivative! And so by defining a “pipe direction” , we can alternatively describe conservation of mass/the first fundamental equation through such a pipe using the following differential equation:

The same process generates the following differential description of the second fundamental equation of hydraulics:

So now that we’ve gotten all that sorted out, what the heck can we actually *do* with these formulations of compressible hydraulics? Well, here’s a question we can tackle—what flow (if any) does a small change in fluid density generate?

To start, let’s consider steady flow within a horizontal pipe with a constant cross-sectional area, where the pressure and densities of the fluid in the inlet/outlet are uniform, unchanging and only slightly different. We can also make the pipe section very short—short enough to make the momentum losses within it negligible. This rapidly simplifies a lot of the content of the second fundamental equation:

We can then ask ourselves what the flow speed through such a pipe must be in order for the small differences in density to be sustained steadily. To do so, we can hypothesize that the speed throughout the pipe section is a uniform constant value —this is a good approximation, since compressible conservation of mass predicts small speed changes for small density changes—and see how such a speed would depend on the changes in pressure/density.

Inserting this hypothesis into the second fundamental equation gets us:

Because we had said that the differences in pressure and density were very small, we find a familiar term appear when we make those differences very small:

This is an interesting, nonintuitive result; if the density of a fluid changes somewhere a little bit, a flow towards the lower density direction will be generated with speed that only depends on the way a specific fluid generates pressure differences as a result of internal density differences. This particular type of flow is commonly called **sound**, and the flow speed is a property of a given fluid called its speed of sound. And because we had stated most fluids generate small density changes for large pressure differences , we should expect speeds of sound in general to be pretty big; 343 meters per second in air, and 1481 meters per second in water. That’s pretty fast!

There’s another question we can ask about compressible flow—how does it behave inside of horizontal pipes where the cross-sectional area is *not* constant? We can start by thinking about what happens for a fully incompressible flow inside such a pipe; as the first fundamental equation of hydraulics indicates, a decrease in cross-sectional area is directly connected to an increase in speed, and the second fundamental equation of hydraulics indicates that that speed increase must lead to a drop in pressure. One can imagine that if one takes this to the extreme, the drop in pressure becomes large enough that the density of the fluid begins to change. So what happens when that occurs? (Be warned: what follows will be an absolute mess of algebra.)

Let’s start by looking at the differential form of the first fundamental equation for compressible flow:

Expanding it out, we can spot the term introduced by compressibility immediately—the density change term.

Because we know that changes in the density are introduced by changes in pressure, we can introduce the speed of sound into the mix:

Now we need to handle the pressure change term. Luckily, we have the differential form of the second fundamental equation to help us out! Applying it to this system, getting rid of gravitational terms since the pipe is horizontal (reasonable), and neglecting momentum loss (somewhat unreasonable, but oh well), we obtain the following:

Expanding out, and noting that , we get:

Isolating the pressure derivative term:

Inserting this big mess into that first equation with the speed of sound in it that we were dealing with earlier leads to:

Dividing everywhere by and grouping everything that’s multiplied by either the speed derivative or area derivative results in:

Look at that—we managed to group everything that involves the pressure and the density into one term! And luckily for us, that term is usually small enough to neglect—we had already claimed that the speed of sound is usually very large, so it stands to reason that pressures need to be very high in order for that term to matter. Neglecting that term, and solving for the area derivative, we find:

Alright, that’s enough algebra for today—now let’s try to pull some useful facts out of all this baloney.

Consider what would happen if I was a rocketry engineer and was trying to design a rocket nozzle—because I know that ejecting fluid at high speeds gives me more thrust, I want to try and design a nozzle that speeds up the fluid as much as possible within it. For a completely incompressible fluid, the obvious answer is to make the nozzle decrease in cross-sectional area, as this leads to a proportional speed increase by conservation of mass. You can also see this in the above equation when the flow speed is sufficiently low; area and speed are both positive quantities, and is negative for speeds below the speed of sound, so the area derivative needs to be negative for the speed derivative to be positive. But as the flow keeps speeding up, something curious happens; once the flow gets faster than the speed of sound, the sign of the term flips and becomes positive! Consequently, the area derivative needs to be positive for the speed derivative to be positive, which is the exact opposite of what was going on below the speed of sound. For speeds faster than the speed of sound, the nozzle’s cross-sectional area needs to start getting bigger in order to accelerate the fluid more.

As a result of all of this, your rocket nozzle design would look like a pipe that gets smaller in radius until the point you predict the flow hits the speed of sound, and then the pipe would start getting bigger again up to some radius based on your operating design. This is precisely why basically all rocket nozzles have that quasi-hourglass shape!

Physically, what’s happening is that two effects compete to speed up/slow down a compressible fluid—the effect you see in incompressible flow that causes flow to speed up/slow down when the cross-sectional area decreases/increases, and the slow down/speed up caused by the fluid density increasing/decreasing as a result of “squeezing”/”spreading out” when the cross-sectional area of the pipe decreases/increases. When the flow speed is below the speed of sound—commonly called subsonic flow—this first effect wins out. When the flow speed is above the speed of sound—commonly called supersonic flow—the second effect dominates. And the threshold between them can be quantified by the dimensionless number that is the ratio of the flow speed to the speed of sound of that fluid, commonly called the Mach number; when the Mach number is above 1, the flow is supersonic.