Pages

Saturday, October 4, 2014

Geology Simulator -- Plate Tectonics Algorithm

(Part 1 of the series here!)

It's time to talk about everybody's two favorite cocktail party conversation topics: plate tectonics and mantle convection currents. I'll also get to our first specific geology algorithm that simulates the planet's dynamic core and source of plate movement, as well as some basic methods of plate formation in the model.

Coding-wise, I've been busy in the meantime with some underlying framework: file input, graphics output, setting up utility functions, classes to store data on plates and columns, considering whether multithreading makes sense or not, etc. I won't bore you with those details right now, though. I'll get straight to the first interesting bits. We need to answer some basic questions about the simulation world:
  1. Why do the tectonic plates in our world move?
  2. What happens at the boundaries of plates?
  3. How do we start building our earliest continents?
The most logical place to begin is by looking for the answers to these same question when it comes to our very own, real-life Earth.



CRASH COURSE ON TERRESTRIAL PLATE TECTONICS

WHAT MOVES THE CRUST?

The Earth is divided into several layers. The inner core is solid, as is the very outermost few miles of rock (crust). The rest ranges from sort-of-maybe-kind-of solid (very outer mantle/asthenosphere) to pretty much flat out liquid (middle portions), and so the outermost parts, to varying degrees, "float" around on top.


Why does it move around, though, instead of just floating perfectly still?  Well, primarily because of convection: the natural cycling pattern formed by fluids of different densities -- most commonly because of uneven heating. Take a look at this cartoon beaker of water on a stove top:
The hot fluid expands and become less dense, so it floats upward on top of the colder liquid above. The cold, dense fluid sinks to fill in its place nearby. The cold fluid then heats up closer to the source of heat, and the hot fluid cools off at the surface, so they begin cycling in orderly patterns. Depending on the shape of container, the rates of cooling and heating, etc., the cycles can take many shapes, from 3-D donuts to columns to rolling cylinders. A single modular pattern, whatever the shape, is called a "convection cell."

The Earth is heated from below, too. And I do mean actively HEATED: most of the Earth's internal temperature is from ongoing radioactivity converting nuclear bond energy to new thermal energy. It is also cooled on top as heat is lost to space. Since it is also partially liquid, it has convection currents.

Now imagine a skin on the surface of the beaker above: the currents from the convection would pull it apart and push it off toward the side walls. Sort of like these chia seed continents in my kitchen:


The plates on Earth move much like that, except there are no sides of the beaker or pot in a round world, so things are less static. I.e., instead of hitting the wall and staying, plates wrap around the planet and tend to keep bumping around and re-jostling into new positions continuously.

PLATE BOUNDARIES AND MANTLE / CRUST ALIGNMENT

It is often assumed that convection cells in the Earth's mantle line up with the joints between tectonic plates. Where plumes of heat are rising up in the convection cells, one theory suggests that that's where (and why) the new crust is forming, swelling, and sliding "downhill" away from the heat, usually in the sea floor. This is called a ridge or rift zone:


(by Wikid77)

Notice those light blue / yellow lines in the middles of the oceans? Those at the mid-ocean ridges and their elevation swells, where most new crust is formed. This might reasonably line up with the rising heat side of a convection cell.

On the other hand, where plates meet, usually one will "subduct" under the other one. Some of the higher-silica-content material will bubble back up through volcanoes, but a lot of the material will sink and remelt into the mantle. In the Earth map above, you can (just barely) see dark blue lines where subducting plates plunge under deep ocean trenches. Japan is an example where two ocean plates meet, one subducts, and volcanic islands and a trench are formed. Cartoon version:


This subducting rock cools the area of mantle it pushes into, and thus might line up with the other, sinking end of a convection cell. The convection would occur anyway just from losing heat to the crust by direct conduction, but the crust itself recycling from rift to subduction zones might nudge the system into lining up in the same way. So you could get an overall picture something like this:


Things wouldn't be anywhere near that neat and tidy in reality, but it may be a rough approximation. In the following picture and video, you can see two interpretations of what a more realistic mantle convection pattern might look like. One is a bit more... tame than the other. But in both cases, you can see reasonable convection cells where heat travels up and down again in a recognizable pattern. You can also imagine how crust might move on top of the video model.



(by turbulenceteamm)


OCEANIC AND CONTINENTAL PLATES

Shifting gears a bit, it's also worth explaining an important distinction between two major types of crust that affect movement patterns: oceanic and continental. Both can exist together on the same plate. Oceanic crust is made out of denser, silica-poor rock (mainly basalt) and is thin. Continental crust is made out of relatively less dense, silica-rich rock (like granite), and is much thicker.

The continents float better, so when a continent and an ocean collide at a boundary, the ocean inevitably subducts under the continent. And when continents collide, sometimes one subducts, but sometimes they just crumple together like a car wreck. Since continents rarely subduct, they tend to stick around, and have been getting bigger over the ages as more of the silicon and lighter elements have settled out toward the surface over time and stayed. Whereas ocean crust comes and goes.


In my program, ocean and continental crust will both be important, but I'm not going to directly code them by fiat -- I hope to instead have these distinctions arise naturally from modeling actual thickness, density, and bouyancy of rock columns.



HOTSPOTS AND SUPERCONTINENT ISSUES

There are a couple problems with the above story so far:
  1. There are places on Earth called hotspots (about 40 "official" ones) where volcanoes or hot thin sections of crust seem to stay in one place for a very long time, ignoring plate movements. Like Hawaii. It doesn't really make sense that hot fluid can travel up in a stationary line AND flow around in circles in the same space at the same time. Something doesn't add up, and there's disagreement among geologists about what that is. Best case scenario, though, this would be a whole extra layer of programming for me on top of the above model. Worst case, it means I have no idea what to program at all.

  2. What happens when a continent gets too large? Remember, continents rarely subduct, so inevitably, they all pile up in a supercontinent. This would be very boring if they don't break up again. They do split, but geologists seem to disagree about what causes the breakup of supercontinents. Everyone agrees it has something to do with heat building up under the insulation, but the details for how this would work in the above model are a bit fuzzy.
Maybe I could soldier on anyway, maybe ignore hotspots entirely (and in fact I tried!). However, I think I may be able to leverage both issues to my advantage instead with a simpler overall system...

What if we theorize that the mantle convection cells essentially "don't care" about the crust? The crust moves and changes (in this theory) more slowly than mantle convection cells. They're rapidly churning away down below, and the crust and it's tiny features are just minor side effects.
  • This allows for hotspots... of course they ignore plates, because ALL mantle convection does.
  • This lets me use one of the simpler supercontinent theories -- which is that hotspots cause more damage under supercontinents as they move more slowly, and have time to burn through the thick continental crust. Eventually "unzipping" the supercontinents along the weakened connected dots.
  • Ridges and subduction zones don't have to line up with convection cells all the time, which removes several awkward implications and restrictions from the basic model. Getting this to all agree was like herding cats or trying to organize bags full of magnets. Whereas plates sliding around semi-freely on top with minimal feedback is much simpler.
  • This should still allow convincing, normal geology at the end product.


CONVECTION + TECTONICS ALGORITHM

Alright, so let's get down to brass tacks and implement this concept in an actual algorithm! I don't have a working demo yet, but this is the quasi-implemented plan:

1) Hotspots.
First, we generate some random dots on the surface, representing hot convection plumes from the core/deep mantle (how many can be a customizable parameter):



2) Convection Cells. 
Next, we simulate what the convection cells for these hotspots might be. I'm going to use Voronoi cells to represent the convection cells. Voronoi cells are shapes drawn between a set of points indicating the regions of space that are closest to each individual point. This makes sense for convection, because these would be the boundaries at which hot fluids sliding along the surface from different plumes would hit each other and stop having anywhere to go but down.

In real life, convection currents often do take on Voronoi cell shapes under the right conditions, which can easily be MY conditions, because I can invoke any depth of planet, any age of planet, any amount of radiation in the core, etc. Here's two actual videos of Voronoi-like cells convecting in a hot fluid, followed by a hand-drawn Voronoi algorithm applied to my hotspot dots above, representing something similar:

(by Jennifer Liang and csegal0)


3) Plate Formation.
These cells radiate heat outward to the shared edges (below, I show this as a circle of heat, but it may actually work better if irregularly shaped due to different speeds of fluid flow within a cell). The heat will change the crust above it: weakening, blistering and thinning the rock, sometimes breaking through like in Hawaii or Yellowstone. These hot, thin, weak areas can rip open into a new crust-producing rift zone.

At the same time, cold (and therefore dense / heavy) crust at the furthest edges of cells wants to sink down. And especially if it happens to be thin crust that can break easily, it might just crack and do so, and one side can begin subducting.

Later, these cracks will be harder to form, but right now the whole world is just brand new, thin basaltic ocean crust everywhere and the first few plates form more easily using some simple pathfinding algorithms that use heat levels and thickness as "pathing costs:"

(red = rift, blue = subduction zone)

4) Plate Drift.
Due to our torus-world, we need at least two cracks to make two plates, since things wrap around. So here we now have two plates. Where do they move? Well, remember the strategy here is that the crust is just a side-effect of a much more powerful mantle. So the mantle convection flows don't care about our new fault lines. They just do their thing, and the plates respond dependently.

Therefore, the movement of each plate will be pretty much purely the resultant vector of the convection currents moving underneath it. So what we do is add up the resultant vectors for all the cells that are part of them:


And so we end up with two overall vectors for plate movement, appropriately moving toward the subduction zone and away from the ridge. 

5) New and Old Crust and Continents.
One of the plates will subduct under the other (coin flip at this point, since both are equally thin, cold, and chemically identical. Later, these factors will make one outcome more likely), causing volcanic island chains in the upper plate, which are then lighter weight than basalt and will stick around, forming the nucleus of our very first continents. And of course, where the plates spread apart leaving no data, new crust gets added on in the simulator. In the model for now, this is simply deleting some cells at overlaps, adding others at gapes (after movement), and keeping track of thickness and volcanism changes, etc.

This is hugely simplifying things. But for now, I need to keep things simple until I can get a working model of SOME sort, at least. Later though:

6) Increasing Complexity
Over time and with future features, this picture will get much more interesting:
  • The plates will slide over the hotspots, which tend to weaken crust above them and maybe even break through, leaving a sort of perforated line of weakness which is then liable to crack to make more plates later, and more interesting dynamics. 
  • At the same time, plates will sometimes fuse if jammed together particularly violently. 
  • The plumes will slowly shift and rearrange.
  • Continents will build up and alter the patterns of subduction. 
  • Sometimes oceans may get gobbled up entirely.
  • Thicker plates will be harder to break through for hotspot volcanoes.
  • And plenty of other geologically-relevant things I haven't talked about at all yet: erosion (waves, wind, rivers), sediment deposition, rock metamorphism from heat and pressure, life forms, changing atmosphere (oxygen rusts minerals...), details of volcanoes, and more.


NEXT TIME

My focus now is on finishing up a few straggling bits of basic engine framework, Then implementing steps 1-5 of the above algorithm. Hopefully I'll have a working demo next time, along with tales to tell about whatever is bound to go wrong along the way! Or I may have to make a short detour into discussing multithreading or simialr. We'll see.

4 comments:

  1. This is very interesting! What will you be doing with the code? Do you have a game in mind?

    ReplyDelete
  2. Brighttumbra: This is part 3 in a developer's blog for this project. If you click on the "Index by Category" at the top of the blog, you can find the other posts about it all in one place. The goal is to make a comprehensive world generator for any voxel-based game that is geologically simulated and realistic. Minecraft and Dwarf Fortress are the main original targets/inspirations, but possibly many other games, too.

    ReplyDelete
  3. I can't wait to see this demo. Your Voronoi idea seems to me as the best approach to reproduce tectonism in a simulation, so far. I hope you come back soon ;)

    ReplyDelete