Quick start

This code:

using Oceananigans

grid = RectilinearGrid(size=(128, 128), x=(0, 2π), y=(0, 2π), topology=(Periodic, Periodic, Flat))
model = NonhydrostaticModel(; grid, advection=WENO())

ϵ(x, y, z) = 2rand() - 1
set!(model, u=ϵ, v=ϵ)

simulation = Simulation(model; Δt=0.01, stop_iteration=100)
[ Info: Initializing simulation...
[ Info:     ... simulation initialization complete (109.099 ms)
[ Info: Executing initial time step...
[ Info:     ... initial time step complete (28.063 seconds).
[ Info: Simulation is stopping after running for 31.117 seconds.
[ Info: Model iteration 100 equals or exceeds stop iteration 100.

runs 100 time steps of a two-dimensional turbulence simulation with 128² finite volume cells and a fifth-order upwinded WENO advection scheme. It's quite similar to the two-dimensional turbulence example.


They say that a Makie visualization is worth a thousand Unicode characters, so let's plot vorticity,

using CairoMakie

u, v, w = model.velocities
ζ = Field(∂x(v) - ∂y(u))

heatmap(interior(ζ, :, :, 1))