tectonics.js icon indicating copy to clipboard operation
tectonics.js copied to clipboard

Carbon Cycle & Climate Thoughts

Open berg44 opened this issue 6 years ago • 15 comments

Proposed carbon reservoirs (as a starting):

  1. Atmosphere (global) - balance CO2 and O2 (ignore other atmospheric composition)
  2. Water solubility aka deep ocean (global)
  3. Biomass (local, lumps together soil, plant and animal for terrestrial, as well as plant and animal for marine biomass; lumps anaerobic and aerobic together as well)

I'm thinking about using this article as a starting point for relative amounts: http://www.gcrio.org/CONSEQUENCES/vol4no1/carbcycle.html

Global temperature has the following interactions as a starting model:

  • Solar radiation minus reflection (reflection a function of global temperature ie clouds or ice maybe, solar output changes over time)
  • Planetary radiation based on surface temperature minus greenhouse effect (CO2 and clouds insulate and reduce planetary radiation).
  • heat flux from core cooling (reduces over time)

I want to keep it pretty simple to start - there will be a lot of speculation and estimations to even approximate the framework above. I think the hardest pieces will be trying to figure out rates and amounts and keeping global and local variables consistent.

berg44 avatar Dec 02 '18 04:12 berg44

Order of Magnitude article:

Oxygen production rate of cyanobacteria: 5 - 10 mmol O2 /( L* hr) @25 deg C and 10% CO2 and O2<1%

The article also mentions that the bacteria was so thick that the light couldn't penetrate more than 1 cm deep, so that will be an upper bound on production per surface area. Likely this will all be an upper bound to the max O2 production - will scale based on billion year production and modeled spread of algae.

https://www.researchgate.net/profile/CG_Lee2/publication/216108981_A_Theoretical_Consideration_on_Oxygen_Production_Rate_in_Microalgal_Cultures/links/0912f50fa118fb1dfe000000/A-Theoretical-Consideration-on-Oxygen-Production-Rate-in-Microalgal-Cultures.pdf

berg44 avatar Dec 03 '18 03:12 berg44

I'll take a deeper look at this. Seems like some things you mention are already implemented.

Solar radiation minus reflection (reflection a function of global temperature ie clouds or ice maybe, solar output changes over time)

We have a really good model for estimating solar radiation in each grid cell. We've implemented surface albedo, but the effect of ice is temporarily disabled, and we don't have clouds. In order to get clouds we probably need precip, and to get precip...

Planetary radiation based on surface temperature minus greenhouse effect (CO2 and clouds insulate and reduce planetary radiation).

Planetary radiation uses the Stephan Boltzmann equation, adjusted for a "greenhouse effect factor" that's currently a hardcoded constant. Looks something like this:

E = gσT⁴

where g is the greenhouse effect factor, T is temperature in kelvin, and σ is the Stephan Boltzmann constant.

We need a model that gives us the greenhouse effect factor given carbon dioxide in the atmosphere. We also need to add a factor for cloud reflectance. Since this is infrared I'm guessing we can't reuse cloud albedo? I think this is infrared optical depth?

heat flux from core cooling (reduces over time)

This is secondary, right? Could be relevant on some newer planets, particularly for lava worlds. I think Lord Kelvin did something on this subject when he was estimating the age of the Earth.

davidson16807 avatar Dec 04 '18 03:12 davidson16807

As for carbon pools, nothing is implemented and we'll still need to research.

Biomass (local, lumps together soil, plant and animal for terrestrial, as well as plant and animal for marine biomass; lumps anaerobic and aerobic together as well)

We're probably closest to implementing plant biomass. Here's how I propose to implement it:

  • We've already implemented a way to model the rate at which plants uptake carbon (aka "net primary productivity" or NPP). This is calculated based off either precip and temperature, whichever is the most limiting resource (note: we should really be using insolation instead of temperature, temperature's just used for historical reasons and it's not estimated as well as insolation).

  • From NPP, we can determine how much leaf area is needed per square meter of ground to generate that much carbon (known as "leaf area index" or LAI).

  • From LAI, we can determine leaf mass per square meter of ground using a ratio known as "specific leaf mass". There's values for it published in literature.

  • From leaf mass density, we can determine stem mass density and in turn plant mass density using allometric ratios that are published in literature. Summing over the entire planet gives total biomass.

That still leaves how we calculate decaying biomass. We can assume a steady state and say mortality is equivalent to productivity, but that doesn't tell us how much is digested by bacteria or how much just sits around waiting to be turned to oil. We'll work on it.

davidson16807 avatar Dec 04 '18 03:12 davidson16807

Wow, that sounds incredibly rigorous (about the plant life 4 stage calculation model) - Granted, I was definitely planning on using black body radiation for the heat radiated. I would also like to include the volcanic activity as another impact - maybe it just ends up as random temperature disturbances.

I was thinking more about how the rate of plant growth should change more as a function of the atmosphere and the evolution of plant life on the planet, though water and temperature is good too. I have seen claims that the entire original atmosphere of CO2 would have reached today's levels of O2 within 2,000 years instead of 2 Gy that it actually took based on current photosynthesis rates. I like the bit about the water and temperature being required by location, but precipitation seems pretty complex. I'll keep looking at it too.

The crucial mechanics will be:

  • When the planet overheats precipitation and temperature will encourage plant growth. This needs to draw down CO2 and reduce the planet temperature.

  • The surface albedo will come in handy for salvaging the planet during ice ages. When the CO2 is drawn down and the temperature plummets, the earth will start to freeze over. I imagine we can also increase weathering of planet surface with glacial activity. As the earth freezes, surface albedo reflects more light and the radiation decreases. When things are balanced it will come and go without too much intervention.

I like to bounce ideas around, good to know what you already have implemented. I'll keep posting ideas and I enjoy hearing your take on them. A good discussion keeps me motivated to keep working on them even if we don't solve every problem immediately.

berg44 avatar Dec 04 '18 04:12 berg44

I was thinking more about how the rate of plant growth should change more as a function of the atmosphere and the evolution of plant life on the planet, though water and temperature is good too. I have seen claims that the entire original atmosphere of CO2 would have reached today's levels of O2 within 2,000 years instead of 2 Gy that it actually took based on current photosynthesis rates.

I like this idea. If we do it right, it should allow us to model plant life more generically. We wouldn't just assume anymore that life on a planet behaves like it does on present day earth. Right now it's already pretty generic because it assumes life is ergodic at these timescales and will evolve to have a productivity that's close to the theoretical maximum, but if what your saying is true about photosynthesis rates then obviously a lot of a planet's history is going to be wrong as it currently stands. The problem is finding a way to model evolution.

precipitation seems pretty complex

sigh yeah, right now precip is strictly a function of latitude. We're handwaving pretty bad. A lot of that's documented here

When the planet overheats precipitation and temperature will encourage plant growth

I don't think we want to continue using temperature though. Fundamentally, a plant needs a certain number of joules from sunlight to create a unit of biomass (aka "radiation use efficiency"). It's easier to get published values for this parameter and it's a more rigorous approach used by a lot of models.

[plant growth] needs to draw down CO2 and reduce the planet temperature.

I think NPP is already expressed as kg of carbon per square meter per second. There's an implicit conversion between kg of carbon and kg of biomass I forgot to mention. Just assume life requires a certain ratio of biomass to be carbon, I think it's 2 to 1. I know at least one respectable academic model that does this.

So just sum NPP over the planet and subtract that from your atmospheric carbon pool.

The surface albedo will come in handy for salvaging the planet during ice ages

Snow albedo exacerbates an ice age, or is there something else I'm not getting?

I imagine we can also increase weathering of planet surface with glacial activity

Ho boy, if you find a model for that then I'm all ears.

Awesome talk, by the way!

davidson16807 avatar Dec 04 '18 05:12 davidson16807

Okay, so I went through your article on O₂ production. Lots of great points to be made:

  • photosynthesis is a function of photon flux density, not intensity. Switching to photon flux density will enable us to simulate photosynthesis on planets with strange lighting conditions, like those orbiting red dwarves.

  • the max O₂ production rate you mention strongly implies a max NPP, yes? Since photosynthesis is:

6CO₂ + 6H₂O + photons → C₆H₁₂O₆ + 6O₂

for every unit of C, there's a unit of O₂. The author estimates each cell has a projection area of 12μm², so:

10 fmol O₂ cell⁻¹ hr⁻¹ / 12μm² cell⁻¹ = 7.3 mol O₂ m⁻² year⁻¹ * 32g mol⁻¹ = 230 g O₂ m⁻² year⁻¹ = 7.3 mol O₂ m⁻² year⁻¹ * 1 C O₂⁻¹ = 7.3 mol C m⁻² year⁻¹ * 12g mol⁻¹ = 88 g C m⁻² year⁻¹

But as far as NPP is concerned that's a desert. So where's the disjunction?

Worst case is we take our estimate for NPP and use it to calculate O₂ production stoichiometrically. Should be a ratio of 1.7 gO₂ gC⁻¹, I think.

BTW, I found a citation for using that 2:1 biomass to carbon ratio I mentioned earlier. Ignore what they say about uncertainty, those numbers are in line with other citations and they're pretty well constrained for our sake.

I also realized I previously made an error. In an earlier post, I reported that plants need enough leaf area to produce our calculated NPP. Well, they actually need enough leaf area to produce GPP, which is NPP plus respiration. Fortunately, I also found a really awesome article that suggests the ratio between respiration and photosynthesis (let's call it "R/P") is highly constrained. For every unit of carbon that's gained by photosynthesis, there ought to be 0.4 - 0.5 units lost to respiration. Moreover, their reasoning is based squarely on the conservation of mass. Under a steady state assumption, we should be able to apply this ratio very generally, to any photosynthetic organism!

davidson16807 avatar Dec 05 '18 07:12 davidson16807

Great - I am glad it turned out to be a low number in the right order of magnitude. This is just cyanobacteria. I don't think it is strictly anaerobic in the study, but I figured it would give us a good starting point for ball-park numbers. I liked the idea about the constraints as mentioned in the article - I wonder if there is a way to estimate how quickly the life spreads and reaches max density

berg44 avatar Dec 06 '18 04:12 berg44

I liked the idea about the constraints as mentioned in the article

I think we have what we need to understand our next iteration on photosynthesis. We don't need to recreate functions from the graphs they give, we just need linear relationships and the law of the minimum. In other words, plants need several resources Rᵢ and for each resource there's a resource use efficiency, RUEᵢ that maps the availability of a resource to an estimate for growth. Multiply those together, and the smallest estimate for growth is the one you go with. Once you have your estimate, divide it by those RUEᵢs to get the actual amount of each resource consumed. You can also back-calculate from growth to estimate the amount of biomass needed to generate that growth, as I mentioned earlier.

I think this is the full list of resources we need to consider:

  • photon flux density
  • water
  • carbon dioxide
  • bioavailable nitrogen
  • phosphorus

Carbon dioxide will be uniform across the planet. Nitrogen and phosphorus will have to wait for now.

There are other factors too, like atmospheric pressure (plants can't live on the moon) and temperature (plant's can't live on venus). I'll personally want to implement these. These are harder to model because life could evolve to work with a new range of conditions. For temperature, we can generally rely on the Arrhenius equation because it works for any chemical reaction, but there's also a temperature at which proteins denature that probably depends on evolution.

Wherever possible, I want life to be represented in the most general way possible, but I suppose for a first pass we can assume anything we can't generalize will be assigned modern earth like values

Also, we do still need to compile a list of values for those RUEᵢs I mentioned.

glad it turned out to be a low number in the right order of magnitude

Probably just an issue with their estimate for cell size. A bioreactor is going to try to max out photosynthesis, so I'd expect NPP to be comparable with the max seen on earth. That's 2500 g C m⁻² year⁻¹, which also happens be the NPP of an algal bed, similar to our bioreactor. That's 28 times larger than our estimate, but if the cell's area is 12μm² / 28 = 0.43 μm², or 0.74 μm in diameter, it works out fine. The wikipedia says the algae they used has a minimum size of 2μm, so close enough to be accounted for by other things. It could also be the size of chloroplasts is what really matters.

I wonder if there is a way to estimate how quickly the life spreads and reaches max density

I think SimEarth created a misperception about the need to model this. Life can spread incredibly fast if able. Just look at any invasive species. An entire continent could be populated in several decades. For a timestep larger than that, we can simply assume life will spread to reach a steady state that's defined by the most limiting resource for each grid cell..

Over the longest timesteps we can assume every part of the planet can be touched by life, so we don't need to model the spread of life. This is what we have right now.

Over shorter timesteps (centuries to several dozen megayears) certain things like oceans can prevent spread, but only for certain taxons. Mammals never reached New Zealand, placentals never reached Austrailia, but overall those places still had plants and animals that carried out all the functions we need to represent the carbon cycle. If we wanted to simulated spread, we'd first need some way to represent diversity.

I mentioned this before, but I think we can use a field of 3d vectors for diversity, essentially a color map. Each grid cell represents the shared ancestry of life in a region. RGB values would be altered at random to simulate mutation and genetic drift. But this is an aside.

Assuming we have a way to represent diversity, a timestep of a megayear is still long enough that if a place can be reached, it will be reached. So in other words, we run a flood fill algorithm to identify contiguous regions where life can access. We fortunately already the flood fill algorithm implemented for vector fields and it's easy to port to scalar fields. When we say "can" be reached, we mean it can be accessed by life and has the resources there to sustain it.

For really small timesteps (years to centuries), you can assume that when the user slows time to that extent the world will already be in a steady state, so it's not that important to model unless you want to be like SimEarth and want to simulate invasive species on a planet with a technological civilization. In that case, I suggest using something like the reaction-diffusion equation to simulate life spatially as if it were a chemical reaction, but that seems like overkill for now.

davidson16807 avatar Dec 06 '18 19:12 davidson16807

Status update:

I've been distracted by some other model work recently. I got a PM from @redferret pointing out some issues with the model that I've since fixed in v2.6. Apparently, the model for atmospheric heat flow didn't conserve energy, so if you slowed down to a yearly or diurnal timescale, the planet would slowly heat up. Also, the ocean density calculation had been broken ever since attempting to standardize units of measure to MKS, which might have seriously affected plate boundaries and velocities, but that's fixed now.

These bugs could have easily been prevented by unit tests, so right now I'm prioritizing work on that. I'm extending unit tests to cover the application's academic layer, which is mostly just a bunch of simple equations you might find in a college textbook (surface area of a sphere, planck's law, etc.). I'm mostly just checking to make sure the model conserves mass/energy and gets the right order of magnitude.

After that I want to modify our existing calculation for photosynthesis to make use of photon flux density for photosynthetically active radiation (PAR), instead of temperature. I think this is a step in the right direction and it incorporates something I read from the paper on O2 produciton.

I already added some equations in the academic layer for estimating photon flux density between arbitrary wave lengths. The equations seem to give good results, and there are already a few unit tests for them.

However while I'm focused on this subject I think I want to implement a way to simulate how the atmosphere of a planet blocks certain wavelengths of light. Ideally, I want it to work for arbitrary wavelengths and atmospheric densities, in addition to working with atmospheres composed from an arbitrary mix of a limited subset of common gases (namely N2, CO2, H2O, O2, and CH4). Absorption for arbitrary wavelengths can require some pretty involved calculations though. You probably have a lot more experience than me on this, my knowledge of chemistry is pretty limited. Do you have any recommendations? I was reading about this thing called a weighted-sum-of-gray-gases model - is that applicable?

davidson16807 avatar Dec 16 '18 09:12 davidson16807

Status update:

I'm continuing my research in prep for a model for atmospheric absorption/reflection. I figure this is needed for two reasons:

1.) Because it's necessary to simulate the effect of CO2 on climate in a sufficiently general manner, and...

2.) Because by having attempted to implement photosynthesis, I realized I needed to estimate radiation at certain wavelengths. In order to determine what wavelengths to consider, I decided to go forward with the assumption that photosynthesis will evolve to utilize whatever wavelengths of light are available. However, this requires understanding which wavelengths get absorbed/reflected by atmosphere.

Whatever I implement, I ideally want it to work in the most general case (e.g. for all wavelengths of light, for all atmospheric compositions, for all temperatures and pressures, etc.). This will allow us to reuse code and simulate many interesting planets.

However, to model absorption this way, you'd have to do some pretty intense quantum mechanics for each molecule. I'm willing to sacrifice model generality in order to avoid doing that. if you have any suggestions, then I'm willing to hear it

All I need to do is empirically model absorption spectra for the most common gases that could occur on a planet, starting with the most influential. So for a first pass: H2O, O2, O3, CO2, and N2. For a second pass, I want to support Titan-like planets, so maybe CH4 and NH3 as well.

I see there are databases that are available online that provide this information (e.g. HITRANS, HITEMP), but these seem like they provide almost too much information. I need to be able to calculate atmospheric absorption fast. All I need are some cheesy, overly simplistic equations for each molecule, just as long as they cover a wide range of the electromagnetic spectrum. Again, I'm open to ideas.

Right now, I'm just plucking data points off absorption graphs I find online, like this one:

absorption_spectrum_of_liquid_water

I just want key data points that I can interpolate between. So within the model, water absorption might look like this:

spectra

If you have any ideas for what graphs and source data to use, let me know.

davidson16807 avatar Dec 24 '18 19:12 davidson16807

I think that is an academically rigorous way to do it - It seems like absorption wavelengths is beyond what I am trying to do for the purposes of climate modelling within a simple game. I am really impressed by the depth of thought and effort you put into the model so far, which seems like it is trying to be a dissertation on tectonics and modelling the whole planet.

If you start going down that road, you probably need to consider ozone and upper atmosphere chemistry of which I know very little. Besides that, you'll probably find the energy contributed at different wavelengths is quite variable. It looks like about 40% of the energy in the sun's radiation is in the visible spectrum so any minor variations in absorption in that tiny part of the spectrum would have significant implications for surface temperatures. If you are going down that road I would prioritize where energy intensity is highest for level of detail.

As an engineer I tend towards simpler solutions that would have the right overall behavior without going nearly to that level of detail to even consider any modelling of quantum states by molecule. I took some classes about various quantum states and I understand the fundamentals, but I don't know if I can advise on wavelengths absorption and what level of accuracy that would bring. I tend to try to identify the biggest discrepancies and make adjustments based on their return on time invested. Maybe we get that aspect of absorption within 2% but we still have 20% error in cloud and ice modelling. I would try to identify which factors have the biggest impact on climate modelling, others that come to mind are: ocean currents, jet stream, ice cap formation and retreat, impact of mountains on circulation. Maybe there is a way to gauge total absorption by atmospheric composition by assigning one value to each atmospheric component, then averaging their absorption efficiency to come up with a single efficiency number for the planet that could still change over time.

I am actually much more in the camp of slimming down complexity. I haven't done much in Java, so I am not sure how useful I will be in putting out code at this point, and a few other projects bubbled to the surface recently. I think it goes back to some different end goals. It looks like you are going for academic rigor and trying to stay as true to life as possible. My goal would be to get out a game that is true enough to life to be realistic, but I am not nearly as concerned about getting every detail correct.

berg44 avatar Dec 26 '18 22:12 berg44

It looks like you are going for academic rigor and trying to stay as true to life as possible.

It might help to explain my intentions. Yeah, I am generally striving to make the model scientifically defensible, since it's hard to find a model that does this realistically while still being user accessible. But that's not the whole picture.

My eventual goal with this project is to generalize the model to work with arbitrary planets:

  • airless planets
  • habitable moons of gas giants
  • uranus like planets that rotate on their sides
  • tidally-locked "eyeball planets"
  • planets around red dwarf stars
  • planets around binary stars

Basically, I want to do everything that's explored in this book

I've already done some work on this goal while implementing the on-rails orbital mechanics submodel. That submodel provides us with good estimates for average insolation for all the example planets I mention above. We already have the capacity to simulate climate on habitable uranus-like planets and binary star systems, though we don't have the UI to show it to the user yet.

And as we are right now, we only have the ability to work with earth like atmospheres, so in talking about this feature I want to start off with the most general solution possible. I am okay with some handwavy things, but if we know there's a better more general model that we can implement right now, then I think we should, especially where it's so fundamental to the climate and biosphere.

If you start going down that road, you probably need to consider ozone and upper atmosphere chemistry of which I know very little

I don't know much about it either. Handwave it for now, set atmospheric concentration for O3 to be a constant fraction of O2, or just simulate O2 for right now since we haven't implemented any effects from UV light.

Besides that, you'll probably find the energy contributed at different wavelengths is quite variable.

We already have an equation implemented that represents intensity at different wavelengths, check out Thermodynamics.solve_black_body_fraction_between_wavelengths() under noncompiled/academics/Thermodynamics.js.

If you are going down that road I would prioritize where energy intensity is highest for level of detail.

Agreed. Looks like we don't have much choice on that anyways, since most absorption spectra I see deal only with near-visible light.

I took some classes about various quantum states and I understand the fundamentals, but I don't know if I can advise on wavelengths absorption and what level of accuracy that would bring.

Yeah, I'm not suggesting we go that route. I only mention it because I'm trying to start with the most general case and fall back on something simpler where the more general solution proves too difficult.

Maybe there is a way to gauge total absorption by atmospheric composition by assigning one value to each atmospheric component, then averaging their absorption efficiency to come up with a single efficiency number for the planet that could still change over time.

If I'm not mistaken, there should be a straight forward way:

  1. find the absorption coefficient, let's say it's published in cm^2/molecule
  2. for a given wavelength, if you multiply the published value by a molecular density ( in molecules/cm^3 ) you get a fraction per cm
  3. if you multiply that fraction per cm by the depth of the atmosphere, you get a fraction (optical depth)
  4. if you take the exponential of that fraction, you'll get the fraction of light that shines through

If you have an atmosphere composed of several gases, just sum the optical depths from step 3, as shown here.

davidson16807 avatar Dec 27 '18 21:12 davidson16807

So it's been a few weeks (wait, er... months, really!?) and I do have to post my status on this.

Attempting to learn about how radiation penetrates through the atmosphere lead down a rabbit hole that's wound up bearing some unexpected fruit for another task we'd previously mentioned: improving 3d renders.

It's all the same equations in the end: reflectance, scattering, absorption, transmission, etc. Using 3d renders as a test platform for the equations provides visual intuition, as well as a visual verification for their accuracy. If you want to check out the results so far, it's on the tests/scattering branch. An example:

physically-based-rendering physically-based-rendering2

So in other words, I'm learning about this problem. I haven't given up on the task, I'm not ignoring it. Investing in education now leads to dividends later.

davidson16807 avatar Mar 01 '19 17:03 davidson16807

Also, the render model is really general purpose. I can for instance render a world where surface temperature is 4-5 times that of earth (in Kelvin):

emission

davidson16807 avatar Mar 01 '19 19:03 davidson16807

Hoookay, brace yourself, this doozy is going to production! 😬

davidson16807 avatar Mar 19 '19 21:03 davidson16807