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{3, Float64, Float32}(order=5)
│ └── b: WENO{3, Float64, Float32}(order=5)
├── vertical_coordinate: ZCoordinate
└── 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
set_theme!(Theme(fontsize = 20))
# 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 => 4
│ ├── stop_iteration_exceeded => -
│ ├── wall_time_limit_exceeded => e
│ └── nan_checker => }
├── 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: 34.756 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (30.279 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (21.967 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 45.306 seconds, max(u): (1.243e-01, 1.119e-01, 1.592e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 706.148 ms, max(u): (2.355e-01, 1.666e-01, 1.714e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 679.273 ms, max(u): (3.297e-01, 2.668e-01, 1.698e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 686.281 ms, max(u): (3.984e-01, 3.823e-01, 1.782e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 682.563 ms, max(u): (5.114e-01, 5.531e-01, 1.878e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 637.693 ms, max(u): (6.617e-01, 9.890e-01, 2.665e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 683.879 ms, max(u): (9.476e-01, 1.232e+00, 3.873e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 684.796 ms, max(u): (1.276e+00, 1.224e+00, 4.683e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 667.423 ms, max(u): (1.529e+00, 1.195e+00, 5.161e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 683.997 ms, max(u): (1.487e+00, 1.068e+00, 4.522e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 637.391 ms, max(u): (1.433e+00, 1.049e+00, 2.987e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 670.692 ms, max(u): (1.367e+00, 1.127e+00, 3.115e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 686.040 ms, max(u): (1.081e+00, 1.309e+00, 3.411e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 623.524 ms, max(u): (1.269e+00, 1.371e+00, 3.284e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.092 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.093 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
-500.0:20.833333333333332: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!
.
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.00936686061322689 -0.008139134384691715 -0.0068601639941334724 -0.005622945725917816 -0.004350787028670311 -0.0031274519860744476 -0.0018680517096072435 -0.0006192605360411108; -0.009374206885695457 -0.008126676082611084 -0.006869754288345575 -0.005632891785353422 -0.004371145740151405 -0.0031280897092074156 -0.0018818940734490752 -0.0006261331145651639; -0.009394488297402859 -0.008112503215670586 -0.006865434814244509 -0.005612584296613932 -0.0043692137114703655 -0.00312252645380795 -0.0018813490169122815 -0.0006320705288089812; -0.009368538856506348 -0.008096430450677872 -0.006878233980387449 -0.005622608121484518 -0.0043706088326871395 -0.0031217793002724648 -0.001857737428508699 -0.0006108651286922395; -0.009381716139614582 -0.00813329964876175 -0.006914813071489334 -0.005618042778223753 -0.004383446183055639 -0.003117391373962164 -0.0018586746882647276 -0.0006253767642192543; -0.009380322881042957 -0.008140732534229755 -0.006901121698319912 -0.005628658924251795 -0.004372702445834875 -0.003129340475425124 -0.0018728557042777538 -0.0006222999072633684; -0.009372461587190628 -0.008102213963866234 -0.006854532286524773 -0.005627581849694252 -0.004370750859379768 -0.0031200461089611053 -0.0018721704836934805 -0.0006471595843322575; -0.009363703429698944 -0.008133620023727417 -0.006884036120027304 -0.005615619942545891 -0.004343873355537653 -0.003120587905868888 -0.001895021996460855 -0.0006583855138160288; -0.0093809450045228 -0.008122234605252743 -0.006873609963804483 -0.0056382413022220135 -0.004373182542622089 -0.0031343488954007626 -0.0018564474303275347 -0.0006342011620290577; -0.009374103508889675 -0.008142639882862568 -0.0068701705895364285 -0.005596431437879801 -0.004391520284116268 -0.003137007588520646 -0.0018721367232501507 -0.0006341879488900304; -0.009338973090052605 -0.008139444515109062 -0.006849290337413549 -0.005624028854072094 -0.004389416892081499 -0.003146533155813813 -0.0018908038036897779 -0.0006243927637115121; -0.009364033117890358 -0.008129524067044258 -0.0068634310737252235 -0.005604937672615051 -0.004372333642095327 -0.0031261665280908346 -0.0018883422017097473 -0.000619635742623359; -0.00939401239156723 -0.008126880042254925 -0.006891355384141207 -0.005609559826552868 -0.004376194439828396 -0.0031433547846972942 -0.0018693552119657397 -0.0006364213768392801; -0.00939256977289915 -0.008139881305396557 -0.006868528202176094 -0.005628206301480532 -0.004368986003100872 -0.0031130476854741573 -0.0018705741968005896 -0.0006244551623240113; -0.009382612071931362 -0.008132588118314743 -0.0068396907299757 -0.005618532188236713 -0.004358128644526005 -0.003124592825770378 -0.0018648045370355248 -0.0006248888093978167; -0.009360154159367085 -0.008109401911497116 -0.006879528518766165 -0.005655315238982439 -0.004389471374452114 -0.003143704729154706 -0.0018768971785902977 -0.0005911756888963282; -0.009366249665617943 -0.008164498955011368 -0.006880379281938076 -0.005656191147863865 -0.00439063785597682 -0.003131275065243244 -0.001859647105447948 -0.000641883525531739; -0.009361815638840199 -0.00812805537134409 -0.006863050628453493 -0.005638812202960253 -0.004370952025055885 -0.0031271104235202074 -0.0018555435817688704 -0.000597344187553972; -0.009385044686496258 -0.008128050714731216 -0.006863459013402462 -0.005636436864733696 -0.0044037168845534325 -0.003129386343061924 -0.0018861843273043633 -0.0006278255605138838; -0.00937449000775814 -0.008127721957862377 -0.006888807751238346 -0.005623599048703909 -0.0043946816585958 -0.0031384702306240797 -0.001840517739765346 -0.0006173254805617034; -0.00938482116907835 -0.008132997900247574 -0.006894266232848167 -0.005621206946671009 -0.004386231768876314 -0.00312767899595201 -0.0018713823519647121 -0.0006365925073623657; -0.009391749277710915 -0.008108114823698997 -0.00689789978787303 -0.005616721231490374 -0.004378347657620907 -0.0031317223329097033 -0.0018420921405777335 -0.0006062686443328857; -0.0075207725167274475 -0.006244111806154251 -0.005002247169613838 -0.0037326256278902292 -0.002487706020474434 -0.0012428006157279015 1.0556405868555885e-5 0.0012446787441149354; -0.005402454640716314 -0.0041726864874362946 -0.0029041871894150972 -0.001658280030824244 -0.0004402390622999519 0.0008224955527111888 0.0020908017177134752 0.003323041833937168; -0.0033283766824752092 -0.002078323857858777 -0.0008045177673920989 0.0004113932081963867 0.0016635622596368194 0.0028962460346519947 0.004182673990726471 0.005425077863037586; -0.0012471695663407445 2.7889407647307962e-5 0.0012408734764903784 0.0025282464921474457 0.0037362684961408377 0.004983388818800449 0.006251084618270397 0.0074860225431621075; 0.0006142805214039981 0.0018728065770119429 0.0031293618958443403 0.004372644238173962 0.005657644476741552 0.006884029135107994 0.008114516735076904 0.009397376328706741; 0.0006210350547917187 0.0018737268401309848 0.0031032152473926544 0.0043488540686666965 0.005627849139273167 0.006890709511935711 0.008132130838930607 0.00937100499868393; 0.0006497474387288094 0.0018996468279510736 0.0031367787159979343 0.004376373253762722 0.005610181484371424 0.006883416324853897 0.008123258128762245 0.009399639442563057; 0.0006295248749665916 0.0018793876515701413 0.003119532484561205 0.004377451259642839 0.005612652748823166 0.006873393896967173 0.008120289072394371 0.009384078904986382; 0.0006357519887387753 0.0018560664029791951 0.0031213874462991953 0.0043947589583694935 0.00561926607042551 0.006869899109005928 0.008105717599391937 0.009349875152111053; 0.0006428880733437836 0.0018805585568770766 0.0031277479138225317 0.00438616331666708 0.0056217326782643795 0.006835749372839928 0.008097279816865921 0.009367786347866058; 0.0006482573226094246 0.0018861863063648343 0.003115376690402627 0.0043831560760736465 0.005638078320771456 0.0069047934375703335 0.008119047619402409 0.009391804225742817; 0.0006171534769237041 0.0018873481312766671 0.0031189690344035625 0.00438431091606617 0.005606406833976507 0.006864128168672323 0.008119647391140461 0.009354311972856522; 0.0006197997136041522 0.001875094952993095 0.0031187112908810377 0.00436253659427166 0.005642049480229616 0.006887086201459169 0.008123589679598808 0.009370153769850731; 0.0006164918886497617 0.0019069648114964366 0.003106036689132452 0.004369643516838551 0.005595567170530558 0.006874371785670519 0.008119297213852406 0.009381507523357868; 0.0006221732473932207 0.0018529391381889582 0.003106073010712862 0.0043646045960485935 0.00562620535492897 0.006883104331791401 0.008114947937428951 0.009370592422783375; 0.0006076130084693432 0.0018486997578293085 0.003113511949777603 0.004373645409941673 0.005640696734189987 0.006878294050693512 0.008113997057080269 0.009377828799188137; 0.0006126193329691887 0.0018672121223062277 0.0031479336321353912 0.0043678586371243 0.005635964684188366 0.006865301635116339 0.00810757465660572 0.009374208748340607; 0.0006225169636309147 0.0018701818771660328 0.0031054439023137093 0.004372827708721161 0.0056016407907009125 0.00686480849981308 0.008138185366988182 0.009390533901751041; 0.0006318370578810573 0.001903649652376771 0.003113560378551483 0.004374620970338583 0.005633500870317221 0.006863911636173725 0.008144843392074108 0.009369028732180595; 0.0006299877422861755 0.00190857017878443 0.003115247003734112 0.004389801528304815 0.005629827734082937 0.006882396060973406 0.008135209791362286 0.00936981663107872; 0.0006440437282435596 0.0018829297041520476 0.0031435720156878233 0.004393731709569693 0.005613173823803663 0.0068676588125526905 0.00807682704180479 0.009385103359818459; 0.0006117921438999474 0.0018899118294939399 0.003139007370918989 0.004386273678392172 0.0056133451871573925 0.00685478001832962 0.008160009980201721 0.00936770997941494; 0.0006288525182753801 0.001877802424132824 0.0031373058445751667 0.0043850489892065525 0.0056340452283620834 0.006890254095196724 0.008122473023831844 0.009379394352436066; 0.0006216628826223314 0.0018652378348633647 0.0031055272556841373 0.004387149587273598 0.00561133399605751 0.006884121801704168 0.008113827556371689 0.009389824233949184; 0.0005959380650892854 0.0018872064538300037 0.00311084883287549 0.004382007755339146 0.005619637202471495 0.006862387526780367 0.00815353263169527 0.009384872391819954; 0.0006144153885543346 0.001877669943496585 0.00312208803370595 0.0043518077582120895 0.005628802347928286 0.0068591018207371235 0.008135818876326084 0.009380004368722439])
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.