Simulating a Supersonic Flow over a Step with CFD
What happens when a supersonic fluid flow collides with a forward facing step? Decades ago, scientists around the world scrambled to develop methods to accurately simulate this scenario using computational fluid dynamics (CFD). Now, thanks to a few decades of computing innovation, casual CFD enthusiasts like myself can investigate this problem using ordinary personal computers.
For this project, I used OpenFOAM 7. OpenFOAM is a trusted CFD package written in C and available for free.
To simulate a flow over a step, I needed a step. CFD simulations often involve a mesh, a predefined grid that instructs the program where to calculate results. I built two meshes: one with 50,000 points and one with 100,000 points. In practice, meshes with more points often yield more accurate results.
Although I simulated a 2D flow, the mesh is technically 3D.
To simplify the results, I normalized the properties of the fluid I was simulating:
- Inviscid
- Ratio of specific heats of 7/5 = 1.4
- Temperature of 1 K
- Speed of sound of 1 m/s
Using that information, I calculated the molecular weight as follows:
I aimed to simulate a supersonic fluid flow. A flow is supersonic if it’s faster than the speed of sound. Specifically, I set the incoming flow to be at mach 3.
After adjusting the parameters as described, I simulated 4 seconds of the flow with a time-step of 0.002 seconds. This means that I calculated properties of the flow at 500 separate points in time.
Using ParaView, a free visualization tool developed by KitWare, I visualized the evolution of the flow’s velocity over time.
In the image above, the flow nears zero velocity on the face of the step. This makes sense; it has nowhere to go! Oppositely, the flow’s pressure reaches a local max on the face of the step. This point is known as a stagnation point. The pressure at the stagnation point is known as the stagnation pressure.
Below is a visualization of the flow’s pressure. Based on the color-bar, the stagnation pressure looks to be around 13 Pascals.
Finally, I visualized the flow’s temperature. As it turns out, the stagnation point gets really hot!
Supersonic flows are often associated with shock waves. According to Wikipedia, shock waves are characterized by abrupt changes in pressure, temperature, and density of the medium. I created a visualization of the flow’s density (rho).
As expected, the density spikes at the flow’s stagnation point.
The entire simulation took about 500 seconds on the mesh with 50,000 points and 1000 seconds on the mesh with 100,000 points. All simulations were ran through Windows Subsystem for Linux on my PC with an 8th generation i7 CPU.
The visualizations represent the results of the simulation with the 50,000 point mesh. The results from the simulation with the beefier mesh were almost identical; it would have been redundant to create separate visualizations.