How an astrophysicist uses Codex to help simulate black holes
Codex helps Chi-kwan Chan to refine and test algorithms that simulate the movement of electrons and ions around a black hole.
The gravity around a black hole is so extreme that nothing, not even light, can escape once it gets close enough. Astrophysicists like Chi-kwan Chan study black holes with computer simulations and observations. But current algorithms and computing power limit how realistic those simulations can be.
With Codex, Chan—a researcher at the University of Arizona and Steward Observatory—is tackling this problem.
Black holes are among the best places to test Einstein’s general theory of relativity, he said. The theory is currently our best explanation of gravity: instead of a force pulling objects together, gravity is the result of mass and energy bending the fabric of space and time.
Chan is part of the international Event Horizon Telescope (EHT) collaboration, which published the first image of a black hole in 2019. The team is currently gathering observations to produce the first video of a supermassive black hole, focusing on the one at the center of the M87 galaxy.
But turning observations into scientific understanding requires enormous amounts of data processing, large-scale computing workflows, and simulations capable of modeling some of the most extreme physics in the universe.
Since light can’t escape a black hole, scientists instead study the region around it called the event horizon, a boundary beyond which matter can’t escape. “It’s a surface of no return,” said Chan. Matter swirling just outside this boundary emits light that astrophysicists can see, measure, and simulate.
The 2019 image released by the EHT showed a black hole’s shadow embedded in glowing plasma near the event horizon. Chan helped develop the simulation and computing tools the team used to interpret the observations. Since then, Chan and his colleagues have continued improving their instruments and observing capabilities as the team moves from still images toward videos.
A short video generated by a supercomputer simulation showing the movement of plasma around the black hole at the center of the Milky Way galaxy.
Credit: EHT Theory Working Group / CK Chan
Addressing a spiraling problem
One of the biggest roadblocks for Chan and his team is modeling the plasma around black holes. Plasma is superheated matter made up of electrically charged electrons and ions.
In many simulations, scientists simplify plasma by treating it like a fluid, using well-known equations to model its movement around a black hole. That works reasonably well in denser plasma where the electrons and ions constantly collide with each other.
But near the supermassive black holes that Chan and his colleagues are studying, some regions become so hot and diffuse that particles rarely encounter each other. “They don’t really collide with each other,” he said. Instead, the particles mostly spiral around magnetic field lines.
To model that behavior correctly, researchers need to follow trillions of electrons and ions as they rapidly corkscrew around a black hole. Standard simulations must calculate every tiny turn, forcing computers to take extremely small timesteps.
As a result, even the world’s fastest supercomputers can spend most of their time calculating these minuscule particle motions instead of simulating the larger behavior scientists actually want to study.
“For decades, this has limited how realistically we can simulate black hole plasma,” Chan said.
Using AI to build a better digital twin
Chan suspected that new mathematical techniques could help work around some of these limitations. The basic idea was to change, mathematically, how the simulation tracked particle motion so the computer no longer had to follow every tiny spiral directly.
“But exploring all the mathematical possibilities by hand would have taken an enormous amount of time,” Chan said. So he turned to Codex to help derive candidate algorithms and test them against known solutions.
Codex generated many potential approaches—not all of them correct. “But that’s okay,” Chan said. “Most scientific ideas fail. What matters is that these algorithms are testable. Once you find one that works, it can potentially unlock simulations that were previously impossible.”
Some AI systems can return results without showing the steps they used to produce their conclusions. But Chan’s group uses Codex to propose and implement numerical schemes that they can inspect, test, and understand physically.
Large language models still make mistakes, and many scientists remain cautious about using AI in research. But Chan believes science may be one of the best uses for today’s AI systems precisely because scientific ideas can be tested rigorously.
“We don’t accept an idea because it came from Einstein, from a bright student, or from an AI model,” he said. “We accept it only after repeated testing.”
Chan sees AI as a tool that can help researchers explore more ideas, test them faster, and accelerate discovery while remaining grounded in verification and reproducibility.
If the approaches that Chan is testing with Codex succeed, the new algorithms could eventually allow scientists to simulate trillions of particles around black holes. That would enable researchers to study physics that has remained out of reach for decades.
- 2026