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

- All Categories 2.4K
- Chat 505
- Study Groups 21
- Petri Nets 9
- Epidemiology 4
- Leaf Modeling 2
- Review Sections 9
- MIT 2020: Programming with Categories 51
- MIT 2020: Lectures 20
- MIT 2020: Exercises 25
- Baez ACT 2019: Online Course 339
- Baez ACT 2019: Lectures 79
- Baez ACT 2019: Exercises 149
- Baez ACT 2019: Chat 50
- UCR ACT Seminar 4
- General 75
- Azimuth Code Project 111
- Statistical methods 4
- Drafts 10
- Math Syntax Demos 15
- Wiki - Latest Changes 3
- Strategy 113
- Azimuth Project 1.1K
- - Spam 1
- News and Information 148
- Azimuth Blog 149
- - Conventions and Policies 21
- - Questions 43
- Azimuth Wiki 719

Options

The earth's oceans account for about 71% of its surface area and 97% of its water.

This is aptly described by NASA oceanographer Josh Willis as the earth's Heat Bucket.

After combining all the data, Willis found that between mid-1993 and mid-2003, the heat content of the upper 750 meters of Earth’s global ocean increased at an average rate of 0.86 watts (plus or minus 0.12 watts) per square meter. Just 0.86 watts per square meter may not sound like much until you consider that we are talking about an area of about 337 trillion square meters (the 93 percent of the world ocean that Willis studied).

James Hansen ran five climate simulations covering the years 1880 to 2003 to estimate change in Earth’s energy budget.

Taking the average of the five model runs, the team found that over the last decade, heat content in the top 750 meters of the ocean increased by 6.0 plus or minus 0.6 watt-years per square meter.

The model described in Gerald North's book, A Simple Climate Model starts with a linear deterministic model of a single slab of the ocean (a 1-box model).

In this code the model will be go down to a depth of 80m.

The NOAA's Office of Climate Observation (OCO) concisely describes some of the physical aspects of oceans and climate:

Water vapor, evaporated from the ocean surface, provides latent heat energy to the atmosphere during the precipitation process. In units of 1,000 km3 per year, evaporation E over the oceans (436) exceeds precipitation P (399), leaving a net of 37 units of moisture transported onto land as water vapor. On average, this flow must be balanced by a return flow over and beneath the ground through river and stream flows, and subsurface ground water flow. The average precipitation rate over the oceans exceeds that over land by 72% (allowing for the differences in areas), and precipitation exceeds evapotranspiration over land by this same amount (37) (Dai and Trenberth 2002). This flow into the oceans occurs mainly in river mouths and is a substantial factor in the salinity of the oceans, thus affecting ocean density and currents. A simple calculation of the volume of the oceans of about 1330x106 km3 and the through-flow fluxes of E and P implies an average residence time of water in the ocean of over 3,000 years.

Changes in phase of water, from ice to liquid to water vapor, affect the storage of heat. However, even ignoring these complexities, many facets of the climate can be deduced simply by considering the heat capacity of the different components of the climate system. The total heat capacity depends on the mass of the substance involved as well as its capacity for holding heat, as measured by the specific heat of sea-water...

and

The atmosphere does not have much capability to store heat. The heat capacity of the global atmosphere corresponds to that of only a 3.2 m layer of the ocean. However, the depth of ocean actively involved in climate is much greater than that. The specific heat of dry land is roughly a factor of 4.5 less than that of seawater (for moist land the factor is probably closer to 2). Moreover, heat penetration into land is limited by the low thermal conductivity (the degree to which a substance transmits heat), of the land surface; as a result only the top two meters or so of the land typically play an active role in heat storage and release (e.g., as the depth for most of the variations over annual time scales). Accordingly, land plays a much smaller role than the ocean in the storage of heat and in providing a memory for the climate system. Major ice sheets, like those over Antarctica and Greenland, have a large mass but, like land, the penetration of heat occurs primarily through conduction (molecular transfer of energy due to a temperature gradient), so that the mass experiencing temperature changes from year to year is small. Hence, ice sheets and glaciers do not play a strong role in heat capacity, while sea ice is important where it forms.

## Comments

Nice stuff. Should we/I write down the specification of that slab model here, to lay the groundwork for a discussion of what some program implementing it should be like?

`Nice stuff. Should we/I write down the specification of that slab model here, to lay the groundwork for a discussion of what some program implementing it should be like?`

Thanks. As usual you suggest just what I want before I ask.

I was about to write nearly:

So far I have 15 pages of documentation and about 50 of the simplest functions in 305 lines of Haskell. I want to ask the model all possible questions so they should be of some use for that.

I have a parameters file which I'm trying to fill in for the whole book. Glyn and Allan have had a look at the coalbedo bits but not even I have looked at the parameters I'm calling as I type in equations from the book. I will release a ParamsOc.lhs file with just the variables in Ch 3 when I've understood my own code and its output over on the stochastic resonance thread.

I was going to suggest this page might be good for a reading group. Shooting methods and Sturm-Liouville are among the myriad pits of ignorance I will need to dig myself out of.

If you've had a chance to look at any of Simon Peyton-Jones papers, you and Nathan should be able to specify whatever equations you want just by substituting them in the correct positions in something like the code example I posted on the stochastic thread in response to a query by Nathan.

`Thanks. As usual you suggest just what I want before I ask. I was about to write nearly: > write down the specification of that slab model here So far I have 15 pages of documentation and about 50 of the simplest functions in 305 lines of Haskell. I want to ask the model all possible questions so they should be of some use for that. I have a parameters file which I'm trying to fill in for the whole book. Glyn and Allan have had a look at the coalbedo bits but not even I have looked at the parameters I'm calling as I type in equations from the book. I will release a ParamsOc.lhs file with just the variables in Ch 3 when I've understood my own code and its output over on the stochastic resonance thread. I was going to suggest this page might be good for a reading group. Shooting methods and Sturm-Liouville are among the myriad pits of ignorance I will need to dig myself out of. If you've had a chance to look at any of Simon Peyton-Jones papers, you and Nathan should be able to specify whatever equations you want just by substituting them in the correct positions in something like the code example I posted on the stochastic thread in response to a query by Nathan.`

Right now I'm stuck on the recipe for choosing a value of c1 to fit the initial conditions for the absent Fig 3.1 on page 47 of Gerald's book.

`Right now I'm stuck on the recipe for choosing a value of c1 to fit the initial conditions for the absent Fig 3.1 on page 47 of Gerald's book. * What should the graph look like? * What's the recipe?`

I reckon I, for one, need much more context than Gerald's book.

Wikipedia has this on Rossby gravity waves:

And this seems to be the book for interested azimuthers to read:

[1] Gill, Adrian E., 1982: Atmosphere-Ocean Dynamics, International Geophysics Series, Volume 30, Academic Press, 662 pp.

Sadly, I had a drinking mate who died in his 40s. Over Christmas I finally managed to borrow a copy of his book:

Billingham J. and King A.C. Wave Motion. CUP 2000.

It goes from diffusion equations (although it seems to presume you know how to derive one) through shock-fitting using the method of characteristics to Korteg-de-Vries, Burgers and Schroedinger equations. I didn't know, for example and if irc, that Kelvin waves from ship's bows radiate and split at a constant angle and stage of bifurcation so you know how far ahead the boat is, regardless of its velocity if you measure the width of the wake.

Glyn Adgie has been reading the book and might comment about the possible utility, perhaps surprisingly, of the chapter on chemical dynamics. From a first reading my impression was that molecular dynamics (except in direct relation to atmosphere and water reactions) was not the method to use in calculating climate stuff. Perhaps he meant a different chapter? Glyn?

`I reckon I, for one, need much more context than Gerald's book. Wikipedia has this on [Rossby gravity waves](http://en.wikipedia.org/wiki/Rossby-gravity_waves): > Vertically-propagating Rossby-gravity waves > As previously stated, the mixed Rossby-gravity waves are equatorially-trapped waves unless the buoyancy frequency remains constant, introducing an additional vertical wave number to complement the zonal wave number and angular frequency. If this Brunt–Vaisala frequency does not change, then these waves become vertically-propagating solutions.[1] On a typical "m,k" dispersion diagram, the group velocity (energy) would be directed at right angles to the n = 0 (mixed Rossby-gravity waves) and n = 1 (gravity or Rossby waves) curves and would increase in the direction of increasing angular frequency.[1] Typical group velocities for each component are the following: 1 cm/s for gravity waves and 2 mm/s for planetary (Rossby) waves.[1] > These vertically-propagating mixed Rossby-gravity waves were first observed in the stratosphere as westward-propagating mixed waves by M. Yanai.[4] They had the following characteristics: 4–5 days, horizontal wavenumbers of 4 (four waves circling the earth, corresponding to wavelengths of 10,000 km), vertical wavelengths of 4–8 km, and upward group velocity.[1] Similarly, westward-propagating mixed waves were also found in the Atlantic Ocean by Weisberg et al. (1979) with periods of 31 days, horizontal wavelengths of 1200 km, vertical wavelengths of 1 km, and downward group velocity.[1] Also, the vertically-propagating gravity wave component was found in the stratosphere with periods of 35 hours, horizontal wavelengths of 2400 km, and vertical wavelengths of 5 km.[1] And this seems to be the book for interested azimuthers to read: [1] Gill, Adrian E., 1982: Atmosphere-Ocean Dynamics, International Geophysics Series, Volume 30, Academic Press, 662 pp. Sadly, I had a drinking mate who died in his 40s. Over Christmas I finally managed to borrow a copy of his book: [Billingham J. and King A.C. Wave Motion. CUP 2000.](http://books.google.co.uk/books/about/Wave_Motion.html?id=bNePaHM20LQC&redir_esc=y) It goes from diffusion equations (although it seems to presume you know how to derive one) through shock-fitting using the method of characteristics to Korteg-de-Vries, Burgers and Schroedinger equations. I didn't know, for example and if irc, that Kelvin waves from ship's bows radiate and split at a constant angle and stage of bifurcation so you know how far ahead the boat is, regardless of its velocity if you measure the width of the wake. Glyn Adgie has been reading the book and might comment about the possible utility, perhaps surprisingly, of the chapter on chemical dynamics. From a first reading my impression was that molecular dynamics (except in direct relation to atmosphere and water reactions) was not the method to use in calculating climate stuff. Perhaps he meant a different chapter? Glyn?`

Sorry, but I don't quite get what you are trying to do, a box model including oceans as a heat reservoir? Or a model that also includes water motions? The latter is vastly more complicated, of course :-)

A long time ago I made a plan to write a numerical approximation to the Burgers equation as a first step, that's why I collected the necessary material on that page (solution in closed form and also approximation via a spectral method).

`Sorry, but I don't quite get what you are trying to do, a box model including oceans as a heat reservoir? Or a model that also includes water motions? The latter is vastly more complicated, of course :-) A long time ago I made a plan to write a numerical approximation to the [[Burgers equation]] as a first step, that's why I collected the necessary material on that page (solution in closed form and also approximation via a spectral method).`

Tim wrote:

Yup.

The code for Fig. 3.2 in Gerald North's book is what I typed on page 2 of A Simple Climate Model. Due to delay, procrastination and ignorance I only got back to it a the other week. I'm just plotting graphs as we 'speak'.

Cool. Have you read the U. Texas KdV and Burgers F90 code?

Best Wishes

`Tim wrote: > what you are trying to do, a box model including oceans as a heat reservoir? Yup. The code for Fig. 3.2 in Gerald North's book is what I typed on page 2 of A Simple Climate Model. Due to delay, procrastination and ignorance I only got back to it a the other week. I'm just plotting graphs as we 'speak'. > I made a plan to write a numerical approximation to the Burgers equation as a first step, that's why I collected the necessary material on that page (solution in closed form and also approximation via a spectral method. Cool. Have you read the U. Texas KdV and Burgers F90 code? Best Wishes`

I hope this doesn't break any posting conventions but I've reposted the salient code from page 2 #88 of the Simple Climate Model discussion. I didn't move it because Nathan added a simple calculation for coefficient b and a guess of 0.0 for parameter a.

(Fig. 3.2)[p47] A Simple Climate Model

The outbound radiation from the slab is:

(Eq. 3.1) The slab temperature under a linear ramp forcing has homogeneous and inhomogeneous components.

The graphs on the Slab Ocean Model page on my website were produced by this code:

Homogeneous solution (Eq. 3.6)

Particular solution (Eq. 3.5)

NB This code is completely unvalidated and unverified.

This page is (modulo markup) literate code. You can use select, copy and paste it to a file called SlabOcean.lhs. It compiles with ghc-7.4.1 on both linux and windows 7. I'll make the ParamsOc.lhs file available somewhere on the interweb shortly.

$> ghci

ghci>:l SlabOcean.lhs ParamsOc.lhs

$>ghc --make SlabOcean.lhs ParamsOc.lhs

Any suggestions for concise, self-explanatory names and dimensions for greek letters in the book would be very welcome.

`I hope this doesn't break any posting conventions but I've reposted the salient code from page 2 #88 of the Simple Climate Model discussion. I didn't move it because Nathan added a simple calculation for coefficient b and a guess of 0.0 for parameter a. (Fig. 3.2)[p47] A Simple Climate Model The outbound radiation from the slab is: > radOut t = a + b*t - gamma * t * h t where > a = 0 -- tnx Nathan > b = 1.485 -- ditto > gamma = 4/70 > h t = if t > 0 then 1 else 0 (Eq. 3.1) The slab temperature under a linear ramp forcing has homogeneous and inhomogeneous components. The graphs on the [Slab Ocean Model page](http://stuttard.org/Graphs.html) on my website were produced by this code: > temp :: Floating a => a -> a > temp t = tHomog t + tPart t Homogeneous solution (Eq. 3.6) > tHomog :: Floating a => a -> a > tHomog t = c * exp((-t) / tSlab) where -- varing c doesn't seem to have much effect in this code. TBD. > c = 1.638 -- a completely arbitrary value. TBD. > tSlab = 5 Particular solution (Eq. 3.5) > tPart :: Fractional a => a -> a > tPart t = (gamma/b)*(t - tSlab) where > gamma = 0.056 > b = 1.485 > tSlab = 5 > heatCapacity0 = 4.18 * 10**9 -- years NB This code is completely unvalidated and unverified. This page is (modulo markup) literate code. You can use select, copy and paste it to a file called SlabOcean.lhs. It compiles with ghc-7.4.1 on both linux and windows 7. I'll make the ParamsOc.lhs file available somewhere on the interweb shortly. $> ghci ghci>:l SlabOcean.lhs ParamsOc.lhs $>ghc --make SlabOcean.lhs ParamsOc.lhs Any suggestions for concise, self-explanatory names and dimensions for greek letters in the book would be very welcome.`

gamma is a feedback parameter (W/m$^2$/K). b is a forcing rate (W/m$^2$/some unit of time). tSlab is a relaxation time constant (some unit of time, like years). c1 is is the initial temperature of the homogeneous part of the equation (K), but I don't know how to interpret that physically.

`gamma is a feedback parameter (W/m$^2$/K). b is a forcing rate (W/m$^2$/some unit of time). tSlab is a relaxation time constant (some unit of time, like years). c1 is is the initial temperature of the homogeneous part of the equation (K), but I don't know how to interpret that physically.`

John asked:

No, do you have a link? After conceding that the 4th generation languages C# and Java are a pain when in comes to programming numerical code, I switched to C++ and tried to fire up my decades old C++ brain part. But I haven't got very far yet. But I have tried to stay away from Fortran so far.

`John asked: <blockquote> <p> Have you read the U. Texas KdV and Burgers F90 code? </p> </blockquote> No, do you have a link? After conceding that the 4th generation languages C# and Java are a pain when in comes to programming numerical code, I switched to C++ and tried to fire up my decades old C++ brain part. But I haven't got very far yet. But I have tried to stay away from Fortran so far.`

It took a bit of googling to find the link again.

The code compiles and runs, as you might expect from spacecraft reentry acoustic boom experts, but as I've posted before, it has ¬41 parameters which took a bit of guesswork.

Anyway I hacked at porting the nub to Haskell when I first noticed that Burgers had been mentioned but gave up when John B. said he wasn't too interested in Burgers.

I did quite a bit of reading up to the point of pondering a paper on symmetries of Burgers equation which I couldn't understand. The idea I had was, as always, Hoare logic invariants to dig out some of the hidden horrors in Fortran and other supposedly 'scientific' codes (read Harry's notes from UEA) by specifying all the invariants I can.

Serendipitously IPECO at the U. Texas does atmosheric and ocean modelling although I didn't come across Gerald North.

My, Glyn and Allan's language for maths programming is Haskell; it translates maths to code almost directly with unrivalled concision and expressiveness except perhaps for OCaml, Coq, Agda, Epigram. All the omega-CPOs and methods needed are in the libraries.

`It took a bit of googling to find the [link](http://people.bu.edu/robinc/kzk/burgers.html) again. The code compiles and runs, as you might expect from spacecraft reentry acoustic boom experts, but as I've posted before, it has ¬41 parameters which took a bit of guesswork. Anyway I hacked at porting the nub to Haskell when I first noticed that Burgers had been mentioned but gave up when John B. said he wasn't too interested in Burgers. I did quite a bit of reading up to the point of pondering a paper on symmetries of Burgers equation which I couldn't understand. The idea I had was, as always, Hoare logic invariants to dig out some of the hidden horrors in Fortran and other supposedly 'scientific' codes (read Harry's notes from UEA) by specifying all the invariants I can. Serendipitously IPECO at the U. Texas does atmosheric and ocean modelling although I didn't come across Gerald North. My, Glyn and Allan's language for maths programming is Haskell; it translates maths to code almost directly with unrivalled concision and expressiveness except perhaps for OCaml, Coq, Agda, Epigram. All the omega-CPOs and methods needed are in the libraries.`

I've now added a linear ramp forcing graph to these graphs.

Does it look plausible?

I'll be adding some more graphs over the next few days. There seems little point in uploading incorrect code so when the graphs are validated I'll put up the code for verification.

PS Don't forget to refresh your browser cache!

`I've now added a linear ramp forcing graph to these [graphs](http://stuttard.org/). Does it look plausible? I'll be adding some more graphs over the next few days. There seems little point in uploading incorrect code so when the graphs are validated I'll put up the code for verification. PS Don't forget to refresh your browser cache!`

I've added a thermal equilibrium graph and will spend some time adding others. I'll add the parameters and runnable literate code afterwards.

`I've added a thermal equilibrium graph and will spend some time adding others. I'll add the parameters and runnable literate code afterwards.`

I've put up some more graphs (Fig. 3.X etc) and some code for the relevant equations.

`I've put up some more [graphs](stuttard.org/Graphs.html) (Fig. 3.X etc) and some code for the relevant equations.`

I've moved this discussion from the category 'Chat' to a new category: 'Azimuth Code Project'.

'Chat' is for mainly for posts that are 'fun' rather than business... the idea is that when you have a lot of people working on a project, they sometimes want to talk about fun stuff that's irrelevant to the project. People also introduce themselves on 'chat', and if I've got the settings right, it should now be impossible for people not signed in to read stuff in 'chat'. But I haven't tested that yet!

'Azimuth Code Project' is for people discussing software, climate models we're working on, etcetera.

`I've moved this discussion from the category 'Chat' to a new category: 'Azimuth Code Project'. 'Chat' is for mainly for posts that are 'fun' rather than business... the idea is that when you have a lot of people working on a project, they sometimes want to talk about fun stuff that's irrelevant to the project. People also introduce themselves on 'chat', and if I've got the settings right, it should now be impossible for people not signed in to read stuff in 'chat'. But I haven't tested that yet! 'Azimuth Code Project' is for people discussing software, climate models we're working on, etcetera.`

I didn't know the difference between chat and discussion. Willco.

`I didn't know the difference between chat and discussion. Willco.`

I was searching this forum for any other mention of the Sturm-Liouville equation and noticed that Jim mentioned it in this thread (which was before my time here).

From what I can gather, all of these oceanic and atmospheric models use a similar set of primitive equations of fluids as a foundation. They are in general fairly complex and unwieldy to deal with. The good news is that I believe that I was able to come up with a simplified analytical representation for an atmospheric circulation model of QBO. This reduced to a Sturm-Liouville variant, which I described in the QBO thread: https://forum.azimuthproject.org/discussion/comment/15433/#Comment_15433

I think this is an informative finding as it illustrates one of the most basic dynamical behaviors in the atmosphere; and it applies analytical math that anyone with a calculus background should be able to follow.

One of the longstanding issues in the Azimuth climate coding project has been how to deal with complexity in the models. This may be a good stepping-stone path for forum participants to follow and build from. It may not apply to Jim's heat diffusion problem in this particular thread (which I think has a different simplification) but the spirit is the same.

`I was searching this forum for any other mention of the Sturm-Liouville equation and noticed that Jim mentioned it in this thread (which was before my time here). > "I was going to suggest this page might be good for a reading group. Shooting methods and Sturm-Liouville are among the myriad pits of ignorance I will need to dig myself out of." From what I can gather, all of these oceanic and atmospheric models use a similar set of [primitive equations](https://en.wikipedia.org/wiki/Primitive_equations) of fluids as a foundation. They are in general fairly complex and unwieldy to deal with. The good news is that I believe that I was able to come up with a simplified analytical representation for an atmospheric circulation model of QBO. This reduced to a Sturm-Liouville variant, which I described in the QBO thread: https://forum.azimuthproject.org/discussion/comment/15433/#Comment_15433 I think this is an informative finding as it illustrates one of the most basic dynamical behaviors in the atmosphere; and it applies analytical math that anyone with a calculus background should be able to follow. One of the longstanding issues in the Azimuth climate coding project has been how to deal with complexity in the models. This may be a good stepping-stone path for forum participants to follow and build from. It may not apply to Jim's heat diffusion problem in this particular thread (which I think has a different simplification) but the spirit is the same.`