Pages

Saturday, December 7, 2024

Re: Re: Re: Charge

A topic of much debate when using battery-powered devices, like phones, laptops, or electric toothbrushes is, how often should they be charged? The main schools of thought are, charge whenever you have power available, or charge only when the battery dies or is low. I tend to subscribe to the second theory, on the principle that batteries are typically rated for a fixed number of charge/discharge cycles. My laptop has some built-in protection that limits how often it charges:

Batteries work through a chemical reaction between two reactants suspended in an electrolyte. Electrons pass between the reactants, creating a current and dissolving some of the reactants into the electrolyte. This is a bit oversimplified, but I am, after all a physicist, so that's how I like things. I wanted to see whether this model could back up my charging habits.

The setup I settled on was several electrodes, each surrounded by a block of reactant, and the whole thing surrounded by electrolyte. Then I put the system through several charge/discharge cycles. During each discharge step, we find all the reactant that's in contact with electrolyte, and dissolve it into electrolyte with some probability. During charging steps, we do the reverse: Find electrolyte in contact with either reactant or electrode, and precipitate reactant with some probability. We keep track of how many changes happen each cycle, which corresponds to the amount of current produced, and we vary the number of repeated discharge steps before switching to charging, and vice versa.

There's a lot of parameters to tune here (probability of state change, number of electrodes, amount of electrolyte), so I haven't come close to exploring the full space, but I'm still pretty happy with the results. This case used 200 steps for each discharge/charge cycle:

You can see we use up most of the reactant (yellow) on each cycle. If we switch to only 80 steps, things look a little more ragged:

We can measure how much reactant is around at the start of each discharge, and plot how it changes as we go through cycles for several different cycle lengths:

For all but the extreme 2-step case, these quickly reach an equilibrium max charge (plotted as a fraction of the initial). I was curious what was going on with 2-steps, so I plotted what it looks like at the end of the simulation:

Because of the way I set up the cycling between dissolution and precipitation, the system tends toward holding only as many as it adds on during charging – That's the source of the pattern in the max charge plot above, and not (as I initially thought) my belief about battery health. As result, I think I have to consider this sim inconclusive as far as charging habits. Maybe I'll do a followup later (which will of course be called "Re: Re: Re: Re: Charge")!

Saturday, October 26, 2024

A Mass of Incandescent Gas

[Title from They Might Be Giants.]

This week, I got a question from my father Steve: We're able to identify the source of nuclear materials used in reactors and weapons from their isotope ratios. Could we do the same thing to figure out which star material that hits Earth came from?

First, let's talk about isotopes: Atoms are made up of a nucleus or protons and neutrons, surrounded by a cloud of electrons. The number of protons tells you what element the atom is – one for hydrogen, two for helium, and on down the periodic table. The number of electrons tells you the charge of the atom – neutral if it's equal to the number of protons, negative or positive for more or fewer electrons. Finally, the number of neutrons tells you the isotope – These are variations on the same element. For example, most carbon on Earth is called carbon-12, which has 6 protons and 6 neutrons for a total atomic mass of 12. However, some is carbon-14, which has 6 protons (since it's still carbon), but 8 neutrons. This configuration is unstable, and gradually decays to carbon-12. The mixture of carbon-14 and carbon-12 leads to radiocarbon dating, which is used in archeology to measure the age of excavations.

Natural uranium is almost all U-238, with small amounts of U-235 and a few other isotopes. Putting it in a nuclear reactor though will change those ratios. As the U-238 decays, it loses neutrons, raising the amount of U-235 present. The amount of U-235 in a sample can be further increased through enrichment, which uses various methods (often advanced centrifuges, which come up in nuclear policy) to separate the lighter U-235 from the heavier U-238. There can also be other isotopes of other elements mixed in depending on the exact process a reactor was using.

Now to stellar compositions: Stars are mostly made up of hydrogen, but the star's mass causes the hydrogen to fuse into helium, releasing energy that helps keep the star from collapsing. Helium can fuse too, and that can continue a few steps down the periodic table, but it's limited, typically petering out near iron:

Wikipedia (Click to enlarge)

The elements in yellow may be present in an active star, and will be spread around the universe when the star eventually explodes. We can find which are in a given star by looking at their absorption spectra:

Wikipedia

The star emits light in a black-body spectrum due to its heat, but the elements it contains will absorb some of that light, leading to dark bands on the spectrum. The frequencies (colors) of those bands correspond to different elements that let us determine the composition of the star.

Now to Steve's suggestion: When massive particles hit the Earth, could we use their makeup to associate them with a particular star? To my understanding, the answer is no, the particles that hit us are typically single protons or neutrons, not entire atoms, and certainly not the collection of atoms that would be needed to find a concentration of certain isotopes. There's another problem too: Uranium and other elements typically associated with isotopic signatures aren't present in active stars – If you look at the table above, you see those need neutron star collisions to form.

So it seems this idea won't work for distant stars, but if we screw things up badly enough on Earth, future scientists will be able to figure out where things went wrong, and curse that we ever trusted Mr. Clevver.

Sunday, October 13, 2024

Zooming On My Cycle

I started my job with the University of Florida in April 2020, right as the COVID work-from-home policies were starting up. As a result, all my meetings are conducted over Zoom. Now and then I get a little bored with the subject at hand (but only very rarely!) and I start thinking about the layout of the meeting participants on my screen:

I try to move my mouse from each window to an adjacent one, visiting each once and returning to the start. This type of problem is the subject of graph theory, which assesses the attributes of nodes (the windows in this case), which are connected by edges (whether two windows are adjacent). The quality we're looking for is called a Hamiltonian cycle. My various meetings have different numbers of participants, and I've been fascinated by whether a given arrangement contains one or more of these cycles.

It turns out this problem is in a category called NP-complete, which is broadly defined as problems that are hard to find solutions for, but easy to check if a given answer works. In this case, given a path through the windows, it's easy to check we visit each once and end at the start, but the only way to find those is to check every possible path. As long as the number of nodes is small, this isn't too taxing, but the complexity scales quickly as we add more people.

Luckily, Zoom only puts 25 people on the screen at a time, and will break the group into pages if there are more. That means I can make a script to test every case! I used the package NetworkX to handle the connections between nodes, which let me generate paths to check. The animation below pages through different numbers of meeting participants, and gives the number of unique cycles at the top.

I find it really interesting how the number of cycles relates to the number of nodes: Even ignoring the drops to zero, the numbers aren't strictly increasing. I'm also surprised by the high numbers of cycles for the bigger groups – I usually only find 1 or 2 before I manage to refocus on the meeting!