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: 37.482 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (31.868 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (18.812 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 43.281 seconds, max(u): (1.265e-01, 1.200e-01, 1.519e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 602.162 ms, max(u): (2.110e-01, 1.728e-01, 1.722e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 626.915 ms, max(u): (2.927e-01, 2.297e-01, 1.828e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 560.054 ms, max(u): (3.654e-01, 2.788e-01, 1.859e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 570.977 ms, max(u): (4.332e-01, 3.556e-01, 1.741e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 489.253 ms, max(u): (5.616e-01, 5.288e-01, 1.774e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 599.186 ms, max(u): (6.715e-01, 8.010e-01, 2.317e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 558.191 ms, max(u): (8.457e-01, 1.133e+00, 3.311e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 485.822 ms, max(u): (1.068e+00, 1.494e+00, 4.646e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 523.873 ms, max(u): (1.359e+00, 1.414e+00, 4.780e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 629.849 ms, max(u): (1.446e+00, 1.330e+00, 4.575e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 520.088 ms, max(u): (1.457e+00, 1.538e+00, 4.197e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 505.029 ms, max(u): (1.530e+00, 1.438e+00, 4.346e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 482.446 ms, max(u): (1.368e+00, 1.340e+00, 3.452e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.034 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.034 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.009396064095199108 -0.008128022775053978 -0.006899877917021513 -0.0056279366835951805 -0.004367631394416094 -0.0031300573609769344 -0.001885316101834178 -0.0006185163510963321; -0.009378359653055668 -0.00812554731965065 -0.006885076407343149 -0.005598502233624458 -0.004394738469272852 -0.003105625044554472 -0.0018552523106336594 -0.0006134114810265601; -0.009374141693115234 -0.008110037073493004 -0.006880635861307383 -0.005617028567939997 -0.004354689735919237 -0.0031339810229837894 -0.0018781980033963919 -0.0006275248597376049; -0.009358996525406837 -0.008111957460641861 -0.0068573434837162495 -0.005597221665084362 -0.00441479217261076 -0.0031295036897063255 -0.0018751627067103982 -0.0006466614431701601; -0.009379809722304344 -0.008113560266792774 -0.006882720626890659 -0.005623043980449438 -0.004390964284539223 -0.0031249653548002243 -0.0018916779663413763 -0.0006263465038500726; -0.009385539218783379 -0.008134022355079651 -0.0068993158638477325 -0.005619140807539225 -0.004391082096844912 -0.003118099644780159 -0.0018646309617906809 -0.0006194387096911669; -0.009388540871441364 -0.008126878179609776 -0.006875893566757441 -0.0056181359104812145 -0.004342980682849884 -0.0031006967183202505 -0.0018677476327866316 -0.000636701297480613; -0.009378195740282536 -0.008155171759426594 -0.0068832142278552055 -0.005611761473119259 -0.0043507046066224575 -0.0031314317602664232 -0.0018720438238233328 -0.0006062278989702463; -0.009371048770844936 -0.008139681071043015 -0.006863285321742296 -0.005634969100356102 -0.0043879179283976555 -0.0031263066921383142 -0.0018819617107510567 -0.0006259153014980257; -0.009386427700519562 -0.008140543475747108 -0.00687278900295496 -0.0056031993590295315 -0.004378690384328365 -0.003120447974652052 -0.0018742447718977928 -0.0006245335098356009; -0.009394255466759205 -0.008112606592476368 -0.006873466074466705 -0.005635794717818499 -0.0044040014035999775 -0.0031259285751730204 -0.0018820733530446887 -0.0006335099460557103; -0.009365552105009556 -0.008135085925459862 -0.00686392979696393 -0.005665382370352745 -0.004403871949762106 -0.0031013996340334415 -0.0018848150502890348 -0.0006217971094883978; -0.00935211218893528 -0.00811131950467825 -0.006874732207506895 -0.005620164796710014 -0.004373582545667887 -0.0031172693707048893 -0.0018494862597435713 -0.000661238213069737; -0.009369590319693089 -0.008117830380797386 -0.006875847466289997 -0.005617386195808649 -0.004383239429444075 -0.0031277695670723915 -0.001869312603957951 -0.0006160768680274487; -0.00934512447565794 -0.008120506070554256 -0.006887894589453936 -0.005616120062768459 -0.004410892724990845 -0.003107166849076748 -0.0018542010802775621 -0.0006106920773163438; -0.009395111352205276 -0.008116126991808414 -0.006892004515975714 -0.005609380081295967 -0.004396507516503334 -0.0031232822220772505 -0.001887973863631487 -0.0006254365434870124; -0.00936704222112894 -0.008142397738993168 -0.006876497995108366 -0.005636271089315414 -0.004371448419988155 -0.0031338268890976906 -0.0018858101684600115 -0.0006228071870282292; -0.009372695349156857 -0.008145096711814404 -0.006891288794577122 -0.005631698295474052 -0.004373540170490742 -0.0031385612674057484 -0.001863485318608582 -0.0006472706445492804; -0.009368940256536007 -0.008144058287143707 -0.006872753147035837 -0.0056493268348276615 -0.0043783667497336864 -0.003118752734735608 -0.0018606253433972597 -0.0005850839079357684; -0.009354004636406898 -0.008153442293405533 -0.00685966806486249 -0.005620822310447693 -0.004380634054541588 -0.003128361189737916 -0.0018706073751673102 -0.000624608772341162; -0.009382192976772785 -0.008133349008858204 -0.006884763948619366 -0.005632208194583654 -0.004350865259766579 -0.003129547694697976 -0.001869789557531476 -0.0006333880592137575; -0.009365997277200222 -0.008129809983074665 -0.006893386133015156 -0.005642496980726719 -0.004356872756034136 -0.0030995181296020746 -0.0018930579535663128 -0.0006126490188762546; -0.007513942662626505 -0.006247885525226593 -0.005005316808819771 -0.003732306184247136 -0.002489877864718437 -0.0012345729628577828 -1.9610353774623945e-5 0.0012409515911713243; -0.0054255020804703236 -0.0041689337231218815 -0.0029219472780823708 -0.0016971944132819772 -0.0003973757557105273 0.0008457794901914895 0.0020751790143549442 0.0033423216082155704; -0.0033516031689941883 -0.0020789990667253733 -0.0008389005670323968 0.0004345755442045629 0.0016644441056996584 0.002906976267695427 0.0041806395165622234 0.005413713864982128; -0.0012681422522291541 2.3479831725126132e-5 0.0012766921427100897 0.0025118719786405563 0.0037488762754946947 0.004980985540896654 0.006249838974326849 0.007524255197495222; 0.0006349037284962833 0.0018761279061436653 0.0030923611484467983 0.0043941643089056015 0.005613051820546389 0.006891758181154728 0.008145419880747795 0.009370310232043266; 0.0006346917944028974 0.0018689470598474145 0.0031210011802613735 0.004379511810839176 0.005631830543279648 0.006882459856569767 0.00812148954719305 0.009372596628963947; 0.0006531988619826734 0.0018540280871093273 0.003143155016005039 0.004371972288936377 0.005619246978312731 0.006876147352159023 0.00810480397194624 0.00936903152614832; 0.0006207312690094113 0.0018817808013409376 0.0030995486304163933 0.004365107975900173 0.0056374575942754745 0.006889896467328072 0.008127054199576378 0.009387117810547352; 0.0006145320949144661 0.0018898358102887869 0.003116423962637782 0.0043898774310946465 0.005645431112498045 0.006887547206133604 0.008123094215989113 0.009371074847877026; 0.0006331537733785808 0.0018891425570473075 0.0031373377423733473 0.0044025820679962635 0.005637115798890591 0.006856992375105619 0.008107511326670647 0.009377267211675644; 0.0006211063591763377 0.0018611752893775702 0.003129432210698724 0.004379813559353352 0.005642719101160765 0.006861453410238028 0.008132019080221653 0.009371686726808548; 0.0006077178404666483 0.001882819808088243 0.003142136847600341 0.0043632532469928265 0.005612804554402828 0.006889155134558678 0.008102208375930786 0.00940326415002346; 0.000624583219178021 0.0018606287194415927 0.0031046480871737003 0.004373698960989714 0.0056633842177689075 0.00684848939999938 0.00811344850808382 0.009375312365591526; 0.0006191838183440268 0.0018640304915606976 0.003123066620901227 0.004374171141535044 0.0056379809975624084 0.006870456971228123 0.008113604970276356 0.009368465282022953; 0.0006122596678324044 0.001869373838417232 0.0031042806804180145 0.004385446198284626 0.005627989303320646 0.006848029792308807 0.008121985010802746 0.009379233233630657; 0.000615556666161865 0.0018807739252224565 0.0031243737321347 0.004354874137789011 0.005605101119726896 0.006858532316982746 0.00811333954334259 0.009398258291184902; 0.0006097840960137546 0.001886385609395802 0.0031059065368026495 0.004365934990346432 0.005608874373137951 0.006874646991491318 0.008139656856656075 0.009374995715916157; 0.0006160088814795017 0.001890666550025344 0.003110141260549426 0.004374061245471239 0.0056185415014624596 0.006849762052297592 0.008139403536915779 0.009383262135088444; 0.0006288487347774208 0.001876479247584939 0.0031302538700401783 0.004343702457845211 0.0056289187632501125 0.006907617207616568 0.008125669322907925 0.009369099512696266; 0.00065020372858271 0.0018859137780964375 0.0031305858865380287 0.004355418495833874 0.005613774061203003 0.006868464406579733 0.008131420239806175 0.009365683421492577; 0.0006221638759598136 0.0018801916157826781 0.0031216905917972326 0.0043962374329566956 0.005607964005321264 0.006908730138093233 0.008135324344038963 0.009391587227582932; 0.0006047302740626037 0.0018801343394443393 0.003117810934782028 0.004387902561575174 0.005627332720905542 0.006894803140312433 0.00813750084489584 0.009342060424387455; 0.0006573044811375439 0.001844983547925949 0.003132238518446684 0.004383479710668325 0.00560706527903676 0.006858442444354296 0.008106883615255356 0.009382260031998158; 0.0006674382020719349 0.001862916979007423 0.003121411195024848 0.004377627279609442 0.005604598671197891 0.006872156634926796 0.008104030974209309 0.009374070912599564; 0.0005991806392557919 0.0018698356579989195 0.00312302028760314 0.004386106505990028 0.0056273844093084335 0.006881748326122761 0.00812600925564766 0.009375669062137604; 0.0006352910422720015 0.00187685526907444 0.0031565348617732525 0.004383763764053583 0.005636894144117832 0.006877539679408073 0.008128643967211246 0.009386429563164711])
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.