Saturday, November 28, 2020

The Summer of Heat & the Winter of Desiccation

Thanksgiving put baking on my mind, and I started thinking about a post I wrote several years ago about baking a cake in different sized pans. I had been concerned in that post that I didn't take into account the evaporation of water from the cake, which would change the way it heated. This week though, I thought of a way to account for that, and decided to follow up on my previous post (and continue the French Revolution theme).

To recap, my mother Sally was baking a cake, but her pan was smaller than the recipe called for. That meant the cake would be thicker, and she wondered how that would change the cooking time. The key to figuring out how temperature changes spread through an object is the heat equation:

This says that the change in temperature at a point is proportional to the variation in temperature at the surrounding points. I mentioned last time that it was the proportionality constant, α, that depended on the moisture content of the cake batter. I realized that we could account for a changing amount of water by varying α according to

where m is the mass of water and of other ingredients in the cake, and α the individual diffusivities. I was surprised to find that a group of food engineers (!) had actually measured the thermal diffusivity of flour. Taking a sheet cake recipe as an example, we can approximate the amount of liquid (~water) and the amount of flour to get the effective α.

It still remains to determine how the amount of water changes over time. I looked into a couple ways to tackle this, and I'm not sure how accurate my technique is, but it made the most sense to me: The particles of a substance at a certain temperature have a statistical distribution of energies. For ideal gases, there's the Maxwell-Boltzmann distribution, and even though that's not a great model for liquid water we'll go for it. It takes a certain amount of energy for water to evaporate, called the heat of vaporization. If we assume that all the molecules with this much energy do leave the solution, we can keep track of the current number of water molecules still in the cake. Taking out those high-energy particles will also cool the cake, so we can figure out the temperature change with the heat capacity.

I updated the previous code to include these new modifications. Once again, we start off by measuring the temperature after a given amount of time using the wider pan:

In contrast to the previous results, the center temperature goes well above water's boiling point! We can also look at how the amount of water changes over time:

I was surprised to see that the center of the cake experiences almost no loss in water. Even the edges don't lose much – The color scale varies from 50 to 60%. To check what effect the loss of water has, I reran the test with the same α calculated above, but left the amount of water constant. The results are almost identical:

As in the previous post, we can use that central temperature as a target for the narrower pan, and find the cook time:

As before, we get about 70 minutes, suggesting the water content is not as significant as I imagined. A big part of physics is figuring out what you can approximate, and what you can't – which results are "good enough". It seems cakes can be quite forgiving when it comes to baking precision!

Sunday, November 22, 2020

Sowing Division

We have several recipes that make 6 servings, and I always have a hard time dividing them equally. It seems I have an easier time splitting things in 2 rather than 3 or other divisions – I assumed this was a human tendency, but I can't turn up anything from searches. While cutting up a casserole one evening, I started thinking about how after cutting 1/3, the next cut would be half of 2/3. Instead of making that cut, I could mark the half and then flip the relation: I have a new 1/3, and I can split the remaining 2/3 in half.

We can put this idea in more mathematical terms: I want to place points a and b on a line of length 1 so that a = 1/3 and b = 2/3, but I can only put them at halfway points. If we start with a0, then b0 goes at (1 + a0)/2. If we keep going back and forth, then

Writing out the first few terms of the sequence for a lets us identify it:
The term in the parentheses is a geometric series, which can be replaced with a simple form. After some rearranging, we get

I realized this technique could be applied to any number of cuts by adjusting each to the center of the two neighboring cuts. Finding an expression for the general case is "left as an exercise to the reader" (textbook cop-out) – I just tossed the algorithm into Python. The main thing I was interested in was how long it takes to get an accurate estimate of the divisions, so I plotted the RMS error at each step:

Each line represents a different number of cuts. Notice that the y scale is logarithmic, meaning these straight lines actually represent exponential decreases. The line for 2 cuts into 3 pieces drops so quickly, it appears to run into some precision error. As the number of cuts increases though, the error is much more difficult to reduce. To get a more concrete handle on this plot, I also made an animation of the cuts as we make iterations:
For the first step, the divisions are evenly distributed at the two endpoints, which is really a worst case scenario. However, we can see how quickly the 2 cuts on the first line settle in place. Moving up the plot, each line takes a little longer to stabilize.

I'm not sure my serving-precision needs are high enough to require actually using this technique, but it was interesting to think through!

Sunday, November 15, 2020

Eule Slick

A couple months ago, I talked about the LIGO work I'm doing here in Florida, but I'm also working on the LISA project, a gravitational wave detector in space. The detector consists of 3 spacecraft that orbit the Sun trailing slightly behind the Earth:


Recently I've been developing a simulation of the LISA spacecraft, specifically their orientation to face each other. This gets into a part of Physics that I don't have a lot of experience with: rigid-body dynamics.

Most of the time, physicist can get away with considering things to be points or spheres, but things get more complicated with asymmetrical objects. Suppose we have a box that we want to rotate around two axes, x and y. Depending on which we do first, we get different results:

To get around this ambiguity, the mathematician Leonhard Euler (pronounced "oiler") realized you can specify the orientation of a 3D object by defining 3 rotations from a principle set of axes:


I won't get into the details of how the angles are defined, but the result explains some really interesting effects. Here's a video recorded by a NASA astronaut aboard the space station of a "T-handle" spinning:

That strange tumbling behavior is explained by Euler's rotation equations:
where ω is the angular velocity, and τ is the torque applied. The I is the moment of inertia tensor, which requires some explanation: Simply put, it's the rotational equivalent of mass, which quantifies how a torque relates to an angular acceleration. What complicates things is that I depends on your choice of axes. It's a simple diagonal matrix in the frame where the T-handle is fixed, but that frame rotates. The fact we're working in a rotating frame results in the second term in the equation above.

Here's where the Euler angles come in: The differential equation above tells us how the angular velocity is changing, but we're interested in how the orientation of the handle changes. We need to relate the angular velocity to the change in the Euler angles, and include those in our integration. Putting everything together, we can simulate how the handle reacts to an initial rotation.

First with the spin perfectly aligned, nothing too interesting happens:

If we introduce just a 2% offset in the angle though...

we see precisely the sort of flip from the video! I've said it before here, but this is why I love Physics: With just a few relatively simple equations, you can explain even the weirder parts of reality.