Unlike plate tectonics, computational climate simulation has an enormous body of research because of modern meteorology. Although we often we joke about incorrect weather forecasts, it’s pretty amazing how accurately we can model the entire atmosphere days in advance.
With climate simulation we have the opposite problem. Modern Global Climate Models are so detailed that it’s difficult to simplify them enough so that they are feasible for a hobbyist to code and run on a laptop in less than a millennium. Most GCMs run on supercomputers for days at a time. Trying to boil that down without amber fields of vector calculus initially seems overwhelming.
Still, I’m tired of all the arbitrary noise in my terrain generator. Climate models exist and are well-specified on the internet. It’s time to play Frankenstein and cut them up and paste them together into a monster of a GCM and pretend it’s perfectly scientifically rigorous.
As always, I’ll start with my simulation goals, as they determine the simulation implementation.
Seasonal Temperature Maps
I want nice-looking temperature maps at a minimum. I think seasonal temperature maps are a feasible goal.
Reasonable Precipitation Patterns
I’d like for these precipitation patterns to feed into my eventual vegetation simulator. Those combined with temperatures and elevations would let me fully generate biomes. I would prefer my biome generator to be purely identification (it will only have to name areas based on their climate and vegetation). Again, seasonal maps would be great.
This will require wind patterns, evaporation, and precipitation.
I’d like to be able to create river basins and rivers from erosion patterns.
100% Science-Based MMO
Just kidding about the MMO. I want to minimize the amount of randomness and noise used in the simulation.
Those are my primary goals. Possible climate features that don’t directly contribute to those goals will be judged on an individual cost/benefit assessment.
Climate Model History
In the early 1970s, UCLA professor Akio Arakawa took previous failed efforts to model climate phenomena on grids, identified the causes of their stability issues, and created a stable model. His paper from 1988 titled “Finite Difference Methods in Climate Modeling” is a good summary from that era, which has the critical advantage of still being simple enough to understand for a non-climate scientist, with a little calculus.
Climate Model Introduction
Global Climate Models (GCMs) have certain common characteristics. Their primary purpose is often to predict weather, but they can have other objectives, such as to model atmospheric composition or sea ice behavior.
In general, GCMs model a whole bunch of climate properties on a discretized map space. There are two main discretization approaches: finite difference (or grid point) and spectral.
Finite difference is the easy-to-think-about grid system. The space is divided into an even grid, and climate properties are defined and modeled at each point. In the space in between grid points, climate properties are assumed to be interpolated in some manner. I’ll be using this model because it’s easier and I’m already using a tilemap.
I’ll be honest: I spent some time several months ago learning what spectral models were, and I’ve forgotten since then. They’re very mathy, more continuous than finite difference, and especially good at modeling the entire earth because they can naturally accommodate spheres.
The Fast Ocean Atmosphere Model
A good starting place for looking at modern GCMs is the Fast Ocean Atmosphere Model (FOAM). This is a stripped-down but still modern GCM with the goal of high throughput over precision. If you read through their page, you’ll notice that they still measure throughput in “simulated years per day.” PER DAY. Even this super-approximated, efficient model still runs over multiple real-world days. We’re aiming for around a minute on my laptop. Ideally 10 seconds.
Let’s look at the characteristics of FOAM, for both what it has in common with more precise models and what approximations make it so blazing fast:
- A low-resolution 40×48 grid with 18 altitude levels. This may seem very low resolution (each tile is close to 1000 km wide), but if it’s good enough for them to model the entire Earth then it’s good enough for me.
- Timestep of 30 min for atmosphere, 1 hr for radiation
- Ocean model has a 128 x 128 grid. They can afford higher resolution here because water currents move slower than air. Their timestep for the oceanic model is 6 hrs.
Let’s take a deeper dive into their atmospheric model. They use a modified Community Climate Model 3 (CCM3) atmospheric model by NCAR. If you follow their link to the CCM3 page, you’ll discover that CCM3 is outdated and the modern version is called the Community Atmospheric Model (CAM).
If you follow that link, you’ll see download links for the CAM documentation. This stuff is an educational gold mine. There are explanations for nearly every segment of CAM at both introductory and advanced levels.
Community Atmospheric Model
CAM emphasizes the following core physics functions in its documentation:
- Several types of convection (moist, dry, vertical, horizontal)
- Several types of diffusion
- Turbulent mixing
- Cloud fraction
- Various fluxes between the land, air, and oceans
Note: An interesting fact that has no relevance to my project is that they use a special vertical coordinate system that adjusts for the terrain elevation where the altitude immediately above the terrain is constant at 0 but the max-altitude coordinate is also constant (e.g. 20,000 km is always 20,000 km).
In general, though, while CAM is very educational, CAM is a full atmospheric model and thus far too complex to be a good example for this project. A more useful class of models is called Earth-system Models of Intermediate Complexity (EMIC).
Earth-system Models of Intermediate Complexity
EMICs lie somewhere between super-simplistic models and GCMs.
The first reference on this page is the real gold mine for hobbyist-project research. It is a table of EMICs. It seems EMICs grew very popular between 2000-2005 and then disappeared from the face of the earth. I’d guess it has something to do with the increasing power of computing and access to supercomputers. That’s fine; climate models from 2005 are still more complex than what I’m planning.
The EMIC Climber2 has a beautiful diagram outlining what I think would be a good upper bound for the complexity of my climate model.
This diagram gives a good outline of what would be necessary to create a climate simulation that could claim to be “scientific” by today’s standards.
If I remove some of the ocean, ice, chemistry, and individual gas species modeling (which is a majority of the diagram), I think it’s a good starting point for my model (also considering what CAM emphasizes in their documentation).
Let’s start as simple as possible. What components are absolutely necessary?
- Insolation and radiation. These are the basic inputs and outputs of the climate system and drive the whole thing. We can start with just insolation from the Sun to the ground and black-body radiation from the ground to space. As we go we can add on things like albedo and emissivity.
- Temperature. Duh. Ground, air, and water.
- Lateral convection a.k.a. wind. These create all the weather patterns that are the purpose of modeling the climate in the first place. For these we’ll need to model air pressure.
- Density and vertical convection. These are a bit tricky. If we left them out, we would still get wind patterns but they would be almost the opposite of a real-world climate system. Heat at the equator would create regions of high pressure and drive winds toward the poles, whereas on Earth equatorial heat causes air to rise and leave behind low-pressure zones at the equator. Thus I think I’ll try to model density and vertical convection somehow.
- The Coriolis effect. This is optional but would be nice and hopefully not too difficult to add on. Should be an extra term or two in Navier-Stokes.
- Lateral diffusion of temperature and air pressure. I don’t think this is necessary but it wouldn’t be difficult and may help stabilize the simulation. Maybe another non-critical add-on.
- Precipitation. One we have winds, it shouldn’t be too difficult to tack on evaporation, precipitation, and let the winds carry water vapor.
- Groundwater, surface water, and erosion. It’s not exactly climate simulation but it would be a nice tie-in to the terrain generator.
- Resolution of around 50 x 25 with 2 air altitude layers, a ground layer, and a water layer. This seems like a minimum workable resolution. Of course I’d like to increase the resolution later, but if I hit a computational limit I’ll use other tricks to increase the apparent resolution of the climate simulator.
- Timestep: the largest possible timestep at which the simulation remains stable. Likely on the order of an hour or less.
- I would like to come back and complete most of the Climber2 diagram with an ice module and an ocean current module.
- I plan to do vegetation after climate and plan to then add it to the climate simulator (albedo and transpiration)
I’ll update these with links when I post them.
- Climate 2: Erosion
- Climate 3: Insolation and Black-body Radiation
- Climate 4: Vertical Convection
- Climate 5: Navier-Stokes
- Climate 6: Blowing Winds
- Climate 7: The Water Cycle
Although the water cycle should appropriately be last, I’ll start with erosion because it is so separate from the rest of the climate simulator. It’ll be a good, isolated first part that won’t have as much math as insolation or lateral convection.