SpeedyWeather.jl

SpeedyWeather.jl: Reinventing atmospheric general circulation models towards interactivity and extensibility - Published in JOSS (2024)

https://github.com/speedyweather/speedyweather.jl

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 10 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords from Contributors

climate ocean climate-change data-assimilation fluid-dynamics meshing pde ode ocean-modelling automatic-differentiation

Scientific Fields

Earth and Environmental Sciences Physical Sciences - 41% confidence
Economics Social Sciences - 40% confidence
Last synced: 4 months ago · JSON representation ·

Repository

Play atmospheric modelling like it's LEGO.

Basic Info
Statistics
  • Stars: 502
  • Watchers: 10
  • Forks: 44
  • Open Issues: 62
  • Releases: 20
Created over 5 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog License Citation

README.md

SpeedyWeather.jl

CI status DOI
docs docs

SpeedyWeather.jl is a global atmospheric model with simple physics developed as a research playground with an everything-flexible attitude as long as it is speedy. It is easy to use and easy to extend, making atmospheric modelling an interactive experience -- in the terminal, in a notebook or conventionally through scripts. With minimal code redundancies it supports

Dynamics and physics - Different physical equations (barotropic vorticity, shallow water, primitive equations, with and without humidity) - Particle advection in 2D for all equations - Tracer advection in 2D/3D that can be added, deleted, (de)activated anytime - Physics parameterizations for convection, precipitation, boundary layer, etc. - Various more or less realistic planets and what-if scenarios by easily modifying initial and boundary conditions - A slab ocean and thermodynamic sea ice model - A 2-layer land bucket model with soil temperature, moisture and vegetation

Numerics and computing - Different spatial grids (full and octahedral, Gaussian and Clenshaw-Curtis, HEALPix, OctaHEALPix) - Different resolutions (T31 to T1023 and higher, i.e. 400km to 10km using linear, quadratic or cubic truncation) - Different arithmetics: Float32 (default), Float64, and (experimental) BFloat16, stochastic rounding - a very fast and flexible spherical harmonics transform library SpeedyTransforms

User interface - Data visualisation: 2D, 3D, interactive (you can zoom and rotate!) powered by Makie - Extensibility: New model components (incl. parameterizations) can be externally defined - Modularity: Models are constructed from its components, non-defaults are passed on as argument - Interactivity: SpeedyWeather.jl runs in a notebook or in the REPL as well as from scripts - Callbacks can be used to inject any piece of code after every time step, e.g. custom output, event handling, changing the model while it's running

and Julia will compile to these choices just-in-time.

For an overview of the functionality and explanation see the documentation. You are always encouraged to raise an issue (even it is not actually an issue but an idea, a suggestion or really anything) describing what you'd like to use SpeedyWeather for. We're keen to help!

Vision and roadmap

Why another model? You may ask. We believe that most currently available are stiff, difficult to use and extend, and therefore slow down research whereas a modern code in a modern language wouldn't have to. We decided to use Julia because it combines the best of Fortran and Python: Within a single language we can interactively run SpeedyWeather but also extend it, inspect its components, evaluate individual terms of the equations, and analyse and visualise output on the fly.

We do not necessarily aim to make SpeedyWeather an atmospheric model for the purpose of production-ready weather forecasting, at least not at the cost of our current level of interactivity and ease of use or extensibility. If someone wants to implement a parameterization that is very complicated and expensive to run then they are more than encouraged to do so. We are happy to provide a general interface to do so and support you to move this to its own repository, leveraging modularity. This may note become the default to not oppose the "easy and fast by default"-philosophy but that does not mean we don't appreciate your efforts or reject your contributions. In fact, we would love to show case more how easy to complex, laptop to HPC can work seamlessly within the same model. But SpeedyWeather's defaults should be balanced: Physically accurate yet general; as independently as possible from other components and parameter choices; not too complicated to implement and understand; and computationally cheap. Finding a good balance is difficult but we try our best.

This means in practice, that while SpeedyWeather is currently developed, many more physical processes and other features will be implemented. On our TODO is

  • A more realistic radiation scheme depending on clouds and humidity
  • Longwave radiation that depends on (globally averaged) greenhouse gas concentrations to represent climate change
  • Snow affecting surface fluxes including albedo
  • Exoplanet support with more flexibility on the atmospheric composition
  • 3D particle advection

Currently in development are

  • single GPU and CPU multi-threading support via KernelAbstractions
  • differentiability with Enzyme

Contributing

Open-source lives from large teams of (even occasional) contributors. If you are interested to fix something, implement something, or just use it and provide feedback you are always welcome. We are more than happy to guide you, especially when you don't know where to start. We can point you to the respective code, highlight how everything is connected and tell you about dos and don'ts. Just express your interest to contribute and we'll be happy to have you.

Example use

For a more comprehensive tutorial with several examples, see Examples in the documentation. The basic interface to SpeedyWeather.jl consist of 4 steps: define the grid, construct the model, initialize, run

julia spectral_grid = SpectralGrid(trunc=31, nlayers=8) # define resolution model = PrimitiveWetModel(spectral_grid) # construct model simulation = initialize!(model) # initialize all model components run!(simulation, period=Day(10), output=true) # aaaand action! showing Weather is speedy: run 0001 100%|█████████| Time: 0:00:02 (1000.22 years/day)

Hurray🥳 In a few seconds seconds we just simulated 10 days of the Earth's atmosphere at a speed of 1000 years per day. This simulation used a T31 spectral resolution on an octahedral Gaussian grid (~400km resolution) solving the primitive equations on 8 vertical levels, storing NetCDF output.

More examples in the How to run SpeedyWeather section of the documentation.

Gallery

Specific humidity in the primitive equation model simulated at T340 spectral resolution (about 40km) with 16 vertical levels (shown here is level 15, just above the surface) on the octahedral Gaussian grid computed in single precision multi-threaded on 16 CPUs. With convection, large-scale condensation, surface fluxes and some simplified radiation (the daily cycle is visible)

https://github.com/SpeedyWeather/SpeedyWeather.jl/assets/25530332/614f04cf-5080-4c89-9fd6-35efd54103a7

Relative vorticity in the shallow water model, simulated at T1023 spectral resolution (about 10km) on an octahedral Clenshaw-Curtis grid with more than 4 million grid points

https://user-images.githubusercontent.com/25530332/190443050-d5b8d093-86c0-46c9-b515-8420059ac8dc.mp4

Surface temperature in the primitive equation model without surface fluxes or radiation at T511 (~20km resolution) and 31 vertical levels. The simulation was multi-threaded in Float32 (single precision).

https://github.com/SpeedyWeather/SpeedyWeather.jl/assets/25530332/95897b82-9b81-4980-934b-cfdcf4d5a4b0

SpeedyWeather.jl can also solve the 2D barotropic vorticity equations on the sphere. Here, we use Float32 (single precision) at a resolution of T340 (40km) on an octahedral Gaussian grid. Forcing is a stochastic stirring on northern hemisphere mid-latitudes following Barnes and Hartmann, 2011. Map projection is orthographic centred on the north pole.

https://github.com/SpeedyWeather/SpeedyWeather.jl/assets/25530332/3d7fccd5-b66d-42e3-9f73-64dcf21d00ee

Here, SpeedyWeather.jl simulates atmospheric gravity waves, initialised randomly interacting with orography over a period of 2 days. Each frame is one time step, solved with a centred semi-implicit scheme that resolves gravity waves with a timestep of CFL=1.2-1.4 despite a single-stage RAW-filtered leapfrog integration.

https://github.com/SpeedyWeather/SpeedyWeather.jl/assets/25530332/510c38c7-12cb-42d5-b905-c66b4eaa514d

Advection of 5000 particles with wind in the lower-most layer of the primitive equation model at T85 (150km) resolution and 8 vertical layers.

https://github.com/SpeedyWeather/SpeedyWeather.jl/assets/25530332/a6192374-24d9-4065-9fcc-8b719190472f

Data visualisation

Difficult to plot spherical data? SpeedyWeather also includes extensions for Makie and GeoMakie making it supereasy to create plots and interactively investigate a variables from a simulation. Two examples (screen recording those makes it a bit laggy, it's pretty smooth otherwise): Humidity plotted on a 50km HEALPix grid

https://github.com/user-attachments/assets/b02b31eb-e139-4193-89d1-7e277a2af5cc

or the visualising cell centres and faces of the OctaminimalGaussianGrid

https://github.com/user-attachments/assets/6dfa212a-c5dc-4c54-b274-7755d5baf15c

History

SpeedyWeather.jl started off as a reinvention of the atmospheric general circulation model SPEEDY in Julia. SpeedyWeather has a different philosophy except for the simplicty of some parameterizations and many features have been added or changed so that only some of the numerical schemes share similarities, but so do many global spectral models. Fortran SPEEDY's dynamical core has an obscure history: Large parts were written by Isaac Held at GFDL in/before the 90ies with an unknown amount of contributions/modifications from Steve Jewson (Oxford) in the 90ies. The physical parametrizations were then added by Franco Molteni, Fred Kucharski, and Martin P. King afterwards while the model was still written in Fortran77. Around 2018-19, SPEEDY was then translated to Fortran90 by Sam Hatfield in speedy.f90. SpeedyWeather.jl is then adopted from first translations to Julia by Sam Hatfield. All these past creators and contributors are strongly acknowledged. Thank you for letting us use your efforts to create intermediate-complexity climate models as a conceptual launchpad for SpeedyWeather!

Submodules

SpeedyWeather.jl defines several submodules that are technically stand-alone (with dependencies) but aren't separated out to their own packages for now

  • RingGrids, a module that defines several iso-latitude ring-based spherical grids (like the FullGaussianGrid or the HEALPixGrid) and interpolations between them
  • LowerTriangularArrays, a module that defines LowerTriangularMatrix used for the spherical harmonic coefficients
  • SpeedyTransforms, a module that defines the spherical harmonic transform between spectral space (for which LowerTriangularArrays is used) and grid-point space (as defined by RingGrids).

These modules can also be used independently of SpeedyWeather like so julia julia> using SpeedyWeather: LowerTriangularArrays, RingGrids, SpeedyTransforms check out their documentation: RingGrids, LowerTriangularArrays, SpeedyTransforms.

Installation

SpeedyWeather.jl is registered in Julia's registry, so open the package manager with ] and julia (@v1.11) pkg> add SpeedyWeather which will install the latest release and all dependencies automatically. For more information see the Installation in the documentation. Please use the current minor version of Julia, compatibilities with older versions are not guaranteed.

Benchmarks

The primitive equations at 400km resolution with 8 vertical layers can be simulated by SpeedyWeather.jl at 1800 simulated years per day (SYPD) on a single core of newer CPUs with arm architecture (M-series MacBooks for example). At that speed, simulating one year takes about 50 seconds without output. The complex fused-multiply adds of the spectral transform compile efficiently to the large vector extensions of the newer arm chips in single precision. Another considerable speed-up comes from the reduced grids minimizing the number of columns for which expensive parameterizations like convection have to be computed. The parameterizations take up 40-60% of the total simulation time, depending on the grid. Particularly the OctaminimalGaussianGrid, OctaHEALPixGrid and the HEALPixGrid are increasingly faster, at a small accuracy sacrifice of the then inexact spectral transforms.

On older CPUs, like the Intel CPU MacBooks, the 1800 SYPD drop to about 500-600 SYPD, which is still 2x faster than Fortran SPEEDY which is reported to reach 240 SYPD. With GPU support being a work in progress we do not expect a performance increase for the lower resolutions but aim to provide the ability to also run the model very efficiently at high resolution!

For an overview of typical simulation speeds a user can expect under different model setups see Benchmarks.

Citing

If you use SpeedyWeather.jl in research, teaching, or other activities, we would be grateful if you could mention SpeedyWeather.jl and cite our paper in JOSS:

Klöwer et al., (2024). SpeedyWeather.jl: Reinventing atmospheric general circulation models towards interactivity and extensibility. Journal of Open Source Software, 9(98), 6323, doi:10.21105/joss.06323.

The bibtex entry for the paper is:

bibtex @article{SpeedyWeatherJOSS, doi = {10.21105/joss.06323}, url = {https://doi.org/10.21105/joss.06323}, year = {2024}, publisher = {The Open Journal}, volume = {9}, number = {98}, pages = {6323}, author = {Milan Klöwer and Maximilian Gelbrecht and Daisuke Hotta and Justin Willmert and Simone Silvestri and Gregory L. Wagner and Alistair White and Sam Hatfield and Tom Kimpson and Navid C. Constantinou and Chris Hill}, title = {{SpeedyWeather.jl: Reinventing atmospheric general circulation models towards interactivity and extensibility}}, journal = {Journal of Open Source Software} }

Copyright and license

Copyright (c) 2020 Milan Klöwer for SpeedyWeather.jl
Copyright (c) 2021 The SpeedyWeather.jl Contributors for SpeedyWeather.jl
Copyright (c) 2022 Fred Kucharski and Franco Molteni for SPEEDY parametrization schemes

Software licensed under the MIT License.

Owner

  • Name: SpeedyWeather
  • Login: SpeedyWeather
  • Kind: organization

JOSS Publication

SpeedyWeather.jl: Reinventing atmospheric general circulation models towards interactivity and extensibility
Published
June 07, 2024
Volume 9, Issue 98, Page 6323
Authors
Milan Klöwer ORCID
Massachusetts Institute of Technology, Cambridge, MA, USA, University of Oxford, UK
Maximilian Gelbrecht ORCID
Technical University of Munich, Germany, Potsdam Institute for Climate Impact Research, Germany
Daisuke Hotta ORCID
Japan Meteorological Agency, Tsukuba, Japan, European Centre for Medium-Range Weather Forecasts, Reading, UK
Justin Willmert ORCID
University of Minnesota, Minneapolis, MN, USA
Simone Silvestri ORCID
Massachusetts Institute of Technology, Cambridge, MA, USA
Gregory L. Wagner ORCID
Massachusetts Institute of Technology, Cambridge, MA, USA
Alistair White ORCID
Technical University of Munich, Germany, Potsdam Institute for Climate Impact Research, Germany
Sam Hatfield ORCID
European Centre for Medium-Range Weather Forecasts, Reading, UK
Tom Kimpson ORCID
University of Oxford, UK, University of Melbourne, Parkville, VIC, Australia
Navid C. Constantinou ORCID
University of Melbourne, Parkville, VIC, Australia, ARC Centre of Excellence for the Weather of the 21st Century, University of Melbourne, Parkville, VIC, Australia
Chris Hill
Massachusetts Institute of Technology, Cambridge, MA, USA
Editor
Kristen Thyng ORCID
Tags
weather climate general circulation model spectral spherical harmonic transform

Citation (CITATION.cff)

cff-version: 1.2.0
preferred-citation:
  type: article
  authors:
  - family-names: "Klöwer"
    given-names: "Milan"
    orcid: "https://orcid.org/0000-0002-3920-4356"
  - family-names: "Gelbrecht"
    given-names: "Maximilian"
    orcid: "https://orcid.org/0000-0002-0729-6671"
  - family-names: "Hotta"
    given-names: "Daisuke"
    orcid: "https://orcid.org/0000-0003-2287-0608"
  - family-names: "Willmert"
    given-names: "Justin"
    orcid: "https://orcid.org/0000-0002-6452-4693"
  - family-names: "Silvestri"
    given-names: "Simone"
    orcid: "https://orcid.org/0000-0002-7156-946X"
  - family-names: "Wagner"
    given-names: "Gregory L"
    orcid: "https://orcid.org/0000-0003-3377-6852"
  - family-names: "White"
    given-names: "Alistair"
    orcid: "https://orcid.org/0000-0001-7235-6450"
  - family-names: "Hatfield"
    given-names: "Sam"
    orcid: "https://orcid.org/0000-0002-6542-6032"
  - family-names: "Kimpson"
    given-names: "Tom"
    orcid: "https://orcid.org/0000-0002-8149-4094"
  - family-names: "Constantinou"
    given-names: "Navid C"
    orcid: "https://orcid.org/0000-0001-5317-2445"
  - family-names: "Hill"
    given-names: "Chris"
  title: "SpeedyWeather.jl: Reinventing atmospheric general circulation models towards interactivity and extensibility"
  journal: "Journal of Open Source Software"
  doi: "10.21105/joss.06323"
  volume: 9
  issue: 98
  start: 6323
  year: 2024
  license: MIT

GitHub Events

Total
  • Fork event: 13
  • Create event: 131
  • Commit comment event: 23
  • Release event: 5
  • Issues event: 87
  • Watch event: 60
  • Delete event: 103
  • Member event: 4
  • Issue comment event: 796
  • Push event: 1,776
  • Pull request event: 256
  • Pull request review event: 257
  • Pull request review comment event: 261
Last Year
  • Fork event: 13
  • Create event: 131
  • Commit comment event: 26
  • Release event: 5
  • Issues event: 87
  • Watch event: 60
  • Delete event: 103
  • Member event: 4
  • Issue comment event: 800
  • Push event: 1,782
  • Pull request event: 256
  • Pull request review event: 259
  • Pull request review comment event: 263

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 2,146
  • Total Committers: 27
  • Avg Commits per committer: 79.481
  • Development Distribution Score (DDS): 0.192
Past Year
  • Commits: 323
  • Committers: 16
  • Avg Commits per committer: 20.188
  • Development Distribution Score (DDS): 0.427
Top Committers
Name Email Commits
Milan Klöwer m****r@g****e 1,733
Maximilian Gelbrecht m****t@p****e 188
Navid C. Constantinou n****y 77
Tom Kimpson t****n@g****m 34
CompatHelper Julia c****y@j****g 18
Simone Silvestri 3****i 17
dmey d****y 17
Pietro Monticone 3****e 15
dependabot[bot] 4****] 8
Brian Groenke b****e@p****e 7
github-actions[bot] 4****] 6
Alistair White 5****r 6
Daisuke Hotta d****a@e****t 2
Daisuke Hotta 8****d 2
Jack Leland j****d@g****m 2
Valentin Churavy v****y@g****m 2
miniufo m****o@1****m 2
Anshul Singhvi a****i@g****m 1
Marcelo Villa 3****a 1
Mosè Giordano m****e@g****g 1
Nathanael Wong 3****g 1
Pier Luigi Vidale 1****e 1
Shpherd-china-can 1****1 1
T. Ehlert 1****k 1
Tim Reichelt t****m 1
minqi6 1****6 1
rocroc2017 c****e@l****n 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 149
  • Total pull requests: 591
  • Average time to close issues: 4 months
  • Average time to close pull requests: 12 days
  • Total issue authors: 43
  • Total pull request authors: 25
  • Average comments per issue: 4.74
  • Average comments per pull request: 2.73
  • Merged pull requests: 466
  • Bot issues: 0
  • Bot pull requests: 55
Past Year
  • Issues: 63
  • Pull requests: 301
  • Average time to close issues: 22 days
  • Average time to close pull requests: 8 days
  • Issue authors: 23
  • Pull request authors: 16
  • Average comments per issue: 2.38
  • Average comments per pull request: 2.87
  • Merged pull requests: 213
  • Bot issues: 0
  • Bot pull requests: 43
Top Authors
Issue Authors
  • milankl (56)
  • maximilian-gelbrecht (11)
  • navidcy (8)
  • pierluigividale (8)
  • miniufo (7)
  • bgroenks96 (6)
  • madnanabid (5)
  • roc-climate (4)
  • mini-DONG (3)
  • natgeo-wong (3)
  • rocroc2017 (3)
  • treigerm (2)
  • slayoo (2)
  • glwagner (2)
  • gargentini (1)
Pull Request Authors
  • milankl (366)
  • maximilian-gelbrecht (79)
  • navidcy (46)
  • github-actions[bot] (38)
  • dependabot[bot] (17)
  • miniufo (4)
  • sunmoumou1 (4)
  • simone-silvestri (4)
  • minqi6 (4)
  • bgroenks96 (3)
  • vchuravy (3)
  • jackleland (3)
  • treigerm (2)
  • rocroc2017 (2)
  • asinghvi17 (2)
Top Labels
Issue Labels
user interface :musical_keyboard: (12) documentation :books: (12) bug :lady_beetle: (11) dynamics :wavy_dash: (10) testing (8) testing :test_tube: (8) parameterizations :cloud_with_rain: (7) structure :house: (7) output :outbox_tray: (6) differentiability 🤖 (6) forcing :weight_lifting: (5) grid :globe_with_meridians: (5) dynamics (5) documentation (5) bug (5) forcing (5) parameterizations (5) initial conditions :traffic_light: (4) question :question: :grey_question: (4) package :package: (3) humidity :droplet: (3) joss review :book: (3) array types :globe_with_meridians: (3) user interface (3) performance :rocket: (3) radiation :sun_with_face: (3) low precision (3) humidity (3) array types :1234: (3) stability :boom: (3)
Pull Request Labels
documentation :books: (82) user interface :musical_keyboard: (49) surface :mountain: (38) bug :lady_beetle: (34) testing :test_tube: (34) parameterizations :cloud_with_rain: (33) gpu :framed_picture: (30) structure :house: (29) array types :1234: (29) array types :globe_with_meridians: (27) time integration :clock10: (27) output :outbox_tray: (26) differentiability 🤖 (25) dependency :guide_dog: (24) documentation (23) grid :globe_with_meridians: (23) transform :arrow_left: :arrow_right: (22) humidity :droplet: (22) dynamics :wavy_dash: (21) compatibility :dancers: (18) parameterizations (17) performance :rocket: (16) spectral :wavy_dash: (15) package :package: (15) vertical (13) forcing (12) user interface (12) initial conditions :traffic_light: (12) dynamics (11) ocean :ocean: (11)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 38 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 20
juliahub.com: SpeedyWeather

Play atmospheric modelling like it's LEGO.

  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 38 Total
Rankings
Stargazers count: 5.0%
Dependent repos count: 9.9%
Forks count: 13.7%
Average: 16.9%
Dependent packages count: 38.9%
Last synced: 4 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/Documenter.yml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia latest composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/CompatHelper.yml actions
  • julia-actions/setup-julia v1 composite
.github/workflows/DocPreviewCleanup.yml actions
  • actions/checkout v2 composite
.github/workflows/julianightly.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • julia-actions/julia-buildpkg latest composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite