Pages

Sunday, May 12, 2024

Whistle While You Wheel

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!

Sunday, May 5, 2024

Making a Spectacle

This week I noticed something interesting about my shadow: I could see the lenses of my glasses casting a dark spot with the rest of my head. This made me curious, since I can see through my glasses, meaning light is passing through them, so why would they cast a shadow? Taking them off revealed an even more interesting effect:

There's a dark spot in the center, but a magnified brighter area around it. I decided to try some ray-tracing, a technique in optics where we consider beams of light coming from a source and follow their path through a system. Often this is done using matrix optics, in which lenses and other elements are represented by matrices which are multiplied together to create a system. Rather than deal with that directly though, we can use Python's RayTracing package to handle the math for us.

Lenses are typically defined by their focal length, which specifies the distance from the lens where parallel beams passing through it converge. However, glasses prescriptions are given in diopters, which are the inverse of the focal length. I'm nearsighted, which requires a lens around -5 diopters. The negative means that the convergence point is on the same side of the lens as the source. This is a little clearer with a diagram: Since the Sun is far away, its light is roughly parallel, so we can look at what my lenses do to a bunch of parallel beams (click to enlarge):

This shows the light being spread out by the lens – If you follow those lines to the left, they converge on the opposite side of the lens, corresponding to the negative focal length.

That accounts for the magnified bright spot we saw above, but it's only considering the light that goes into the lens – There's also light that goes past the lens on the sides. We can add together this light with what was redirected by the lens to get the total image:

The different lines show distances from the lens to the surface of the shadow. As in the picture that started this, we see a dark spot surrounded by a brighter area! What's interesting is that, because the beams from the Sun are parallel, the shadow (drop in intensity) stays the same size for all the distances, but the brighter area gets bigger or smaller. I've been wearing glasses since the 4th grade, but somehow this is the first I've wondered about their shadow – One of those blind spots that seems obvious once you see it.