Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Options

A simple online climate model

George Musser is leaving the CQT this Saturday; we did not succeed in writing anything about climate change during his stay here, but he says he will remain interested in the project of putting a simple climate model online together with explanation written by him and me, as long as the model has 'enough knobs and dials to be fun'.

So, just to repeat, one proposal on the table is to create software that works on a webpage, which graphs a solution of

$$C \frac{d T}{d t} = - A - B T + Q(t) \, a_p(T(t))$$ where

$$a_p(T) = a_i + \frac{1}{2} (a_f-a_i) (1 + \tanh(\gamma T))$$ and

$$a_i=0.35, \qquad a_f=0.7$$ and

• $A=218$ watts per square meter,

• $B=1.90$ watts per square meter per degree Celsius,

• $C = 5 \times 10^6$ joules per square meter per degree Celsius,

and most importantly:

$$Q(t) = 342.5 + f(t)$$ where $f$ is a function with $f(t) = X$ for $0 \le t \le T$, and $f(t) = 0$ outside that interval.

The user should be able to choose:

1. the constant $\gamma$
2. the time $T$,
3. the constant $X$.

Unfortunately I doubt this differential equation can be solved in closed form. So, it will require some numerical computation.

I think a number of people have said they'd be willing to write this program, but everyone is politely waiting for someone else to do it. I think nobody is actually doing it. If I'm wrong on that, please correct me! Is there anything I can do to catalyze this process?

«13

• Options
1.

I think a number of people have said they'd be willing to write this program, but everyone is politely waiting for someone else to do it

I've been politely doing some other things, like preparing for my first child (due in February!); also, like Tim van Beek, I have a day job in IT -- so sometimes it is a stretch to want to sit down of an evening and do more "real coding"

That said, I'm still on it, and need no more catalysis than a simple nudge :-)

I believe Curtis was interested in looking at this in JavaScript too, that Staffan is simultaneously working in Sage, and that Tim was investigating Runge Kutta solvers in JavaScript, and that we were all happy with (or resigned to!) potential duplication of effort since it is likely to involve a fairly small amount of actual code.

Comment Source:> I think a number of people have said they'd be willing to write this program, but everyone is politely waiting for someone else to do it I've been politely doing some other things, like preparing for my first child (due in February!); also, like Tim van Beek, I have a day job in IT -- so sometimes it is a stretch to want to sit down of an evening and do more "real coding" That said, I'm still on it, and need no more catalysis than a simple nudge :-) I believe Curtis was interested in looking at this in JavaScript too, that Staffan is simultaneously working in Sage, and that Tim was investigating Runge Kutta solvers in JavaScript, and that we were all happy with (or resigned to!) potential duplication of effort since it is likely to involve a fairly small amount of actual code.
• Options
2.
edited December 2011

John, do I understand correctly that you would like to discuss a graph of T vs. t (as opposed to T_stable vs. insolation)? I've been playing with GSL Shell to understand the model and I've cooked up some graphs. There aren't any knobs and dials, so I made the next best thing: animations, which you can find here as well as a view of the "phase space" here (warning: contains a 2.5MB jpeg). Clicking on a graph will give you the high-resolution version. I've fixed the upper time limit t2 (T is a bit ambiguous) at 2e7 (seconds I presume?). Curves are colour coded according to their starting temperature.

So, where are we on the map? :-)

Comment Source:John, do I understand correctly that you would like to discuss a graph of T vs. t (as opposed to T_stable vs. insolation)? I've been playing with [GSL Shell](http://www.nongnu.org/gsl-shell/) to understand the model and I've cooked up some graphs. There aren't any knobs and dials, so I made the next best thing: animations, which you can find [here](http://users.ugent.be/~ldecruz/coalbedo/) as well as a view of the "phase space" [here](http://users.ugent.be/~ldecruz/coalbedo/coalbedo.html) (warning: contains a 2.5MB jpeg). Clicking on a graph will give you the high-resolution version. I've fixed the upper time limit t2 (T is a bit ambiguous) at 2e7 (seconds I presume?). Curves are colour coded according to their starting temperature. So, where are we on the map? :-)
• Options
3.

John, do I understand correctly that you would like to discuss a graph of T vs. t (as opposed to T_stable vs. insolation)?

Yes, and not just discuss it - I'd like to actually have a program that draws such a graph, which can be run using someone's web browser, and takes user input as described here.

allan e (= Allan Erskine) has already written a nice program that graphs the equibrium temperature(s) as a function of insolation: check it out! (It's at the bottom of the page, after the explanation.)

There aren't any knobs and dials, so I made the next best thing: animations...

That sounds cool too! Unfortunately the animations don't seem to be running properly under Firefox 8.0 on my Windows laptop: I just see a green page. Do they work for anyone else here?

Anyway, thanks - we can probably get this worked out, and that will be good, though not quite as addictive as software that takes user input.

Comment Source:> John, do I understand correctly that you would like to discuss a graph of T vs. t (as opposed to T_stable vs. insolation)? Yes, and not just discuss it - I'd like to actually _have_ a program that draws such a graph, which can be run using someone's web browser, and takes user input as described [here](http://www.math.ntnu.no/~stacey/Mathforge/Azimuth/comments.php?DiscussionID=892&Focus=6042#Comment_6042). allan e (= Allan Erskine) has already written a nice program that graphs the equibrium temperature(s) as a function of insolation: [check it out!](http://math.ucr.edu/home/baez/coalbedo/coalbedo.html) (It's at the bottom of the page, after the explanation.) > There aren't any knobs and dials, so I made the next best thing: animations... That sounds cool too! Unfortunately the animations don't seem to be running properly under Firefox 8.0 on my Windows laptop: I just see a green page. Do they work for anyone else here? Anyway, thanks - we can probably get this worked out, and that will be good, though not quite as addictive as software that takes user input.
• Options
4.
edited December 2011

Allan wrote:

That said, I'm still on it, and need no more catalysis than a simple nudge :-)

Nudge.

Anyway, that's great. I was just becoming afraid that we were stuck in an 'after you, Alphonse' logjam with lots of people willing to help but politely waiting in case others wanted to go first.

And: wow! I see you're about to become 10 times busier than you ever were! Congratulations and goodbye come February!

Comment Source:Allan wrote: > That said, I'm still on it, and need no more catalysis than a simple nudge :-) Nudge. Anyway, that's great. I was just becoming afraid that we were stuck in an 'after you, Alphonse' logjam with lots of people willing to help but politely waiting in case others wanted to go first. And: wow! I see you're about to become 10 times busier than you ever were! Congratulations and goodbye come February!
• Options
5.

Unfortunately the animations don't seem to be running properly under Firefox 8.0 on my Windows laptop: I just see a green page. Do they work for anyone else here?

They seem to work fine under Firefox 8.0 on Ubuntu.

Comment Source:> Unfortunately the animations don't seem to be running properly under Firefox 8.0 on my Windows laptop: I just see a green page. Do they work for anyone else here? They seem to work fine under Firefox 8.0 on Ubuntu.
• Options
6.
edited December 2011

Nudge.

wakes up in a state of catalytic shock

I've made a bit of progress here.

My graph isn't as exciting as Lesley's state space of graphs though, it's not as clear what is going on.

In particular, Lesley's animation very clearly shows that there are two regimes at work in the dynamic, a hot one and a cold one -- with my slider-operated version, you have to futz around with lots of settings first to eventually see the same thing.

I think it could use either field line-segments, or a range of initial temperatures like Lesley's charts (currently $T_0$ is hard-coded to 25C) --- or if someone can think of a nice way it should be animated like Lesley's AND slider controlled?

I see you're about to become 10 times busier than you ever were! Congratulations and goodbye come February!

Thanks! Guess I'd better finish up this example before I slip-on my dressing gown and slip-off into paternal dotage!

Comment Source:> Nudge. *wakes up in a state of catalytic shock* I've made a bit of progress [here](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html). My graph isn't as exciting as Lesley's state space of graphs though, it's not as clear what is going on. In particular, Lesley's animation very clearly shows that there are two regimes at work in the dynamic, a hot one and a cold one -- with my slider-operated version, you have to futz around with lots of settings first to eventually see the same thing. I think it could use either field line-segments, or a range of initial temperatures like Lesley's charts (currently $T_0$ is hard-coded to 25C) --- or if someone can think of a nice way it should be animated like Lesley's *AND* slider controlled? > I see you're about to become 10 times busier than you ever were! Congratulations and goodbye come February! Thanks! Guess I'd better finish up this example before I slip-on my dressing gown and slip-off into paternal dotage!
• Options
7.

John, I realise that it's not what you had in mind, but it was just an attempt to get some feel for the model. Feel free to use it or not! And everyone, please don't hesitate to make something that's more fun to use :-)

Allen, I'm curious to see your implementation but sadly the URL you provided is broken.

I think it could use either field line-segments, or a range of initial temperatures like Lesley's charts (currently is hard-coded to 25C) --- or if someone can think of a nice way it should be animated like Lesley's AND slider controlled?

Given infinite bandwidth and storage (and a spherical frictionless user...) I assume we could just make a 1D slider which generates the file name of an animated .gif, so that the corresponding animation is shown in which the other parameter is varied. Perhaps that creates some interactivity without the need to manually search through an n-dimensional parameter space to find the interesting regions? But like I said, that formula would be very bandwidth-intensive. And I guess that performing the calculations beforehand instead of in your browser also makes it less cool (although it's hard to tell the difference). All of this is undoubtedly also doable in JavaScript -- though probably not by me.

Any other ideas?

Comment Source:John, I realise that it's not what you had in mind, but it was just an attempt to get some feel for the model. Feel free to use it or not! And everyone, please don't hesitate to make something that's more fun to use :-) Allen, I'm curious to see your implementation but sadly the URL you provided is broken. > I think it could use either field line-segments, or a range of initial temperatures like Lesley's charts (currently is hard-coded to 25C) --- or if someone can think of a nice way it should be animated like Lesley's AND slider controlled? Given infinite bandwidth and storage (and a spherical frictionless user...) I assume we could just make a 1D slider which generates the file name of an animated .gif, so that the corresponding animation is shown in which the other parameter is varied. Perhaps that creates some interactivity without the need to manually search through an n-dimensional parameter space to find the interesting regions? But like I said, that formula would be very bandwidth-intensive. And I guess that performing the calculations beforehand instead of in your browser also makes it less cool (although it's hard to tell the difference). All of this is undoubtedly also doable in JavaScript -- though probably not by me. Any other ideas?
• Options
8.
edited December 2011

Allen, I'm curious to see your implementation but sadly the URL you provided is broken.

Really? Try the link here again now (you should see a sad and solitary orange line representing the solution from $T_0 = 20C$).

I have some work on it to do still! The solver can give me curves for a range of other initial values, but I have to learn the correct JSXGraph voodoo to get all of them on one graph.

I'm not sure I got what you said next about the bandwidth, but if you are suggesting loading all the data up-front and then displaying different slices through it depending on the slider values, then I think this is feasible and perhaps even preferable for slower browsers. Right now though I'm trying to compute everything in JavaScript.

(PS I'm sure John wishes he had N spherical frictionless programmers.. he might then be able to predict when this will all be finished!)

Comment Source:> Allen, I'm curious to see your implementation but sadly the URL you provided is broken. Really? Try the link [here](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html) again now (you should see a sad and solitary orange line representing the solution from $T_0 = 20C$). I have some work on it to do still! The solver can give me curves for a range of other initial values, but I have to learn the correct JSXGraph voodoo to get all of them on one graph. I'm not sure I got what you said next about the bandwidth, but if you are suggesting loading all the data up-front and then displaying different slices through it depending on the slider values, then I think this is feasible and perhaps even preferable for slower browsers. Right now though I'm trying to compute everything in JavaScript. (PS I'm sure John wishes he had N spherical frictionless programmers.. he might then be able to predict when this will all be finished!)
• Options
9.

Really? Try the link here again now

I tried, I got

Oops! Google Chrome could not connect to 127.0.0.1
Suggestions:

Comment Source:> Really? Try the link here again now I tried, I got ~~~~ Oops! Google Chrome could not connect to 127.0.0.1 Suggestions: Try reloading: 127.­0.­0.­1/­~aerskine/­azimuth-­coalbedo-­example-­dev/­www/­coalbedo2.­html ~~~~
• Options
10.
Comment Source:"127.0.0.1" is [your computer's address for itself](https://en.wikipedia.org/wiki/Localhost).
• Options
11.
edited December 2011

I'll check out all this good stuff as soon as I put up my blog post on quantropy - I've been pretty distracted by that, it seems like a cool idea. I hope my computer can connect to itself.

Comment Source:I'll check out all this good stuff as soon as I put up my blog post on [quantropy](http://johncarlosbaez.wordpress.com/2011/12/22/quantropy/) - I've been pretty distracted by that, it seems like a cool idea. I hope my computer can connect to itself.
• Options
12.

:D Graham and Blake, thank you for pointing out what should have been glaringly obvious! *looks sheepish*

I've updated all my links, which should have pointed here all along!

Comment Source::D Graham and Blake, thank you for pointing out what should have been glaringly obvious! \*looks sheepish\* I've updated all my links, which should have pointed [here all along](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html)!
• Options
13.
edited December 2011

Okay, I'm checking out Allan's program now. Cool! Great! Wow! Thanks!

The behavior of this model is a bit funny, maybe because I've got some parameters chosen in a bad way, or something. As Allan notes, one has to be rather persistent to get this model stuck in the "hot" state. Also, the parameters are such that most of the graph is horizontal - the climate comes to equilibrium quite soon.

Here's one thing that confused me at first: in the graph below where it says "Temperature $T_{eq}$ for t between 0 and 10 years out", the $x$ axis is labelled 5.00 e+7, 1.00 e+8 and so on. What are those units? Seconds, I guess? We'll have to make it a bit more intuitive for normal folks - say, by using years.

Comment Source:Okay, I'm checking out [Allan's program](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html) now. Cool! Great! Wow! Thanks! <img src = "http://math.ucr.edu/home/baez/emoticons/love.gif" alt = ""/> The behavior of this model is a bit funny, maybe because I've got some parameters chosen in a bad way, or something. As Allan notes, one has to be rather persistent to get this model stuck in the "hot" state. Also, the parameters are such that most of the graph is horizontal - the climate comes to equilibrium quite soon. Here's one thing that confused me at first: in the graph below where it says "Temperature $T_{eq}$ for t between 0 and 10 years out", the $x$ axis is labelled 5.00 e+7, 1.00 e+8 and so on. What are those units? Seconds, I guess? We'll have to make it a bit more intuitive for normal folks - say, by using years. Let me think about this model a bit more.
• Options
14.

Hey, now I'm seeing Lesley's animated gifs just fine! One great thing about gifs is that I can easily include them on any webpage, even my blog, and (unlike mp4's, I guess) people can see them embedded in text that explains them. So I'll definitely write a blog article that includes these... say, when I get back from Luang Prabang on December 30th.

I suspect that when people see these programs and gifs, some of them are going to get very interested.

Comment Source:Hey, now I'm seeing Lesley's animated gifs just fine! <img src = "http://math.ucr.edu/home/baez/emoticons/thumbsup.gif" alt = ""/> One great thing about gifs is that I can easily include them on any webpage, even my blog, and (unlike mp4's, I guess) people can see them embedded in text that explains them. So I'll definitely write a blog article that includes these... say, when I get back from Luang Prabang on December 30th. I suspect that when people see these programs and gifs, some of them are going to get very interested.
• Options
15.

I've uploaded a new version of the animations which include animated 'slices' for a fixed parameter (X or gamma). This might be useful to discuss the behaviour at a certain critical value on a webpage, or perhaps even to combine with a 1D slider. Knock yourselves out :-)

I've also updated the state space (warning: 4MB JPG!): gamma now goes from 0.0 to 0.3 in steps of 0.01.

Happy holidays!

Comment Source:I've uploaded a new version of the [animations](http://users.ugent.be/~ldecruz/coalbedo/animations) which include animated 'slices' for a fixed parameter (X or gamma). This might be useful to discuss the behaviour at a certain critical value on a webpage, or perhaps even to combine with a 1D slider. Knock yourselves out :-) I've also updated the [state space](http://users.ugent.be/~ldecruz/coalbedo/coalbedo.html) (warning: 4MB JPG!): gamma now goes from 0.0 to 0.3 in steps of 0.01. Happy holidays!
• Options
16.
edited December 2011

Thanks, Lesley! And happy holidays to you too! I'll spring into action when I get back from Laos on the 30th of December.

Comment Source:Thanks, Lesley! And happy holidays to you too! I'll spring into action when I get back from Laos on the 30th of December.
• Options
17.

I updated my example to use years for the time units, and I squished the timescale down to 3 years which seems to increase interestingness-per-slider-pixel.

There's curves for a range of initial values too.

(An alternative to this could be to borrow from this example allowing the user to choose a single initial temperature, and drawing field lines.)

Comment Source:I updated [my example](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html) to use years for the time units, and I squished the timescale down to 3 years which seems to increase interestingness-per-slider-pixel. There's curves for a range of initial values too. (An alternative to this could be to borrow from [this example](http://faculty.fortlewis.edu/Pearson_P/jsxgraph/slopefield.html) allowing the user to choose a single initial temperature, and drawing field lines.)
• Options
18.

Sorry for my absence without leave, there were several issues I had to deal with (mostly regarding my job), also I haven't had internet access from my apartment for quite some time...

But if there is still the need for more help, I'll dive into it. Allan, do you still use your git repository? (Where was that?) Maybe we could create a wiki page for the project, or is there one already?

Comment Source:Sorry for my absence without leave, there were several issues I had to deal with (mostly regarding my job), also I haven't had internet access from my apartment for quite some time... But if there is still the need for more help, I'll dive into it. Allan, do you still use your git repository? (Where was that?) Maybe we could create a wiki page for the project, or is there one already?
• Options
19.

Hi Tim! I still use my github repository -- the code you find here (in Coalbedo2.html) corresponds exactly to the example I posted earlier

A wiki page would be good! Perhaps I can help out with that (I feel guilty for never having lifted a finger to assist the over-worked elves around here)

I believe someone had also asked Eric about how easy it would be to install the example on a Wordpress blog or a wiki page -- I could help or advise with either, assuming we have control over the wiki server (or the Wordpress server).

Comment Source:Hi Tim! I still use my github repository -- the code you find [here](https://github.com/aerskine/azimuth-coalbedo-example) (in Coalbedo2.html) corresponds exactly to the [example I posted earlier](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html) A wiki page would be good! Perhaps I can help out with that (I feel guilty for never having lifted a finger to assist the over-worked elves around here) I believe someone had also asked Eric about how easy it would be to install the example on a Wordpress blog or a wiki page -- I could help or advise with either, assuming we have control over the wiki server (or the Wordpress server).
• Options
20.

@John did you notice I updated the example to incorporate the changes you suggested? It resembles Lesley's animations a bit more closely now (although perhaps could use more of that elusive quantity known as 'interesting')

Comment Source:@John did you notice I updated the example to incorporate the changes you suggested? It resembles Lesley's animations a bit more closely now (although perhaps could use more of that elusive quantity known as 'interesting')
• Options
21.

I'm just looking at it now, Allan. It looks great! The only problem is that right now the sliders respond very slowly to my attempts to slide them - giving a strange breakdown of the usual kinesthetic illusion where you feel like you're actually using your fingers to slide something. I'll check in a while to see if this is a transient problem.

I've spent the last 2 days at a meeting of people designing the curriculum for a new college, the Yale-NUS College. It's interesting because they're trying to rethink college education from the ground up. For example, there will be no departments, and everyone will be required to take a course on 'quantitative reasoning' and a course on 'scientific inquiry'. The latter will try to teach the key ideas everyone should know in physics, chemistry, biology and astronomy. It's very fun and scary trying to design a new educational system.

Tomorrow I go to Kuala Lumpur to teach a week-long course in 'network theory' as part of Expository Quantum Lectures 5.

So, I'm a bit distracted, but very soon I'll blog about your earlier, simpler coalbedo program - maybe even this week, if I have superabundant energy. Is there anything I should say about the program itself, or the challenge of doing programs like this, that hackers might be interested to hear?

Comment Source:I'm just looking at it now, Allan. It looks great! The only problem is that right now the sliders respond very slowly to my attempts to slide them - giving a strange breakdown of the usual kinesthetic illusion where you feel like you're actually using your fingers to slide something. I'll check in a while to see if this is a transient problem. I've spent the last 2 days at a meeting of people designing the curriculum for a new college, the [Yale-NUS College](http://www.ync.nus.edu.sg/). It's interesting because they're trying to rethink college education from the ground up. For example, there will be no departments, and everyone will be required to take a course on 'quantitative reasoning' and a course on 'scientific inquiry'. The latter will try to teach the key ideas everyone should know in physics, chemistry, biology and astronomy. It's very fun and scary trying to design a new educational system. Tomorrow I go to Kuala Lumpur to teach a week-long course in 'network theory' as part of [Expository Quantum Lectures 5](http://einspem.upm.edu.my/equals5/). So, I'm a bit distracted, but very soon I'll blog about your [earlier, simpler coalbedo program](http://math.ucr.edu/home/baez/coalbedo/coalbedo.html) - maybe even this week, if I have superabundant energy. Is there anything I should say about the program itself, or the challenge of doing programs like this, that hackers might be interested to hear?
• Options
22.
edited January 2012

Ugh, Allan, do you have a personal Wiki page about yourself that I could link to? Like in "This solution was created by Allan...(link to your wiki page that tells people what a nice and competent person you really are)". I have one: Tim van Beek

Comment Source:Ugh, Allan, do you have a personal Wiki page about yourself that I could link to? Like in "This solution was created by Allan...(link to your wiki page that tells people what a nice and competent person you really are)". I have one: [[Tim van Beek]]
• Options
23.

Arg, I don't! But I've just applied for new membership, under a non-nefarious name, and then I'll create one. This is the last you'll hear from allan e (-eeeeeee tails off in silence)

Comment Source:Arg, I don't! But I've just applied for new membership, under a non-nefarious name, and then I'll create one. This is the last you'll hear from allan e (-eeeeeee *tails off in silence*)
• Options
24.
edited January 2012

John wrote:

The only problem is that right now the sliders respond very slowly to my attempts to slide them - giving a strange breakdown of the usual kinesthetic illusion where you feel like you're actually using your fingers to slide something.

I'm probably doing too many iterations in the solver or drawing too many curves (or both!) to make it a smooth experience. Let me try to tune it a bit.

I'll also work with Tim to get some content on that wiki page, and to tidy up the code in the example (JavaScript moan: it really steers you towards side-effects and globals!)

Comment Source:John wrote: > The only problem is that right now the sliders respond very slowly to my attempts to slide them - giving a strange breakdown of the usual kinesthetic illusion where you feel like you're actually using your fingers to slide something. I'm probably doing too many iterations in the solver or drawing too many curves (or both!) to make it a smooth experience. Let me try to tune it a bit. I'll also work with Tim to get some content on that wiki page, and to tidy up the code in the example (JavaScript moan: it really steers you towards side-effects and globals!)
• Options
25.

(indeed: it is running like a dog on my iPad... I should probably test on that rather than my speedy desktop PC)

Comment Source:(indeed: it is running like a dog on my iPad... I should probably test on that rather than my speedy desktop PC)
• Options
26.

The only problem is that right now the sliders respond very slowly

The example I posted earlier is running much faster for me now.. give it a whirl! (I centered the sliders too, which seems to start things off closer to the action)

Comment Source:> The only problem is that right now the sliders respond very slowly [The example I posted earlier](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html) is running much faster for me now.. give it a whirl! (I centered the sliders too, which seems to start things off closer to the action)
• Options
27.

Could someone tell me where the numerical coefficients in this model are derived? For example, the $Q$ coefficient appears to have the wrong units (it should be joules per degree per square meter). Even if the units are a typo, the numerical value may be off.

It's typical in energy balance models to have the "effective heat capacity" represent a 50-meter mixed layer ocean. If the ocean surface area is $A_O = 0.7 A$ where $A$ is the surface area of the Earth and its depth is $d = 50\,\mathrm{m}$, the density of water is $\rho = 1000\,kg/\mathrm{m}^3$, and its specific heat is $c = 4184\,\mathrm{J}/kg/\mathrm{K}$, then the ocean heat capacity per unit area is $C = c\rho\A_O d/A = 0.7c\rho d$ or $C = 1.5\times 10^8\,\mathrm{J}/\mathrm{K}/\mathrm{m}^2$. This is about 30 times larger than the $C$ given above. I haven't checked any of the other coefficients.

Comment Source:Could someone tell me where the numerical coefficients in this model are derived? For example, the $Q$ coefficient appears to have the wrong units (it should be joules per degree per square meter). Even if the units are a typo, the numerical value may be off. It's typical in energy balance models to have the "effective heat capacity" represent a 50-meter mixed layer ocean. If the ocean surface area is $A_O = 0.7 A$ where $A$ is the surface area of the Earth and its depth is $d = 50\,\mathrm{m}$, the density of water is $\rho = 1000\,kg/\mathrm{m}^3$, and its specific heat is $c = 4184\,\mathrm{J}/kg/\mathrm{K}$, then the ocean heat capacity per unit area is $C = c\rho\A_O d/A = 0.7c\rho d$ or $C = 1.5\times 10^8\,\mathrm{J}/\mathrm{K}/\mathrm{m}^2$. This is about 30 times larger than the $C$ given above. I haven't checked any of the other coefficients.
• Options
28.

I should add that the "effective heat capacity" depends on the time scale of interest (since it's trying to absorb multiple time scales into one number). 50 meters is chosen to be relevant to climate change on decadal-to-century time scales. A smaller effective ocean depth would be relevant to even shorter time scales (which is odd, since the model discussed above seems to have been adopted from paleoclimate models, given the albedo term).

Comment Source:I should add that the "effective heat capacity" depends on the time scale of interest (since it's trying to absorb multiple time scales into one number). 50 meters is chosen to be relevant to climate change on decadal-to-century time scales. A smaller effective ocean depth would be relevant to even shorter time scales (which is odd, since the model discussed above seems to have been adopted from paleoclimate models, given the albedo term).
• Options
29.

Nathan -- did you get an answer to your question?

Could someone tell me where the numerical coefficients in this model are derived? For example, the Q coefficient appears to have the wrong units (it should be joules per degree per square meter).

The model used is from Simple Models of Global Climate by Gerald North of starting from page 40 or so, with some words on the derivation on page 30. It is on page 30 that he estimates the numerical coefficients A and B. The baseline value for Q of 342.5 $\mathrm{W}/\mathrm{m}^2$ in the model in John's opening comment above was I believe plucked out the air to be close to the equilibrium value.

I can't comment on the choice of $\mathrm{W}/\mathrm{m}^2$ as units for insolation since I'm not an expert -- I'll just say they appear to be consistent with the other units used!

Comment Source:Nathan -- did you get an answer to your question? > Could someone tell me where the numerical coefficients in this model are derived? For example, the Q coefficient appears to have the wrong units (it should be joules per degree per square meter). The model used is from Simple Models of Global Climate by Gerald North of starting from page 40 or so, with some words on the derivation on page 30. It is on page 30 that he estimates the numerical coefficients A and B. The baseline value for Q of 342.5 $\mathrm{W}/\mathrm{m}^2$ in the model in John's opening comment above was I believe plucked out the air to be close to the equilibrium value. I can't comment on the choice of $\mathrm{W}/\mathrm{m}^2$ as units for insolation since I'm not an expert -- I'll just say they appear to be consistent with the other units used!
• Options
30.

I can't find that book anywhere, so I'm still in the dark. What does he say about the $C$ coefficient?

I don't have any complaints about units of $W/m^2$ for insolation. I have complaints about $K^{-1}$ for the $C$ coefficient. You can see that the right hand side of the equation has units of $W/m^2$. As written, the left hand side has units of $s^{-1}$. I think $C$ should be "joules per square meter per degree", not "per degree" as stated.

Comment Source:I can't find that book anywhere, so I'm still in the dark. What does he say about the $C$ coefficient? I don't have any complaints about units of $W/m^2$ for insolation. I have complaints about $K^{-1}$ for the $C$ coefficient. You can see that the right hand side of the equation has units of $W/m^2$. As written, the left hand side has units of $s^{-1}$. I think $C$ should be "joules per square meter per degree", not "per degree" as stated.
• Options
31.
edited March 2012

Ok, thanks for sending me the book, Allan. I forgot John sent it to me earlier.

According to the discussion above Eq. 2.9, $C$ has the units I gave ($J/m^2/K$). (It says $J/K$, but then also mention that this over a per square meter.) So the units are mislabeled in John's first comment.

North says that the value given is appropriate for an all-land planet. However, if we're interested in studying, say, the modern Earth, the slab ocean model in Eq. 3.2 would be more appropriate. I'm not sure what problem you wanted to study.

Comment Source:Ok, thanks for sending me the book, Allan. I forgot John sent it to me earlier. According to the discussion above Eq. 2.9, $C$ has the units I gave ($J/m^2/K$). (It says $J/K$, but then also mention that this over a per square meter.) So the units are mislabeled in John's first comment. North says that the value given is appropriate for an all-land planet. However, if we're interested in studying, say, the modern Earth, the slab ocean model in Eq. 3.2 would be more appropriate. I'm not sure what problem you wanted to study.
• Options
32.

The problem we wanted to study was the model John posted above, and to provide some interactive graphics to illustrate what was going on.

John made an early cut of an article, and I subsequently improved the graphs of the coalbedo function and also made a graph of solutions to the model above using the JSXGraph JavaScript library, which can be embedded in any web page.

But although this captures "simple" we somehow failed to capture "interesting", so Eq 3.2 of North's book might be good to follow-up with. But only if it comes with some new phenomena to interest George Musser enough to write about it! (Unless that moment has passed now?)

Comment Source:The problem we wanted to study was the model John posted above, and to provide some interactive graphics to illustrate what was going on. John made an [early cut of an article](http://math.ucr.edu/home/baez/coalbedo/coalbedo.html), and I subsequently improved the [graphs of the coalbedo function](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo.html) and also made a [graph of solutions to the model above](http://64.131.197.246/~aerskine/azimuth-coalbedo-example-dev/www/coalbedo2.html) using the JSXGraph JavaScript library, which can be embedded in any web page. But although this captures "simple" we somehow failed to capture "interesting", so Eq 3.2 of North's book might be good to follow-up with. But only if it comes with some new phenomena to interest George Musser enough to write about it! (Unless that moment has passed now?)
• Options
33.
edited March 2012

Hi - sorry, I've been distracted. I will fix the units of the constant $C$ in my article and also above.

But only if it comes with some new phenomena to interest George Musser enough to write about it! (Unless that moment has passed now?)

I don't think that moment has passed, despite my ridiculous slowness.

I need to get back into this project. I'll start by writing an issue of This Week's Finds about what we have so far.

Allan: do you have anything people might like to hear about the programming aspects? I want This Week's Finds to talk about that, but I don't know what to say or even what questions to ask you! People would like to hear about what you've done so far, but you could also talk about what you want to do, or what you think someone should do.

Comment Source:Hi - sorry, I've been distracted. I will fix the units of the constant $C$ in my article and also above. > But only if it comes with some new phenomena to interest George Musser enough to write about it! (Unless that moment has passed now?) I don't think that moment has passed, despite my ridiculous slowness. I need to get back into this project. I'll start by writing an issue of _This Week's Finds_ about what we have so far. Allan: do you have anything people might like to hear about the programming aspects? I want _This Week's Finds_ to talk about that, but I don't know what to say or even what questions to ask you! People would like to hear about what you've done so far, but you could also talk about what you want to do, or what you think someone should do.
• Options
34.

I don't think that moment has passed, despite my ridiculous slowness.

I don't think you have been ridiculously slow! Beginning our discussion by asking "now, what programming language will we use?" was a rocky start though as always, and if you recall a lot of our time was spent discussing this. My volunteering to hand-code some JavaScript after a 10 year absence from working with it hardly put the project into overdrive either

I like to keep things positive though, so let me see if I can put a nice slant on our decision making process leading up to hand-coded JavaScript. I think rather than focus so much on what we did, I could put together some pointers (cribbed from posts by Nad, Steffan and +Jim Stuttard) for what good stuff is out there.

Perhaps there is also a point to be made that visualizing mathematical models on the web is somewhat lagging behind visualizing data -- that field is booming, as is the availability of supporting software.

(Writing this up may take a day or two because my mum is coming to visit.)

Comment Source:> I don't think that moment has passed, despite my ridiculous slowness. I don't think you have been ridiculously slow! Beginning our discussion by asking "now, what programming language will we use?" was a rocky start though as always, and if you recall a lot of our time was spent discussing this. My volunteering to hand-code some JavaScript after a 10 year absence from working with it hardly put the project into overdrive either I like to keep things positive though, so let me see if I can put a nice slant on our decision making process leading up to hand-coded JavaScript. I think rather than focus so much on what we did, I could put together some pointers (cribbed from posts by Nad, Steffan and +Jim Stuttard) for what good stuff is out there. Perhaps there is also a point to be made that visualizing mathematical models on the web is somewhat lagging behind visualizing data -- that field is booming, as is the availability of supporting software. (Writing this up may take a day or two because my mum is coming to visit.)
• Options
35.

It's different fun for me. I've only ever worked in java on projects where javascript was banned for security reasons (IE) (a decision vindicated by the glaring security hole in one of the first commercial applications of ajax).

So I've just started learning and reading Doug Crockford's work on that "most misunderstood language" .

Glyn Adgie and I have been trying to go through the plethora of options for client-side javascript. We've kept notes on our efforts so far so it might be a good idea for us to swap email addresses and share them.

I'll put my hacked, single-page graph javascript example on linux.usecs.co.uk:8000 when I've got the labels etc in the correct place.

Comment Source:It's different fun for me. I've only ever worked in java on projects where javascript was banned for security reasons (IE) (a decision vindicated by the glaring security hole in one of the first commercial applications of ajax). So I've just started learning and reading Doug Crockford's work on that "most misunderstood language" . Glyn Adgie and I have been trying to go through the plethora of options for client-side javascript. We've kept notes on our efforts so far so it might be a good idea for us to swap email addresses and share them. I'll put my hacked, single-page graph javascript example on linux.usecs.co.uk:8000 when I've got the labels etc in the correct place.
• Options
36.
edited March 2012

Allan wrote:

I don't think you have been ridiculously slow!

That's kind of you. Claims that starting in August 2008, we have a hundred months to prevent irreversible global warming make me feel a big clock ticking behind me... even if they're exaggerated, and even though I know it won't be me up there on trial if humanity screws up. And ironically, this feeling of a heavy burden sometimes makes me more inclined to goof off and procrastinate.

Perhaps there is also a point to be made that visualizing mathematical models on the web is somewhat lagging behind visualizing data -- that field is booming, as is the availability of supporting software.

Yes, that would be great! Talk about the problems is just as interesting as talk about how you're facing them.

(Writing this up may take a day or two because my mum is coming to visit.)

Okay. If irreversible global warming happens two days before people are able to stop it, we can blame your mum.

Comment Source:Allan wrote: > I don't think you have been ridiculously slow! That's kind of you. Claims that [starting in August 2008, we have a hundred months to prevent irreversible global warming](http://www.neweconomics.org/publications/one-hundred-months-technical-note) make me feel a big clock ticking behind me... even if they're exaggerated, and even though I know it won't be me up there on trial if humanity screws up. And ironically, this feeling of a heavy burden sometimes makes me more inclined to goof off and procrastinate. <img src = "http://math.ucr.edu/home/baez/emoticons/yuck.gif" alt = ""/> > Perhaps there is also a point to be made that visualizing mathematical models on the web is somewhat lagging behind visualizing data -- that field is booming, as is the availability of supporting software. Yes, that would be great! Talk about the problems is just as interesting as talk about how you're facing them. > (Writing this up may take a day or two because my mum is coming to visit.) Okay. If irreversible global warming happens two days before people are able to stop it, we can blame your mum. <img src = "http://math.ucr.edu/home/baez/emoticons/tongue2.gif" alt = ""/>
• Options
37.

Allan wrote:

The baseline value for $Q$ of 342.5 $\mathrm{W}/\mathrm{m}^2$ in the model in John's opening comment above was I believe plucked out the air to be close to the equilibrium value.

As Nathan later pointed out, it's not $Q$ he was worried about, it was $C$. But let me just say: this value of $Q$ is not plucked from the air! The solar constant is $1366 \pm 2 \mathrm{W}/\mathrm{m}^2$: this is 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. A little calculation shows that the time- and space-averaged solar power hitting the Earth's atmosphere is 1/4 of this - accounting for night and the spherical shape of the Earth. We did this calculation on the Azimuth blog once upon a time. That's $341.5 \mathrm{W}/\mathrm{m}^2$.

Hmm, the figure of 342.5 looks like a typo! Either that, or I computed it starting from some other estimate of the solar constant. Not a huge deal, but annoying.

Comment Source:Allan wrote: > The baseline value for $Q$ of 342.5 $\mathrm{W}/\mathrm{m}^2$ in the model in John's opening comment above was I believe plucked out the air to be close to the equilibrium value. As Nathan later pointed out, it's not $Q$ he was worried about, it was $C$. But let me just say: this value of $Q$ is not plucked from the air! The [solar constant](http://www.azimuthproject.org/azimuth/show/Solar+radiation) is $1366 \pm 2 \mathrm{W}/\mathrm{m}^2$: this is 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. A little calculation shows that the time- and space-averaged solar power hitting the Earth's atmosphere is 1/4 of this - accounting for night and the spherical shape of the Earth. We did this calculation on the Azimuth blog once upon a time. That's $341.5 \mathrm{W}/\mathrm{m}^2$. Hmm, the figure of 342.5 looks like a typo! Either that, or I computed it starting from some other estimate of the solar constant. Not a huge deal, but annoying.
• Options
38.

Plucked out the air, panel hovering in space -- my assertion almost holds (sorry!)

If irreversible global warming happens two days before people are able to stop it, we can blame your mum.

I'll add that to the list of things to blame her for. Luckily she has some redeeming, if not offsetting, features :-)

Comment Source:Plucked out the air, panel hovering in space -- my assertion *almost* holds (sorry!) > If irreversible global warming happens two days before people are able to stop it, we can blame your mum. I'll add that to the list of things to blame her for. Luckily she has some redeeming, if not offsetting, features :-)
• Options
39.

Comment Source:+Jim Stuttard, what is your email address? Google+ is circumspect about revealing it (thankfully!). Mine is firstname.lastname@gmail.com
• Options
40.
edited March 2012

Hi Allan,

Great to hear from you.

I've only just got the Gerald North book which I read with alacrity. I immediately thought this is wonderful and large project brief. It provides a great basis for John to start describing the algorithms!

Glyn has now got plotting working on the Julia server and hopefully will finally get registered very soon and be able to post his review of the language. He thinks it's better than Matlab, Octave etc but John wants interactivity on the blog. We could serve stuff compiled on the UC Riverside machine so I'm not writing off any options yet.

As Glyn's done the work I will set up the Julia environment on

linux.usecs.co.uk:8000

so we can see if the REPL [1] works.

I think you've done a large proportion of the work with your coalbedo code (for which I am now very grateful) and JQuery seems to be a popular standard. I don't know about performance though. What did you do to improve the performance of the sliders between versions 1 and 2?

What do you think the candidate libraries are apart from JQuery, JSXGraph, JSMath?

The contact details are:

jims (the usual article) stuttard (fullstop) org

and

glyn (the usual article) adgie (fs) f9 (fs) co (fs) uk

And congrats on producing another great programmer in the making :)

Cheers

[1] REPL : Read, Evaluate, Print Loop eg. what happens when you enter a command into a terminal, press enter and it prints the result in the terminal.

Comment Source:Hi Allan, Great to hear from you. I've only just got the Gerald North book which I read with alacrity. I immediately thought this is wonderful and large project brief. It provides a great basis for John to start describing the algorithms! Glyn has now got plotting working on the Julia server and hopefully will finally get registered very soon and be able to post his review of the language. He thinks it's better than Matlab, Octave etc but John wants interactivity on the blog. We could serve stuff compiled on the UC Riverside machine so I'm not writing off any options yet. As Glyn's done the work I will set up the Julia environment on linux.usecs.co.uk:8000 so we can see if the REPL [1] works. I think you've done a large proportion of the work with your coalbedo code (for which I am now very grateful) and JQuery seems to be a popular standard. I don't know about performance though. What did you do to improve the performance of the sliders between versions 1 and 2? What do you think the candidate libraries are apart from JQuery, JSXGraph, JSMath? The contact details are: jims (the usual article) stuttard (fullstop) org and glyn (the usual article) adgie (fs) f9 (fs) co (fs) uk And congrats on producing another great programmer in the making :) Cheers [1] REPL : Read, Evaluate, Print Loop eg. what happens when you enter a command into a terminal, press enter and it prints the result in the terminal.
• Options
41.

Good stuff Jim! Great to have the momentum you and Glyn are bringing.

Thanks also for your kind words, although I am disappointed to report Alex is far from mastering Haskell, even after eight weeks of life.

Let me jot down a quick thought on servers vs self-contained JavaScript apps.

What originally appealed to me about the JavaScript solution was that it scaled very well and was about as future-proof as an interactive solution is likely to be (ie was robust to servers being decommissioned etc). Running ode solvers on a server and sending data to-and-fro via JSON for example doesn't scale as well (would take perhaps 10 seriously inquisitive widget sliders to slow things right down, even on a powerful server), and requires a server admin

But since thinking about data visualization vs modelling, and also reading on +Jim Stuttard's Google+ stream about tesseract I've realized that perhaps the most scaleable and least labor-intensive way to grind through the examples in the Gerald North book might look like this:

• we agree upon a high-level language or three, eg Haskell, Python/Sage and Julia
• we agree upon a data format (making language choice less important above!)
• we work together on a single JavaScript framework for just viewing the data (say tesseract and/or D3) , and which is easy to embed in plain HTML, Wordpress, Instiki
• for every model/ode/FFT etc we care to visualize we code it up in the language du jour, sample it for a restricted range of slider/widget values and export it as a single large zip file of data
• we embed the zip file, and the viewing code in any web page we please (along with a footnote explaining where the data came from for those interested)

I'd like to hear peoples thoughts on this!

And Jim I will email you soon.. just not tonight, as a bunch of nanny interviews used up all my time.

Comment Source:Good stuff Jim! Great to have the momentum you and Glyn are bringing. Thanks also for your kind words, although I am disappointed to report Alex is far from mastering Haskell, even after eight weeks of life. Let me jot down a quick thought on servers vs self-contained JavaScript apps. What originally appealed to me about the JavaScript solution was that it scaled very well and was about as future-proof as an interactive solution is likely to be (ie was robust to servers being decommissioned etc). Running ode solvers on a server and sending data to-and-fro via JSON for example doesn't scale as well (would take perhaps 10 seriously inquisitive widget sliders to slow things right down, even on a powerful server), and requires a server admin But since thinking about data visualization vs modelling, and also reading on +Jim Stuttard's Google+ stream about [tesseract](http://square.github.com/crossfilter/) I've realized that perhaps the most scaleable and least labor-intensive way to grind through the examples in the Gerald North book might look like this: * we agree upon a high-level language or three, eg Haskell, Python/Sage and Julia * we agree upon a data format (making language choice less important above!) * we work together on a single JavaScript framework for just viewing the data (say [tesseract](http://square.github.com/crossfilter/) and/or [D3](http://mbostock.github.com/d3/)) , and which is easy to embed in plain HTML, Wordpress, Instiki * for every model/ode/FFT etc we care to visualize we code it up in the language du jour, sample it for a restricted range of slider/widget values and export it as a single large zip file of data * we embed the zip file, and the viewing code in any web page we please (along with a footnote explaining where the data came from for those interested) I'd like to hear peoples thoughts on this! And Jim I will email you soon.. just not tonight, as a bunch of nanny interviews used up all my time.
• Options
42.
edited March 2012

I fully subscribe to this plan. I've just got my first dual-core machine so I can play with flat and nested data parallelism in Haskell and hopefully use the modified UHC compiler to automatically generate javascript; I read somewhere that the output has been described as "pretty decent".

Javascript html5 engines now have threads (WebWorkers) so we can use concurrency which should be interesting.

Glynn has written his RFC review of the current state of Julia, which I'll email you as soon as I get it.

I'm looking forward to reading other people's ideas too but I'd also like to know if anyone has any suggestions about what information they'd like to see in the specs for this model (between the book and the code)?

I'm sure Alex will be having a smashing time with higher-order virtual hammer icons on his tablet very soon :).

Comment Source:I fully subscribe to this plan. I've just got my first dual-core machine so I can play with flat and nested data parallelism in Haskell and hopefully use the modified UHC compiler to automatically generate javascript; I read somewhere that the output has been described as "pretty decent". Javascript html5 engines now have threads (WebWorkers) so we can use concurrency which should be interesting. Glynn has written his RFC review of the current state of Julia, which I'll email you as soon as I get it. I'm looking forward to reading other people's ideas too but I'd also like to know if anyone has any suggestions about what information they'd like to see in the specs for this model (between the book and the code)? I'm sure Alex will be having a smashing time with higher-order virtual hammer icons on his tablet very soon :).
• Options
43.
edited March 2012

The "cache a bunch of model output" approach is less flexible than an interactive script, since it doesn't allow users to try scenarios that we didn't think of and run ahead of time. This is particularly relevant if users want to explore different forcing time series, as opposed to a few parameter values.

By the way, a fair bit of my research is concerned with "emulators", which are tools (like Gaussian processes or neural networks) that predict model output at new parameter settings based on a small "training" set. They're basically fancy interpolators. This lets you explore parameter space without doing tons and tons of runs (but makes certain assumptions like smoothness, so doesn't always work well for systems with bifurcations or chaos).

Comment Source:The "cache a bunch of model output" approach is less flexible than an interactive script, since it doesn't allow users to try scenarios that we didn't think of and run ahead of time. This is particularly relevant if users want to explore different forcing time series, as opposed to a few parameter values. By the way, a fair bit of my research is concerned with "emulators", which are tools (like Gaussian processes or neural networks) that predict model output at new parameter settings based on a small "training" set. They're basically fancy interpolators. This lets you explore parameter space without doing tons and tons of runs (but makes certain assumptions like smoothness, so doesn't always work well for systems with bifurcations or chaos).
• Options
44.
edited March 2012

Nathan said:

The "cache a bunch of model output" approach is less flexible than an interactive script, since it doesn't allow users to try scenarios that we didn't think of and run ahead of time.

This is very true. So it will definitely involve some extra effort care to make sure we cache the right "bunch of model output".

But I still think we could get a lot more done this way: if we spend too much time pushing the frontiers of numerical computation in the browser, we risk crossing the 56 month deadline to this project!

Another trouble with interactive scripts, or at least those which run numerical solvers, is that they only work well on fast computers (this was especially clear on earlier versions of my example!). So the approach doesn't scale to everyone and their grandmother, which I presume is the target audience. Static data can be rendered quickly enough on any computer less than, say, 12 years old (to pluck a number out the air). The only people we are excluding are those on slow dial-up connections, who may balk at the 10MB download of a 1000x1000x1000 data set.

Comment Source:Nathan said: > The "cache a bunch of model output" approach is less flexible than an interactive script, since it doesn't allow users to try scenarios that we didn't think of and run ahead of time. This is very true. So it will definitely involve some extra effort care to make sure we cache the *right* "bunch of model output". But I still think we could get a lot more done this way: if we spend too much time pushing the frontiers of numerical computation in the browser, we risk [crossing the 56 month deadline](http://www.neweconomics.org/publications/one-hundred-months-technical-note) to this project! Another trouble with interactive scripts, or at least those which run numerical solvers, is that they only work well on fast computers (this was especially clear on earlier versions of my example!). So the approach doesn't scale to everyone and their grandmother, which I presume is the target audience. Static data can be rendered quickly enough on any computer less than, say, 12 years old (to pluck a number out the air). The only people we are excluding are those on slow dial-up connections, who may balk at the 10MB download of a 1000x1000x1000 data set.
• Options
45.

I suppose "people with slow computers" and "people with slow dial-up connections" may be correlated, and no interactive approach will work well for them. I'd still lean toward browser-side Javascript myself, but its lack of fast matrix math is a real problem. I worry about backend server solutions (e.g., Julia, Sage, etc.) More points of failure, latency problems when serving interactive graphics, may not scale (although we probably don't have to worry about a million users hitting some poor UCR server), etc.

Comment Source:I suppose "people with slow computers" and "people with slow dial-up connections" may be correlated, and no interactive approach will work well for them. I'd still lean toward browser-side Javascript myself, but its lack of fast matrix math is a real problem. I worry about backend server solutions (e.g., Julia, Sage, etc.) More points of failure, latency problems when serving interactive graphics, may not scale (although we probably don't have to worry about a million users hitting some poor UCR server), etc.
• Options
46.

I suppose "people with slow computers" and "people with slow dial-up connections" may be correlated, and no interactive approach will work well for them.

This could well be the case!

I worry about backend server solutions

Me too! But there could well be a compromise: if we first get good at the generate-some-data/view-some-data approach, then in the future if we get a server up and running it would be a simple matter to have a "Refresh..." button, which would make one call to a server for an updated snapshot, which could then be explored with new parameters. This would provide the flexibility you mentioned earlier at a lower cost for us to implement.

Comment Source:> I suppose "people with slow computers" and "people with slow dial-up connections" may be correlated, and no interactive approach will work well for them. This could well be the case! > I worry about backend server solutions Me too! But there could well be a compromise: if we first get good at the generate-some-data/view-some-data approach, then in the future if we get a server up and running it would be a simple matter to have a "Refresh..." button, which would make one call to a server for an updated snapshot, which could then be explored with new parameters. This would provide the flexibility you mentioned earlier at a lower cost for us to implement.
• Options
47.
edited March 2012

Allan E. wrote:

(PS I'm sure John wishes he had N spherical frictionless programmers.. he might then be able to predict when this will all be finished!)

From what I've seen, assuming spherical programmers is often a better approximation than assuming they're frictionless... but you guys seem to be getting along quite well.

I have no idea what you're talking about, a lot of the time these days. So, starting in week319 and going on into the future, I hope you folks contribute text explaining fun aspects of how your code works and what decisions you had to make. If you make it sound interesting, it could attract even more programmers... until we have N of them.

Comment Source:Allan E. wrote: > (PS I'm sure John wishes he had N spherical frictionless programmers.. he might then be able to predict when this will all be finished!) From what I've seen, assuming spherical programmers is often a better approximation than assuming they're frictionless... but you guys seem to be getting along quite well. I have _no idea_ what you're talking about, a lot of the time these days. So, starting in [week319](http://math.ucr.edu/home/baez/week319.html) and going on into the future, I hope you folks contribute text explaining fun aspects of how your code works and what decisions you had to make. If you make it sound interesting, it could attract even more programmers... until we have N of them.
• Options
48.

Hello everybody. As you probably know, I was introduced to the Azimuth Project by Jim Stuttard.

Jim and I have been discussing the general problem of implementing web-interactive numeric computation, where the user adjusts parameters, and the results are displayed as graphs. The Small Climate Model is one such computation. When I started this discussion with Jim, he suggested that the computations be done in Javascript running in the user's browser. My initial reaction was "Eeuw! This will be horribly slow compared to server-side computation running native code." My later thoughts are that I do not know this for a fact. Javascript may be good enough, even if far from the best performing solution.

So what I am doing now is working on some cross-language numeric benchmarks, so the performance of Javascript can be compared with that of other languages, e.g. Python, Octave, Haskell, and C/C++. Personally, I would be interested to see how Javascript performs against other scripting languages. There are three main points of comparison:

• Raw speed: how many iterations per second of CPU time.

• Ease of writing correct code.

• Ease of understanding code written by others.

I will conclude here by making an important distinction between Javascript and other scripting languages. Most scripting languages can be extended by interfacing to C/C++ libraries using a Foreign Function Interface (FFI). For example, you can compute an FFT in Python using a module that interfaces to the highly-optimised fftw C library. This generally makes the interpreting/bytecode overhead negligible. As far as I know, this is not possible in Javascript, because it would require that the user has the required specialist libraries installed on their machine. So if you want an FFT in Javascript, it must be implemented in Javascript. Comments on this point would be welcome.

Comment Source:Hello everybody. As you probably know, I was introduced to the Azimuth Project by Jim Stuttard. Jim and I have been discussing the general problem of implementing web-interactive numeric computation, where the user adjusts parameters, and the results are displayed as graphs. The Small Climate Model is one such computation. When I started this discussion with Jim, he suggested that the computations be done in Javascript running in the user's browser. My initial reaction was "Eeuw! This will be horribly slow compared to server-side computation running native code." My later thoughts are that I do not know this for a fact. Javascript may be good enough, even if far from the best performing solution. So what I am doing now is working on some cross-language numeric benchmarks, so the performance of Javascript can be compared with that of other languages, e.g. Python, Octave, Haskell, and C/C++. Personally, I would be interested to see how Javascript performs against other scripting languages. There are three main points of comparison: * Raw speed: how many iterations per second of CPU time. * Ease of writing _correct_ code. * Ease of understanding code written by others. I will conclude here by making an important distinction between Javascript and other scripting languages. Most scripting languages can be extended by interfacing to C/C++ libraries using a Foreign Function Interface (FFI). For example, you can compute an FFT in Python using a module that interfaces to the highly-optimised fftw C library. This generally makes the interpreting/bytecode overhead negligible. As far as I know, this is not possible in Javascript, because it would require that the user has the required specialist libraries installed on their machine. So if you want an FFT in Javascript, it must be implemented in Javascript. Comments on this point would be welcome.
• Options
49.

Total web-newbie comment: my understanding about Javascript is that the situation is highly asymmetric

1. If you have some Javascript code running in a browser and you want to move some of the functionality to a native language, there are ways (such as [node.js](http://nodejs.org/api/addons.html to make a native executable that is running Javascript and uses native libraries.)

2. It's pretty much impossible to use native libraries with Javascript that's running in a browser.

Clearly ideally we want to have stuff running in the browser if at all possible so we're in case 2. The relevance of case 1 is that it means (if the information is right) that if something is tried in browser Javascript and it doesn't perform acceptably, moving it to a native executable -- which obviously means having to deal with all the end-user deployment challenges associated with native executables -- doesn't necessarily force the programmers to rewrite all the Javascript code, only the performance sensitive bit.

Comment Source:Total web-newbie comment: my understanding about Javascript is that the situation is highly asymmetric 1. If you have some Javascript code running in a browser and you want to move some of the functionality to a native language, there are ways (such as [node.js](http://nodejs.org/api/addons.html to make a native executable that is running Javascript and uses native libraries.) 2. It's pretty much impossible to use native libraries with Javascript that's running in a browser. Clearly ideally we want to have stuff running in the browser if at all possible so we're in case 2. The relevance of case 1 is that it means (_if the information is right_) that if something is tried in browser Javascript and it doesn't perform acceptably, moving it to a native executable -- which obviously means having to deal with all the end-user deployment challenges associated with native executables -- doesn't necessarily force the programmers to rewrite all the Javascript code, only the performance sensitive bit.
• Options
50.
edited April 2012

Jim has just pointed out Allan Erskine's post no. 42 above. I would like to make some comments regarding precomputing solutions for sets of parameter values, putting them on the server, then using Javascript in the browser simply to display the solution graphs depending on slider values. One problem I see is that the number of precomputed solutions would multiply dramatically as the number of parameters and the number of points for each parameter increases. Using coarse sampling of each parameter would reduce the data requirements, but would make the user interface "jerky".

I have thought about using Javascript for multi-dimensional interpolation between coarsely-spaced precomputed solutions, but I do not think it is valid in general. A trivial case in 2D shows this. Given two samples from exp(k * x), with k = 1 and 2, (exp(x) + exp(2 * x)) / 2 is obviously not the same as exp(1.5 * x).

Is there a possibilty that the form of nonlinear differential equation computable by the Runge-Kutta method could be decomposed into linear regions, each with exponential solutions? The parameters of the exponential solutions could be precomputed, then it would be fairly easy to do linear interpolation on these parameters, and compute the resulting exponentials, in Javascript. This is just speculation. Perhaps there are known methods out there.

Comment Source:Jim has just pointed out Allan Erskine's post no. 42 above. I would like to make some comments regarding precomputing solutions for sets of parameter values, putting them on the server, then using Javascript in the browser simply to display the solution graphs depending on slider values. One problem I see is that the number of precomputed solutions would multiply dramatically as the number of parameters and the number of points for each parameter increases. Using coarse sampling of each parameter would reduce the data requirements, but would make the user interface "jerky". I have thought about using Javascript for multi-dimensional interpolation between coarsely-spaced precomputed solutions, but I do not think it is valid in general. A trivial case in 2D shows this. Given two samples from exp(k * x), with k = 1 and 2, (exp(x) + exp(2 * x)) / 2 is obviously not the same as exp(1.5 * x). Is there a possibilty that the form of nonlinear differential equation computable by the Runge-Kutta method could be decomposed into linear regions, each with exponential solutions? The parameters of the exponential solutions could be precomputed, then it would be fairly easy to do linear interpolation on these parameters, and compute the resulting exponentials, in Javascript. This is just speculation. Perhaps there are known methods out there.