milank.δe

On the road to realitγ.

January 5, 2019

Juls - The first 16bit Atmosphere/Ocean Model

Juls is great. No probably it's not, at least not yet. But, it can simulate geostrophic turbulence typical for either atmospheric or oceanic flow with 16bit numbers. Indeed 16bit. Usually climate models use 64bit numbers. Why?

Juls - The first 16bit Atmosphere/Ocean Model

Juls is great. No probably it's not, at least not yet. But, it can simulate geostrophic turbulence typical for either atmospheric or oceanic flow with 16bit numbers. Indeed 16bit. Usually climate models use 64bit numbers. Why? Well, because it's the standard and nobody questioned it since the seventies where the IEEE consortium agreed on having 64bit as standard representation for real numbers on computers. A lot happened since then, computers don't become magically faster anymore, even smartphones have several processors instead of a single very fast one. And then there is machine learning. Google developed TPUs (tensor processing unit) to meet hardware requirements of machine learning algorithms. They realized, they don't need 64bit. So they went down: 32, 16 and probably in the future even 8 or 4 bit.

What about weather and climate models? One problem is, these models have several million lines of code. Going down from 64 to 32bit if you're lucky doesn't cause any problems. Why? The largest representable number with 64bit is ~10^300, which is really really big. The largest representable number with 32bit is ~10^30, still quite big and I guess, if you see such a number popping up as the result of your calculation you would likely assume something went wrong. That means we barely write code that actually requires such big numbers, hence the transition in that case is easy. However, going down to 16bit the biggest number you can represent is 65504.0 If you want to try to represent pressure in pascal (which would be O(10^5)), good luck. It's gonna crash.

And that's where juls comes in. I wrote this model with the focus to be run in 16bit. A bit of non-dimensionalising numbers here, a bit of precompution there, avoiding some redundant calculations that may cause overflow, and here we go: Juls - the first 16bit Atmosphere/Ocean Model. It's far from perfect. Far. Really far. But so far it works on simple test cases. And it has some complicated schemes that I mainly borrowed from state-of-the-art ocean models, such as biharmonic diffusion, time-splitting (RK4 for the "fast modes": pressure gradient, continuity etc. / semi-implicit for diffusive terms), a semi-Lagrangian advection scheme and there is many features planned for the future!

Check it out: It's on github.com/milankl/juls

Oh and it's written in Julia. What a great language. That's probably also where the name comes from, but don't ask me what the s stands for. I should come up with a backronym. Definitely. One day.