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)
└── 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: 43.831 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (43.779 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (28.989 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 1.022 minutes, max(u): (1.246e-01, 1.173e-01, 1.517e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 880.330 ms, max(u): (2.129e-01, 1.675e-01, 1.729e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.164 seconds, max(u): (2.914e-01, 2.284e-01, 1.733e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.084 seconds, max(u): (3.563e-01, 2.901e-01, 1.723e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 806.772 ms, max(u): (4.140e-01, 4.126e-01, 1.898e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 1.003 seconds, max(u): (5.498e-01, 6.163e-01, 2.560e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 900.462 ms, max(u): (7.122e-01, 1.000e+00, 3.268e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.014 seconds, max(u): (1.100e+00, 1.237e+00, 4.235e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 1.064 seconds, max(u): (1.386e+00, 1.196e+00, 4.758e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 1.030 seconds, max(u): (1.484e+00, 1.284e+00, 4.364e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 969.973 ms, max(u): (1.542e+00, 1.127e+00, 4.063e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 1.047 seconds, max(u): (1.502e+00, 1.023e+00, 4.335e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 903.464 ms, max(u): (1.480e+00, 1.071e+00, 2.489e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 964.181 ms, max(u): (1.276e+00, 1.131e+00, 2.591e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.518 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.519 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.009367487393319607 -0.008118201047182083 -0.00688503123819828 -0.005612592212855816 -0.004361000843346119 -0.0031179466750472784 -0.0018640875350683928 -0.0006040494772605598; -0.009379785507917404 -0.008117863908410072 -0.006879289634525776 -0.005639418959617615 -0.004373430740088224 -0.003122681984677911 -0.00188215053640306 -0.0006183477235026658; -0.009365030564367771 -0.008110756054520607 -0.006864497903734446 -0.0056404052302241325 -0.004382933955639601 -0.0031100825872272253 -0.0018890664214268327 -0.0006299064261838794; -0.009382461197674274 -0.008103438653051853 -0.0068726129829883575 -0.005656353197991848 -0.004374731797724962 -0.0031251830514520407 -0.0018995723221451044 -0.0006412654765881598; -0.00937140453606844 -0.008127064444124699 -0.0068529704585671425 -0.005619400646537542 -0.004366724286228418 -0.003114723600447178 -0.0019074518932029605 -0.0006356702069751918; -0.009399169124662876 -0.008107496425509453 -0.006878129672259092 -0.005623759236186743 -0.0043860990554094315 -0.003143532667309046 -0.001888998318463564 -0.0006334094796329737; -0.009393404237926006 -0.008125228807330132 -0.006884747184813023 -0.005613001529127359 -0.0043914346024394035 -0.0031392083037644625 -0.0018763641128316522 -0.0006417877739295363; -0.009400217793881893 -0.008118640631437302 -0.006885368376970291 -0.005619086790829897 -0.004418071825057268 -0.003105469513684511 -0.0018724288092926145 -0.0006282468675635755; -0.009357218630611897 -0.00814490020275116 -0.006864367984235287 -0.005634229630231857 -0.004370181821286678 -0.00314635643735528 -0.001871215645223856 -0.0006172612775117159; -0.009391010738909245 -0.008138836361467838 -0.006871352903544903 -0.0056358929723501205 -0.0043710265308618546 -0.0031393717508763075 -0.001875559682957828 -0.0006345043075270951; -0.009370863437652588 -0.008102800697088242 -0.006849796511232853 -0.0056091370061039925 -0.004381931386888027 -0.003138819243758917 -0.0019056720193475485 -0.0006119147292338312; -0.00936651136726141 -0.008117933757603168 -0.0068666585721075535 -0.0056528812274336815 -0.004380777478218079 -0.0031122041400521994 -0.0018667816184461117 -0.0006325692520476878; -0.009370241314172745 -0.00812083762139082 -0.006868493743240833 -0.005622739437967539 -0.0043697780929505825 -0.003142173867672682 -0.0018571603577584028 -0.0006204945966601372; -0.0093669593334198 -0.00814197026193142 -0.006863087881356478 -0.005620238371193409 -0.00438467413187027 -0.0031124309170991182 -0.0018868097104132175 -0.0006258938228711486; -0.00938486773520708 -0.008118837140500546 -0.006877949461340904 -0.005639987997710705 -0.004357762169092894 -0.0031164302490651608 -0.0018815241055563092 -0.0006283061229623854; -0.009352857246994972 -0.008124349638819695 -0.006882044952362776 -0.005607804283499718 -0.004378041252493858 -0.0031252342741936445 -0.0018726447597146034 -0.0006262456299737096; -0.00939734373241663 -0.00812753476202488 -0.006886553019285202 -0.00560072110965848 -0.004385866690427065 -0.003098035929724574 -0.0018974015256389976 -0.0006307440926320851; -0.009359341114759445 -0.008102312684059143 -0.006855453364551067 -0.005604095291346312 -0.004376942291855812 -0.003147910116240382 -0.001900410745292902 -0.0006276026251725852; -0.009379795752465725 -0.008124632760882378 -0.006840648595243692 -0.0056327637284994125 -0.004365344066172838 -0.0031082669738680124 -0.001867984072305262 -0.0006440586876124144; -0.009350652806460857 -0.00814213789999485 -0.006890320684760809 -0.005609928630292416 -0.004388435743749142 -0.0031238349620252848 -0.0018719747895374894 -0.0006278447690419853; -0.009406860917806625 -0.008119800128042698 -0.006888529285788536 -0.005630387458950281 -0.004346941132098436 -0.003125492949038744 -0.0018650118727236986 -0.0006364142755046487; -0.009399833157658577 -0.00813585426658392 -0.00687990291044116 -0.0056125689297914505 -0.004350045695900917 -0.0031217148061841726 -0.0018861379940062761 -0.0006530610262416303; -0.007487211376428604 -0.006264465395361185 -0.004974293522536755 -0.003745344467461109 -0.0024949845392256975 -0.0012418986298143864 -4.114024250156945e-6 0.0012526862556114793; -0.005414820741862059 -0.00414674635976553 -0.002910483395680785 -0.0016758717829361558 -0.0004275319224689156 0.0008441988611593843 0.0020790984854102135 0.003318940754979849; -0.0033256046008318663 -0.002079476835206151 -0.0008297782624140382 0.00041008531115949154 0.001683607348240912 0.0029077366925776005 0.004120821598917246 0.005410599987953901; -0.0012617952888831496 -2.2611124222748913e-5 0.0012557364534586668 0.002503509633243084 0.003736474784091115 0.0049789706245064735 0.006269419565796852 0.0074945781379938126; 0.000634682597592473 0.001898421673104167 0.0031137375626713037 0.004360143560916185 0.00564174260944128 0.00686849607154727 0.008118875324726105 0.009385921992361546; 0.0006010046345181763 0.001882087206467986 0.0031213758047670126 0.00436368677765131 0.005609218496829271 0.006860060151666403 0.008126527070999146 0.009365934878587723; 0.0006187725230120122 0.0018866222817450762 0.0031056595034897327 0.004388409201055765 0.0056411805562675 0.006885225418955088 0.00810281652957201 0.009331653825938702; 0.0006181690259836614 0.0018727665301412344 0.0031347661279141903 0.00434828782454133 0.0056257424876093864 0.006885661743581295 0.008135734125971794 0.009389027021825314; 0.0006466893828473985 0.0018653852166607976 0.003109764074906707 0.0043736407533288 0.005619384814053774 0.006844589952379465 0.00813131220638752 0.009387936443090439; 0.0006201505893841386 0.0018852601060643792 0.003136507933959365 0.004389239940792322 0.005620571319013834 0.0068745422177016735 0.0081459516659379 0.009383277036249638; 0.000649373687338084 0.0018738934304565191 0.0031181129161268473 0.004369070287793875 0.005638126749545336 0.006850996054708958 0.008128399960696697 0.009351231157779694; 0.0006392564391717315 0.0018855378730222583 0.003119076369330287 0.004413013346493244 0.005629449617117643 0.0068749925121665 0.008124449290335178 0.00938369520008564; 0.0006179174524731934 0.0018684500828385353 0.003104010596871376 0.0043830168433487415 0.005634486209601164 0.006845957133919001 0.008095461875200272 0.009373912587761879; 0.0006321651162579656 0.0018778055673465133 0.0031283397693187 0.004360785707831383 0.0056267692707479 0.006881512701511383 0.00809941254556179 0.009392905980348587; 0.0006242128438316286 0.0018749600276350975 0.003139588749036193 0.004379272926598787 0.005612294189631939 0.006872815545648336 0.008119119331240654 0.009353754110634327; 0.0006510863313451409 0.0018514468101784587 0.003132751677185297 0.004369907081127167 0.005612919107079506 0.006877797655761242 0.008133950643241405 0.009338734671473503; 0.0006330077303573489 0.0018773116171360016 0.0031392488162964582 0.004376558121293783 0.005632254295051098 0.006854262202978134 0.008099088445305824 0.009384947828948498; 0.0006205735844559968 0.0018719128565862775 0.003126824740320444 0.004384317900985479 0.005618271883577108 0.006862705107778311 0.008135074749588966 0.009373143315315247; 0.0005992403603158891 0.0018845413578674197 0.003112607868388295 0.004369131289422512 0.00562193151563406 0.0068928031250834465 0.008121195249259472 0.009389749728143215; 0.0006307671428658068 0.001883596763946116 0.0031455308198928833 0.004387569613754749 0.0056270998902618885 0.006858014967292547 0.008101098239421844 0.009370734915137291; 0.0006008277414366603 0.0018525824416428804 0.003120595822110772 0.00439454847946763 0.005609808024019003 0.006850981153547764 0.008164117112755775 0.009357107803225517; 0.0006293551414273679 0.0018983341287821531 0.003144201822578907 0.004382672719657421 0.005651715211570263 0.0068574100732803345 0.0081368712708354 0.009383694268763065; 0.0006363987340591848 0.0018697689520195127 0.003146037459373474 0.004379423800855875 0.005627337843179703 0.006889988202601671 0.008106314577162266 0.009387165307998657; 0.0005995727842673659 0.001893951091915369 0.0031159361824393272 0.004365233238786459 0.005620566196739674 0.006864048540592194 0.008125266060233116 0.009328065440058708; 0.0006486873026005924 0.0018707807175815105 0.0031349475029855967 0.0043740300461649895 0.005630389787256718 0.006856649648398161 0.00810910016298294 0.009378901682794094; 0.0006033182144165039 0.0018655556486919522 0.0031152055598795414 0.004347173031419516 0.005616144742816687 0.006877817213535309 0.008137518540024757 0.009363099932670593])
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.