As a result of the Auto-Evo algorithm, I’m starting to reach a point where I need to implement environmental compounds like oxygen, carbon dioxide, ammonia, etc. Meanwhile, TJ is making great progress in building the first version of a Planet Generator for the upcoming update. So as a way of hitting two birds with one stone, I think it would be good to create simple theoretical models of how compounds cycle through the environment. We’ll specifically be modelling how we implement this in Thrive.
This field is referred to as Biogeochemistry, and includes the famous nutrient cycles you may have heard of (the carbon cycle, the nitrogen cycle, the phosphorous cycle, etc). On this thread we’ll focus just on tackling the Carbon Cycle. Hopefully by creating a model for the carbon cycle we can come up with a way of knowing how much carbon dioxide can be found in each patch at any moment in time.
I think the best way to think of these cycles is to draw out a diagram of Bins and Flows. A bin is something that holds carbon, and a flow is a process that causes carbon to move from one bin to another. A bin could be something like the ocean, and a flow could be something like acid rain (moving carbon from the atmosphere into the oceans).
Here is the diagram I’ve made so far of how to model the carbon cycle. It purely looks at abiotic flows of carbon throughout the planet (flows that are not related to living organisms).
Black arrows represent one-way flows. Red arrows represent two-way arrows, meaning the carbon will reach an equilibrium between the two bins.
I’ll explain the different bins and flows:
Bins
Atmosphere
This represents the entire atmosphere of the planet.
Ocean Surface
This represents the first few hundred meters at the top of the ocean.
Deep Ocean
This represents the remaining ocean underneath the ocean surface. The deep ocean typically contains huge reserves of dissolved carbon dioxide.
Planetary Crust
This represents the top 5-50km of the rock layer of the planet. These rocks comprise the tectonic plates that move around (via tectonic drift) and form continents.
Planetary Mantle
This represents the next layer of molten rock beneath the crust. Volcanoes draw their magma from this layer. The layers below this (including the Planetary Core) are assumed to be irrelevant to the carbon cycle
Flows
Air-Sea Gas Exchange
The exposure of the surface ocean waters to the atmosphere causes a constant exchange back and forth between carbon dioxide in the atmosphere and carbon dioxide in the ocean surface. The ocean surface and atmosphere reach equilibrium within days to years.
Thermohaline Circulation
This refers to the cycling of hot and cold water containing different levels of dissolved carbon dioxide throughout the ocean. Warm upwelling water rises to the ocean surface from the deep ocean and delivers carbon dioxide, while cold sinking water takes carbon dioxide from the ocean surface and stores it in the deep ocean. This process of equilibrium is MUCH slower and takes centuries.
Carbonate Sedimentation
When carbon dioxide dissolves in the ocean, a small fraction of it turns into carbonate. Over time, this carbonate binds to calcium and small particles (like sand) and turns into carbonate rock that deposits at the bottom of the ocean (such as limestone). These rocks become a part of the planetary crust. As the carbonate turns into rocks, this reduces the carbonate remaining in the ocean and more of the dissolved carbon dioxide turns into carbonate. Overall this slowly reduces the dissolved carbon dioxide in the ocean.
Tectonic Plate Subduction
Tectonic plates are pieces of the planetary crust. Over time, some plates will eventually get pushed under by other plates. When they get pushed under, they will be pushed into the mantle where the heat and pressure melts the rocks into basically magma.
Volcanic Gasses
When volcanoes erupt, carbon dioxide is typically the second most common gas they release. Depending on where the volcano forms, it can release this carbon dioxide into the atmosphere or into the oceans. Around 70% of volcanic eruptions on Earth are underwater.
Volcanic Lava
When volcanoes erupt, they also often release lava as well. This lava is drawn from the planetary mantle and can contain many of the carbonate containing rocks that were earlier subducted. This releases them back into the crust.
What do you guys think of such a model? Any changes? How can this apply to patches (I have an idea on this but want to hear what you guys think)
I think one thing I’ve been finding recently is how much work it is to implement and debug things and wondering how much value some things are providing. For example I made a complicated planetary temperature calculator which was a lot of work and then I made the system compute the habitable zone and put your planet in it (because outside that you can’t play the game). And now I’m having to put a load of work into a gui to show the player what is happening which is taking ages.
However isn’t that just a really roundabout way of setting the temperature to a value where there is liquid water? Couldn’t that have just been set directly? This calculator has some cool features that it responds to changing gas concentrations in the atmosphere, but that would be easy to implement directly too. Like everything I put all this work into could be replaced with temp = 293K + some function of how much CO2 you have + some function of how much O2 you have.
So I’d be interested to hear what you’re thinking about how this carbon cycle applies to the patches. I’m not super keen myself on having to build a lot of different cycles (especially if this is just the abiotic half of the carbon cycle) if all we really want is just some reasonable values which fluctuate over time.
I’m cool with putting work into things which are important.
Yeah for sure, it’s an important question what level of detail of this model we want to implement.
I tried to reduce the number of flows in this model to the basic ones that we would need, but of course the bin-flow model will have an inherent level of complexity. I would be up for a simple linear function if we could make it represent the results of the bin-flow model close enough, but I don’t know if that’s possible.
One thing I like about the bin-flow model is that it allows for natural events to alter the model in predictable ways. For example a period of intense volcanism can lead to a lot of carbon dioxide getting released from the mantle into the atmosphere and oceans. This would lead to more ocean acidity and increased greenhouse effect which would warm up the planet. Over time, this carbon would equilibrate back across all the bins and return to its normal levels, but during that period there would be intense climate changes. Such an event is actually theorized to be the cause of the Permian-Triassic extinction and the Triassic-Jurassic extinction.
I guess with setting things directly you can say CO2 = 20% ±3% or something.
Then the volcanism event happens and that raises it to 25% ±2% for 3 turns before returning to normal. You can set the temperature and acidity to increase for a bit too.
I saw it in Star Citizen, they made a Newtonian model for how ships should work with each thruster individually modeled for what forces it could produce at which angles and then spent ages making an automated control system to make the ships fly how they wanted them to fly. It seems like if you know what the output of a system should be then just hardcoding that output is the easiest thing.
I think having the environment change and that drive the player to continually adapt is great, that’s really important. Those examples of extinction events are cool, the GOE is also a really cool thing.
One part of all this is we need to massage any changes to fit the timescale of the turns. Like if CO2 concentration is rising it can’t go from 10% to 30% in one turn because quite a lot of stuff will die without getting a chance to adapt. It needs to move slowly enough to adapt to, which again is easier to set if we just set it.
I mean we can have events where the conditions radically change however the player might just get nuked by that. But that I guess depends on what the rules are for when your species goes extinct.
I cannot speak one way or the other to the implementation of a full cyclic model as a desirable course of action. I did however want to dive deeper into the world of Python by trying to make a mathematical model of the Carbon Cycle in the original post. I hope to refine it some more in the next few days/weeks. Regardless, I do think there is a way to integrate the cycle and patches.
If we determine the mass composition of each bin (I.e. for the mantle 4.07e24 kg Carbon, xxx kg nitrogen, xxx kg oxygen, etc), we can create mass ratios (I.e. 4.07e24 kg Carbon/xxx total mass of mantle). Every patch can correspond to specific bins it comes into contact with (I.e. an abyssal pitch would come into contact with the deep ocean and crustal bins). Each patch could then access an element in accordance with the ratios available to its local bins. I envision the math working out to something along the lines of:
Patch Carbon = (Carbon Ratio of Bin 1) * (Mass Fraction of Patch Composed of Bin 1) + … + (Carbon Ratio of Bin X) * (Mass Fraction of Patch Composed of Bin X)
That way the bins directly impact patches and patches respond to changes in their local bins that might be on a different timeline from others. This can be further complicated to include the local biological component of the carbon cycle, which can store and release carbon like regular bins. These bio-bins have access to a maximum of “Patch Carbon” to store each “round” but can release any stored amount of carbon in accordance with their metabolic activity (possibly derived from the AutoEvo calculations).
Each Bin could then lose or gain carbon to any biological populations associated with it.
I apologize if this was not particularly coherent, I have not quite settled out the mathematics in the Python model.