Skip to content

Latest commit

 

History

History
executable file
·
69 lines (49 loc) · 2.46 KB

README.md

File metadata and controls

executable file
·
69 lines (49 loc) · 2.46 KB

Oceanostics

Useful diagnostics to use with Oceananigans. Mostly AbstractOperationss and a few useful progress messengers.

To add the latest registered version from Julia:

julia>]
(v1.6) pkg> add Oceanostics

If you want the latest developments (which may or may not be unstable) you can add the latest version from github in the main branch:

julia> using Pkg

julia> Pkg.add(url="https://github.com/tomchor/Oceanostics.jl.git", rev="main")

The keyword rev let's you pick which github branch you want.

Simple example

The example below is a simple illustration of the use of TimedProgressMessenger (which keeps track of how long each time step takes) and KineticEnergy, which computed the kinetic energy of a flow.

(Note that (; tke, ε) is a shorthand for (tke=tke, ε=ε).)

using Oceananigans
using Oceanostics

grid = RectilinearGrid(size=(4, 5, 6), extent=(1, 1, 1))
model = NonhydrostaticModel(grid=grid, closure=SmagorinskyLilly())
simulation = Simulation(model, Δt=1, stop_iteration=10, progress=Oceanostics.TimedProgressMessenger(; LES=false))

ke = Field(KineticEnergy(model))
ε = Field(IsotropicViscousDissipationRate(model))
simulation.output_writers[:netcdf_writer] = NetCDFOutputWriter(model, (; ke, ε), filepath="out.nc", schedule=TimeInterval(2))
run!(simulation)

Caveats

  • Not every diagnostic has been thoroughly tested (we're still working on testing everything with CI).
  • Most diagnostics are written very generally since most uses of averages, etc. do not assume any specific kind of averaging procedure. Chances are it "wastes" computations for a given specific application.