Ocean Biogeochemical Modelling Environment
Description
OceanBioME was developed with generous support from the Cambridge Centre for Climate Repair CCRC and the Gordon and Betty Moore Foundation as a tool to study the effectiveness and impacts of ocean carbon dioxide removal (CDR) strategies.
OceanBioME is a flexible modelling environment written in Julia for modelling the coupled interactions between ocean biogeochemistry, carbonate chemistry, and physics. OceanBioME can be run as a stand-alone box model, or coupled with Oceananigans.jl to run as a 1D column model or with 2 and 3D physics.
Installation:
First, download and install Julia
From the Julia prompt (REPL), type:
julia> using Pkg
julia> Pkg.add("OceanBioME")
Running your first model
As a simple example lets run a Nutrient-Phytoplankton-Zooplankton-Detritus (NPZD) model in a two-dimensional simulation of a buoyancy front:
using OceanBioME, Oceananigans
using Oceananigans.Units
grid = RectilinearGrid(CPU(), size=(256, 32), extent=(500meters, 100meters), topology=(Bounded, Flat, Bounded))
biogeochemistry = NutrientPhytoplanktonZooplanktonDetritus(; grid, open_bottom=true)
model = NonhydrostaticModel(; grid, biogeochemistry,
buoyancy=BuoyancyTracer(), tracers=:b,
advection=WENO(; grid),
closure = AnisotropicMinimumDissipation())
bᵢ(x, y, z) = ifelse(x < 250, 1e-4, 1e-3)
set!(model, b = bᵢ, N = 5.0, P = 0.1, Z = 0.1, T = 18.0)
simulation = Simulation(model; Δt = 2.0, stop_time = 3hours)
simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.tracers,
filename = "buoyancy_front.jld2",
schedule = TimeInterval(1minute),
overwrite_existing = true)
run!(simulation)
We can then visualise this:
b = FieldTimeSeries("buoyancy_front.jld2", "b")
P = FieldTimeSeries("buoyancy_front.jld2", "P")
xb, yb, zb = nodes(b)
xP, yP, zP = nodes(P)
times = b.times
using CairoMakie
n = Observable(1)
b_lims = (minimum(b), maximum(b))
P_lims = (minimum(P), maximum(P))
bₙ = @lift interior(b[$n], :, 1, :)
Pₙ = @lift interior(P[$n], :, 1, :)
fig = Figure(resolution = (1200, 480), fontsize = 20)
title = @lift "t = $(prettytime(times[$n]))"
Label(fig[0, :], title)
axis_kwargs = (xlabel = "x (m)", ylabel = "z (m)", width = 970)
ax1 = Axis(fig[1, 1]; title = "Buoyancy perturbation (m / s)", axis_kwargs...)
ax2 = Axis(fig[2, 1]; title = "Phytoplankton concentration (mmol N / m³)", axis_kwargs...)
hm1 = heatmap!(ax1, xb, zb, bₙ, colorrange = b_lims, colormap = :batlow)
hm2 = heatmap!(ax2, xP, zP, Pₙ, colorrange = P_lims, colormap = Reverse(:bamako))
Colorbar(fig[1, 2], hm1)
Colorbar(fig[2, 2], hm2)
record(fig, "buoyancy_front.gif", 1:length(times)) do i
@info string("Plotting frame ", i, " of ", length(times))
n[] = i
end
In this example OceanBioME
is providing the biogeochemistry
and the remainder is taken care of by Oceananigans
. For comprehensive documentation of the physics modelling see Oceananigans' Documentation, and for biogeochemistry and other features we provide read below.
Using GPU
To run the same example on the GPU we just need to construct the grid
on the GPU; the rest is taken care of!
Just replace CPU()
with GPU()
in the grid construction with everything else left unchanged:
grid = RectilinearGrid(GPU(), size=(256, 32), extent=(500meters, 100meters), topology=(Bounded, Flat, Bounded))
Documentation
See the documentation for full description and examples.