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: 45.717 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (45.227 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (31.408 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 1.093 minutes, max(u): (1.303e-01, 1.286e-01, 1.522e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 998.448 ms, max(u): (2.436e-01, 2.067e-01, 1.802e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.219 seconds, max(u): (3.087e-01, 3.015e-01, 1.904e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.003 seconds, max(u): (4.006e-01, 3.965e-01, 2.042e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 1.046 seconds, max(u): (4.758e-01, 5.544e-01, 1.994e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 954.111 ms, max(u): (6.039e-01, 7.342e-01, 2.977e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 1.118 seconds, max(u): (9.530e-01, 1.101e+00, 3.836e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.177 seconds, max(u): (1.288e+00, 1.172e+00, 4.703e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 1.034 seconds, max(u): (1.405e+00, 1.214e+00, 4.567e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 1.068 seconds, max(u): (1.319e+00, 1.107e+00, 3.714e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 1.078 seconds, max(u): (1.388e+00, 1.015e+00, 3.210e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 884.587 ms, max(u): (1.345e+00, 9.821e-01, 1.958e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 1.092 seconds, max(u): (1.303e+00, 1.025e+00, 3.419e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 769.483 ms, max(u): (1.245e+00, 1.084e+00, 3.547e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.621 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.622 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.00937410444021225 -0.008137446828186512 -0.006870511453598738 -0.005628376733511686 -0.004355653654783964 -0.0030885974410921335 -0.0018980822060257196 -0.0006377236568368971; -0.009361332282423973 -0.008123696781694889 -0.006860306952148676 -0.0056285853497684 -0.004346095025539398 -0.0031110055278986692 -0.0018577914452180266 -0.000612881442066282; -0.009386283345520496 -0.00812729261815548 -0.006878027692437172 -0.005629213061183691 -0.004357848782092333 -0.0031256608199328184 -0.001872679335065186 -0.0006300160312093794; -0.009359190240502357 -0.008108392357826233 -0.006855819374322891 -0.005638421047478914 -0.004366646520793438 -0.003096109488978982 -0.0018781386315822601 -0.0006437470437958837; -0.009362938813865185 -0.00812929030507803 -0.006873385515064001 -0.0056237708777189255 -0.004376779310405254 -0.0031250123865902424 -0.0018399315886199474 -0.0006268133874982595; -0.009376024827361107 -0.00812726654112339 -0.006865694187581539 -0.005594805348664522 -0.004373018629848957 -0.0031255343928933144 -0.0018670788267627358 -0.0006296622450463474; -0.009365813806653023 -0.008144870400428772 -0.006878587882965803 -0.005618425086140633 -0.004392408765852451 -0.003126417985185981 -0.0018946676282212138 -0.0006354250945150852; -0.009367191232740879 -0.0081210071220994 -0.006866151001304388 -0.005623848643153906 -0.004394954070448875 -0.003134562401100993 -0.0018871016800403595 -0.0005986233591102064; -0.00936965737491846 -0.008104088716208935 -0.006905026733875275 -0.005624367389827967 -0.0043858727440238 -0.003089267062023282 -0.0018884459277614951 -0.0006334566860459745; -0.009362684562802315 -0.00813253503292799 -0.00690104765817523 -0.005611363798379898 -0.004388932604342699 -0.0031242454424500465 -0.001873514149338007 -0.0006308680167421699; -0.009360989555716515 -0.008101758547127247 -0.006849123630672693 -0.0056199501268565655 -0.004399000201374292 -0.00314144603908062 -0.0018858809489756823 -0.00058048713253811; -0.00937851145863533 -0.008148999884724617 -0.006884465925395489 -0.005597943440079689 -0.004381563514471054 -0.003116756910458207 -0.001874348847195506 -0.0006348972674459219; -0.009367565624415874 -0.008133422583341599 -0.006869492586702108 -0.005620366428047419 -0.0043762014247477055 -0.003133291145786643 -0.0018779606325551867 -0.0006223294767551124; -0.009365394711494446 -0.008125429973006248 -0.006892657373100519 -0.005635684356093407 -0.004377903416752815 -0.0031240449752658606 -0.0018867648905143142 -0.0006213215528987348; -0.009398323483765125 -0.008134469389915466 -0.006865860428661108 -0.005620485637336969 -0.004369825124740601 -0.003136242739856243 -0.001872566295787692 -0.0006359525141306221; -0.009356257505714893 -0.008112470619380474 -0.006858773995190859 -0.005648992955684662 -0.004381050355732441 -0.0031219490338116884 -0.0018952104728668928 -0.0006292267935350537; -0.00939936377108097 -0.008135419338941574 -0.006877305917441845 -0.005617525894194841 -0.004363602958619595 -0.0031349174678325653 -0.0018663897644728422 -0.0006250691367313266; -0.009370274841785431 -0.008142896927893162 -0.00686550373211503 -0.0056140972301363945 -0.004389709793031216 -0.0031173403840512037 -0.0018762352410703897 -0.0006207522819750011; -0.009375454857945442 -0.008110716007649899 -0.006896807346493006 -0.005652697756886482 -0.004355147480964661 -0.0031399077270179987 -0.0018883553566411138 -0.0006129172397777438; -0.009388918988406658 -0.00811800453811884 -0.006873046979308128 -0.005601355340331793 -0.004365570843219757 -0.003125349758192897 -0.0018508417997509241 -0.0006055815028958023; -0.009365503676235676 -0.008128670044243336 -0.006878694519400597 -0.005618144292384386 -0.0043692318722605705 -0.0031195562332868576 -0.001863753655925393 -0.0006379263359121978; -0.009370408020913601 -0.00812042411416769 -0.006879918742924929 -0.005617780145257711 -0.004396609030663967 -0.0031196894124150276 -0.0018729213625192642 -0.0006176956812851131; -0.007501283660531044 -0.006236095912754536 -0.005000648554414511 -0.0037480886094272137 -0.002476087538525462 -0.0012652422301471233 8.97688096301863e-6 0.0012448118068277836; -0.005435545928776264 -0.004179847426712513 -0.002910410054028034 -0.0016797339776530862 -0.00038878683699294925 0.000820134999230504 0.002086453139781952 0.0033075353130698204; -0.0033496003597974777 -0.0020731461700052023 -0.0008427668362855911 0.0003995114821009338 0.0016562622040510178 0.0028957996983081102 0.004168091807514429 0.005398741457611322; -0.0012322785332798958 2.788966776279267e-5 0.0012533467961475253 0.002507528755813837 0.003729596734046936 0.0050031570717692375 0.006253776606172323 0.007474160753190517; 0.0006331863696686924 0.0018602105556055903 0.003128716954961419 0.004382733255624771 0.005644994787871838 0.006864731665700674 0.008135185576975346 0.009368467144668102; 0.0006572742131538689 0.0018752017058432102 0.0031088953837752342 0.004381231497973204 0.005622341763228178 0.006874393206089735 0.008126113563776016 0.0093601755797863; 0.0005993605591356754 0.0018516150303184986 0.003125491552054882 0.004371164366602898 0.0056203086860477924 0.006875425577163696 0.008135035634040833 0.009391424246132374; 0.0006053521065041423 0.0018632273422554135 0.0031441375613212585 0.004355518613010645 0.005630528088659048 0.0068768165074288845 0.008108831942081451 0.009376945905387402; 0.0006244562100619078 0.0018733030883595347 0.003108502132818103 0.004356975667178631 0.005608696956187487 0.006849334575235844 0.008143660612404346 0.009379222989082336; 0.0006326449802145362 0.00188663718290627 0.0031525595113635063 0.004395752213895321 0.005621293094009161 0.006875052582472563 0.00814603827893734 0.009368485771119595; 0.0006184136145748198 0.0018624687800183892 0.0031363079324364662 0.004398014862090349 0.005644847638905048 0.006836282555013895 0.00811805296689272 0.009365723468363285; 0.0006243367679417133 0.001887184684164822 0.0031439107842743397 0.004384441301226616 0.005616465583443642 0.006854506209492683 0.00811406783759594 0.009347004815936089; 0.0006019369466230273 0.001876877504400909 0.003136106301099062 0.004355781711637974 0.00563920708373189 0.00687286676838994 0.00812410656362772 0.009369120933115482; 0.0006401688442565501 0.0018599671311676502 0.003104942850768566 0.004383434541523457 0.005624286364763975 0.0068712313659489155 0.008148143999278545 0.00936400331556797; 0.0006245679687708616 0.0018746129935607314 0.0031225772108882666 0.004383306484669447 0.005630867090076208 0.006878096144646406 0.008107545785605907 0.009379587136209011; 0.0006347789894789457 0.0018898090347647667 0.003102196380496025 0.004353927448391914 0.005604403559118509 0.006897018291056156 0.008117437362670898 0.009354077279567719; 0.0006152419373393059 0.00187206850387156 0.003110057907178998 0.0043908897787332535 0.005618778057396412 0.006878001615405083 0.008140352554619312 0.009376630187034607; 0.0006111212424002588 0.0018579737516120076 0.003122717374935746 0.004376970697194338 0.005631453823298216 0.006896375212818384 0.008129159919917583 0.009374507702887058; 0.0006528290105052292 0.0018780778627842665 0.003128742566332221 0.004363151732832193 0.005660850089043379 0.006891544442623854 0.008103752508759499 0.009406537748873234; 0.0006098737358115613 0.001909904065541923 0.003110608085989952 0.004382710438221693 0.005612955894321203 0.0068727959878742695 0.008131923153996468 0.009381920099258423; 0.0006052230601198971 0.001896045170724392 0.0031331677455455065 0.004379892256110907 0.005639990791678429 0.0068653663620352745 0.00813722051680088 0.009414291940629482; 0.0006251659942790866 0.001867841463536024 0.003158144187182188 0.004396955017000437 0.005630762316286564 0.006882606539875269 0.008112973533570766 0.009360902942717075; 0.0006125483196228743 0.0018700077198445797 0.00312442216090858 0.004363256506621838 0.005622067488729954 0.006872340105473995 0.008131719194352627 0.009363619610667229; 0.0006265999982133508 0.001888040453195572 0.0031211564783006907 0.004384144209325314 0.005624520126730204 0.006876151077449322 0.008128275163471699 0.009363398887217045; 0.000631829840131104 0.0018955672858282924 0.003146020695567131 0.004383055027574301 0.005653429310768843 0.006883191876113415 0.008139004930853844 0.009359892457723618; 0.0006372132920660079 0.0018869698978960514 0.0031700092367827892 0.004362017381936312 0.005620683543384075 0.0068707154132425785 0.008129364810883999 0.009391561150550842])
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.