3D Plate Tectonics in Python


Why not use fractals?

Fractals generate superficially realistic terrain using processes that radically differ from reality. This enables them to operate many orders of magnitude faster than tectonic simulators, but this comes at a cost. A fractal world has no history - users cannot look at a landscape and say why or how that landscape formed the way it did, at least not in reference to real life processes. An author, for instance, would have a harder time breathing life into a fractal world because such details would have to be tacked on after the fact in a way that loosely conforms to what's already been generated.

Why 3D?

I like to fall back on a favorite quote of mine:

We need to make sure that... simulations and reality agree, because generally when they don't reality wins.-Elon Musk

2D models go a long ways towards reducing the code needed to express themselves. In a 2D model, grid cells can be represented in 2D arrays, and contents can be moved between them through a series of integer vectors. In a 3D model, decisions such as these are nowhere near as straightforward. Developers must answer basic questions concerning how grid cells are arranged and how cell contents move. The bright side of this scheme, however, is that reality fights on your side. Some planet features for instance form naturally since they're simple products of geometry. Island arcs are perhaps the best example - 2d models based upon similar principles appear to have difficulty forming island chains along anything other than straight lines, but properly shaped arcs form here as emergent behavior.

Why Python?

PyTectonics seeks to be accessible to a wide audience of developers. Python helps to that end as it can be easily learned, even among those with little to no coding experience.

This comes at a tradeoff, of course - Python is not a fast language. It's an unusual choice for a problem most have addressed with faster languages like C or even FORTRAN. However, processing power continues to increase at an exponentiating rate. The speed problem is still tangeable, even today, but steps are taken against it. Most speed intensive operations are handled through the Vpython library, which is itself written in C. With some judicious optimization, planets with tens of thousands of grid cells are easily simulated. Instantaneous generation is currently out of the question, but you can still generate worlds in the time you'd be willing to sit in front of a computer. If you're, say, writing a novel and want to emphasize the quality of worlds over quantity, then pyTectonics is meant for you.

How does it work?

It's largely a geometry problem. You start out with any number of roughly equidistant points on a sphere representing samples of the crust. Points can be arranged in any way so long as they're equidistant. The points are divided up by plates. Plates are randomly assigned a speed and what's known as an euler pole. Every plate in real life has these. From there on, plate motion is simulated in timesteps of given length.

Points that overlap represent subduction - the denser of the two sinks below the other, just like in real life. There, it continues to move for a predefined distance until its said to detach from the lithosphere. In other words, it's destroyed from memory. The predefined distance a point travels before destruction effectively describes the width of mountains on a planet. I've wanted to incorporate models to describe this distance mechanistically, but all research I've read so far suggest this would require adding way more parameters that could not go on to be used elsewhere, and I do want to keep this thing parsimonious.

As opposed to overlaps, gaps forming between points represent rifting. Here, a new point is formed that represents ocean crust. Each plate stores its points in a grid matching the planet's original configuration, and points are added to this grid - this way, points don't start looking messy as time progresses.

There's other submodels, but this is the gist of it. For more information, you may to check our growing wiki, which documents the model and provides basic knowledge on the principles it simulates.

Can I build off your model?

Yes. PyTectonics is licensed under version 2.0 of the [Creative Commons Non-Commercial Attribution license]. This means you are free to share and modify PyTectonics in most any way you please. There are however two restrictions:

  1. You must give credit. I'm not militant as to where, but it'd be nice if someone is able to find it without having to search for it.
  2. You must not charge people for it (ads and donations, however, are notwithstanding when used external to the program).

If you do wind up building off the model I'd like to hear it, if only to know someone finds the work useful. Along the same lines, if you feel there's something you'd like to contribute without making your own distribution, let me know - I may be able to work changes into the mainline, and if so I'll make sure you get credit for the work.