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(order=5)
│ └── b: WENO(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
# 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 => 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 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: 31.882 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (29.118 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (21.405 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 43.719 seconds, max(u): (1.289e-01, 1.177e-01, 1.507e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 894.041 ms, max(u): (2.185e-01, 1.756e-01, 1.861e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 739.654 ms, max(u): (2.878e-01, 2.527e-01, 1.810e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 768.375 ms, max(u): (3.505e-01, 3.489e-01, 1.857e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 701.001 ms, max(u): (4.387e-01, 4.596e-01, 2.022e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 764.945 ms, max(u): (5.269e-01, 7.534e-01, 3.107e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 777.825 ms, max(u): (7.815e-01, 1.146e+00, 3.811e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 743.186 ms, max(u): (1.201e+00, 1.147e+00, 4.626e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 736.028 ms, max(u): (1.399e+00, 1.163e+00, 4.527e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 846.869 ms, max(u): (1.308e+00, 1.030e+00, 4.655e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 893.007 ms, max(u): (1.280e+00, 1.155e+00, 3.278e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 787.687 ms, max(u): (1.324e+00, 1.132e+00, 2.516e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 727.955 ms, max(u): (1.226e+00, 1.104e+00, 2.372e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 687.879 ms, max(u): (1.327e+00, 1.051e+00, 3.345e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.089 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.089 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
49-element Vector{Float64}:
-500.0
-479.1666666666667
-458.3333333333333
-437.5
-416.6666666666667
-395.8333333333333
-375.0
-354.1666666666667
-333.3333333333333
-312.5
-291.6666666666667
-270.8333333333333
-250.0
-229.16666666666666
-208.33333333333334
-187.5
-166.66666666666666
-145.83333333333334
-125.0
-104.16666666666667
-83.33333333333333
-62.5
-41.666666666666664
-20.833333333333332
0.0
20.833333333333332
41.666666666666664
62.5
83.33333333333333
104.16666666666667
125.0
145.83333333333334
166.66666666666666
187.5
208.33333333333334
229.16666666666666
250.0
270.8333333333333
291.6666666666667
312.5
333.3333333333333
354.1666666666667
375.0
395.8333333333333
416.6666666666667
437.5
458.3333333333333
479.1666666666667
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!
.
set_theme!(Theme(fontsize=24))
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.009385366924107075 -0.008100971579551697 -0.006885474547743797 -0.005625618621706963 -0.0043761893175542355 -0.0030991097446531057 -0.0018774864729493856 -0.0006407762411981821; -0.009344931691884995 -0.008142142556607723 -0.0068761506117880344 -0.005608473438769579 -0.0043857465498149395 -0.003128403564915061 -0.0018786867149174213 -0.0006273219478316605; -0.009364397265017033 -0.00812709890305996 -0.00686977244913578 -0.005615540314465761 -0.00437503308057785 -0.0031293893698602915 -0.0018797467928379774 -0.0006387889734469354; -0.009369449689984322 -0.008125881664454937 -0.006855391897261143 -0.005625517573207617 -0.00434860261157155 -0.0031268340535461903 -0.001871454413048923 -0.0006033517420291901; -0.009367816150188446 -0.00812776479870081 -0.0068666511215269566 -0.005638842470943928 -0.0043796212412416935 -0.003117845393717289 -0.0019125796388834715 -0.0006297141662798822; -0.009378460235893726 -0.008141838945448399 -0.006857754662632942 -0.00562110124155879 -0.0043584685772657394 -0.003120200475677848 -0.0018596069421619177 -0.0006147201638668776; -0.009352624416351318 -0.008125939406454563 -0.006874402053654194 -0.005623531062155962 -0.0043777707032859325 -0.0031214917544275522 -0.0018612692365422845 -0.0006262095994316041; -0.009382381103932858 -0.008108995854854584 -0.0068611763417720795 -0.0056331404484808445 -0.004366147331893444 -0.0031189972069114447 -0.0018365347059443593 -0.000648815359454602; -0.009399207308888435 -0.00813909713178873 -0.006869456265121698 -0.005635290406644344 -0.004330925643444061 -0.0031182102393358946 -0.0018651618156582117 -0.0006265845731832087; -0.009398209862411022 -0.008164392784237862 -0.006862794514745474 -0.005627775564789772 -0.0043644108809530735 -0.0031336573883891106 -0.0018690916476771235 -0.0006250204751268029; -0.00938409473747015 -0.008122088387608528 -0.0068623279221355915 -0.005632871296256781 -0.004403391852974892 -0.0031054054852575064 -0.001868249149993062 -0.0006372895441018045; -0.00937266368418932 -0.008146706037223339 -0.006896148901432753 -0.005637187045067549 -0.0043976749293506145 -0.003142277244478464 -0.0018609849503263831 -0.0006388199981302023; -0.009361726231873035 -0.008127444423735142 -0.0068759918212890625 -0.005614240653812885 -0.00438698148354888 -0.0031106099486351013 -0.001873496570624411 -0.0006063972832635045; -0.009379451163113117 -0.008120488375425339 -0.006889255717396736 -0.005612414795905352 -0.004383315332233906 -0.0031163902021944523 -0.0018714149482548237 -0.0006296100909821689; -0.009349625557661057 -0.008127488195896149 -0.006851933430880308 -0.005609811749309301 -0.004378777928650379 -0.0031102055218070745 -0.001848361804150045 -0.0006484222831204534; -0.009344179183244705 -0.00811429787427187 -0.006891991477459669 -0.0056157344952225685 -0.0043872962705791 -0.003138934029266238 -0.0018584694480523467 -0.0006212706211954355; -0.009362917393445969 -0.008146627806127071 -0.006889060605317354 -0.005599252413958311 -0.004379805643111467 -0.0031242079567164183 -0.0018805089639499784 -0.0006135867442935705; -0.009377285838127136 -0.008122636005282402 -0.0068554044701159 -0.005614961963146925 -0.004379121121019125 -0.0031390730291604996 -0.0018867654725909233 -0.0006273057078942657; -0.009384321048855782 -0.008147316053509712 -0.006863498594611883 -0.005627908743917942 -0.004371452610939741 -0.0031471094116568565 -0.0018743295222520828 -0.0006272320169955492; -0.009406794793903828 -0.00812713336199522 -0.006899156142026186 -0.005658293142914772 -0.0043787360191345215 -0.003128977958112955 -0.0018687477568164468 -0.0006404082523658872; -0.009373386390507221 -0.008116108365356922 -0.0068655237555503845 -0.005615563597530127 -0.0043905992060899734 -0.0031470234971493483 -0.0018703335663303733 -0.0006501590250991285; -0.009373126551508904 -0.008113386109471321 -0.006878716871142387 -0.0056328121572732925 -0.00437920680269599 -0.0031330822966992855 -0.0018911990337073803 -0.0006343284039758146; -0.007514731492847204 -0.006240494549274445 -0.004996231757104397 -0.003759789513424039 -0.002504844916984439 -0.001237977296113968 9.761624824022874e-6 0.001245063729584217; -0.005383678711950779 -0.004158716648817062 -0.002904706634581089 -0.001663182396441698 -0.00040362594882026315 0.0008210371597670019 0.002093769144266844 0.0033324139658361673; -0.003354324260726571 -0.0020792740397155285 -0.0008112492505460978 0.00043478087172843516 0.001685981173068285 0.0029390996787697077 0.004135736729949713 0.00539436237886548; -0.0012329976307228208 -9.442326700082049e-6 0.0012466578045859933 0.002518163528293371 0.00375567190349102 0.005003626924008131 0.006244117394089699 0.007492004428058863; 0.0006181927165016532 0.0018765393178910017 0.0031177697237581015 0.004370281007140875 0.00561349093914032 0.00686912564560771 0.008101269602775574 0.009384202770888805; 0.0006157614407129586 0.0018497168784961104 0.0031356913968920708 0.00436009094119072 0.00563463568687439 0.006907436065375805 0.008131593465805054 0.009370334446430206; 0.000620961538515985 0.001891391584649682 0.003132888348773122 0.004358883947134018 0.005618834402412176 0.006880082655698061 0.008124537765979767 0.009395090863108635; 0.0005801953957416117 0.0018779957899823785 0.0031280291732400656 0.004364526830613613 0.005622548051178455 0.006882658693939447 0.00810085330158472 0.009377367794513702; 0.0006078576552681625 0.0018744640983641148 0.003147729439660907 0.004379500634968281 0.005599283613264561 0.006879300810396671 0.00813143141567707 0.009367818012833595; 0.0006234610918909311 0.001884118071757257 0.0031111398711800575 0.004390550311654806 0.005616501439362764 0.006864151917397976 0.00809865165501833 0.009361576288938522; 0.0006206334801390767 0.001893359120003879 0.00312847294844687 0.0043747927993535995 0.005625654011964798 0.006847192998975515 0.008134013041853905 0.009365161880850792; 0.0006251308368518949 0.0018641265342012048 0.0031178349163383245 0.004406983032822609 0.005623858422040939 0.006872696336358786 0.008153635077178478 0.009374325163662434; 0.0006376158562488854 0.001853586407378316 0.003130226396024227 0.004356828983873129 0.005617877468466759 0.00685236556455493 0.008140431717038155 0.009364721365272999; 0.0006360224215313792 0.001880207913927734 0.0031045011710375547 0.004359576851129532 0.0056318556889891624 0.006862749811261892 0.008119890466332436 0.009358255192637444; 0.0006170277483761311 0.0018656606553122401 0.0031333237420767546 0.004359613172709942 0.005628671031445265 0.006866110488772392 0.008094803430140018 0.009382674470543861; 0.0006206886610016227 0.001863981131464243 0.0031267476733773947 0.004360901657491922 0.005635647568851709 0.006892525590956211 0.00811520591378212 0.009381994605064392; 0.0005979582783766091 0.001844589482061565 0.0031227630097419024 0.004387642256915569 0.005634082015603781 0.006882028188556433 0.008125117979943752 0.009393662214279175; 0.0006315415375865996 0.0018884656019508839 0.003123895265161991 0.004359045065939426 0.005619757808744907 0.006896461360156536 0.008131521753966808 0.009353219531476498; 0.000635566539131105 0.0018949409713968635 0.0031276564113795757 0.004365844186395407 0.005631070118397474 0.006879040040075779 0.008105202578008175 0.009386295452713966; 0.0006272146129049361 0.0018842285498976707 0.003141899360343814 0.0043741571716964245 0.005627708043903112 0.006871147081255913 0.008110951632261276 0.009362277574837208; 0.0006145911174826324 0.0018788628512993455 0.0031550470739603043 0.0043893433175981045 0.005621433258056641 0.006865737959742546 0.008136823773384094 0.009366355836391449; 0.0006299744127318263 0.001910424092784524 0.0031325886957347393 0.0043607973493635654 0.005592562258243561 0.006892784498631954 0.008098771795630455 0.009361238218843937; 0.0006201075157150626 0.0018840571865439415 0.003107564290985465 0.00436587817966938 0.005623831879347563 0.006906998343765736 0.008144383318722248 0.009341955184936523; 0.0006397924153134227 0.0018812877824530005 0.003112948499619961 0.004358401522040367 0.0056196278892457485 0.006882762536406517 0.008094393648207188 0.009360001422464848; 0.0006443882593885064 0.0018625707598403096 0.0031066706869751215 0.004370145499706268 0.005641584750264883 0.006866232492029667 0.008140893653035164 0.00938873179256916; 0.0006261817179620266 0.0018883878365159035 0.00313373189419508 0.004368223715573549 0.005615489557385445 0.006866921670734882 0.00811693910509348 0.009358186274766922])
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.