milankl / ShallowWaters.jl

A type-flexible shallow water model that can run with 16-bit arithmetic.
MIT License
115 stars 20 forks source link

ShallowWaters.jl - A type-flexible 16-bit shallow water model

CI DOI

sst

A shallow water model with a focus on type-flexibility and 16-bit number formats. ShallowWaters allows for Float64/32/16, Posit32/16/8, BFloat16, LogFixPoint16, Sonum16, Float32/16 & BFloat16 with stochastic rounding and in general every number format with arithmetics and conversions implemented. ShallowWaters also allows for mixed-precision and reduced precision communication.

ShallowWaters uses an energy and enstrophy conserving advection scheme and a Smagorinsky-like biharmonic diffusion operator. Tracer advection is implemented with a semi-Lagrangian advection scheme. Strong stability-preserving Runge-Kutta schemes of various orders and stages are used with a semi-implicit treatment of the continuity equation. Boundary conditions are either periodic (only in x direction) or non-periodic super-slip, free-slip, partial-slip, or no-slip. Output via NetCDF.

Please feel free to raise an issue if you discover bugs or have an idea how to improve ShallowWaters.

Requires: Julia 1.2 or higher

How to use

julia> using ShallowWaters
julia> run_model()
Starting ShallowWaters on Thu, 20 Jan 2022 15:44:30 without output.
100% Integration done in 0.61s.

You just successfully ran ShallowWaters.jl! For more examples and arguments to pass on to run_model see the documentation.

Installation

ShallowWaters.jl is a registered package, so simply do

julia> ] add ShallowWaters

References

ShallowWaters.jl was used and is described in more detail in

[1] Klöwer M, S Hatfield, M Croci, PD Düben and TN Palmer, 2022. Fluid simulations accelerated with 16 bits: Approaching 4x speedup on A64FX by squeezing ShallowWaters.jl into Float16, Journal of Advances in Modeling Earth Systems, 14, 10.1029/2021MS002684

[2] Klöwer M, PD Düben, and TN Palmer, 2020. Number formats, error mitigation and scope for 16-bit arithmetics in weather and climate modelling analysed with a shallow water model. Journal of Advances in Modeling Earth Systems, 10.1029/2020MS002246

[3] Klöwer M, PD Düben, and TN Palmer, 2019. Posits as an alternative to floats for weather and climate models. In: Proceedings of the Conference for Next Generation Arithmetic 2019, Singapore, ACM, 10.1145/3316279.3316281

If you use this package in your research, please cite us. Additionally, we would love to hear from you that you have used this package, so feel always free to reach out!