SpeedyWeather.jl: Reinventing atmospheric generalcirculation models towards interactivity and extensibility

Milan Klöwer, Maximilian Gelbrecht, Daisuke Hotta, J. Willmert, Simone Silvestri, Gregory LeClaire Wagner, Alistair White, Sam Hatfield, Tom Kimpson, Navid C. Constantinou, Chris Hill

Atmospheric modeling has long been the domain of massive, monolithic Fortran codebases. While these models are highly optimized, they often suffer from a "two-language" friction: simulations are performed in low-level code, while analysis and experimentation happen in high-level languages like Python or R. This separation creates barriers to innovation, particularly when integrating modern data-driven techniques.

SpeedyWeather.jl addresses these challenges by reimagining the atmospheric general circulation model (GCM) as a modular, interactive, and extensible Julia library. By leveraging Julia's unique capabilities, it allows researchers to build, run, and analyze models within a single, unified environment.

A Modular Hierarchy of Models

SpeedyWeather.jl does not just provide a single model; it offers a hierarchy of complexity. This ranges from the simple 2D barotropic vorticity equation to full 3D primitive equations that incorporate variables such as humidity and temperature. This modularity allows researchers to choose the level of physical complexity necessary for their specific study without the overhead of a full Earth System Model.

Global surface wind speed simulation demonstrating the model's ability to capture complex atmospheric dynamics.

Technical Innovations: Dispatch and Flexibility

The library's architecture is built on several key technical pillars:

  • Multiple Dispatch: Using Julia’s core strength, the model is highly extensible. Users can define new physical processes (like custom convection schemes) by simply creating a new "type" and a corresponding function, which the model incorporates without requiring modifications to the core source code.
  • Spectral Numerics and Grid Flexibility: The model utilizes spherical harmonic transforms for high-accuracy simulations. Unlike traditional models locked into specific grids, SpeedyWeather.jl supports various "iso-latitude ring-based" grids, including Gaussian, octahedral Gaussian, and HEALPix.
  • Bit-Precision Agnosticism: The codebase is designed to be agnostic to number formats. While it defaults to Float32 for performance, it can run on Float64 or experimental Float16 formats using the same underlying code.

Results: High-Resolution Global Simulations

The framework is capable of high-resolution simulations, such as T1023 spectral resolution (approximately 20km), utilizing multi-threaded parallelization across vertical layers and horizontal grid points. This performance allows for the real-time inspection of variables—researchers can pause a simulation, adjust parameters in the REPL, and resume immediately, a workflow that significantly accelerates the research cycle.

Simulated surface specific humidity (left) and surface air temperature (right) showcasing the 3D primitive equation model's output.

The Future of Hybrid Modeling

By treating a GCM as a library rather than a standalone executable, SpeedyWeather.jl aligns atmospheric modeling with modern software engineering practices. Its native compatibility with Julia’s machine learning ecosystem (e.g., Flux.jl) and automatic differentiation tools (e.g., Enzyme.jl) makes it an ideal platform for developing hybrid models where traditional physics and neural networks operate in tandem.

While current limitations include a lack of distributed-memory parallelization (MPI) and full GPU support, the project represents a significant step toward more accessible, interactive, and future-proof climate and weather research tools.

Summary updated

BibTeX
@article{klower2024speedyweather,
  author = {Milan Klöwer and Maximilian Gelbrecht and Daisuke Hotta and J. Willmert and Simone Silvestri and Gregory LeClaire Wagner and Alistair White and Sam Hatfield and Tom Kimpson and Navid C. Constantinou and Chris Hill},
  title = {{SpeedyWeather.jl: Reinventing atmospheric generalcirculation models towards interactivity and extensibility}},
  journal = {The Journal of Open Source Software},
  year = {2024},
  doi = {10.21105/joss.06323},
}
Figure