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: 42.794 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (38.015 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (29.045 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 57.994 seconds, max(u): (1.312e-01, 1.223e-01, 1.596e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 1.043 seconds, max(u): (2.128e-01, 1.812e-01, 1.791e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.111 seconds, max(u): (2.872e-01, 2.391e-01, 1.632e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 986.218 ms, max(u): (3.864e-01, 3.094e-01, 1.693e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 970.413 ms, max(u): (4.896e-01, 5.009e-01, 1.869e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 1.152 seconds, max(u): (6.526e-01, 8.166e-01, 2.477e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 1.083 seconds, max(u): (9.451e-01, 1.209e+00, 3.118e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 998.259 ms, max(u): (1.342e+00, 1.210e+00, 4.552e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 992.168 ms, max(u): (1.340e+00, 1.251e+00, 4.566e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 1.042 seconds, max(u): (1.291e+00, 1.241e+00, 4.842e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 743.541 ms, max(u): (1.496e+00, 1.388e+00, 4.258e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 889.832 ms, max(u): (1.311e+00, 1.342e+00, 3.206e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 926.251 ms, max(u): (1.338e+00, 1.136e+00, 2.889e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 1.114 seconds, max(u): (1.155e+00, 1.142e+00, 1.964e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.446 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.447 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.009379426948726177 -0.008133620955049992 -0.0068545215763151646 -0.005634862929582596 -0.00436327513307333 -0.003090786514803767 -0.0018809169996529818 -0.000647847424261272; -0.009392930194735527 -0.008109306916594505 -0.0068791755475103855 -0.005630357190966606 -0.004379499237984419 -0.003109300509095192 -0.0018796288641169667 -0.0006069312803447247; -0.009352229535579681 -0.008130207657814026 -0.006877616047859192 -0.005625718738883734 -0.004355502314865589 -0.003133451798930764 -0.001874744426459074 -0.0006213999586179852; -0.00938103161752224 -0.008141080848872662 -0.006864388007670641 -0.005636954680085182 -0.004365871660411358 -0.0031133207958191633 -0.0018514783587306738 -0.0006153219728730619; -0.009358689188957214 -0.008134201169013977 -0.006876042112708092 -0.0056112585589289665 -0.0043906522914767265 -0.0031122628133744 -0.00189497834071517 -0.0006176391616463661; -0.009364794008433819 -0.008113478310406208 -0.006881905719637871 -0.005604912526905537 -0.004367598332464695 -0.0031245569698512554 -0.0018905109027400613 -0.0006174027803353965; -0.009369000792503357 -0.00811031088232994 -0.006861856207251549 -0.005634394008666277 -0.004358916077762842 -0.0030971746891736984 -0.0018790505127981305 -0.000636311830021441; -0.009349312633275986 -0.00814698077738285 -0.006872313562780619 -0.0056373970583081245 -0.004347602371126413 -0.003113002050668001 -0.001885795732960105 -0.0006392849609255791; -0.009379369206726551 -0.00813610851764679 -0.006892120465636253 -0.0056157587096095085 -0.004387349355965853 -0.003147793235257268 -0.0018619070760905743 -0.0006183303776197135; -0.009340716525912285 -0.00813070498406887 -0.00685582822188735 -0.005647127516567707 -0.004361261613667011 -0.003140504937618971 -0.0018670563586056232 -0.0006259513320401311; -0.009384745731949806 -0.008117848075926304 -0.006885851267725229 -0.005624464247375727 -0.004367111716419458 -0.003134964732453227 -0.0018727394053712487 -0.0006394746014848351; -0.00938976090401411 -0.00812558364123106 -0.006896217819303274 -0.00563468411564827 -0.004390578251332045 -0.003113985527306795 -0.0018773587653413415 -0.0006221036310307682; -0.009378001093864441 -0.008144905790686607 -0.006877464707940817 -0.005583554040640593 -0.004392481409013271 -0.0031357593834400177 -0.0018681877991184592 -0.0006265657721087337; -0.00935782864689827 -0.008117943070828915 -0.006911571137607098 -0.005615770351141691 -0.00436506187543273 -0.003157727885991335 -0.001876956783235073 -0.0006196094327606261; -0.009356619790196419 -0.008115570992231369 -0.0068546864204108715 -0.005634883884340525 -0.004379986319690943 -0.003114323830232024 -0.0018835458904504776 -0.0006320076645351946; -0.009373687207698822 -0.008130185306072235 -0.006878323387354612 -0.005641415249556303 -0.0043505337089300156 -0.00311048561707139 -0.0018706019036471844 -0.000646893575321883; -0.009380952455103397 -0.008139027282595634 -0.006888560485094786 -0.005634348373860121 -0.00439029186964035 -0.0031228698790073395 -0.0018634679727256298 -0.0006135618314146996; -0.00936487503349781 -0.008124188520014286 -0.006896256934851408 -0.005655827932059765 -0.004356288816779852 -0.0031285476870834827 -0.0018758679507300258 -0.0006252151797525585; -0.009377866983413696 -0.008140788413584232 -0.0068560997024178505 -0.005625769030302763 -0.004362969659268856 -0.0031414323020726442 -0.001873699715360999 -0.0006354442448355258; -0.0093428585678339 -0.008122543804347515 -0.006868100259453058 -0.005624830722808838 -0.004361328203231096 -0.0031081829220056534 -0.0018394344951957464 -0.0005954098305664957; -0.009378423914313316 -0.008142374455928802 -0.006862286943942308 -0.005612863693386316 -0.004388223867863417 -0.003100152825936675 -0.0018786770524457097 -0.0006233517779037356; -0.009374445304274559 -0.008126268163323402 -0.006867774296551943 -0.005644639488309622 -0.004383760038763285 -0.0031224365811794996 -0.0018752376781776547 -0.0006437605479732156; -0.007536924909800291 -0.006224458105862141 -0.004988371394574642 -0.003750595962628722 -0.0024996940046548843 -0.0012522967299446464 1.8049611753667705e-5 0.0012297416105866432; -0.005408299621194601 -0.00417509488761425 -0.0029148575849831104 -0.0016648274613544345 -0.00044113220064900815 0.0008325558737851679 0.002042285166680813 0.003334991866722703; -0.00331691512838006 -0.0020624957978725433 -0.0008301128982566297 0.0004324947949498892 0.001666115247644484 0.002910362556576729 0.004186531063169241 0.005436432547867298; -0.0012235878966748714 2.5147557607851923e-5 0.0012476699193939567 0.0025057264138013124 0.00373072293587029 0.005002366378903389 0.006275480147451162 0.007510998751968145; 0.0006155336159281433 0.00189096643589437 0.0031281926203519106 0.004369565285742283 0.005611122585833073 0.006876467261463404 0.008139897137880325 0.009361302480101585; 0.0006352036143653095 0.0018586164806038141 0.00312224798835814 0.0043520028702914715 0.005633066408336163 0.006887509953230619 0.008131531067192554 0.009361164644360542; 0.00062327750492841 0.001880162162706256 0.0030942398589104414 0.00439311470836401 0.005611792206764221 0.006873008795082569 0.008121269755065441 0.009347906336188316; 0.0006088411901146173 0.0018749599112197757 0.003156705992296338 0.004400665871798992 0.005629366729408503 0.006867030169814825 0.008108783513307571 0.009383009746670723; 0.0006463775644078851 0.0018903519958257675 0.0031253339257091284 0.004386703483760357 0.005630667321383953 0.006872877012938261 0.008102917112410069 0.009379853494465351; 0.0006231123697943985 0.0018480224534869194 0.0031186318956315517 0.004392244387418032 0.005605807062238455 0.00688176229596138 0.008132977411150932 0.009393378160893917; 0.000611024908721447 0.0018484018510207534 0.003127023112028837 0.004362340085208416 0.005589740350842476 0.0068539101630449295 0.008150110952556133 0.009342760778963566; 0.0006019489374011755 0.001868942636065185 0.003137617139145732 0.004341281019151211 0.00561489025130868 0.006878946907818317 0.008125042542815208 0.009351653046905994; 0.0006477312417700887 0.0018631800776347518 0.0031175140757113695 0.004386499989777803 0.005636047571897507 0.0069050234742462635 0.008146749809384346 0.00936452578753233; 0.0006254278123378754 0.0018920887960121036 0.0031192845199257135 0.0043632215820252895 0.005636247340589762 0.006877189967781305 0.008091759867966175 0.009366699494421482; 0.000583907007239759 0.0018670602003112435 0.003118987660855055 0.004363106098026037 0.005622750613838434 0.006858038250356913 0.008120061829686165 0.009358687326312065; 0.0006137982709333301 0.001882934127934277 0.003142187837511301 0.004367861431092024 0.005616957321763039 0.006858862470835447 0.008126650005578995 0.009345111437141895; 0.0006303487461991608 0.0018722154200077057 0.003130925353616476 0.004367069341242313 0.005631494801491499 0.006891789846122265 0.00808650441467762 0.009375067427754402; 0.0006274242186918855 0.0018634011503309011 0.003106675110757351 0.004391064401715994 0.005637767259031534 0.0068677933886647224 0.008104084059596062 0.009397951886057854; 0.000630249036476016 0.001875086221843958 0.003123475704342127 0.004399455618113279 0.005629625171422958 0.006868414580821991 0.00812598504126072 0.009386556223034859; 0.0006065532797947526 0.001866425503976643 0.003115842118859291 0.0043614935129880905 0.0056379991583526134 0.006881689187139273 0.008111489936709404 0.009355236776173115; 0.0006227337871678174 0.0018802196718752384 0.0031442444305866957 0.004382803104817867 0.005624265875667334 0.006870198994874954 0.008142730221152306 0.009376571513712406; 0.000608113594353199 0.0018941189628094435 0.0031478842720389366 0.004365521017462015 0.005630741361528635 0.0068621644750237465 0.008129279129207134 0.00935469288378954; 0.0006267295684665442 0.0018791755428537726 0.003119449131190777 0.004351343028247356 0.005600763019174337 0.00687430938705802 0.008112060837447643 0.00936934445053339; 0.0006247650599107146 0.001880601979792118 0.0031256568618118763 0.004389909096062183 0.00561475520953536 0.006862691603600979 0.008140847086906433 0.009391366504132748; 0.0006349210161715746 0.0018664883682504296 0.003121832152828574 0.0043793474324047565 0.005633018910884857 0.006861398927867413 0.00810327660292387 0.009376748465001583; 0.0006093382835388184 0.0018840355332940817 0.0031308401376008987 0.004381692502647638 0.0056332494132220745 0.006886353716254234 0.008128815330564976 0.009364325553178787])
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.