Simulating Reality: Where Games and Science Meet
What do you think about when you hear the word simulation? A quick search on Google indicates that a popular thought is whether we live in a simulation, e.g., The Matrix. The idea has been around for decades, but recently, it has been rekindled by advancements in virtual reality (VR) technology. It is arguably true that VR technology is precisely the path that will one day lead us to the “Matrix”—an entirely simulated world. What, then, has changed since the year 1999 (when The Matrix was first released) that made a sci-fi concept appear realistic today?
To simulate reality, we need two things: first, a very powerful computer. If you purchase a home computer today, you may notice that sometimes, there is an expensive component that you would not find twenty years ago. It typically costs more than your CPU, motherboard, RAM, or hard drives—sometimes even all of them combined. It is called a GPU, or Graphics Processing Unit, the reincarnated version of what was once called a display card.
You can think of a GPU as a second brain in your computer. The main brain, the CPU, does most of the complicated tasks, such as communicating between different devices, organizing task schedules, and shuffling data. Meanwhile, the GPU does one thing only—it crunches numbers. This simplicity is inherited from when it was still a display card, but now, instead of just calculating the color of your monitor’s pixels, it does much, much more.
This takes me to the second ingredient in simulating reality: the knowledge of how reality works. What is “real”? What seems real or natural to you? How leaves fall from a gust of wind, a lamp illuminates a room, or water flows in a kitchen sink, must all follow particular patterns in order to seem natural. These patterns are dictated by natural laws and can be computed given those laws. If that sounds like physics to you, that’s because it is.
As it turns out, the fastest, most efficient way to make a virtual world seem real is to simulate reality using the laws of physics. Some decades ago, the gaming industry realized this, and became motivated to solve physical equations as fast as possible. Back then, only supercomputers, which are clusters of many CPUs connected together, could solve these equations sufficiently fast. Clearly, they could not expect gamers to have these kinds of resources. No, they needed an average person in an average household to have access to the kind of computational power that state-of-the-art science used. Millions of dollars in research and development later, they found the answer in GPUs.
From this point on, the line between “virtual” and “reality” started to blur, and so did the line between games and scientific simulations. From gas dynamics (explosions), mechanical motion (gun shots), to ray tracing (cinematic graphics), behind every immersive gaming experience are GPUs performing the incredible feat of solving the laws of physics in real time.
As a computational astrophysicist, I could not be happier about this somewhat accidental alignment between myself and the gaming industry. I, too, simulate reality. I, too, want to solve physical equations as fast as possible. So, piggybacking on this computational paradigm shift, I write my programs to run on GPUs. Though the questions I ask relate to how planets form.
You may know that about 99.9 percent of the mass in the solar system is in the Sun; in other words, planets are formed from the leftover material of star formation. When a star forms, some material avoids falling onto the star, and instead becomes a surrounding disk, in a fashion similar to Saturn’s rings, but larger by about a million times (literally). Because planets arise from these disks, we name them protoplanetary disks. In my research, I simulate the interaction between forming planets and their natal disks. These simulations offer insights into how planets form and grow, and also how protoplanetary disks are modified by the presence of planets. The latter is useful for spotting planet formation in action, which may appear as gaps, spiral structures, or other asymmetries in the disks.
To say I simulate protoplanetary disks is a jargony way of saying I simulate gas orbiting a thing with gravity (the star). Fluid in space and fluid on Earth are governed by the same type of equations. In fact, fluid in space is the same as fluid in games. Then, as one might expect, GPUs perform well with my kind of simulations. Over the years, I have developed a GPU-based simulation program specially designed for protoplanetary disks, which I named PEnGUIn (a very forced acronym. Don’t ask.) In its latest version, it is able to simulate the motion of gas, representing hydrogen and helium gas in protoplanetary disks, and solids, representing icy or rocky particles, simultaneously.
Most of my simulations are run on desktop computers not unlike the one you may have at home (okay, I have a $3000 GPU in mine, but otherwise it is still a regular desktop.) Even with my rather “homemade” equipment, my collaborators and I managed to publish some cutting-edge simulations. In a paper titled “Circumplanetary Disk Dynamics in the Isothermal and Adiabatic Limits,” we pushed the resolution of our simulations higher than ever before and were ultimately able to confirm the formation of circumplanetary disks—mini disks that form out of the material in the protoplanetary disk but encircle planets as small as the Earth.
Moons and satellites are expected to form out of circumplanetary disks. The giant planets in our solar system, Jupiter, Saturn, Uranus, and Neptune, all host extensive satellite systems, and so they likely harbored circumplanetary disks in their early days. The smaller planets, Mercury, Venus, Earth, and Mars, have far fewer satellites, and so it was believed that they never had circumplanetary disks because their gravity is too weak. In our work, we showed that instead of the planet’s mass, the more decisive factor is thermodynamics. Gas that cools faster is more likely to form circumplanetary disks. Perhaps the giant planets had circumplanetary disks not because they are massive, but because they are further away from the Sun where the gas is less dense, leading to faster cooling.
As much as I (and many other scientists) have benefited from technology developed by the gaming industry, the relationship between games and science is more of a symbiosis. Scientists are the ones who uncover the laws of physics, and sometimes the ones who develop novel, more efficient algorithms to simulate them. For instance, in a paper titled “A Staggered Semi-Analytic Method for Simulating Dust Grains Subject to Gas Drag,” we found a way to save a lot of time when simulating particles that experience strong gas drag. This and a number of other innovations are also included in PEnGUIn, many of which I came up with during the six-month lockdown we have had. Perhaps some of these algorithms will one day be pulling the strings behind a waterfall or a cloud in your virtual world.
Enough rambling. If there is a message here, maybe it is that there is a lot of science in games, and a lot of games in science. Or the message is that you don’t need to worry about The Matrix because to build it, you need the scientists too, not just the machines. Or, maybe the real message is that you should watch The Matrix if you haven’t already.