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.UnitsGrid
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.0Model
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⁻²]")
figSimulation
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
├── run_wall_time: 0 seconds
├── run_wall_time / 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 entriesWe 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.6 KiBNow 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: 33.297 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (9.629 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (3.065 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 9.150 seconds, max(u): (1.282e-01, 1.203e-01, 1.541e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 804.882 ms, max(u): (2.243e-01, 1.913e-01, 1.776e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 778.858 ms, max(u): (2.862e-01, 2.620e-01, 1.870e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.015 seconds, max(u): (3.636e-01, 3.029e-01, 1.859e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 1.288 seconds, max(u): (4.748e-01, 4.032e-01, 1.940e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 1.135 seconds, max(u): (5.862e-01, 5.948e-01, 2.135e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 1.207 seconds, max(u): (8.079e-01, 9.034e-01, 3.053e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.264 seconds, max(u): (1.211e+00, 1.013e+00, 3.806e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 1.054 seconds, max(u): (1.268e+00, 1.059e+00, 5.101e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 797.735 ms, max(u): (1.377e+00, 1.137e+00, 4.461e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 765.233 ms, max(u): (1.353e+00, 9.756e-01, 5.648e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 791.772 ms, max(u): (1.217e+00, 1.105e+00, 2.844e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 835.954 ms, max(u): (1.276e+00, 1.112e+00, 2.724e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 755.585 ms, max(u): (1.336e+00, 1.274e+00, 2.960e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 27.282 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 27.301 seconds
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 CairoMakieThree-dimensional visualization
We load the saved buoyancy output on the top, north, and east surface as FieldTimeSerieses.
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.grid48×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.0We 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 Observables, check out Makie.jl's Documentation.
n = length(times)41Now 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.0Next, 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.009353840723633766 -0.008120551705360413 -0.006871673744171858 -0.005620142910629511 -0.004363392014056444 -0.0031356490217149258 -0.0018646990647539496 -0.0005902426200918853; -0.00936710275709629 -0.008120942860841751 -0.006881058681756258 -0.005640032701194286 -0.00438288226723671 -0.0031183259561657906 -0.0018719222862273455 -0.0006167570827528834; -0.009377270005643368 -0.008141234517097473 -0.006885549984872341 -0.005641721189022064 -0.0043882206082344055 -0.0031206589192152023 -0.0018700705841183662 -0.000613527197856456; -0.009361720643937588 -0.008138682693243027 -0.006862897891551256 -0.005617939867079258 -0.004381324164569378 -0.003098144428804517 -0.0018599600298330188 -0.0006398583645932376; -0.009375713765621185 -0.008136358112096786 -0.0068707093596458435 -0.005612216889858246 -0.004360907711088657 -0.0031327391043305397 -0.0018376680091023445 -0.0005938664544373751; -0.0093659907579422 -0.008106304332613945 -0.006897635292261839 -0.005618992727249861 -0.004374303389340639 -0.00312025030143559 -0.001872316817753017 -0.000625603657681495; -0.009370092302560806 -0.008134189061820507 -0.006858300883322954 -0.005606568418443203 -0.004387373104691505 -0.003110281890258193 -0.0018863772274926305 -0.0006442838930524886; -0.00938772689551115 -0.008125240914523602 -0.0068717473186552525 -0.005615610163658857 -0.004378562793135643 -0.0031269732862710953 -0.0018432224169373512 -0.0006143836653791368; -0.009376767091453075 -0.008107447065412998 -0.006868348922580481 -0.005624276585876942 -0.004384424537420273 -0.0031261304393410683 -0.0018660848727449775 -0.0006353341159410775; -0.009347263723611832 -0.008139868266880512 -0.006873907055705786 -0.005620068870484829 -0.004361264873296022 -0.003129354678094387 -0.0018720787484198809 -0.0006238454952836037; -0.009370454587042332 -0.008108150213956833 -0.0068702432326972485 -0.005642491392791271 -0.004400182049721479 -0.003133678575977683 -0.0018944857874885201 -0.000628368987236172; -0.009388920851051807 -0.00811676774173975 -0.006861354690045118 -0.005626821890473366 -0.004395655356347561 -0.003134853905066848 -0.0018801731057465076 -0.000623570813331753; -0.00937449000775814 -0.00814027525484562 -0.006899767555296421 -0.005630824249237776 -0.004366336390376091 -0.003116224892437458 -0.0018825895385816693 -0.0006404477753676474; -0.009394929744303226 -0.008145689032971859 -0.006883559748530388 -0.005629796534776688 -0.004369146656244993 -0.0031193869654089212 -0.0018867312464863062 -0.0006021086010150611; -0.009404130280017853 -0.008125189691781998 -0.006870811339467764 -0.005627952050417662 -0.004369805566966534 -0.0031167850829660892 -0.0018818898824974895 -0.0006155089940875769; -0.009377860464155674 -0.008136996068060398 -0.006890321150422096 -0.005621900781989098 -0.004377265460789204 -0.0031310163903981447 -0.0019027784001082182 -0.000635168282315135; -0.009377663023769855 -0.008115630596876144 -0.006864632945507765 -0.005626666825264692 -0.004366130102425814 -0.0031200991943478584 -0.0018439695704728365 -0.0006196790491230786; -0.009364371187984943 -0.008118662051856518 -0.006889870390295982 -0.005610383581370115 -0.0043806531466543674 -0.003105111885815859 -0.0018875251989811659 -0.0006089677335694432; -0.009361754171550274 -0.00811810977756977 -0.006867171730846167 -0.005655764136463404 -0.004391614813357592 -0.0031240142416208982 -0.0018586218357086182 -0.0006617466569878161; -0.009410493075847626 -0.008136771619319916 -0.006887936498969793 -0.005639569368213415 -0.004393486306071281 -0.0031470030080527067 -0.0018868225160986185 -0.0006276671774685383; -0.009366398677229881 -0.008113153278827667 -0.00687407748773694 -0.005655768793076277 -0.004387810826301575 -0.0031195799820125103 -0.0018646897515282035 -0.0006246700650081038; -0.009377889335155487 -0.008143752813339233 -0.006882329937070608 -0.005627643316984177 -0.004375912249088287 -0.003100339323282242 -0.0018516143318265676 -0.0006505722412839532; -0.00749497814103961 -0.006228156853467226 -0.0049923500046133995 -0.0037364063318818808 -0.002512619597837329 -0.0012357896193861961 -4.607782557286555e-6 0.0012551116524264216; -0.0054146116599440575 -0.004161350429058075 -0.0029115763027220964 -0.0016689305193722248 -0.00041865979437716305 0.0008195643313229084 0.0020697794388979673 0.003330470994114876; -0.003350938204675913 -0.002086419379338622 -0.0008443028200417757 0.0004062638327013701 0.001672411453910172 0.002911021700128913 0.004171167034655809 0.005423517432063818; -0.0012512593530118465 -3.635255779954605e-5 0.0012451237998902798 0.0025043445639312267 0.0037528574466705322 0.0049943989142775536 0.0062381853349506855 0.007503726985305548; 0.0006481844466179609 0.0018821436678990722 0.00313548999838531 0.004350598435848951 0.005639280192553997 0.00687331473454833 0.008127056062221527 0.00936324056237936; 0.0006329147727228701 0.0018803005805239081 0.003102382179349661 0.0044053541496396065 0.005645782221108675 0.006881444714963436 0.008113418705761433 0.009370649233460426; 0.0006378906546160579 0.0018927181372419 0.0031140781939029694 0.004361194092780352 0.005627704784274101 0.0068872044794261456 0.008115592412650585 0.00937157403677702; 0.0006175454473122954 0.0018781969556584954 0.0031293584033846855 0.00439066207036376 0.005626545753329992 0.006886302027851343 0.00811007246375084 0.009369676932692528; 0.0006575184524990618 0.0018793536582961679 0.0031281406991183758 0.00436369888484478 0.00565085606649518 0.006876232568174601 0.008127073757350445 0.009395903907716274; 0.0006223970558494329 0.0019122888334095478 0.003124298295006156 0.004351970739662647 0.005612550303339958 0.006872302852571011 0.008134313859045506 0.009359444491565228; 0.0006354794022627175 0.001895899884402752 0.003118183696642518 0.004366290755569935 0.005624320358037949 0.0068984078243374825 0.008149796165525913 0.009378848597407341; 0.000625402492005378 0.001849410473369062 0.0031354317907243967 0.004355587065219879 0.0056141517125070095 0.006888884119689465 0.008114121854305267 0.009325711987912655; 0.0006197862094268203 0.0018525944324210286 0.0031232007313519716 0.004365168046206236 0.005585201550275087 0.006884015630930662 0.00812560971826315 0.009374779649078846; 0.00063479965319857 0.0018753279000520706 0.0031307977624237537 0.004374139942228794 0.00563293369486928 0.006852124817669392 0.008138909935951233 0.009366756305098534; 0.0006226339610293508 0.0018822536803781986 0.0031067412346601486 0.004367172718048096 0.005644377786666155 0.0068559832870960236 0.008099776692688465 0.009364721365272999; 0.0006106265354901552 0.0018727792194113135 0.003129898803308606 0.004358767997473478 0.005647205747663975 0.006872574333101511 0.00811685062944889 0.00938944797962904; 0.0006194086745381355 0.0018904629396274686 0.0030784206464886665 0.0043747033923864365 0.005639090668410063 0.006854464299976826 0.008149796165525913 0.009363222867250443; 0.0006564898649230599 0.001873553148470819 0.0031144865788519382 0.004368110094219446 0.0056484155356884 0.006878716871142387 0.008107135072350502 0.009385534562170506; 0.0006166987004689872 0.0018648761324584484 0.003118084045127034 0.004358133766800165 0.005647670011967421 0.006863321643322706 0.008123759180307388 0.009364413097500801; 0.0006325850845314562 0.0018829400651156902 0.003143340116366744 0.004374844487756491 0.005617416463792324 0.006899803876876831 0.008124093525111675 0.009355797432363033; 0.0005979802808724344 0.0018940115114673972 0.003113695653155446 0.0043696747161448 0.005648424848914146 0.006878222338855267 0.008108152076601982 0.009391195140779018; 0.0006379698752425611 0.0018742862157523632 0.00311903259716928 0.004362501669675112 0.005628389772027731 0.006873650010675192 0.008131389506161213 0.00939752347767353; 0.0006187214748933911 0.001862415112555027 0.003130086464807391 0.004360949154943228 0.005617182236164808 0.0068706632591784 0.008144247345626354 0.009384460747241974; 0.000630549096968025 0.001869472675025463 0.003127754433080554 0.004356387071311474 0.005628432147204876 0.00688536511734128 0.008129042573273182 0.009374850429594517; 0.0006186469690874219 0.0018802197882905602 0.0031207134015858173 0.004379598423838615 0.0056227934546768665 0.00688202865421772 0.008114230819046497 0.009376203641295433; 0.0006102740881033242 0.0018726420821622014 0.003140995278954506 0.004395764786750078 0.005628477316349745 0.006904878653585911 0.008139034733176231 0.00939092505723238])
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
endThis page was generated using Literate.jl.