CESM: A [more] Portable Climate Model for Single-Column Experiments

Some years ago I did a small project that involved running the NCAR Community Earth System Model (CESM) in a series of single-column model (SCM) experiments to test some ideas about the diurnal cycle of convection (or diel cycle). One of my graduate school professors, Dave Randall, has a nice explanation of single-column models,

A single-column model (SCM) is essentially a single-grid column of a GCM. A GCM can be considered to be a collection of many single-column models, arranged to cover the entire earth, and interacting with each other through a set of rules known as “large-scale dynamics.” When we run a single-column model, we have to tell the grid column what the other grid columns would be doing to it, if they were there. We use observations to specify what the other grid columns would be doing. Alternatively, we could force the SCM with suitable model output, or with idealized forcing designed to mimic a situation of interest, or we could just run it in “radiative-convective equilibrium mode.”

Normally this type of model needs to be built on a Linux server or server cluster. However, CESM is intended to be a “portable” climate model to serve the broader geo-science community. And since the SCM is so cheap to run, I figured there had to be a way to build and run the model on my laptop. Thanks to this post by professor Steve Easterbrook from the University of Toronto, I was able to build and run the CESM on my Macbook pro! His debugging notes were a huge help to get me started.

Being able to run simulations on a laptop made it easy to play around with the source code without having to worry about applying for time on a super computer or remotely logging into a server. However, similar to Steve’s experience, actually getting the model to build on a Mac (a.k.a. porting) was very difficult. I probably spent more time trying to get various libraries to compile than I ever spent running the model!

Recently, I’ve become interested in trying some more SCM experiments. Currently, CESM is on version 1.2, but I was able to get my hands on some development versions of the model that will most likely be part of the next IPCC assessment report. The CESM team has made a laundry list of improvements to the architecture of the models that made it much easier to build. This time around it only took me a few days to get the model built on my iMac (OSX 10.9.5).

Another thing that made building CESM on my Mac much easier than the first time was the Homebrew Package Manage, which installs missing libraries (I strongly recommend this over alternatives like MacPorts!). I used Homebrew to install the GNU compiler and Open MPI libraries.

The one that gave me trouble was the same thing that made my life miserable the first time: the NetCDF libraries! NetCDF is a standard data format for large datasets that is very easy to work with. The model needs these to read and write data, so they are very important. The Homebrew version of NetCDF works great for most things, but, unfortunately, the FORTRAN libraries (which are now separate from the C libraries) are not included. This meant that I needed to build my own NetCDF libraries from source code. Luckily, the people at Unidata have made this easy and painless (instructions here).

I feel I should mention one other minor snag that I encountered, that resulted in the following error in the build log:

Undefined symbols for architecture x86_64:
“_isnanf”, referenced from:
_shr_sisnan_ in libcsm_share.a(shr_isnan.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

I found the solution for this one here on he CESM bulletin board. It involved editing a source file ( $CCSM_ROOT/models/csm_share/shr/shr_isnan.c ), which was not ideal, but easy enough to implement.

There’s a bit more to getting the SCM version of CESM to run, but I’ll give details on that in another post.

One thought on “CESM: A [more] Portable Climate Model for Single-Column Experiments

Leave a Reply

Your email address will not be published. Required fields are marked *