Thrive Game Development

Development of the evolution game Thrive.
 
HomeHome  PortalPortal  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  
Welcome new and returning members!
If you're new, read around a bit before you post: the odds are we've already covered your suggestion.
If you want to join the development team, sign up and tell us why.
ADMIN is pleased to note that this marquee has finally been updated.
ADMIN reminds you that the Devblog is REQUIRED reading.
Currently: The Microbe Stage GUI is under heavy development
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Quick Links
Website
/r/thrive
GitHub
FAQs
Wiki
New Posts
Search
 
 

Display results as :
 
Rechercher Advanced Search
Statistics
We have 1675 registered users
The newest registered user is dejo123

Our users have posted a total of 30851 messages in 1411 subjects
Who is online?
In total there are 4 users online :: 0 Registered, 0 Hidden and 4 Guests

None

Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm
Latest topics
» THIS FORUM IS NOW OBSOLETE
by NickTheNick Sat Sep 26, 2015 10:26 pm

» To all the people who come here looking for thrive.
by NickTheNick Sat Sep 26, 2015 10:22 pm

» Build Error Code::Blocks / CMake
by crovea Tue Jul 28, 2015 5:28 pm

» Hello! I can translate in japanese
by tjwhale Thu Jul 02, 2015 7:23 pm

» On Leave (Offline thread)
by NickTheNick Wed Jul 01, 2015 12:20 am

» Devblog #14: A Brave New Forum
by NickTheNick Mon Jun 29, 2015 4:49 am

» Application for Programmer
by crovea Fri Jun 26, 2015 11:14 am

» Re-Reapplication
by The Creator Thu Jun 25, 2015 10:57 pm

» Application (programming)
by crovea Tue Jun 23, 2015 8:00 am

» Achieving Sapience
by MitochondriaBox Sun Jun 21, 2015 7:03 pm

» Microbe Stage GDD
by tjwhale Sat Jun 20, 2015 3:44 pm

» Application for Programmer/ Theorist
by tjwhale Wed Jun 17, 2015 9:56 am

» Application for a 3D Modeler.
by Kaiju4u Wed Jun 10, 2015 11:16 am

» Translator to Serbian here
by Simeartherist Sun Jun 07, 2015 6:36 am

» Presentation
by Othithu Tue Jun 02, 2015 10:38 am

» Application of Sorts
by crovea Sun May 31, 2015 5:06 pm

» want to contribute
by Renzope Sun May 31, 2015 12:58 pm

» Music List Thread (Post New Themes Here)
by Oliveriver Thu May 28, 2015 1:06 pm

» Application: English-Spanish translator
by Renzope Tue May 26, 2015 1:53 pm

» Want to be promoter or project manager
by TheBudderBros Sun May 24, 2015 9:00 pm


Share | 
 

 Planetary Climate Maths

View previous topic View next topic Go down 
AuthorMessage
~sciocont
Overall Team Lead


Posts : 3406
Reputation : 138
Join date : 2010-07-06

PostSubject: Planetary Climate Maths   Sun Jul 03, 2011 7:45 pm

This is a thread for maths having to do with planetary climate. I'll update it whenever I create more equations to deal with it.

All equations and expressions should be written in Times New Roman.

1) Sunlight intensity by latitude

l=le(cos(90-d))

Where
l is light intensity
le is light intensity at the temporary equator (place where light hits the planet @ highest intensity (90°)
d is degrees latitude measured from temporary equator

equation assumes:
-light rays only hit it parallel to that plane, from one light source

2) Seasonal difference in sunlight intensity

t/.9°=ds

Where
t is the tilt of the planet on its axis, in degrees
ds is the % difference in sunlight intensity from summer to winter

3)Goldilocks zone (distance from sun)

z=l2

Where
z is the distance from sun where the zone is (in astronomical units, where the distance between sun & Earth is 1)
l is the light intensity of the star

equation assumes:
the planet is the same size and density as earth, making it have the same general climate.

4) Star Light Intensity
Reference

l=m3.5

Where
l is the light intensity of the star (compared to the sun)
m is the mass of the star (compared to the sun)

5) light intensity over distance
source

l= 1/d2

Where
l is the light intensity of the star (compared to the sun)
d is the distance from the star



Star Table- a more complete table can be found at Wikipedia
ClassTemperatureConventional ColorMassRadiusLuminosity
O≥33,000blue≥ 16 M☉≥ 6.6 R☉≥ 30,000 L☉
B10,000-33,000blue white2.1–16 M☉1.8–6.6 R☉25–30,000 L☉
A7,200-10,000white to blue white1.4–2.1 M☉1.4–1.8 R☉5–25 L☉
F7,500-6,000white1.04–1.4 M☉1.15–1.4 R☉1.5–5 L☉
G5,200-6,00yellowish white0.8–1.04 M☉0.96–1.15 R☉0.6–1.5 L☉
K3,700–5,200yellow orange0.45–0.8 M☉0.7–0.96 R☉0.08–0.6 L☉
M≤ 3,700 Korange red≤ 0.45 M☉≤ 0.7 R☉≤ 0.08 L☉

6)Light intensity @ noon at any point on a planet at any point over the rotational period

le = light intensity at the temporary equator
x = time of year (0 >= x > 1)
delta = tilt at x
t = tilt at winter solstice
h = time of day (in radians, with 0 = noon, +/- pi/2 = midnight)
phi = lattitude

delta is calculated as before:
delta = cos(x * 2 * phi) * t

angle of incidence from the wiki article:
cos(theta) = sin(phi) * sin(delta) + cos(phi) * cos(delta) * cos(h)

light intensity:
if cos(theta) <= 0
Q = 0
else
Q = cos(theta) * le


Testing this, I get the following graph for light intensity vs time of year at noon (yellow lines are near the equator, between -pi/8 and pi/8, red lines are southern hemisphere, blue lines are north):

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]


Last edited by ~sciocont on Sun Oct 14, 2012 9:55 am; edited 6 times in total
Back to top Go down
View user profile
~sciocont
Overall Team Lead


Posts : 3406
Reputation : 138
Join date : 2010-07-06

PostSubject: Re: Planetary Climate Maths   Tue Aug 02, 2011 1:05 pm

Update 8/2/11
Added equations 2,3,4

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]
Back to top Go down
View user profile
~sciocont
Overall Team Lead


Posts : 3406
Reputation : 138
Join date : 2010-07-06

PostSubject: Re: Planetary Climate Maths   Sat Feb 18, 2012 3:00 pm

Light intensity by distance added.

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Sat Oct 18, 2014 8:45 am

Climate Dynamics:

Hi Thrive! There is a TL:DR at the bottom if you want that. I wanted to take a shot at some climate modelling. All feedback welcome.

So I have done some thinking and reading about climate dynamics. I wanted to post in the style of Seregon's “crash course” on population dynamics. Hopefully a non-mathematician will be able to read this and understand how climate systems work in general.

I bring this up now as climate fluctuations are most important in the microbe/multicellular stage (as the timescales are large) and get less and less important as time goes on (because the timescales get shorter) so it would be nice to have something in place.

Questions to answer:

1) Based on the size of a planet, distance from it's star, type of star and elemental composition of the atmosphere/planet can you deduce what sort of climate the planet will have?

2) When we look at the microbe stage and I am swimming around can you tell me what temperature it should be in my patch? (I have been using the word “patch” to mean a sub-area of a biome).

3) If my civilisation radically changes the composition of gasses in the atmosphere can you model how the climate will change?

4) Can we make a climate + weather model that looks good and is (at least somewhat) realistic?

So as you can see these are big questions and will take a lot of answering. I will do my best here.

To clear up a couple of things weather is short timescale fluctuations in temperature, pressure and air velocity etc (think windy and rainy rather than sunny and bright). Climate is large timescale averaged weather (so if it is 5 degrees at night and 10 in the day then the climate temperature is 7.5). Climate evolves over much longer timescales than weather.

For that reason I suggest we have a primary climate model with uses atmospheric composition + ice coverage + solar factors to derive a climate (average) temperature for the planet and then we have a weather model which is slaved to this one to produce local weather when you need it.

A question which has arisen in the species population dynamics modelling is you can either have a lot of species and a simple model OR a few species and a very accurate model. The same question arises here, how much computing time do we want to give to weather? I suggest we have a simple 1D climate model that can be run continuously and then skimp on the weather model (and essentially “paint” the weather on the planet as it will look better and be much easier).

As you can see from this picture



there are a lot of factors that go into modelling a climate! So we can't deal with them all.

I) Radiative Equilibrium.



At the simplest approximation a planet's atmosphere is determined by how much heat energy arrives from the sun (mostly in the form of visible light) versus how much leaves by radiating away from the earth. Energy leaves the earth because anything which vibrates (and hot things vibrate!) gives off longwave radiation (which is also called “blackbody radiation” (and was very important in the development of quantum mechanics!)).

So this means the change in temperature is Energy in minus energy out, or

dT/dt = E_in – E_out

Where T is temperature and t is time (I hope that's not confusing!) The most basic interpretation of this is

E_in = S

E_out = C*T^4

so

dT/dt = S - C*T^4


where S is the incident solar radiation (incoming light energy from the sun), C is a constant and T is the temperature of the atmosphere. (The amount leaving is T^4 by Stephan Boltzmann Law ).

This is a good first model and means we can derive the temperature of the atmosphere from facts known about the solar system. However it does not change over time (other than if the star changes and if the planet gets closer of further from the sun, see Milankovitch Cycles ).

If the planet starts at some initial temperature T_0, then it will evolve slowly towards an equilibrium, T_E, where

S = C*(T_E)^4

and the incoming energy is balanced by the outgoing energy.

II) Albedo

Albedo means how white something is. This is important because it will reflect away some of the incoming light if it is very white. Snow is much whiter than water or soil so albedo is proportional to temperature. When the temperature on the planet is low then there is a lot of ice and the planet is very white so a lot of light energy is reflected away. When the temperature is high there is very little ice and very little of the light energy is reflected away.

We can improve our model by making S a function of T, S(T). I have drawn a graph



The red line is C*T^4 which is E_out and the blue line is S(T) which is E_In (see [4] where I got it from). As you can see the equilibrium is marked by an arrow. This is where the two graphs cross. To the right of this point E_out is higher than E_in so the temperature would decrease over time. To the left of this point E_out is lower than E_in so the temperature would increase over time. So this equilibrium is stable. The kink in the blue line represents the earth icing up. When the graph is at it's low value the whole earth is an ice ball so very little light lands, when the graph is at it's high value it has no ice so much more light lands, inbetween the earth is partially icy.

In the next graph the planet is further from the sun. This means the blue E_in line is lower. Now there are 3 equilibria meaning the planet has multiple stable states. Interestingly it is hypothesized the earth was in an Iceball state for 4 million years (corresponding to the lower equilibrium where E_in and E_out are balanced) but carbon buildup in the atmosphere may have ended this period (if it even happened. We know other objects in the solar system are iceballs, like Europa, so it is possible).



So we have made some progress, we now have taken account of the reflectivity of ice and snow!

III) Atmospheric Gasses, the carbon cycle and the greenhouse effect.

As light is radiating away from the earth (the blackbody radiation, Stephan-Boltzmann law!) it can strike particles in the atmosphere and stay trapped. This is known as the greenhouse effect. The main particles for this are C02 and water vapour however there are many others, like methane which I will not consider.



So to model these we need to understand first how the carbon cycle works. This is also important because there is a direct interface with the microbe stage population dynamics / compound system.



To simplify this a bit I'll just consider this subset for now.



The Ocean-Air Gas Exchange is driven by partial pressure, that means essentially the concentration of the Air and the Ocean should balance (of course it is more complicated than this but I will get onto that in the next section). This exchange changes with temperature. When the ocean is frozen over very little carbon is absorbed, when it is open water more is absorbed. Organisms in the ocean take up the carbon and when they die it gets deposited on the ocean floor. Over a long time period these deposits get drawn up by tectonic movement and spat out of volcanoes or the rock gets weathered away and the carbon re-enters the atmosphere. This is what ends an “iceball earth” scenario, with the oceans frozen very little carbon is absorbed in the ocean and so it pools in the atmosphere. This traps more longwave radiation so the planet heats up and this starts to melt the oceans reducing the albedo.

How I suggest we model this (though see the next section for debate on that) is to have a carbon cycle running (we are already working towards modelling carbon concentrations for the compound system so this isn't a huge jump) and then we reduce the escaping longwave radiation by a factor based on the C02 saturation of the atmosphere.

So E_Out = C(Carbon)*C*T^4.

I've drawn a graph,



when you add the carbon the E_out graph moves to the left and this moves the equilibria. As you can see as we change this parameter the system goes through some bifurcations and this makes the system quite complicated.

We can do the same thing for oxygen (as in measure the amount of oxygen in the atmosphere).



The effect oxygen has is a bit different. As ozone the oxygen catches some of the incoming solar radiation and traps it in the high atmosphere. This means it can be radiated away more easily than if it falls on the earth's surface.

I suggest we model this simply by adding a constant to the E_in term, to make E_in = (1 - C(oxygen))*S(T). Again oxygen uptake by the ocean will be affected by T (because when the water is frozen less enters) and so these systems will be non-linearly coupled.

If you wanted to add methane and other greenhouse gasses you could, quite easily, by using the same adjustment as I used for the presence of carbon. This is reasonably valid as carbon is relatively well mixed throughout the atmosphere.

IV) Water Vapour

Water vapour is where things start to get more complicated. I did an AskScience on Reddit [1] to help to try and understand this.

The approach to water vapour taken in [2] is to split the atmopshere into vertical sections (18 I believe). And then to model how energy moves between the sections. Here is a picture from [2].



Then the energy radiating from one layer to another is calculated, along with convection which itself moves energy around. The advantage of the method of [2] is that they can replicated the tropopause.  It is an odd fact that as you ascend in altitude the atmosphere gets colder, until a minimum where it starts to get hotter again. The place where this process reverses is called the tropopause.

However I think this is too far for us. In my opinion I would like to propose we don't build a model as complicated as they did in [2] and we stick with the simple, 1D model I have been extending thus far and we add a mechanism for water vapour. The form it will probably take (and I haven't got right down to an equation for this yet) is a delay differential equation which reduces E_out. This is relatively delicate because we don't want a huge amount of runaway climate change (the atmosphere getting hotter increases the amount of water vapour which makes the atmosphere hotter …) though it would be nice to have some.

Another issue is that because clouds are white they reflect away some of the incoming light (they have high albedo) so this needs to be considered too.

It is hypothesized that Venus had this exact effect. That all the water was pushed into the atmosphere because it trapped so much longwave radiation.

V) Spatial Variation

This is where things get really complicated. Different parts of the planet are different temperatures (as they have different albedos and specific heat capacities) and this causes the air (and ocean) to circulate, moving this energy around. This, on a short time scale, is weather.

Now modelling this is very hard because fluid flow is usually modelled using the Navier-Stokes equations which have a very complicated structure. I found these equations for the atmosphere but it's going to get very complicated to simulate these very quickly.

Because of this I think it's not worth spending a lot of programming time and computer resources building a circulation model. Remember that if you want to cover the earth in gridpoints 100 miles apart (so you still have very little resolution (as in you have no idea what is happening in-between these gridpoints)) then you need 20,000 gridpoints. This is so many we could easily have every player's computer only modelling the climate on one planet.

Another reason why I am in favour of a 1D model is that we can run it for multiple planets. Once we have a carbon cycle, oxygen cycle, formula for water vapour and some solar data then we can model the climate with some accuracy (this is my answer to question 1). Because it is so computationally cheap to do it this way we can have a galaxy of thousands of planets all with dynamic climates!

Hopefully the results will be reasonable. Venus, as it is close to the sun, will have a very high equilibrium with runaway water vapour (accurate), the Earth should, hopefully, have a temperate climate. Mars will be much cooler and have all water locked away as ice (~accurate I think) and an object like Europa would be an iceball (accurate).

This means we can randomly generate planets and have them generate their own climate (this will need a lot of testing to get the parameters right).

Of course this model only refers to rocky planets with thin atmospheres but gas giants are less important (though I am happy to think about them if people are interested).

So to deal with spatial variation (and question 2) I suggest that we calculate an average, climate temperature for a planet and the “paint on” variation and weather. So the planet cools as you go closer to the poles and higher in altitude. The ocean cools as you go deeper but when ice forms it forms on the top. Then we add in some animated jet streams / Hadley cells and use this to make wet / dry bands. This should look really good (as we are just copying the earth) and give hot deserts and hot rain forests on the same planet (as we don't want the whole planet to be 1 biome!). So I think this is the best answer (and answers question 4). If we go down the route of trying to model how water vapour is dispersed around a planet then we may end up with worse results than painting for a lot more trouble! Though if anyone has suggestions I would be interested.

I think question 3 is answered. If you fly to a planet and dump a load of C02 into the atmosphere then yes, the climate will change radically. This is cool and paves the way for terraforming in the galactic stage.  

References:

[1] I did and AskScience on Reddit!

[2] Manabe and Strickland '65  

[3] Manabe et al '69

[4] Hans Kaper: Maths and Climate

TL:DR To sum up.

I suggest the model

dT/dt = (1 - C(Oxygen))*S(T) – f(Watervapour)*C(Carbon)*C*T^4

for a planets average temperature. When T is temperature, t is time, C(Oxygen) is the atmospheric concentration of oxygen (came for C(Carbon)), S(T) is albedo adjusted incident solar radiation, C is the Stephan-Boltzmann law constant and f(Watervapour) is a yet undetermined function of T and t for the amount of water vapour in the atmosphere.

This is good because it is computationally cheap, can be used on procedurally generated planets and is asymptotically stable (the temperature is never going to get ridiculous high or low). I think it fits out present solar system reasonably (not perfectly).

On top of this we should “paint” some local planetary weather when we need it or when the player wants to see it, though this can be added at a later stage.

.

Hope you enjoyed this post! All responses and thoughts welcome! Is this along the right track? Do the rest of you have other ideas about how climate should be modelled or any objections to what I am suggesting?
Back to top Go down
View user profile
moopli
Developer


Posts : 318
Reputation : 56
Join date : 2013-09-30
Age : 21
Location : hanging from the chandelier

PostSubject: Re: Planetary Climate Maths   Sat Oct 18, 2014 11:48 am

Following on with question two, here are some starting points for the spatial painting of weather/local climate:

Assume the planet rotates. So, 1: the sun rises in some direction if you are on the planet's surface, let's call it east, and then define north, south and west accordingly. 2: We can make some handwavey use of the coriolis effect to choose prevailing winds.

Some background: We agree that since planets are (near-)spherical, there is a latitudinal gradient in the amount of heat absorbed by the surface. Since there's an atmosphere, the temperature gradient will result in a single convection cell in each hemisphere:


The equatorial ring of maximum temperature is very important -- we call it the InterTropical Convergence Zone, or ITCZ, and it's an area characterized by low pressures and low pressure differentials, and thus almost no wind, also knwn as the doldrums.

Since the planet rotates, we end up with a skew in the direction of the wind -- winds flowing towards the equator get skewed to aim westwards, winds flowing away get skewed to aim eastwards. Thanks to some dynamic instability in the large-scale flow (ie, stuff we need not calculate but can handwave), the one twisted cell will instead break up into several cells, much like on the Earth:


Or Jupiter (here, z abbreviates upwelling, and b downwelling):


I have a feeling there's a simple equation which we could pull out of an atmospheric model for the number and size of bands given planet size, some temperature information, rotation rate, and so on; but I don't have it.

Anyway, we have some cells; where hemispheres are (nearly) mirrors of each other; and where within a hemisphere the equatorial and polar winds aim west and to the equator, and the direction alternates between consecutive cells. So, an odd number of cells. In between cells are bands of atmospheric upweling or downwelling. Downwelling is generally cold and dry, upwelling is generally wet and stormy. The ITCZ is a band of upwelling, and the poles are points of downwelling, and in between, we alternate. So, trivially, we always have an odd number of cells.

So now we have prevailing winds. Since prevailing winds passing over oceans acquire moisture, we can start making some rules for humidity of areas:

  • Areas of atmospheric downwelling are dry.
  • Areas between downwelling and ocean are dry.
  • Areas between upwelling and ocean are wet.

Finding these areas could be annoying if we have complicated prevailing wind patterns, so we add an assumption -- that prevailing winds only go diagonally -- between NE and SW in northern hemisphere, and NW and SE in southern. With this simplifying assumption we can use a sweepline algorithm. And since we're only looking for large-scale effects, we can use a very low resolution and only need to run this once per tectonic change. Later we could augment the sweepline with things like rain shadow, but we aren't considering topography yet.

So we've settled large-scale wind flow; but now we get into seasonal variability. Let's consider the case of a planet with seasons. Since winter/summer are ambiguous terms, I'll call the seasons january and july (we won't be worrying about the transitions yet). In january, the south hemisphere gets more heat from the sun, and in july the north does. Now, if we look all the way back at that first picture, the center ring between north and south cells is positioned at the maximum of heat absorption. Thus, due to seasonal variation, the ITCZ shifts south in january and north in july. This is what causes monsoon climates -- regions of the earth between ITCZ extrema will get winds from the south for half the year and winds from the north for the rest. However, not everywhere in the tropics is there a monsoon climate. That's because the ITCZ is not a simple circle, but very wavy:


Luckily, there's a simple reason for the waviness. Thanks to the specific heat of water and the circulation of the oceans, oceans have a seasonally-moderating effect; and thus contribute less than the continents to the shift in temperature gradients causing a shift in the ITCZ.

How does that translate to Thrive? First we sum up the amount of continent in each of several north-south strips, can be very approximate. Then, we skew the january ITCZ south, scaled with the amount of continent south, and possibly slightly with the amount of continent north. We do the same, vice-versa, for the july ITCZ. We smooth the lines a bit, and the area in between is our monsoon zone.

So now, within the monsoon zone, the direction of prevailing wind depends on time of year. This means our sweepline humidity-solver will have to calculate some areas more than once, going from a different direction. This isn't much of a problem, it just abstracts the storage of the climate information somewhat. This also means that we'll have to move the ICTZ over time. How that happens depends on our implementation, but it would be really cool to see the line of equatorial storm clouds shift north and south if you observe a planet (or live on it!) for long enough.

Now, that should be enough so far -- we know how to paint large-scale land areas with varying humidity (with a method more realistic and simple than measuring distance to water; to boot), we have prevailing winds, and we even have the beginnings of a model for seasonal variation in wind patterns. Next we'll have to handle topographic effects, a way to figure out the number and placement of atmospheric convection cells, the particulars of the sweepline, seasonal movement of jetstreams (and the associated changes in prevailing winds), and issues anyone sees with this stuff.
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Sun Oct 19, 2014 9:55 am

Wow Moopli, great response, thank you. A couple of things

I) Are you in principle agreeing with the paradigm of a simple 1D climate model for average temperature and then painting on weather? I assume you are. I think this is a good way to go and I'd like to hear from anyone if they have objections. I'll keep thinking about water vapour in the air, I have a few ideas, some which are cheating and some more complex.

II) Painting on the ice is very easy aswell, once you have a temperature field for the planet (using the value from the model + colder towards the poles and high altitude + weather effects) then anywhere where it goes below 0 degrees C paint it white. This should give a nice looking effect.

III) I'm not very interested in seasons as they will be averaged out in much of the gameplay, especially the microbe stage where 1,000 years is the blink of an eye. However they may become more important in later stage like industrial where the gameplay slows down to that kind of speed.

However what I am really interested in is "Can we derive biomes from the data we have?"

Can we set up an algorithm so

1) Stellar data and atmospheric compounds determines the planets average temperature

2) We paint some weather on corresponding to this

3) We derive the biomes from this weather data.

Becuase I think if that is possible then it is very exciting and powerful. Imagine being able to set up a planet and watch it derive the biomes for you. It paves the way so beautifully for terraforming in the late game aswell, as you'll be able to see things like giant solar shades / orbit alteration / dumping C02 on the planet actually affect the creatures living on the planet in real time. (As the biomes will change and move and the species will have to adapt to that or die).

That's got a really nice feel for me as a unique type of gameplay I've never seen before. Anyway for the microbe stage that is not too important however I don't think derived biomes are that difficult.

Are biomes defined by temperature / humidity / water content / topography / compounds (C02, 02 etc)? Because if they are then it shouldn't be too hard and that is pretty cool.
Back to top Go down
View user profile
MitochondriaBox
Learner


Posts : 188
Reputation : 7
Join date : 2013-01-29
Age : 17
Location : Houston, Texas

PostSubject: Re: Planetary Climate Maths   Sun Oct 19, 2014 5:23 pm

[quote= "moopli"] Now, that should be enough so far -- we know how to paint large-scale land areas with varying humidity (with a method more realistic and simple than measuring distance to water; to boot)...[/quote]

Works well on nuclear fallout and dust storms, too. Also, sand from the Sahara Desert apparently is carried by the wind all the way to the Amazon, so there's something.

tjwhale wrote:
II) Painting on the ice is very easy aswell, once you have a temperature field for the planet (using the value from the model + colder towards the poles and high altitude + weather effects) then anywhere where it goes below 0 degrees C paint it white. This should give a nice looking effect.

Preferably based on the presence of water on the celestial body; the moon's dry, and it can get really cold at night there, so there would be less/no white-painting. Same for far-out asteroids that don't have very high ice content.

tjwhale wrote:
I'm not very interested in seasons as they will be averaged out in much of the gameplay, especially the microbe stage where 1,000 years is the blink of an eye. However they may become more important in later stage like industrial where the gameplay slows down to that kind of speed.

I agree with seasons being pointless in the Microbe Stage, and maybe the Multicellular Stage, too, since you're at the blasted bottom of the ocean. Not sure with the Aware Stage, since I heard somewhere that you play at normal time, but time jumps occur in the editor, so you could, potentially, witness seasons while living out your creature's lifetime. Also, if seasons only came in the Industrial Stage, then everything that evolved for static temperatures during the Aware Stage would die from seasons coming out of nowhere.

Also, there wouldn't be any reason for migration, since, y'know, no seasons.

tjwhale wrote:
Becuase I think if that is possible then it is very exciting and powerful. Imagine being able to set up a planet and watch it derive the biomes for you.

I agree! Biomes being simulated in a way like this keeps things sensible. Jungles in a rainshadow would be weird.

tjwhale wrote:
Are biomes defined by temperature / humidity / water content / topography / compounds (C02, 02 etc)? Because if they are then it shouldn't be too hard and that is pretty cool.

I suppose that's how it'll be. I'm pretty sure compounds'll be evenly distributed throughout the lower atmosphere, though, so that'll affect the entire planet.

Will wind-humidity dynamics take the amount of water being transported into account? A planet with only a few small seas, for instance?
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Fri Oct 24, 2014 5:07 pm

So I did a bit of simulation to test these ideas. If found this set of notes pretty helpful.

So as a raw calculation, if you assume the albedo of the earth is approx 0.3 (so 30% of incoming radiation is radiated away) and you take

sigma = C = Stephan-Boltzmann law constant = 5.67 x 10 ^-8 W m^-2 K^-4
S = incoming solar energy = 1367 W m^-2

then you get a temperature of the earth of 255K (which is Kelvin, so -18.5 C) which is a bit low but really not that bad.

From there I set up a dynamic model. The oxygen concentration is set at 0.2 (20% of the atmosphere is oxygen but of course not all of it is Ozone so this may need to be tweaked) and C02 concentration is 0.03. I also assumed that if the atmosphere were all C02 then it would block 30% of outgoing radiation and the amount blocked grows linearly. This is very rough, see the notes for more on absorbtion spectra.

So

dT/dt = (1 - C(O2)/3)*S*(1 - albedo) - C*(1 - C(C02)/3)*T^4

and I found the temperatures were a little low however if I upped the incoming solar radiation it yields something better.

This first image is hundreds of starting values that converge to a single equilibrium (red dot = air temp, there are so many red dots you can't really see them)



so the model does work independently of initial value (which is good and kind of obvious).

I then added in water vapour. I made three very simple assumptions (which may need improving) that

1) when the ocean temperature is below 273K (0 C) there is no water vapour in the atmosphere and when it is over 373K 100 percent of the ocean is in the atmosphere as water.

2) The ocean equailizes it's temperature with the air but the mass of the ocean is a lot greater (it takes 100x more energy to heat up 100x more mass) and the specific heat capacity of the ocean is a lot greater (it takes more energy to heat the ocean up by 1C than the atmosphere by 1C)

I'll call this constant A,

A = Mass of air/Mass of ocean * SHC of Air / SHC of Water

3) If all the water were in the air it would block 30% of outgoing radiation (however this should be dependant on the mass of the water so I'll go back to that)

and now the equations look like this

dT(Air)/dt = (1 - C(O2)/3)*S*(1 - albedo) - C*(1 - C(C02)/3)*T(Air)^4 + (T(Water) - T(Air))*A^-1

dT(Water)/dt = (T(AIR) - T(Water))*A

now note this doesn't conserve temperature, it conserves energy. Heating the water up a bit stores a lot more energy than heating the air up a bit (by factor A).

Then I got this for something like the earth (red dot = air temp, blue dot = water temp, size = amount of water vapour)



which seems pretty reasonable, about the right temperature with a humid atmosphere.

This next image is for something like Venus (I got it by just increasing the incoming solar energy a lot)



As you can see all the water is in the atmosphere. (the first few dots are small as the oceans warm and then all the water vapourises).

Then I added a sinusoidal driving force (some kind of orbital variation, very artificial though we havent made any deicisons about how orbits will be calculated)



This would be periodic ice ages etc (Note the changes in air humidity they cause)

Then I added a super simple carbon cycle. Basically weathering traps C02 in the rocks and volcanic activity lets it out. Volcanic activity is constant but weathering is temperature dependant (Which is interesting because it means over long time scales C02 stabilises an atmosphere! Unlike the current worries about climate change (so maybe the model should be revisited for those reasons) and I very quickly hacked this into the code).

Colour of the red dots now represents carbon. Black = no carbon, full red = loads.



However now the model is a bit too stable IMO.

I'd appreciate some feedback to these questions

1) How stable should the climate be? I assume pretty stable as when you are a micro-organism there is nothing you can do if your climate spins wildly off

2) Do you think this model is too artificial? It does answer a lot of the questions I started with in this thread, it is dynamic and reasonable, but a bit "tacky" and "hacked together".

All feedback welcome!
Back to top Go down
View user profile
moopli
Developer


Posts : 318
Reputation : 56
Join date : 2013-09-30
Age : 21
Location : hanging from the chandelier

PostSubject: Re: Planetary Climate Maths   Sun Oct 26, 2014 12:11 am

So far, I don't think your model is tacky or artificial. If a simpler model that involves a lot of approximations and handwaving works about as well for our purposes as a more complex model, then I'm all for simple. I'm keen on seeing if a better model for ocean-atmosphere water balance will change anything, though.

And yeah, I'd say the model should be pretty stable. I think. Considering the main cycles at work, there's almost always an equilibrium in each -- global warming is simply a shift in the carbon equilibrium towards the atmosphere, after all. I guess what I'm saying is there shouldn't be any runaway effects -- a planet going Venus isn't an exception, but is totally unrelated. The sort of trigger for such a massive change should be something of astronomical proportions, like, say, tidal effects causing massive volcanism, or orbital instability taking you to an orbit closer to the sun, or the sun changing life-cycle stage and putting out more heat, or the lack of a magnetosphere allowing all water vapour to be stripped from the atmosphere by the solar wind, or another reason.

Of course, it's always possible to put a planet sufficiently close to the inner edge of the Goldilocks Zone that a bolide could heat the atmosphere enough that the oceans start boiling over; but luckily the width of this danger zone (a few degrees C at most) is sufficiently small that you would still have plenty of safe space for planets in the habitable zone.

Now to talk some more about my thoughts on painting weather and biomes:

  • For each segment of the sweepline, we can track air humidity, subject to a few simple rules:
  • Passing over water would increase it, with rate and maximum humidity scaling with temperature
  • Passing over land would decrease it through precipitation, with rate scaling with humidity, and probably some other things.
  • Orographic precipitation would happen when the segment hits an altitude that is 1) high enough to lift the clouds, and 2) high enough so the lower pressure adiabatically cools the airmass enough that its maximum humidity drops below current humidity.
  • Any time maximum humidity falls below actual humidity, excess humidity is dropped as precipitation.
  • That takes us to precipitation, which drops as water if the surface temperature is above 0 C and ice/snow otherwise. Other distinctions aren't important I'd say.
  • I'm sure we have something somewhere on turning temperature/precipitation ranges into biomes, but I'm very tired and not all earth biomes can be generalized I think.


I'm in the mood to spitball, so it's time for more thoughts!

After a quick google, it turns out I was right on that last point -- modern biomes can't even be generalized to the same Earth long ago enough. And the reason why is obvious; after all, a biome is defined by the prevalent type of ecosystem, and if we want to map temperature-humidity coordinates to biomes, we have to work our way backwards anyway. Since we don't know what sort of ecosystems will arise, that gets decidedly less trivial. So we're left asking ourselves whether we really want to paint biomes down at all. And that gets deep into the issue of how we'll populate worlds with ecosystems.
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Sun Nov 02, 2014 10:42 am

I've done a bit more messing around with numerics (which is something I'm not very good at). I'm hoping these charts are easier to read.

Along the bottom (x - axis) is the amount of solar radiation received from the sun (in Watts per square meter). Being on the left means you are close to the sun. Along the side (y - axis) is the temperature of the atmosphere (in Kelvin, 0C = 273K).

I have tried to plot (as best I can, I had some trouble with the axes) the known data we have for planets in our solar system. There's problems and I'll get to that below.

This first graph is of pure radiative equilibrium.



As you can see it is very good for Jupiter and Mars but very far off for Venus (as Venus has a lot of water vapour effects).

This second one is with temperature dependant albedo and with a relatively slight water vapour effect (water vapour blocks 1/3rd of outgoing radiation).



Which is better but still not great.

This third one includes carbon dioxide in the atmosphere, which has a stabilising effect on the climate.



Finally I set the amount of radiation the water vapour could trap to 99%! Which is huge and it get's Venus pretty much correct, which is cool.



Anyway I hope you like what I have done.

Problems: All the above planets have very different climate systems. Under the model I am using Mars would be an iceball but of course it's not (there isn't enough water for that). Mercury is much closer to the sun but is only 425K (so quite a lot cooler than Venus) and so that needs to be taken account of. The next thing I'll do is try and get a variable model for how much water is on the planet (which will hopefully take Venus and Mercury's difference into account and maybe Mars aswell).

I don't know how this will all work for planets much further from the sun, I'll keep looking into it. Though I think a pure radiative equilibrium will probably work well for them.

----

Moopli: I agree the question of how to populate a planet with ecosystems is very difficult and deep.

What we have thus far (if we use this climate model and the painting of weather) is a planetary temperature, a planetary water vapour volume and a planetary carbon system. From the weather system we have local temperature, humidity and rainfall. So this is pretty good.

Where the problem comes in is when trees grow in an area it radically alters the local climate. Lots of plants and animals can live in forests but not on plains (and visa versa). However for the microbe stage what we have is basically enough (a rocky earth where micro-organisms can't really alter the local climate, though they can alter the gas concentrations in the atmosphere and affect the global climate.)

From here we then have the question of whether we want to try to simulate how trees affect climate. If so we will have to populate the planet iteratively. That is start with only microbe life and then go forward in time as more complex life evolves and changes the local climates (this is going to be very hard, though can a biologist here speak to whether any life forms other than trees can alter climate? Is modelling plants enough? (of course animals can affect the plants so that is complex too)).

Or we can just be relatively arbitrary and just pick some areas which have the right conditions and designate them as forests and others as plains etc. Basically just painting the biomes on.

Maybe it would be best for now just to have a placeholder system of arbitrary biomes and then come back to it later. For the microbe / multicellular stage it's not going to matter.

For the space stage it's going to be really important we have a cheap way of (relatively realistically) populating planets with life (biomes and species) as we're going to need to do it for thousands of planets. But that's a long way off and can be neglected for now.
Back to top Go down
View user profile
moopli
Developer


Posts : 318
Reputation : 56
Join date : 2013-09-30
Age : 21
Location : hanging from the chandelier

PostSubject: Re: Planetary Climate Maths   Mon Nov 03, 2014 12:08 am

The problem of laying down ecosystems is even more deep than that -- the current system of biomes is not a general system.

For example, the bistable equilibrium between forests and plains likely dates no earlier than the early cenozoic, when the first large grazers arose. Before that, most ecosystems were on a continuum, anywhere from barren to small plants to shrubland to forest. The forest might be coniferous, or fern, or bamboo, or deciduous, or cattail, or something not of this earth; but grasslands in particular require large grazers. The reason why is simple: Grasses have basal meristems; most forest-forming plants that outcompete them in grazer-free environments have apical meristems. Meristems are the places where new stems/leaves/branches form on a plant, they are the places with most of the stem cells, and where the lengthwise growth of a branch/leaf/etc occurs. Aplant with apical meristems can have a meristem on every new branch, and can thus branch much more densely, and grow much bigger. Plants with basal meristems are limited, usually, to growing new things from one place, or from one axis. So, the apical-meristematic plants will tend to outcompete the basals, since their ability to get more of their leaf mass higher (due to the different branching) shades out the basal-meristematic plants. And thus we get forest being the dominant archetype, with different levels of forestation depending on the environment.

But then, in come the grazers: instead of browsing; eating just the leaves of many plants, they chop away all of each plant that they can bite with their incisors. This is very bad news for young, soft apical-meristematic plants -- they lose their meristems, and cannot grow new leaves or branches, and die. Grasses, however, have basal meristems -- even if all the blades of grass get cut down, they can grow from the base, and thus survive. So where grazers are, forest won't form. And then, when you consider old-growth forest, there isn't much food accessible to specialised grazers, so where forest is, grazers won't come. And there you get the bistable equilibrium.

Given all the other ways large communities of photosynthetic autotrophs could be configured, we really have too many different possible topologies (for a certain stretch of the word, considering I'm only considering large-scale physical configuration) to enumerate. Okay, that was an ugly sentence. Here is my point: One of the most notable features of an ecosystem is the nature of the large-scale plant structure. I talked of two main ones above, one where the photosynthesis is raised high above ground, and another where the photosynthesis is done right by the surface; with all sorts of other differences within each group arising when we consider more details of the overarching structure, like the nature of branching, and light penetration, and so on. I imagine there are other important distinctions and categories for which we have no (or minor) precedent on earth; so I don't want to make a list of all possible biomes, for fear of leaving something out and thus forcing earth models onto other very-different planets, or ones where evolution took a different path.

TL;DR: The biomes we know of on earth aren't enough to make a model for all biomes possible ever; for science's sake, we need to feed climate data into population/evolution simulation, and get the spread of ecosystems from there.

Addenda:
1. However, from what I know of ideas we have on modeling geographic spread of populations, we've so far assumed there'll be a biome map of sorts which helps us simplify some simulationsor something. I'm not sure how we can solve the spatial partitioning problem (since it is a necessary problem; we do need a reasonable way to chunk up the regions which populations will exist in) without biomes. What we might need is a way to categorize ecosystems other than biomes; which we can map onto a temperature-humidity plot and with which we could thus partition the world's surface.

2. Here's an idea if you want to extend your climate model with some biosphere feedback: The bistable equilibrium between grassland and forest is pretty much an equilibrium between less locked carbon and more locked carbon. Even without going as far as modelling a generic grazer population (the variations would mostly smooth out over geological time anyway), and without considering other ecosystems, most relatively-hospitable land can either be grassland or forest, and even if you simply arbitrarily tweak the balance between the two for now, you can probably figure out what effects you'd get with a more realistic sim.
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Mon Nov 03, 2014 7:06 am

That's really interesting, I did not know that.

moopli wrote:
Here's an idea if you want to extend your climate model with some biosphere feedback: The bistable equilibrium between grassland and forest is pretty much an equilibrium between less locked carbon and more locked carbon. Even without going as far as modelling a generic grazer population (the variations would mostly smooth out over geological time anyway), and without considering other ecosystems, most relatively-hospitable land can either be grassland or forest, and even if you simply arbitrarily tweak the balance between the two for now, you can probably figure out what effects you'd get with a more realistic sim.

We are almost at the level where we have the machinery to handle this. The reason I'm trying to push the climate maths forward a bit is that it fits well with the population systems Seregon and I have been finishing off.

So say there are four species in a patch. Horses, grass, trees and wolves. If horses are strong predators for trees but weak predators for grass AND trees make the horses much slower and more vulnerable to wolves then we will have two equilibria.

One is grass is prevalent, the horses kill all the trees and then can escape the wolves to the wolf population is low and it's grassland.

The other is there are a lot of trees, this makes the horses vulnerable to the wolves and the horse population is controlled so the trees can reproduce and it's a forest.

So this is already available in the model we have (of course we've only been thinking about the microbe stage but this is an obvious extension) so we're fine.

That's why I was suggesting we build planets iteratively. So we start with them barren and then run the simulation on them until they are fully populated with life. The problem with this is with evolution this could be far too computationally intensive for many planets at once, however it may well work. We could take some shortcuts.

For example I imagine in the space stage there will be a greatly simplified representation of life. So species will be things like "large mammals" and "trees" and in total there will be, maybe a few hundred different ones, which represent the whole biome of a planet.

Running it like that it would be possible to quickly evolve a planet from barren + bacteria to fully living which answers questions like "this could have been forest or a grassland which is it?" With that answer, "whatever survived well there".

Another shortcut would be to make a library of populated planets in advance which you be used to populate the players game cheaply.

.

Seregon and I haven't discussed spatial variation very much (we've been trying to get a model that's going to work in a single "patch" and then extend it) but I don't think it's going to be too hard. Successful species spread to nearby patches where there is "space" for them (I like the idea that biomes have a cap on the number of species that can "register" there, I think that works well). Migratory speices are registered in two distant patches at the same time etc. So we should get nice features, like different ecosystems seperated by an impassable mountain range / islands with unusual species on them. I think we're on course for this.

This is why I'm trying to push the climate model a bit as the pop-dynamics / compound system / auto evo is going to need temperature and atmospheric gas content as inputs but other than that it looks pretty good as is.
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Tue Dec 23, 2014 8:28 pm

Here is an interesting page about the temperature of the oceans.
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Wed Dec 24, 2014 11:06 am

So I had a go at replicating some of the Phytoplankton bloom ideas above.

Imagine a column of water. In this column there are nutrients and Phytoplankton. If there is sunlight and nutrients then the Phytoplankton will breed. The phytoplankton slowly die over time. The amount of sunlight varies over the year.

In the summer there is a lot of sunlight and there is very little mixing of the column. The hot water stays at the top and the cold water stays at the bottom.

In winter there is a lot of mixing of the column as the water at the top cools and sinks.

I have modelled this using these equations.



In the winter the sunlight falls below 1 and the diffusion term (laplacian) dominates. In the summer there is a lot of sunlight so there is very little mixing and the growth and death terms dominate.

Here is a video of the results. The top is the surface the bottom is the depths. To the right means a greater quantity exists at that level. It starts in spring. The top number in the top left is the amount of sunlight. Sunlight available decays exponentially with depth by the Beer-Lambert law. The next number is what fraction of a year has passed.

As you can see at the beginning there is a lot of light so the Phytoplankton (RED) breed a lot at the top and then you can see they fall off exponentially as you go down (limited by the light). The nurtrients (GREEN) are opposite.

The amount of sunlight peaks (at about 1.9) and then falls. When it gets below about 0.5 the mixing term starts to kick in and almost all of the Phyotplankton die. The nutrients get evenly mixed throughout the column.

Then the sunlight hits it's minimum (at about 0.1). When it grows at about 0.28 there is a sudden burst of growth. This is because the mixing is switching off and there is sunlight and nutrients available in the upper layers. This is the Bloom we are looking for.




What I have done is quite artificial but I thought it was a reasonable first try. It's not that surprising that there is a sudden burst of growth because of the 10th power on the mixing term. That is a very steep curve.

The thing that is really wrong is that really I want nutrients to become inaccessible in the summer when they are locked into dead phytoplankton which is drifting to the bottom. Then they are slowly broken down and when the winter churn begins they become accessible again.
Back to top Go down
View user profile
tjwhale
Theorist


Posts : 87
Reputation : 26
Join date : 2014-09-07

PostSubject: Re: Planetary Climate Maths   Fri Dec 26, 2014 10:07 am

Ok so I had another go today and I am rather happier with the results.

I included (following moopli's suggestion) dead matter. So Nutrients turn into Phytoplankton, then Phytoplankton turn into dead matter and then dead matter is broken down back into nutrients. I made the mixing on the dead matter constant and large (so all year round dead phytoplankton fall to the bottom of the ocean). Here is the video.



You can see when the video begins (in deep winter) there is very little Phytoplankton (RED) and dead matter (BLUE) and quite a lot of available nutrients (GREEN) everywhere. Then as spring begins the Phytoplankton start to bloom. The number in the very top left is the available amount of sunlight, midwinter it's 0.1 and mid summer it's 1.9.

Interestingly they bloom and hit their maximum value at about sunlight = 1! This corresponds to a spring bloom. They then die back during the summer.

Why? Essentially they eat all the nutrients in the top layer and lock them in to dead matter which sinks to the bottom.

You can see some nice wavelike behaviour as there is a living front of phytoplankton which chases the nutrients deeper and deeper.

This is what happens with real phytoplankton



So this model produces similar behaviour (max population in spring with them dying back in the summer). However I haven't got the autumn bloom, that's something to do with currents I haven't looked into.

.

So how does this apply to thrive? Well when you are an organism living in the ocean the currents (which are seasonal) will transport members of your species to different areas. How well will your species survive in areas with different concentrations of compounds and amounts of available sunlight?
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Planetary Climate Maths   Today at 11:54 pm

Back to top Go down
 
Planetary Climate Maths
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Thrive Game Development :: Development :: Design :: Editors :: Planet-
Jump to: