Baroclinic adjustment
In this example, we simulate the evolution and equilibration of a baroclinically unstable front.
Install dependencies
First let's make sure we have all required packages installed.
using Pkg
pkg"add Oceananigans, CairoMakie"
using Oceananigans
using Oceananigans.Units
Grid
We use a three-dimensional channel that is periodic in the x
direction:
Lx = 1000kilometers # east-west extent [m]
Ly = 1000kilometers # north-south extent [m]
Lz = 1kilometers # depth [m]
grid = RectilinearGrid(size = (48, 48, 8),
x = (0, Lx),
y = (-Ly/2, Ly/2),
z = (-Lz, 0),
topology = (Periodic, Bounded, Bounded))
48×48×8 RectilinearGrid{Float64, Periodic, Bounded, Bounded} on CPU with 3×3×3 halo
├── Periodic x ∈ [0.0, 1.0e6) regularly spaced with Δx=20833.3
├── Bounded y ∈ [-500000.0, 500000.0] regularly spaced with Δy=20833.3
└── Bounded z ∈ [-1000.0, 0.0] regularly spaced with Δz=125.0
Model
We built a HydrostaticFreeSurfaceModel
with an ImplicitFreeSurface
solver. Regarding Coriolis, we use a beta-plane centered at 45° South.
model = HydrostaticFreeSurfaceModel(; grid,
coriolis = BetaPlane(latitude = -45),
buoyancy = BuoyancyTracer(),
tracers = :b,
momentum_advection = WENO(),
tracer_advection = WENO())
HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── grid: 48×48×8 RectilinearGrid{Float64, Periodic, Bounded, Bounded} on CPU with 3×3×3 halo
├── timestepper: QuasiAdamsBashforth2TimeStepper
├── tracers: b
├── closure: Nothing
├── buoyancy: BuoyancyTracer with ĝ = NegativeZDirection()
├── free surface: ImplicitFreeSurface with gravitational acceleration 9.80665 m s⁻²
│ └── solver: FFTImplicitFreeSurfaceSolver
├── advection scheme:
│ ├── momentum: WENO(order=5)
│ └── b: WENO(order=5)
└── coriolis: BetaPlane{Float64}
We start our simulation from rest with a baroclinically unstable buoyancy distribution. We use ramp(y, Δy)
, defined below, to specify a front with width Δy
and horizontal buoyancy gradient M²
. We impose the front on top of a vertical buoyancy gradient N²
and a bit of noise.
"""
ramp(y, Δy)
Linear ramp from 0 to 1 between -Δy/2 and +Δy/2.
For example:
```
y < -Δy/2 => ramp = 0
-Δy/2 < y < -Δy/2 => ramp = y / Δy
y > Δy/2 => ramp = 1
```
"""
ramp(y, Δy) = min(max(0, y/Δy + 1/2), 1)
N² = 1e-5 # [s⁻²] buoyancy frequency / stratification
M² = 1e-7 # [s⁻²] horizontal buoyancy gradient
Δy = 100kilometers # width of the region of the front
Δb = Δy * M² # buoyancy jump associated with the front
ϵb = 1e-2 * Δb # noise amplitude
bᵢ(x, y, z) = N² * z + Δb * ramp(y, Δy) + ϵb * randn()
set!(model, b=bᵢ)
Let's visualize the initial buoyancy distribution.
using CairoMakie
# Build coordinates with units of kilometers
x, y, z = 1e-3 .* nodes(grid, (Center(), Center(), Center()))
b = model.tracers.b
fig, ax, hm = heatmap(view(b, 1, :, :),
colormap = :deep,
axis = (xlabel = "y [km]",
ylabel = "z [km]",
title = "b(x=0, y, z, t=0)",
titlesize = 24))
Colorbar(fig[1, 2], hm, label = "[m s⁻²]")
fig
Simulation
Now let's build a Simulation
.
simulation = Simulation(model, Δt=20minutes, stop_time=20days)
Simulation of HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
├── Next time step: 20 minutes
├── Elapsed wall time: 0 seconds
├── Wall time per iteration: NaN days
├── Stop time: 20 days
├── Stop iteration: Inf
├── Wall time limit: Inf
├── Minimum relative step: 0.0
├── Callbacks: OrderedDict with 4 entries:
│ ├── stop_time_exceeded => Callback of stop_time_exceeded on IterationInterval(1)
│ ├── stop_iteration_exceeded => Callback of stop_iteration_exceeded on IterationInterval(1)
│ ├── wall_time_limit_exceeded => Callback of wall_time_limit_exceeded on IterationInterval(1)
│ └── nan_checker => Callback of NaNChecker for u on IterationInterval(100)
├── Output writers: OrderedDict with no entries
└── Diagnostics: OrderedDict with no entries
We add a TimeStepWizard
callback to adapt the simulation's time-step,
conjure_time_step_wizard!(simulation, IterationInterval(20), cfl=0.2, max_Δt=20minutes)
Also, we add a callback to print a message about how the simulation is going,
using Printf
wall_clock = Ref(time_ns())
function print_progress(sim)
u, v, w = model.velocities
progress = 100 * (time(sim) / sim.stop_time)
elapsed = (time_ns() - wall_clock[]) / 1e9
@printf("[%05.2f%%] i: %d, t: %s, wall time: %s, max(u): (%6.3e, %6.3e, %6.3e) m/s, next Δt: %s\n",
progress, iteration(sim), prettytime(sim), prettytime(elapsed),
maximum(abs, u), maximum(abs, v), maximum(abs, w), prettytime(sim.Δt))
wall_clock[] = time_ns()
return nothing
end
add_callback!(simulation, print_progress, IterationInterval(100))
Diagnostics/Output
Here, we save the buoyancy, $b$, at the edges of our domain as well as the zonal ($x$) average of buoyancy.
u, v, w = model.velocities
ζ = ∂x(v) - ∂y(u)
B = Average(b, dims=1)
U = Average(u, dims=1)
V = Average(v, dims=1)
filename = "baroclinic_adjustment"
save_fields_interval = 0.5day
slicers = (east = (grid.Nx, :, :),
north = (:, grid.Ny, :),
bottom = (:, :, 1),
top = (:, :, grid.Nz))
for side in keys(slicers)
indices = slicers[side]
simulation.output_writers[side] = JLD2Writer(model, (; b, ζ);
filename = filename * "_$(side)_slice",
schedule = TimeInterval(save_fields_interval),
overwrite_existing = true,
indices)
end
simulation.output_writers[:zonal] = JLD2Writer(model, (; b=B, u=U, v=V);
filename = filename * "_zonal_average",
schedule = TimeInterval(save_fields_interval),
overwrite_existing = true)
JLD2Writer scheduled on TimeInterval(12 hours):
├── filepath: baroclinic_adjustment_zonal_average.jld2
├── 3 outputs: (b, u, v)
├── array type: Array{Float32}
├── including: [:grid, :coriolis, :buoyancy, :closure]
├── file_splitting: NoFileSplitting
└── file size: 32.5 KiB
Now we're ready to run.
@info "Running the simulation..."
run!(simulation)
@info "Simulation completed in " * prettytime(simulation.run_wall_time)
[ Info: Running the simulation...
[ Info: Initializing simulation...
[00.00%] i: 0, t: 0 seconds, wall time: 37.283 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (34.507 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (25.813 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 50.179 seconds, max(u): (1.366e-01, 1.249e-01, 1.568e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 1.032 seconds, max(u): (2.149e-01, 1.846e-01, 1.703e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.243 seconds, max(u): (2.924e-01, 2.634e-01, 1.789e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.041 seconds, max(u): (3.551e-01, 3.460e-01, 1.906e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 998.420 ms, max(u): (4.184e-01, 4.655e-01, 1.881e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 918.456 ms, max(u): (5.378e-01, 6.593e-01, 1.999e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 2.215 seconds, max(u): (6.742e-01, 9.941e-01, 2.594e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.205 seconds, max(u): (1.100e+00, 1.181e+00, 4.807e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 1.120 seconds, max(u): (1.465e+00, 1.186e+00, 4.564e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 1.463 seconds, max(u): (1.425e+00, 1.323e+00, 5.556e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 2.188 seconds, max(u): (1.418e+00, 1.387e+00, 4.123e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 1.189 seconds, max(u): (1.310e+00, 1.161e+00, 3.642e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 1.269 seconds, max(u): (1.395e+00, 1.075e+00, 2.661e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 901.783 ms, max(u): (1.254e+00, 1.107e+00, 3.331e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 0 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.376 minutes
Visualization
All that's left is to make a pretty movie. Actually, we make two visualizations here. First, we illustrate how to make a 3D visualization with Makie
's Axis3
and Makie.surface
. Then we make a movie in 2D. We use CairoMakie
in this example, but note that using GLMakie
is more convenient on a system with OpenGL, as figures will be displayed on the screen.
using CairoMakie
Three-dimensional visualization
We load the saved buoyancy output on the top, north, and east surface as FieldTimeSeries
es.
filename = "baroclinic_adjustment"
sides = keys(slicers)
slice_filenames = NamedTuple(side => filename * "_$(side)_slice.jld2" for side in sides)
b_timeserieses = (east = FieldTimeSeries(slice_filenames.east, "b"),
north = FieldTimeSeries(slice_filenames.north, "b"),
top = FieldTimeSeries(slice_filenames.top, "b"))
B_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "b")
times = B_timeseries.times
grid = B_timeseries.grid
48×48×8 RectilinearGrid{Float64, Periodic, Bounded, Bounded} on CPU with 3×3×3 halo
├── Periodic x ∈ [0.0, 1.0e6) regularly spaced with Δx=20833.3
├── Bounded y ∈ [-500000.0, 500000.0] regularly spaced with Δy=20833.3
└── Bounded z ∈ [-1000.0, 0.0] regularly spaced with Δz=125.0
We build the coordinates. We rescale horizontal coordinates to kilometers.
xb, yb, zb = nodes(b_timeserieses.east)
xb = xb ./ 1e3 # convert m -> km
yb = yb ./ 1e3 # convert m -> km
Nx, Ny, Nz = size(grid)
x_xz = repeat(x, 1, Nz)
y_xz_north = y[end] * ones(Nx, Nz)
z_xz = repeat(reshape(z, 1, Nz), Nx, 1)
x_yz_east = x[end] * ones(Ny, Nz)
y_yz = repeat(y, 1, Nz)
z_yz = repeat(reshape(z, 1, Nz), grid.Ny, 1)
x_xy = x
y_xy = y
z_xy_top = z[end] * ones(grid.Nx, grid.Ny)
Then we create a 3D axis. We use zonal_slice_displacement
to control where the plot of the instantaneous zonal average flow is located.
fig = Figure(size = (1600, 800))
zonal_slice_displacement = 1.2
ax = Axis3(fig[2, 1],
aspect=(1, 1, 1/5),
xlabel = "x (km)",
ylabel = "y (km)",
zlabel = "z (m)",
xlabeloffset = 100,
ylabeloffset = 100,
zlabeloffset = 100,
limits = ((x[1], zonal_slice_displacement * x[end]), (y[1], y[end]), (z[1], z[end])),
elevation = 0.45,
azimuth = 6.8,
xspinesvisible = false,
zgridvisible = false,
protrusions = 40,
perspectiveness = 0.7)
Axis3()
We use data from the final savepoint for the 3D plot. Note that this plot can easily be animated by using Makie's Observable
. To dive into Observable
s, check out Makie.jl's Documentation.
n = length(times)
41
Now let's make a 3D plot of the buoyancy and in front of it we'll use the zonally-averaged output to plot the instantaneous zonal-average of the buoyancy.
b_slices = (east = interior(b_timeserieses.east[n], 1, :, :),
north = interior(b_timeserieses.north[n], :, 1, :),
top = interior(b_timeserieses.top[n], :, :, 1))
# Zonally-averaged buoyancy
B = interior(B_timeseries[n], 1, :, :)
clims = 1.1 .* extrema(b_timeserieses.top[n][:])
kwargs = (colorrange=clims, colormap=:deep, shading=NoShading)
surface!(ax, x_yz_east, y_yz, z_yz; color = b_slices.east, kwargs...)
surface!(ax, x_xz, y_xz_north, z_xz; color = b_slices.north, kwargs...)
surface!(ax, x_xy, y_xy, z_xy_top; color = b_slices.top, kwargs...)
sf = surface!(ax, zonal_slice_displacement .* x_yz_east, y_yz, z_yz; color = B, kwargs...)
contour!(ax, y, z, B; transformation = (:yz, zonal_slice_displacement * x[end]),
levels = 15, linewidth = 2, color = :black)
Colorbar(fig[2, 2], sf, label = "m s⁻²", height = Relative(0.4), tellheight=false)
title = "Buoyancy at t = " * string(round(times[n] / day, digits=1)) * " days"
fig[1, 1:2] = Label(fig, title; fontsize = 24, tellwidth = false, padding = (0, 0, -120, 0))
rowgap!(fig.layout, 1, Relative(-0.2))
colgap!(fig.layout, 1, Relative(-0.1))
save("baroclinic_adjustment_3d.png", fig)
Two-dimensional movie
We make a 2D movie that shows buoyancy $b$ and vertical vorticity $ζ$ at the surface, as well as the zonally-averaged zonal and meridional velocities $U$ and $V$ in the $(y, z)$ plane. First we load the FieldTimeSeries
and extract the additional coordinates we'll need for plotting
ζ_timeseries = FieldTimeSeries(slice_filenames.top, "ζ")
U_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "u")
B_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "b")
V_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "v")
xζ, yζ, zζ = nodes(ζ_timeseries)
yv = ynodes(V_timeseries)
xζ = xζ ./ 1e3 # convert m -> km
yζ = yζ ./ 1e3 # convert m -> km
yv = yv ./ 1e3 # convert m -> km
49-element Vector{Float64}:
-500.0
-479.1666666666667
-458.3333333333333
-437.5
-416.6666666666667
-395.8333333333333
-375.0
-354.1666666666667
-333.3333333333333
-312.5
-291.6666666666667
-270.8333333333333
-250.0
-229.16666666666666
-208.33333333333334
-187.5
-166.66666666666666
-145.83333333333334
-125.0
-104.16666666666667
-83.33333333333333
-62.5
-41.666666666666664
-20.833333333333332
0.0
20.833333333333332
41.666666666666664
62.5
83.33333333333333
104.16666666666667
125.0
145.83333333333334
166.66666666666666
187.5
208.33333333333334
229.16666666666666
250.0
270.8333333333333
291.6666666666667
312.5
333.3333333333333
354.1666666666667
375.0
395.8333333333333
416.6666666666667
437.5
458.3333333333333
479.1666666666667
500.0
Next, we set up a plot with 4 panels. The top panels are large and square, while the bottom panels get a reduced aspect ratio through rowsize!
.
set_theme!(Theme(fontsize=24))
fig = Figure(size=(1800, 1000))
axb = Axis(fig[1, 2], xlabel="x (km)", ylabel="y (km)", aspect=1)
axζ = Axis(fig[1, 3], xlabel="x (km)", ylabel="y (km)", aspect=1, yaxisposition=:right)
axu = Axis(fig[2, 2], xlabel="y (km)", ylabel="z (m)")
axv = Axis(fig[2, 3], xlabel="y (km)", ylabel="z (m)", yaxisposition=:right)
rowsize!(fig.layout, 2, Relative(0.3))
To prepare a plot for animation, we index the timeseries with an Observable
,
n = Observable(1)
b_top = @lift interior(b_timeserieses.top[$n], :, :, 1)
ζ_top = @lift interior(ζ_timeseries[$n], :, :, 1)
U = @lift interior(U_timeseries[$n], 1, :, :)
V = @lift interior(V_timeseries[$n], 1, :, :)
B = @lift interior(B_timeseries[$n], 1, :, :)
Observable([-0.009377194568514824 -0.008121104910969734 -0.006870151963084936 -0.00561558548361063 -0.004381313920021057 -0.0031203667167574167 -0.0018705683760344982 -0.0006305125425569713; -0.009366423822939396 -0.00811171904206276 -0.006878864485770464 -0.00562310591340065 -0.004356762859970331 -0.0031405934132635593 -0.0018805069848895073 -0.000635925738606602; -0.009378453716635704 -0.008123727515339851 -0.006868438329547644 -0.0056381369940936565 -0.004369871225208044 -0.0031211134046316147 -0.001873173052445054 -0.0006263187970034778; -0.009365291334688663 -0.008127778768539429 -0.006867266725748777 -0.005621832329779863 -0.004359460435807705 -0.0031419345177710056 -0.0018502967432141304 -0.0006111214752309024; -0.00938386470079422 -0.008133620023727417 -0.00686252024024725 -0.005647605285048485 -0.004371727351099253 -0.0031308766920119524 -0.001865962753072381 -0.0006295056082308292; -0.009366226382553577 -0.008108973503112793 -0.006878836080431938 -0.005635655019432306 -0.0043863654136657715 -0.003129498101770878 -0.0018929534126073122 -0.0006060831947252154; -0.009373116306960583 -0.008113894611597061 -0.006877297535538673 -0.005610800813883543 -0.004366774577647448 -0.0031223073601722717 -0.0018962208414450288 -0.0006058262079022825; -0.00936965737491846 -0.008130447939038277 -0.0068726628087460995 -0.005643429234623909 -0.004367953632026911 -0.003111747559159994 -0.001875634421594441 -0.0005987939657643437; -0.009367527440190315 -0.008098715916275978 -0.00688503822311759 -0.005618279334157705 -0.0043809846974909306 -0.0030972459353506565 -0.0018514018738642335 -0.000633198011200875; -0.009364568628370762 -0.008126680739223957 -0.006879313848912716 -0.005647646263241768 -0.004351814277470112 -0.0031258082017302513 -0.0018612321000546217 -0.0006093767005950212; -0.00938029307872057 -0.008118920028209686 -0.006878079380840063 -0.005638977978378534 -0.004369464237242937 -0.0031185236293822527 -0.0018572909757494926 -0.0006311722099781036; -0.009369147941470146 -0.008095660246908665 -0.006901631131768227 -0.005599698517471552 -0.0043671936728060246 -0.003109249984845519 -0.001891232212074101 -0.0006263921386562288; -0.009363869205117226 -0.00811210460960865 -0.006891977973282337 -0.005627094767987728 -0.004385579843074083 -0.0031103731598705053 -0.0018914290703833103 -0.0006240594666451216; -0.00939063262194395 -0.008137259632349014 -0.0068741743452847 -0.005603614263236523 -0.004377423785626888 -0.0031270256731659174 -0.0019004943314939737 -0.0006293114274740219; -0.00938910897821188 -0.008105938322842121 -0.006857624277472496 -0.0056547848507761955 -0.004371227230876684 -0.003113103797659278 -0.0018882049480453134 -0.000631484086625278; -0.009380517527461052 -0.008123611100018024 -0.006874870974570513 -0.005626372992992401 -0.004394135903567076 -0.0031180393416434526 -0.0018753402400761843 -0.0006293114274740219; -0.009375510737299919 -0.008098108693957329 -0.006884856149554253 -0.005632101092487574 -0.004357130266726017 -0.0031254442874342203 -0.0018721334636211395 -0.0006180279888212681; -0.009398763068020344 -0.008106592111289501 -0.006852008868008852 -0.00562996556982398 -0.004387919791042805 -0.0031160882208496332 -0.0018597675953060389 -0.0006046807393431664; -0.009389055892825127 -0.008121849969029427 -0.0068878536112606525 -0.005646714009344578 -0.004396526142954826 -0.003149517346173525 -0.0018750021699815989 -0.0006470746011473238; -0.009377210400998592 -0.00812701229006052 -0.006891343276947737 -0.005643374752253294 -0.0043813008815050125 -0.003124870825558901 -0.0018367929151281714 -0.0006319702370092273; -0.00939179491251707 -0.008124934509396553 -0.006884417962282896 -0.005631438456475735 -0.0043814233504235744 -0.003123925067484379 -0.0018678189953789115 -0.0006028066854923964; -0.009365289472043514 -0.008140946738421917 -0.006878274492919445 -0.005616260226815939 -0.004383377730846405 -0.0031307281460613012 -0.0018928288482129574 -0.0006076272111386061; -0.007498087361454964 -0.006243639625608921 -0.004985883366316557 -0.0037770906928926706 -0.0024874326772987843 -0.0012491848319768906 -9.078723451239057e-6 0.0012501487508416176; -0.005398294422775507 -0.004147138446569443 -0.002928762696683407 -0.001679477165453136 -0.0004196001391392201 0.0007983256364241242 0.0020952406339347363 0.0033162308391183615; -0.003327864222228527 -0.0020713440608233213 -0.0008451896137557924 0.00042635967838577926 0.001674670958891511 0.002915916731581092 0.004144047386944294 0.005435328930616379; -0.0012433150550350547 -1.407441777701024e-5 0.0012196615571156144 0.0025020719040185213 0.003759864019230008 0.004997404292225838 0.006240328308194876 0.007529291324317455; 0.0006165180238895118 0.001819524564780295 0.0031403840985149145 0.004383821040391922 0.005630383733659983 0.006875623483210802 0.008100413717329502 0.009391757659614086; 0.0006306827999651432 0.0019005249487236142 0.0031263360287994146 0.004372747149318457 0.005628926679491997 0.00688310619443655 0.008100165985524654 0.009366001933813095; 0.0006182832294143736 0.001864087418653071 0.0031430604867637157 0.004384519532322884 0.005624137353152037 0.006879033520817757 0.008114047348499298 0.00937329139560461; 0.0006272742175497115 0.0018651417922228575 0.0031058192253112793 0.004343557171523571 0.005612129811197519 0.006875704508274794 0.008127209730446339 0.00936893094331026; 0.000633114657830447 0.0018587280064821243 0.0031160316430032253 0.004392204340547323 0.005634799599647522 0.006888290401548147 0.00811530277132988 0.009374609217047691; 0.0006199133349582553 0.0018598020542412996 0.0031290126498788595 0.004375931341201067 0.005608843639492989 0.006865768693387508 0.008122393861413002 0.009370286017656326; 0.0006217315676622093 0.001886864542029798 0.0031369223725050688 0.00439014658331871 0.005638298578560352 0.006895861122757196 0.008106740191578865 0.009387077763676643; 0.0006247214041650295 0.0018874108791351318 0.0031287360470741987 0.004371780902147293 0.005595986265689135 0.006859911140054464 0.008115476928651333 0.009342106990516186; 0.000627518049441278 0.0018626226810738444 0.0031483357306569815 0.004397095646709204 0.005620065610855818 0.006904649082571268 0.008112522773444653 0.009366070851683617; 0.0006235800101421773 0.0018713613972067833 0.0031444693449884653 0.004366199020296335 0.005624162033200264 0.0068442560732364655 0.008108172565698624 0.009384685195982456; 0.0006397454999387264 0.0018758263904601336 0.00310864532366395 0.004370822571218014 0.00564954336732626 0.006875520572066307 0.008122849278151989 0.009369374252855778; 0.000644077081233263 0.0018795221112668514 0.003113824175670743 0.0043494016863405704 0.005605287849903107 0.006878306157886982 0.008141357451677322 0.009389162063598633; 0.0006501136813312769 0.0018871559295803308 0.0031210044398903847 0.004353346303105354 0.005651393439620733 0.0068958052434027195 0.008110502734780312 0.00938617903739214; 0.0006393355433829129 0.001865732716396451 0.003104504896327853 0.004361530765891075 0.005640575196594 0.006882311776280403 0.008130144327878952 0.009367277845740318; 0.0006422926671802998 0.0018662604270502925 0.0031333076767623425 0.004367896355688572 0.005646842997521162 0.0068650804460048676 0.008128546178340912 0.009398048743605614; 0.0006388998590409756 0.0018574245041236281 0.003126232186332345 0.0043926117941737175 0.005634176079183817 0.00689538661390543 0.008132673799991608 0.009352751076221466; 0.0006370648043230176 0.0018657989567145705 0.0031305814627557993 0.0043880147859454155 0.005625830497592688 0.006862618029117584 0.008141112513840199 0.009392266161739826; 0.0006240494549274445 0.0018509586807340384 0.003137612482532859 0.004345139022916555 0.005620625801384449 0.006876833271235228 0.008145464584231377 0.00936088152229786; 0.0006259775254875422 0.001897024572826922 0.003124104579910636 0.004380980506539345 0.005623318254947662 0.006852830294519663 0.008131200447678566 0.009380071423947811; 0.0006361324922181666 0.001848991378210485 0.003120267763733864 0.004374388605356216 0.005636256653815508 0.006882091052830219 0.008134494535624981 0.009370763786137104; 0.0006130099063739181 0.0018955054692924023 0.0031348878983408213 0.004358318634331226 0.005636828485876322 0.006865141913294792 0.008132713846862316 0.009396577253937721; 0.0006399560952559114 0.0018367379670962691 0.0031335356179624796 0.004384236875921488 0.005633202381432056 0.0068588838912546635 0.008120903745293617 0.009384042583405972])
and then build our plot:
hm = heatmap!(axb, xb, yb, b_top, colorrange=(0, Δb), colormap=:thermal)
Colorbar(fig[1, 1], hm, flipaxis=false, label="Surface b(x, y) (m s⁻²)")
hm = heatmap!(axζ, xζ, yζ, ζ_top, colorrange=(-5e-5, 5e-5), colormap=:balance)
Colorbar(fig[1, 4], hm, label="Surface ζ(x, y) (s⁻¹)")
hm = heatmap!(axu, yb, zb, U; colorrange=(-5e-1, 5e-1), colormap=:balance)
Colorbar(fig[2, 1], hm, flipaxis=false, label="Zonally-averaged U(y, z) (m s⁻¹)")
contour!(axu, yb, zb, B; levels=15, color=:black)
hm = heatmap!(axv, yv, zb, V; colorrange=(-1e-1, 1e-1), colormap=:balance)
Colorbar(fig[2, 4], hm, label="Zonally-averaged V(y, z) (m s⁻¹)")
contour!(axv, yb, zb, B; levels=15, color=:black)
Finally, we're ready to record the movie.
frames = 1:length(times)
record(fig, filename * ".mp4", frames, framerate=8) do i
n[] = i
end
This page was generated using Literate.jl.