Pages

Showing posts with label Fluid Mechanics. Show all posts
Showing posts with label Fluid Mechanics. Show all posts

Sunday, January 19, 2025

Beet the Traffic

We watch the local news every morning, and this week a story caught my interest: Alternatives to using road salt to avoid harmful risks. The key point of the story is that runoff from salting the roads can damage the surrounding environment, but adding beet juice to the solution can make it stick to the roads better. Reading up on the idea, I've found it's still debated whether this idea is really better for the environment, but the bit I was curious about is the ability to stay on the road.

Looking into ways I could model this, I found a paper discussing how droplets spread over time based on their surface tension. Their model was a bit more involved than I wanted to get, so I made some simplifications: The droplet takes the form of an ellipsoid with constant volume and circular base. This constrains the relationship between the height and the radius. The paper defines a value they call h* where gravity and surface tension balance. After my simplifications, it takes the form

where ρ is the density of the fluid, g is the acceleration due to gravity, and γ is the surface tension. For a given fluid, we can look up the surface tension and density. I decided to try a salt-water solution (γ, ρ), a sugar-water solution (γ, ρ), and molasses (γ, ρ).

The paper gives a t^1/5 form for the height of the drop, so we can start each of these fluids as a hemisphere and see how they spread as they approach their respective h* values:

This shows the sugar and salt spreading at roughly the same rate, contrary to the idea given in the report, so I expect my model is not capturing all their qualities. What I find really interesting though is that the thicker molasses actually spreads faster, because it's more dense that the other two, so gravity exerts a stronger force. Naturally, this brought to mind a bit of history from my home state, when a flood of molasses from a ruptured tank cut a swath of destruction through Boston!

Sunday, October 6, 2024

Touched By His Noodly Appendage

[Click here if you've yet to welcome the Flying Spaghetti Monster into your heart and stomach!]

Near out house, there a several car dealerships, which have the requisite flailing noodle men out front:


via GIPHY

I was curious whether I could make a simple model of this system that still showed the interesting dynamics. The way I imagined it was a series of joints stacked on top of each other with fixed length, but able to bend left or right. Gravity will bend each joint according to the distribution of mass above it, and the puffs of air will straighten each joint as it passes through.

Since I'm using only 20 nodes, at first I tried to make the pressure changes move between them smoothly, but I couldn't find a good way to do that without adding a bunch more complexity to the simulation, so instead I just had the pressure move to the next node on each step. The air comes in periodic bursts, which I modeled as a square wave, which turns on and off at some frequency. When I tried this model, I got a bit too much flailing, and my noodle person was spinning crazily around the anchor point, so I realized I needed drag.

There are two typical models for drag, both proportional to the object's velocity, but one linear and the other quadratic. I tried the linear case initially, but that wasn't strong enough, so I switched to the quadratic. I makes sense that we would be in the high-drag case, since this is flimsy plastic sheeting pushing against air.

If you'd like to make plans before opening your own dealership, you can find my code here, or you can sit back and watch some joyous flailing from your own home:

Sunday, July 28, 2024

Hyd-Rant

A couple weeks ago, my father-in-law Scott told us about an incident he heard about in a nearby water system (part of his field of expertise): A local fire department was testing their equipment with water from a fire hydrant, and shut off the valve too quickly. The high volume of water that had been flowing through the pipes slammed into the closed valve, and the resulting pressure wave bounced back and caused issues at other points along the water line. Scott mentioned a couple ways to avoid this: A Kunkle valve is designed to release excess pressure to avoid damaging other points along the line, or the firefighters could simply close the hydrant more slowly.

I was curious if I could adapt the same Lattice Boltzmann simulation I used a couple months ago to show the effect Scott was talking about. I had hoped to try including multiple outlets for the water to represent other customers, but it took me several tries to get the simplest case working: Water flows through a single pipe that closes at one end. In the simulation, when fluid hits a boundary, it bounces off, reversing its direction. This is a change in momentum, which is exactly what a force causes. We can use this change in momentum to find the reaction force (equal and opposite, per Newton) that the water is putting on the pipe.

One issue I encountered with the simulation was the spatial resolution: if we make things too coarse, then closing the valve involves big bricks of wall being added at once, which leads to sharp spikes in force. Increasing the number of pixels helps smooth it out, but then it takes longer to run. I didn't get around to trying to add other pipes to the main line, but I'm still quite pleased with the results.

The animations below shows the horizontal velocity of the water at different points along the pipe: red shades are to the right and blue to the left. The valve begins to close at t=100. For the slowest case, I used 600 steps to close it fully:

The fastest case I tried snaps shut in only 50 steps:

Comparing the two, you can definitely see more, and darker, blue in the fast case, indicating significant ricochet from the valve. to get more quantitative though, we can use the force calculation I outlined to find out how badly we're shaking up the system:

The maximum force is clearly proportional to the time it takes to close, but there's also some interesting oscillation from the right/left flows running into each other. You can also see a bit of the resolution effect I mentioned in the spikes along the curve.

When Scott described this, it actually reminded me of something I experienced growing up: At my parents' house, if you shut off the shower too quickly, there would be a sharp "bang!" when the flowing water hit the valve. This is sometimes called a water hammer, and can damage the pipes in your house, just like this hydrant can affect a whole system!

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!