DEV Community

Cover image for Recomputing 4.6 billion years of Earth with a box model that never reads the timeline
sishiya (しし屋)
sishiya (しし屋)

Posted on

Recomputing 4.6 billion years of Earth with a box model that never reads the timeline

I made a page that watches 4.6 billion years of Earth, from its birth to the appearance of humans, from one fixed spot. Move the time slider and the land, sky, sea and living things change to match that age. The 3D view uses Three.js.

https://sishiya.github.io/manabi-lab/evolution/?lang=en

The scenery is drawn from what research has found (the record). But the record alone does not show why things happened.

So I built a box model that never reads the timeline. It computes temperature, CO2, oxygen and sea animals only from outside drivers such as the Sun, volcanoes and weathering, and you can compare it with the record. This post covers how the model is built, and where it does and does not match.

Inputs are only "outside drivers"

runModel() reads nothing but the outside drivers in FORCE:

  • Brightness of the Sun (dimmer in the past)
  • Volcanoes (and giant eruptions)
  • How easily rock weathers (amount of continent, supercontinent breakup, mountain building)
  • Weathering by plants, methane-making microbes, burial of organic carbon, how reducing volcanic gas is
  • Earth's orbit, humans

It does not read the timeline (when snowball Earths or mass extinctions happened). The point is to see whether those come out of the calculation.

The grid has 4000 points (past and future), stepped in 0.02-million-year slices. One run takes about 0.22 seconds.

The CO2 thermostat

CO2 changes with the difference between what volcanoes add and what rock weathering removes:

dC = 700 × (volcanoes − weathering)
weathering = weath × bio × (plants) × (C/280)^0.3 × exp((background temp − 14)/13) × √ocean
Enter fullscreen mode Exit fullscreen mode

Weathering is faster when it is warm, so warming lowers CO2 and cools the planet, and cooling raises CO2 and warms it. That is Earth's long-term thermostat. During a snowball Earth, weathering drops to 3%.

Temperature and snowball Earth

temp = 14 + Sun 140×(S−1) + CO2 effect + methane 18×exp(−O2/0.003) + orbit + water vapor + ice −40×(I − 0.03)
Enter fullscreen mode Exit fullscreen mode

With x = ln(C/280), the CO2 effect is 4.33x + 0.25x² for x ≥ 0 and −12×(1 − exp(4.33x/12)) for x < 0.

Ice grows partially as it cools. Below 5 °C the whole planet freezes, and it thaws when the ice-free temperature would exceed 30 °C.

This includes both "ice reflects sunlight → even colder" and "weathering stops while frozen → volcanic CO2 builds up → eventually it melts".

Oxygen and the ozone layer

Oxygen is set by organic carbon burial B minus reducing volcanic gases R. R was larger in the past (0.75×(A/2.4e9)^1.2 + 0.15), and oxygen starts to rise once B − R exceeds 0.002. More oxygen removes methane's greenhouse effect, which changes the temperature too.

Results compared with the record

What emerged on its own:

Event Model The app's record
Huronian glaciation snowball 2.396–2.239 billion years ago about 2.4–2.1 billion years ago
Cryogenian snowballs (two) 734–687 and 683–649 million years ago two, about 720–635 million years ago
End-Permian (P-T) extinction sea animal diversity −50% the largest mass extinction
End-Cretaceous (K-Pg) extinction −36% dinosaurs and others die out

The Late Devonian and end-Triassic extinctions also appear in the model. Today comes out at about 15.6 °C and about 440 ppm CO2.

What did not match:

  • The end-Ordovician extinction comes out at only about −10% (the record is about −50%)
  • Average mismatch over all time: temperature ±6 °C, CO2 ×1.7, oxygen ±1.4%, sea animals ±27%

The "how it works" panel overlays the record (dotted) and the model (solid) in four graphs and shows the mismatch as it is.

The future and "what if"

Since the model never reads the record, it can keep running into the future.

  • Human CO2 is removed with the Bern carbon-cycle response (the ocean takes thousands of years, rock weathering tens to hundreds of thousands)
  • In the middle scenario (SSP2-4.5), 2100 is +2.45 °C (about the same as IPCC AR6's +2.7 °C)
  • In about 600 million years CO2 drops below 150 ppm and plants can no longer grow (matches the literature)
  • The oceans are lost in 2–3 billion years (the literature says 1–2 billion; the model is late)

You can also make "what if" worlds. For example, with "no oxygen-making life", methane's greenhouse effect remains and none of the three snowball Earths happen.

A gotcha: bulk replace in PowerShell

I used PowerShell to rewrite code in bulk and failed three times:

  1. With only one replacement pair, @( @("a","b") ) gets flattened and replaces one character at a time (write @(,@("a","b")))
  2. Adding 'a'+"`n"+'b' inside an array: the comma binds first and breaks the pair
  3. PowerShell expands ${...} inside double quotes

Now the replace function refuses to run unless each pair is a two-element array.

Main sources

The sources for the record and the model's shape are listed in the app under "About this app". The future comparison uses IPCC AR6 (2021).


This page is part of Manabi Lab, a series of small learning apps that run in the browser (English and Japanese). The code and this post were written together with AI (Claude).

https://sishiya.github.io/manabi-lab/?lang=en

Top comments (0)