Monday, March 11, 2024

Creeping toward the Matrix

 kw: book reviews, nonfiction, cosmology, simulation, modeling

I was for several years, in my career of writing scientific software, the leader of a "Modeling and Simulation Group". One of our products had three sections, simulating first the geochemistry of crude oil generation from organic matter in deep rocks (up to a few kilometers), then the upward migration of the petroleum liquids through porous rocks, and finally their entrapment against nonporous, or less porous, rock layers to form oil and gas reservoirs.

I was sent to a few exploration offices to show off the software. In one instance, after the geologist set up access to a set of grids based on seismic data, I ran the software, which displayed the progress through time of oil and natural gas collecting under the trapping layer some half-kilometer beneath our feet. At the end of the run, he pointed to one green blob on the map, saying, "This is X field," and to another, "This is Y field." Then he pointed to a third one between them, asking, "But what is that?" I answered, "That could represent a lot of money." As it happened, the company had decided to sell that property to another company. That oil company made the money! But the software found the oil before the property was drilled. Later that year I spoke about the experience at a Research Review. My talk was titled, "Finding Oil in a Computer."

It was with great relish that I read The Universe in a Box: Simulations and the Quest to Code the Cosmos by Andrew Pontzen. If you buy the book feel free to download this image to print a bookplate; it's 1024x1024 px. Use Upscayl or something similar if you want it rendered at higher resolution. I produced it using Playground AI; the only prompt was "Cosmology". I tinkered with Samplers and other parameters, looking for something else. Getting this image was a side benefit.

The author could have delved deeply into sundry technical issues—there are many! Instead, he has skirted these, providing just a taste of some of them, in favor of the philosophy and motivations for making computer simulations of natural phenomena.

The terms "simulation" and "modeling" have overlapping meanings. In principle, a Model is the framework and the sets of parameters that define the physical structure and the physics rules to be followed, while a Simulation is the operation of the Model over a chosen span of time, producing a series of output data sets that describe the expected physical state of the modeled "thing" at one or more points in time, whether past or future. Note that a simulation can be done on equipment other than a computer. One story of the book is about a galaxy simulation done with light bulbs and photocells and a glorious tangle of wires.

Weather forecasting is one very visible result of computer simulation, seen daily (or hourly) on newscasts and in the various weather apps on our devices. There are a couple of dozen important models used by weather agencies the world over. One expression of these is the Spaghetti Plot of a hurricane's forecasted track, as produced by several models. The models differ in the importance they place on various aspects of the modeled system, including whether it represents the whole Earth or a hemisphere, or a couple of continents.

All weather models are based on a global General Circulation Model, in which the atmosphere and the land and sea surfaces in contact with it (and sometimes a surface layer of the ocean) are divided up into roughly ¼ to ½ million quasi-rectangular portions. Half a million to a million "cells" is about the most that modern supercomputers can handle. In general, spatial resolution is likely to be as large as 200x200 km! The Earth's surface area is about 127 million km², and the models have between 20 and 40 vertical layers (at present). A 40-layer model would have more than five billion cells of 1x1x0.5 km, so to get the count below one million requires using cells with an area of more than 5,000 km², which is 71x71x0.5 km, and most models are set up for grid squares of about 100x100 to 200x200 (and half a km thick). The physics rules, primarily those relating to pressure and temperature relationships, are applied at the boundaries between grid cells.

To get a "future radar rain" map with finer detail requires using "sub grid" rules, and partial simulations over short times and restricted areas, a subject that Dr. Pontzen discusses. Compared to Earth, the Universe is immensely more complex, and the problems of building an appropriate model and running simulations that may span billions of years, but don't take billions of years of computer time, are truly tough!

For example, consider a galaxy. On the scale of the while Universe, galaxies are tiny and far apart.


This is the Hubble Ultra-Deep Field image, which shows about 10,000 galaxies (only one star is in the field, the really bright point with spikes caused by diffraction). The area of this image on the sky is 0.038°x0.038°, or about 0.15% of a square degree. It is about the size of the smallest thing you can see with your eye.

To a very rough estimate, although galaxies vary a lot in size, the really big ones seen here are a lot closer than the really small ones. The six or eight largest ones in this image are seen to be far from one another. If their intrinsic size is a little smaller than the size of "our" galaxy, the Milky Way, they are about 50,000 light-years across, and the average spacing between them is one or two million light-years. But larger-scale observations reveal that nearly all galaxies are strung out along strands in an immense web, with voids that contain no galaxies at all but span hundreds of millions of light-years.

One problem of computational cosmology that the author dwells on is that it is really hard to produce a cosmological simulation that doesn't result in a much larger number of galaxies. According to most models, this image "should" contain so many galaxies that there would be very little black space seen between them! A conundrum of computational cosmology is, "Why is space so empty?" I suppose all I can say is, "Stay tuned." I await a follow-on book on the subject as more is learned!

The smallness of galaxies compared to the intergalactic web, and the incredible smallness of the stars that make up the galaxies, and even more amazing smallness of planets, moons, and everything "solid" that we are familiar with, produce a huge problem of "stiffness" in any kind of simulation that seeks to span the entire range of sizes. Mathematical equations that drive simulations are called differential equations (DE's). By their nature, DE's produce one or more side effects, which mathematicians deal with using various schemes, and such schemes are embodied in the computer codes that run simulations. However, these schemes are seldom perfect, and runaway effects can swamp the simulation if it is run outside of a carefully chosen range. If a simple simulation includes two processes, and one runs 100 times as fast as the other, it is necessary to cater to the faster process or the results blow up. This time-scale contrast is called "stiffness". One must use time steps shorter than the time scale of the faster process, even though during such short steps, the slower process doesn't do much. Now consider what happens if the time scale varies over a range, not of 100 to one, but millions to one, with numerous processes all across the time spectrum. Not only that, if 99% of the volume is empty, and the remaining 1% has similar ranges of "spatial stiffness", the problem compounds dramatically. A lot of the book deals with such things, but using more accessible language.

The author also discusses dark matter and dark energy. Dark matter is probably quite real. It is needed to keep the stars in their orbits about their galactic centers, because the visible mass is not sufficient. This is not a small effect: the "extra gravity" needed is about five times what would be exerted by all the visible stuff we see. The current theory is that 70+% of the matter in the Universe isn't affected by electromagnetic radiation, so we can't see it. Scientists are working hard to find out what kind of stuff could be so invisible but so heavy.

Side question for the author or other cosmologists who may come across this review: Do black holes consume dark matter that encounters them?

Anyway, dark matter and the properties we infer for it must be included in cosmological models for their simulations to make any sense.

Dark energy is the term applied to an odd effect seen when very distant supernovae are studied. They seem too dim. Their distances are determined from the redshift calculated from their spectrum and, if possible, the redshift of their host galaxies. There are distinct "lines" in the spectrum of any astronomical body that allow us to determine its composition and the speed with which it is moving, radially at least. The Hubble Constant (named for Edwin Hubble, not the space telescope which was also named for him) characterizes the velocity-distance relationship.

Determining the actual brightness of a distant object is not straightforward. Dust and gas in and between galaxies absorbs some light. The relationship between distance and "intergalactic extinction" ("extinction" to an astronomer means light is being absorbed) is thought to be well understood. When such calculations are applied to certain supernovae, a discrepancy is found between how bright they are and how bright they "should" be. The farther away they are, the greater the discrepancy. This indicates that they might be farther away than their redshift would indicate; the "Hubble Constant" would then be not so constant! This implies that cosmological expansion is speeding up, not slowing down as we would expect.

I personally look at two matters that need more study before I will seriously consider that dark energy is real. 

Firstly, it is not mentioned in the book that the kind of supernovae one must study to discern dark energy are Type 1a. They are produced by a special mechanism. Most supernovae result when a large star (8-20x the mass of the Sun) runs out of fuel and its core collapses. About a quarter of supernovae result from a white dwarf star being loaded up with matter from a nearby red giant that is shedding mass. The maximum mass of a white dwarf is 1.44 solar masses; at this point it collapses and erupts as a Type 1a supernova. Because of these mechanics, Type 1a supernovae have very similar maximum brightness, making them a "standard candle". However, I have looked in the literature for an indication that the composition of the white dwarf and/or its red giant companion might affect the brightness of a Type 1a supernova. In the very early Universe there was hardly anything except hydrogen and helium. The first supernovae were all Type 2, when large stars, that had been forging hydrogen into more helium, and then forging helium into heavier elements, up to iron, exploded. Over time, the abundance of heavier elements in the Universe increased. To astronomers, all elements from lithium on up are called "metals" for convenience. Metallicity is a measure of the percent of "metals" in a star or galaxy. Our Sun's metallicity, at its visible surface, is 1.3%. Its age is 4.5 billion years, and it has not undergone fusion reactions that could change its metallicity, but an unknown amount of interstellar "stuff" has fallen into it; this is probably quite small in proportion to its total mass. Thus, a little over 1% probably represents the metallicity of this part of the Universe 4.5 billion years ago. The metallicity of the stars in a galaxy varies with distance from the center also, but not over a huge range. The bigger difference is seen between "Population I" stars, that are younger and have higher metallicity, and "Population II" stars, that are older and have something more like the metallicity of the Milky Way when it first formed, perhaps 10-12 billion years ago. This is roughly 1/10 or less of our Sun's metallicity, or less than 0.1%.

Very early galaxies and their stars had very small metallicities, ranging from 0.001% down to nearly zero. Therefore, so do the earliest Type 1a supernovae. A question I have not seen answered:

We know that white dwarf stars are composed primarily of carbon and oxygen. They are known to have some metals, because they are diagnosed by lines of silicon. BUT: Is the peak brightness of a Type 1a supernova significantly affected by the proportion of elements heavier than oxygen?

Secondly, is it possible that dark matter interacts very slightly with electromagnetic radiation? Simply put, the Universe's age is considered to be 13.8 billion years. At an age of 1.38 billion years, its "size" was 1/10 of its present "size", and the concentration of both ordinary matter and dark matter would have been, on average, 1,000 times greater. Somewhere along midway, say at an age of 4.4 billion years (the square root of 1/10 times 13.8), the "size" would have been about 0.32 of the current size, and the concentration of both ordinary matter and dark matter would have been about 32 times greater than at present. If there is even a slight interaction, "dark matter luminous extinction" could be a genuine effect, yet we would be very hard put to determine whether the dark matter that must be all around us has a measurable influence on light.

For the time being I consider that it is much, much more likely that "dark energy" is a phantom, and will eventually be found not to exist.

That is a significant digression from the discussion of the book. The author discusses the utility of cosmological simulations of various kinds. They aren't just a way for us to have a "pocket Universe" to play with, but they help us understand what might have occurred at various stages of the evolution of the Universe, or of groups of galaxies, or of stars and star clusters. Unlike weather forecasting, Universe simulation focuses on retro-casting, trying to reproduce how things worked out over some interesting span of past time, whether measured in centuries, millennia, or billions of years. To know where we really are we need to know what came before. Looking at distant things, as the Ultra Deep Field does, lets us look back in time. Things were different way back then, and computational cosmology is a powerful tool to help us understand it all. We've made a bit of a start; we're just getting going!

The author also asks whether it is plausible that we are living in an über-simulation inside some super-Matrix run by super-beings. He gets into that because he gets asked about it frequently. I'll mention one thing that he does not: one human brain has complexity of the same scale as a good chunk of the non-human Universe, and all of us together are more complex than the whole rest of the Universe (unless there are lots and lots of alien species!). In the Cosmos series by Carl Sagan, decades ago, it was stated that there are probably 100 billion galaxies in the observable Universe, with an average population of 100 billion stars each. The number of galaxies is probably more like a trillion. The number of stars is thus a number with 23 digits.

What's in a brain? The cortex has 16 billion neurons and the cerebellum has 70 billion. Each neuron has about 5,000 connections to other neurons. The 100 billion smaller "glial cells" also contact numerous neurons and large numbers of each other. The number of connections is thus a number with 15 digits. The number of humans is about 8 billion, a 10-digit number. So the "total human connectome" is about 100 times as great as the number of stars in the Universe. Another number of similar size is the number of molecules in 18 grams of water (a quantity known to chemists as a "mole"), which is a 24-digit number starting with the digit 6. If one could somehow use each water molecule in a tablespoon of water as a computer bit, it would take ten tablespoons to have enough molecules to devote just one "bit" to each connection in the sum total of all human brains. That's the bare bones of what's needed to produce The Matrix. And that's just one intelligent species on one planet. I'd say that if Moore's Law gallops along unimpeded long enough (but it won't, it's already faltering), it would take hundreds of doublings, or at least 1,000 years, for a big enough, fast enough computer to be produced (by Someone) that could simulate the entire Universe in real time. Of course, by making the computer's time steps for each second of real time actually take, say, a century, a much smaller computing system could to the work. How could we tell? Dr. Pontzen doesn't know, and neither do I.

A very enjoyable book. You don't have to be a computer geek like me to understand it.

No comments: