This Week’s Finds (Week 319)

This week I’m trying something new: including a climate model that runs on your web browser!

It’s not a realistic model; we’re just getting started. But some programmers in the Azimuth Project team are interested in making more such models—especially Allan Erskine (who made this one), Jim Stuttard (who helped me get it to work), Glyn Adgie and Staffan Liljgeren. It could be a fun way for us to learn and explain climate physics. With enough of these models, we’d have a whole online course! If you want to help us out, please say hi.

Allan will say more about the programming challenges later. But first, a big puzzle: how can small changes in the Earth’s orbit lead to big changes in the Earth’s climate? As I mentioned last time, it seems hard to understand the glacial cycles of the last few million years without answering this.

Are there feedback mechanisms that can amplify small changes in temperature? Yes. Here are a few obvious ones:

Water vapor feedback. When it gets warmer, more water evaporates, and the air becomes more humid. But water vapor is a greenhouse gas, which causes additional warming. Conversely, when the Earth cools down, the air becomes drier, so the greenhouse effect becomes weaker, which tends to cool things down.

Ice albedo feedback. Snow and ice reflect more light than liquid oceans or soil. When the Earth warms up, snow and ice melt, so the Earth becomes darker, absorbs more light, and tends to get get even warmer. Conversely, when the Earth cools down, more snow and ice form, so the Earth becomes lighter, absorbs less light, and tends to get even cooler.

Carbon dioxide solubility feedback. Cold water can hold more carbon dioxide than warm water: that’s why opening a warm can of soda can be so explosive. So, when the Earth’s oceans warm up, they release carbon dioxide. But carbon dioxide is a greenhouse gas, which causes additional warming. Conversely, when the oceaans cool down, they absorb more carbon dioxide, so the greenhouse effect becomes weaker, which tends to cool things down.

Of course, there are also negative feedbacks: otherwise the climate would be utterly unstable! There are also complicated feedbacks whose overall effect is harder to evaluate:

Planck feedback. A hotter world radiates more heat, which cools it down. This is the big negative feedback that keeps all the positive feedbacks from making the Earth insanely hot or insanely cold.

Cloud feedback. A warmer Earth has more clouds, which reflect more light but also increase the greenhouse effect.

Lapse rate feedback. An increased greenhouse effect changes the vertical temperature profile of the atmosphere, which has effects of its own—but this works differently near the poles and near the equator.

See week302 for more on feedbacks and how big they’re likely to be.

On top of all these subtleties, any proposed solution to the puzzle of glacial cycles needs to keep a few other things in mind, too:

• A really good theory will explain, not just why we have glacial cycles now, but why we didn’t have them earlier. As I explained in week317, they got started around 5 million years ago, became much colder around 2 million years ago, and switched from a roughly 41,000 year cycle to a roughly 100,000 year cycle around 1 million years ago.

• Say we dream up a whopping big positive feedback mechanism that does a great job of keeping the Earth warm when it’s warm and cold when it’s cold. If this effect is strong enough, the Earth may be bistable: it will have two stable states, a warm one and a cold one. Unfortunately, if the effect is too strong, it won’t be easy for the Earth to pop back and forth between these two states!

The classic example of a bistable system is a switch—say for an electric light. When the light is on it stays on; when the light is off it stays off. If you touch the switch very gently, nothing will happen. But if you push on it hard enough, it will suddenly pop from on to off, or vice versa.

If we’re trying to model the glacial cycles using this idea, we need the switch to have a fairly dramatic effect, yet still be responsive to a fairly gentle touch. For this to work we need enough positive feedback… but not too much.

(We could also try a different idea: maybe the Earth keeps itself in its icy glacial state, or its warm interglacial state, using some mechanism that gradually uses something up. Then, when the Earth runs out of this stuff, whatever it is, the climate can easily flip to the other state.)

We must always remember that to a good approximation, the total amount of sunlight hitting the Earth each year does not change as the Earth’s orbit changes in the so-called ‘Milankovich cycles’ that seem to be causing the ice ages. I explained why last time. What changes is not the total amount of sunlight, but something much subtler: the amount of sunlight at particular latitudes in particular seasons! In particular, Milankovitch claimed, and most scientists believe, that the Earth tends to get cold when there’s little sunlight hitting the far northern latitudes in summer.

For these and other reasons, any solution to the ice age puzzle is bound to be subtle. Instead of diving straight into this complicated morass, let’s try something much simpler. Let’s just think about how the ice albedo effect could, in theory, make the Earth bistable.

To do this, let’s look at the very simplest model in this great not-yet-published book:

• Gerald R. North, Simple Models of Global Climate.

This is a zero-dimensional energy balance model, meaning that it only involves the average temperature of the earth, the average solar radiation coming in, and the average infrared radiation going out.

The average temperature will be T, measured in Celsius. We’ll assume the Earth radiates power square meter equal to

\displaystyle{ A + B T }

where A = 218 watts/meter2 and B = 1.90 watts/meter2 per degree Celsius. This is a linear approximation taken from satellite data on our Earth. In reality, the power emitted grows faster than linearly with temperature.

We’ll assume the Earth absorbs solar energy power per square meter equal to

Q c(T)

Here:

Q is the average insolation: that is, the amount of solar power per square meter hitting the top of the Earth’s atmosphere, averaged over location and time of year. In reality Q is about 341.5 watts/meter2. This is one quarter of the solar constant, meaning the solar power per square meter that would hit a panel hovering in space above the Earth’s atmosphere and facing directly at the Sun. (Why a quarter? That’s a nice geometry puzzle: we worked it out at the Azimuth Blog once.)

c(T) is the coalbedo: the fraction of solar power that gets absorbed. The coalbedo depends on the temperature; we’ll have to say how.

Given all this, we get

\displaystyle{ C \frac{d T}{d t} = - A - B T + Q c(T(t)) }

where C is Earth’s heat capacity in joules per degree per square meter. Of course this is a funny thing, because heat energy is stored not only at the surface but also in the air and/or water, and the details vary a lot depending on where we are. But if we consider a uniform planet with dry air and no ocean, North says we may roughly take C equal to about half the heat capacity at constant pressure of the column of dry air over a square meter, namely 5 million joules per degree Celsius.

The easiest thing to do is find equilibrium solutions, meaning solutions where \frac{d T}{d t} = 0, so that

A + B T = Q c(T)

Now C doesn’t matter anymore! We’d like to solve for T as a function of the insolation Q, but it’s easier to solve for Q as a function of T:

\displaystyle{ Q = \frac{ A + B T } {c(T)} }

To go further, we need to guess some formula for the coalbedo c(T). The coalbedo, remember, is the fraction of sunlight that gets absorbed when it hits the Earth. It’s 1 minus the albedo, which is the fraction that gets reflected. Here’s a little chart of albedos:

If you get mixed up between albedo and coalbedo, just remember: coal has a high coalbedo.

Since we’re trying to keep things very simple right not, not model nature in all its glorious complexity, let’s just say the average albedo of the Earth is 0.65 when it’s very cold and there’s lots of snow. So, let

c_i = 1  - 0.65 =  0.35

be the ‘icy’ coalbedo, good for very low temperatures. Similarly, let’s say the average albedo drops to 0.3 when its very hot and the Earth is darker. So, let

c_f = 1 - 0.3 = 0.7

be the ‘ice-free’ coalbedo, good for high temperatures when the Earth is darker.

Then, we need a function of temperature that interpolates between c_i and c_f. Let’s try this:

c(T) = c_i + \frac{1}{2} (c_f-c_i) (1 + \tanh(\gamma T))

If you’re not a fan of the hyperbolic tangent function \tanh, this may seem scary. But don’t be intimidated!

The function \frac{1}{2}(1 + \tanh(\gamma T)) is just a function that goes smoothly from 0 at low temperatures to 1 at high temperatures. This ensures that the coalbedo is near its icy value c_i at low temperatures, and near its ice-free value c_f at high temperatures. But the fun part here is \gamma, a parameter that says how rapidly the coalbedo rises as the Earth gets warmer. Depending on this, we’ll get different effects!

The function c(T) rises fastest at T = 0, since that’s where \tanh (\gamma T) has the biggest slope. We’re just lucky that in Celsius T = 0 is the melting point of ice, so this makes a bit of sense.

Now Allan Erskine’s programming magic comes into play! Unfortunately it doesn’t work on this blog—yet!—so please hop over to the version of this article on my website to see it in action.

You can slide a slider to adjust the parameter \gamma to various values between 0 and 1.

You can then see how the coalbedo c(T) changes as a function of the temperature T. In this graph the temperature ranges from -50 °C and 50 °C; the graph depends on what value of \gamma you choose with slider.

You can also see how the insolation Q required to yield a given temperature T between -50 °C and 50 °C:

It’s easiest to solve for Q in terms of T. But it’s more intuitive to flip this graph over and see what equilibrium temperatures T are allowed for a given insolation Q between 200 and 500 watts per square mater.

The exciting thing is that when \gamma gets big enough, three different temperatures are compatible with the same amount of insolation! This means the Earth can be hot, cold or something intermediate even when the amount of sunlight hitting it is fixed. The intermediate state is unstable, it turns out. Only the hot and cold states are stable. So, we say the Earth is bistable in this simplified model.

Can you see how big \gamma needs to be for this bistability to kick in? It’s certainly there when \gamma = 0.05, since then we get a graph like this:

When the insolation is less than about 385 W/m2 there’s only a cold state. When it hits 385 W/m2, as shown by the green line, suddenly there are two possible temperatures: a cold one and a much hotter one. When the insolation is higher, as shown by the black line, there are three possible temperatures: a cold one, and unstable intermediate one, and a hot one. And when the insolation gets above 465 W/m2, as shown by the red line, there’s only a hot state!

Why is the intermediate state unstable when it exists? Why are the other two equilibria stable? To answer these questions, we’d need to go back and study the original equation:

C \frac{d T}{d t} = - A - B T + Q c(T(t))

and see what happens when we push T slightly away from one of its equilibrium values. That’s really fun, but we won’t do it today. Instead, let’s draw some conclusions from what we’ve just seen. There are at least three morals: a mathematical moral, a climate science model, and a software moral.

Mathematically, this model illustrates catastrophe theory. As we slowly turn up \gamma, we get different curves showing how temperature is a function of insolation… until suddenly the curve isn’t the graph of a function anymore: it becomes infinitely steep at one point! After that, we get bistability:


\gamma = 0.00

\gamma = 0.01

\gamma = 0.02

\gamma = 0.03

\gamma = 0.04

\gamma = 0.05

This is called a cusp catastrophe, and you can visualize these curves as slices of a surface in 3d, which looks roughly like this picture:



from here:

• Wolfram Mathworld, Cusp catastrophe. (Includes Mathematica package.)

The cusp catastrophe is ‘structurally stable’, meaning that small perturbations don’t change its qualitative behavior. This concept is made precise in catastrophe theory. It’s a useful concept, because it focuses our attention on robust features of models: features that don’t go away if the model is slightly wrong, as it always is.

As far as climate science goes, one moral is that it pays to spend some time making sure we understand simple models before we dive into more complicated ones. Right now we’re looking at a very simple model, but we’re already seeing some interesting phenomena. The kind of model we’re looking at now is called a Budyko-Sellers model. These have been studied since the late 1960’s:

• M. I. Budyko, On the origin of glacial epochs (in Russian), Meteor. Gidrol. 2 (1968), 3-8.

• M. I. Budyko, The effect of solar radiation variations on the climate of the earth, Tellus 21 (1969), 611-619.

• William D. Sellers, A global climatic model based on the energy balance of the earth-atmosphere system, J. Appl. Meteor. 8 (1969), 392-400.

• Carl Crafoord and Erland Källén, A note on the condition for existence of more than one steady state solution in Budyko-Sellers type models, J. Atmos. Sci. 35 (1978), 1123-1125.

• Gerald R. North, David Pollard and Bruce Wielicki, Variational formulation of Budyko-Sellers climate models, J. Atmos. Sci. 36 (1979), 255-259.

It also pays to compare our models to reality! For example, the graphs we’ve seen show some remarkably hot and cold temperatures for the Earth. That’s a bit unnerving. Let’s investigate. Suppose we set \gamma = 0 on our slider. Then the coalbedo of the Earth becomes independent of temperature: it’s 0.525, halfway between its icy and ice-free values. Then, when the insolation takes its actual value of 342.5 watts per square meter, the model says the Earth’s temperature is very chilly: about -20 °C!

Does that mean the model is fundamentally flawed? Maybe not! After all, it’s based on very light-colored Earth. Suppose we use the actual albedo of the Earth. Of course that’s hard to define, much less determine. But let’s just look up some average value of the Earth’s albedo: supposedly it’s about 0.3. That gives a coalbedo of c = 0.7. If we plug that in our formula:

\displaystyle{ Q = \frac{ A + B T } {c} }

we get 11 °C. That’s not too far from the Earth’s actual average temperature, namely about 15 ° C. So the chilly temperature of -20 °C seems to come from an Earth that’s a lot lighter in color than ours.

Our model includes the greenhouse effect, since the coeficients A and B were determined by satellite measurements of how much radiation actually escapes the Earth’s atmosphere and shoots out into space. As a further check to our model, we can look at an even simpler zero-dimensional energy balance model: a completely black Earth with no greenhouse effect. Another member of the Azimuth Project has written about this:

• Tim van Beek, Putting the Earth in a box, Azimuth, 19 June 2011.

• Tim van Beek, A quantum of warmth, Azimuth, 2 July 2011.

As he explains, this model gives the Earth a temperature of 6 °C. He also shows that in this model, lowering the albedo to a realistic value of 0.3 lowers the temperature to a chilly -18 ° C. To get from that to something like our Earth, we must take the greenhouse effect into account.

This sort of fiddling around is the sort of thing we must do to study the flaws and virtues of a climate model. Of course, any realistic climate model is vastly more sophisticated than the little toy we’ve been looking at, so the ‘fiddling around’ must also be more sophisticated. With a more sophisticated model, we can also be more demanding. For example, when I said 11 °C is “is not too far from the Earth’s actual average temperature, namely about 15 ° C”, I was being very blasé about what’s actually a big discrepancy. I only took that attitude because the calculations we’re doing now are very preliminary.

Finally, here’s what Allan has to say about the software you’ve just seen, and some fancier software you’ll see in forthcoming weeks:

Your original question in the Azimuth Forum was “What’s the easiest way to write simple programs of this sort that could be accessed and operated by clueless people online?” A “simple program” for the climate model you proposed needed two elements: a means to solve the ODE (ordinary differential equation) describing the model, and a means to interact with and visualize the results for the (clearly) “clueless people online”.

Some good suggestions were made by members of the forum:

• use a full-fledged numerical computing package such as Sage or Matlab which come loaded to the teeth with ODE solvers and interactive charting;

• use a full-featured programming language like Java which has libraries available for ode solving and charting, and which can be packaged as an applet for the web;

• do all the computation and visualization ourselves in Javascript.

While the first two suggestions were superior for computing the ODE solutions, I knew from bitter experience (as a software developer) that the truly clueless people were us bold forum members engaged in this new online enterprise: none of us were experts in this interactive/online math thing, and programming new software is almost always harder than you expect it to be.

Then actually releasing new software is harder still! Especially to an audience as large as your readership. To come up an interactive solution that would work on many different computers/browsers, the most mundane and pedestrian suggestion of “do it all ourselves in Javascript and have them run it in the browser” was also the most likely to be a success.

The issue with Javascript was that not many people use it for numerical computation, and I was down on our chances of success until Staffan pointed out the excellent JSXGraph software. JSXGraph has many examples available to get up and running, has an ODE solver, and after a copy/paste or two and some tweaking on my part we were all set.

The true vindication for going all-Javascript though was that you were subsequently able to do some copy/pasting of your own directly into TWF without any servers needing configured etc., or even any help from me! The graphs ought to be viewable by your readership for as long as browsers support Javascript (a sign of a good software release is that you don’t have to think about it afterwards).

There are some improvements I would make to how we handle future projects which we have discussed in the Forum. Foremost, using Javascript to do all our numerical work is not going to attract the best and brightest minds from the forum (or elsewhere) to help with subsequent models. My personal hope is that we allow all the numerical work to be done in whatever language people feel productive with, and that we come up with a slick way for you to embed and interact with just the data from these models in your webpages. Glyn Adgie and Jim Stuttard seem to have some great momentum in this direction.

Or perhaps creating and editing interactive math online will eventually become as easy as wiki pages are today—I know Staffan had said the Sage developers were looking to make their online workbooks more interactive. Also the bright folks behind the new Julia language are discussing ways to run (and presumably interact with) Julia in the cloud. So perhaps we should just have dragged our feet on this project for a few years for all this cool stuff to help us out! (And let’s wait for the Singularity while we’re at it.)

No, let’s not! I hope you programmers out there can help us find good solutions to the problems Allan faced. And I hope some of you actually join the team.

By the way, Allan has a somewhat spiffier version of the same Budyko-Sellers model here.

For discussions of this issue of This Week’s Finds visit my blog, Azimuth. And if you want to get involved in creating online climate models, contact me and/or join the Azimuth Forum.


Thus, the present thermal regime and glaciations of the Earth prove to be characterized by high instability. Comparatively small changes of radiation—only by 1.0-1.5%—are sufficient for the development of ice cover on the land and oceans that reaches temperate latitudes.M. I. Budyko

8 Responses to This Week’s Finds (Week 319)

  1. Pertti says:

    Was that enough to join the team? I’d love to help you with models.

  2. John Baez says:

    Hi! Yes, you’ve successfully joined the Azimuth Forum. I see you posted something in the ‘Chat’ section saying a bit about who you are and what you’d like to do. Great! You’ll see other people’s self-introductions there. Also check out the section Categories to see other kinds of discussions: ‘Strategy’ (for members only) is for talking about what we want to do, and you might be interested in ‘Software’ too.

  3. Climate is a system with phenomenology spanning many orders of magnitude in space and in time. If you’re going to build “a climate model” to explain why the current ice age started 5 Ma ago you will be doing something very different (geochemistry) from building a model of the vertical temperature structure of the atmosphere with convection (thermodynamic equilibrium). Neither of these class of model is what the public is referring to when they discuss “climate models”, which are essentially weather models run for a very long time, where the dominant phenomenology is “GFD” (geophysical fluid dynamics, or dynamics of rotating, stratified fluids) which if you ask me is the fun part.

    It’s very interesting watching you recapitulate Budyko. So far you haven’t done anything wrong. But it’s a long way to Ooyama…

    I think there is a question of purpose here. I have my own ideas of what the purpose of an effort at climate modeling from a blank slate would be. I don’t know that it will match. Still, I am sure whatever you come up with will be worthwhile and I’m happy to participate if I might.

    And I’m thrilled with the javascript library you spotted and pretty much have to learn it, but that is better (and more likely) than inventing it from scratch…

    • John Baez says:

      Michael Tobis wrote:

      I think there is a question of purpose here. I have my own ideas of what the purpose of an effort at climate modeling from a blank slate would be.

      Over on the Azimuth Forum, Pertti Lundqvist wrote:

      When I first read about the simple climate model, I thought, that the idea would be to help “average people” to understand the system.

      I replied:

      I am reluctant to explain climate science to “average people” before I actually know climate science. So far I think the Azimuth Project goal is to

      1) learn climate science

      and

      2) teach it while we learn it

      so that

      3) we can make sure we understand it

      and

      4) we can get students of science, and working scientists, more interested in the subject.

      In short, the current goal is to slowly build a kind of online course on climate science. So: not just one model, but many models, slowly increasing in complexity. Also: for such an online course, we need to explain the actual equations being used, and the many simplifying assumptions used in obtaining these equations.

      However, once we have the software working, we can change it slightly, and change the text that accompanies it, to make it suitable for different audiences.

      I should add that most of my blog output consists of ‘teaching things while learning them’, and this means not acting authoritative and explaining everything in the simplest possible way to the largest possible audience, but instead putting in enough detail so that people can learn along with me, and asking questions when I don’t understand things.

      And I’m thrilled with the javascript library you spotted and pretty much have to learn it, but that is better (and more likely) than inventing it from scratch…

      Here ‘you’, of course, is not me. I’m glad you joined the Azimuth Forum, so you can talk to the computer experts on the team.

      • John Baez says:

        And by the way, I should add that even if we don’t make it all the way to very sophisticated climate models, we’ll still have done something useful, since every model will come with an explanation and be publicly available… so they’re all good for people learning stuff.

  4. jimstuttard says:

    The “spiffier” Budyko-Sellers link is broken here.

  5. Ken Webb says:

    I’ve re-implemented parts of the climate model as an editable in-browser app. All of the code, some of it borrowed from Allan’s “spiffier version”, is in a set of editors on the page. This is part of my experimenting with an informal workbook-blog style, that combines notes, code, and images. Also, I’m learning about climate science. If you want to run the app, follow the instructions in the Notes editor at the top of the page. If you want to modify something, just click inside one of the editors, start typing, and then click Run or Refresh to re-run the app.

    http://www.primordion.com/Xholon/wb/openwb.php?q=2406644&f=gist.github.com/raw/

    Thanks for making me aware of JSXGraph and MathJax.

    Regards,
    Ken

You can use HTML in your comments. You can also use LaTeX, like this: $latex E = m c^2 $. The word 'latex' comes right after the first dollar sign, with a space after it.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,877 other followers