Shortly after Marika and I got our car, we installed a roof rack to carry our cargo box for camping trips. The first time we drove on the highway with it, we suddenly heard a clear, crisp note from above our heads. As our speed changed, the note would suddenly shift to a new pitch, just as clear. The roof rack has a channel running down the center of its length, with a rubber seal on top that opens on each end. I realized it was acting exactly like a flute – Air blown across one end of an open tube was resonating at a specific frequency. I had hoped to make a simulation of this at the time, but I couldn't get my head around the equations involved.
Some time later, I found this wonderful interactive simulator, and tried adapting that to this situation, but now the obstacle was introducing the pipe geometry. Finally this week I looked again, and was saved by Daniel Schroeder, who introduced me to the HTML5 simulations I've shown here. Schroeder's demo shows how a steady stream past a barrier can create vortices, but we want a tube with an opening on top. Here's the boundary I came up with:
Now we can see what happens to air moving left to right. The simulation used here keeps track of the density and velocity of air at each point. To get the next state, it uses the Lattice Boltzmann method, which involves two steps: collision and streaming. The collision step changes the velocity in each cell to push the system toward equilibrium, and the streaming step uses those velocities to shift the density between cells. You can find my adaptation of Schroeder's code here. I found that this setup would pretty quickly reach equilibrium, but to get sound we need oscillation. Adding a little bit of noise allowed it to settle into an oscillating pattern. Looking at the full map we can only really see the transients (though those are pretty nifty):
If we instead focus in on the opening of the tube, we can see the density oscillating around a central value, which is exactly what we need to get sound:
Now on to the pitch question: We can measure the relative strengths of the frequencies using an amplitude spectral density, and see how it changes for different speeds.
Sharp peaks indicate a clear note, and we can see a few here, separated by the different speeds. This is exactly what we experience in the car, and it's pretty cool to see it show up in such a pared down model – One of the things I love about physics!