Tuesday 16 November 2021

Open Source Climate Models: initial review


Climate models are normally built to do real science; that is not my aim. Rather, I want something which will form a component of an educational game which allows players to make policy decisions to attempt to maintain the climate within ‘safe’ limits, given constraints of population, consumption, demand for strategic materials and so on.

Consequently, I need the model to run on ordinary PCs that people may be expected to have, or even perhaps on something like an X Box. It also needs to be able to simulate a year in at most about twenty minutes, with enough processor cycles free to run user interface code.

It’s quite likely that no existing climate model will work under these constraints.

Systems considered

Name Language Licence Status Documentation Builds?
ClimateMachine Julia Apache License v2.0 Released Present Failing, probably fixable.
Community Earth System Model Fortran, C, Python, Perl BSD-style Released Present Failing
Hector C++, R GPL v3 Released Present Apparently successful
E3SM Fortran, C BSD Style Not suitable for consumer-grade machines Present Not attempted
atlas C, Fortran Apache License v2.0 Probably too low level Minimal Not attempted
Isca Fortran, Python GPL v3 Released Present Apparently successful, documentation slightly wrong

Climate Machine

Build failed with the following output:

ERROR: LoadError: UndefVarError: LLVMPtr not defined
 [1] include(::Module, ::String) at ./Base.jl:377
 [2] top-level scope at none:2
 [3] eval at ./boot.jl:331 [inlined]
 [4] eval(::Expr) at ./client.jl:449
 [5] top-level scope at ./none:3
in expression starting at /home/simon/.julia/packages/CUDA/wTQsK/src/CUDA.jl:9
ERROR: LoadError: LoadError: Failed to precompile CUDA [052768ef-5323-5732-b1bb-66c8b64840ba] to /home/simon/.julia/compiled/v1.4/CUDA/oWw5k_BxRo2.ji.
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] include(::String) at /home/simon/tmp/climate/ClimateMachine.jl/src/ClimateMachine.jl:1
 [8] top-level scope at /home/simon/tmp/climate/ClimateMachine.jl/src/ClimateMachine.jl:12
 [9] include(::Module, ::String) at ./Base.jl:377
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:331 [inlined]
 [12] eval(::Expr) at ./client.jl:449
 [13] top-level scope at ./none:3
in expression starting at /home/simon/tmp/climate/ClimateMachine.jl/src/Arrays/MPIStateArrays.jl:3
in expression starting at /home/simon/tmp/climate/ClimateMachine.jl/src/ClimateMachine.jl:12

The error appears to be caused by a problem in Julia’s CUDA library, which should hand off computation to my graphics processor (which would be a good thing as this has some serious compute power).

All tests also fail, but that is almost certainly because the build failed.

This is probably fixable without a huge amount of effort.

Overall, although I have no experience with Julia, the codebase looks very clean and well designed. The installation process was big and complex, but ran commendably cleanly, with no installation problems.

Community Earth System Model

The build instructions appear to be incomplete. Nothing compiles. There is no executable product. I don’t even know where to start with attempting to investigate further.


Pure R build appeared to work cleanly, but I didn’t understand what I’d got sufficiently to carry out any meaningful tests. I think it worked.

Makefile (standalone) build also appeared to build satisfactory, produced an executable, and I was able to use this to do a test run, but again I don’t understand what I’m doing sufficiently to understand what I got. Still, this is promising.


From the documentation it appeared exceedingly unlikely that E3SM would run satisfactorily on the hardware available to me, so I didn’t attempt this


I think Atlas is probably a useful library for people who know how to build climate models, but I think it’s too low level for what I want to do. Build was not attempted.


Installation/build appeared to work correctly, but there was a slight error with the build documentation.

Where the documentation says to run

(isca_env)$ pip install -e .

I got the following error:

(isca_env) simon@mason:~/tmp/climate/Isca$ pip install -e .
Obtaining file:///home/simon/tmp/climate/Isca
ERROR: file:///home/simon/tmp/climate/Isca does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

I found a setup.py file under src/extra/python/, so I ran

pip install -e src/extra/python/

This gave the following output:

Obtaining file:///home/simon/tmp/climate/Isca/src/extra/python
  Preparing metadata (setup.py) ... done
Requirement already satisfied: sh in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from Isca==0.2) (1.13.1)
Requirement already satisfied: jinja2 in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from Isca==0.2) (3.0.3)
Requirement already satisfied: f90nml in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from Isca==0.2) (1.3.1)
Requirement already satisfied: numpy in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from Isca==0.2) (1.21.4)
Requirement already satisfied: pandas in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from Isca==0.2) (1.3.4)
Requirement already satisfied: xarray in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from Isca==0.2) (0.20.1)
Requirement already satisfied: MarkupSafe>=2.0 in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from jinja2->Isca==0.2) (2.0.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from pandas->Isca==0.2) (2.8.2)
Requirement already satisfied: pytz>=2017.3 in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from pandas->Isca==0.2) (2021.3)
Requirement already satisfied: six>=1.5 in /home/simon/bin/miniforge3/envs/isca_env/lib/python3.9/site-packages (from python-dateutil>=2.7.3->pandas->Isca==0.2) (1.16.0)
Installing collected packages: Isca
  Running setup.py develop for Isca
Successfully installed Isca-0.2

So I think that worked satisfactorily. To test it I then attempted to run a test case, and this failed complaining about missing environment variables. So I think this is working and I just need to read the documentation better to get it running.

It needs to be said this was also a very big, complex installation process and the fact that it all ran cleanly is very commendable: this isn’t easy.


All climate models are complex bits of software, and, being mathematically intensive, tend to be written in relatively special purpose languages (R, Julia, Fortran) with which I’m not familiar. I’m also intensely prejudiced against Python, because I hate significant white space, so again where systems use Python as a front end scripting language, this isn’t familiar to me.

Hector and Isca built satisfactorily without much difficulty. Hector successfully ran test cases (and commendably quickly), although it didn’t produce output I am able to interpret at this stage. **Climate Machine** didn't build, but I think this is fixable with a little more work.

All three of these systems are promising and worthy of further investigation. Whether any will do what I need I am not yet certain.

No comments:

Creative Commons Licence
The fool on the hill by Simon Brooke is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License