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: 29.275 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (27.069 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (19.288 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 39.786 seconds, max(u): (1.288e-01, 1.195e-01, 1.589e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 752.128 ms, max(u): (2.278e-01, 2.020e-01, 1.857e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 765.071 ms, max(u): (3.451e-01, 2.944e-01, 1.837e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 597.244 ms, max(u): (3.860e-01, 3.699e-01, 2.146e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 590.661 ms, max(u): (4.951e-01, 5.761e-01, 2.083e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 661.785 ms, max(u): (7.051e-01, 8.678e-01, 2.678e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 599.276 ms, max(u): (1.160e+00, 1.100e+00, 3.706e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 589.409 ms, max(u): (1.432e+00, 1.211e+00, 4.703e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 599.933 ms, max(u): (1.364e+00, 1.104e+00, 4.066e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 604.610 ms, max(u): (1.478e+00, 1.053e+00, 4.908e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 637.609 ms, max(u): (1.449e+00, 1.045e+00, 3.646e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 662.133 ms, max(u): (1.173e+00, 1.101e+00, 2.514e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 748.259 ms, max(u): (1.170e+00, 1.175e+00, 2.804e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 615.506 ms, max(u): (1.371e+00, 1.227e+00, 2.526e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 59.159 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 59.191 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 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.009367897175252438 -0.00813909899443388 -0.006872377824038267 -0.005640301387757063 -0.004346881527453661 -0.0031231462489813566 -0.0018613600404933095 -0.0006180696655064821; -0.00937967374920845 -0.008123212493956089 -0.006838268134742975 -0.005622551776468754 -0.004367852117866278 -0.0031284845899790525 -0.0018768507288768888 -0.0006306819850578904; -0.009372130036354065 -0.008099272847175598 -0.0068784793838858604 -0.0056218779645860195 -0.0043729450553655624 -0.00313634448684752 -0.0018484703032299876 -0.0006507618818432093; -0.009377985261380672 -0.00813814252614975 -0.006877018604427576 -0.0056391567923128605 -0.004371684975922108 -0.003109977813437581 -0.0018736362690106034 -0.000625107204541564; -0.009374992921948433 -0.00813276693224907 -0.00689107459038496 -0.005616769660264254 -0.004389616660773754 -0.003132942831143737 -0.001856630784459412 -0.0006398131372407079; -0.009378218092024326 -0.008154572919011116 -0.0068803648464381695 -0.005628907587379217 -0.004383061546832323 -0.003122737631201744 -0.0018610204569995403 -0.0006302600959315896; -0.00940017681568861 -0.008113726042211056 -0.006879156455397606 -0.005646241828799248 -0.0043753101490437984 -0.003135161241516471 -0.001867018872871995 -0.0006190714193508029; -0.009380447678267956 -0.00812262948602438 -0.006882880814373493 -0.005615050904452801 -0.004394907969981432 -0.0031350674107670784 -0.0018772429320961237 -0.0006165193044580519; -0.009371201507747173 -0.00815035030245781 -0.006887654308229685 -0.005660979077219963 -0.0043727559968829155 -0.003116385545581579 -0.0018900841241702437 -0.0006173002766445279; -0.00937366858124733 -0.0081274239346385 -0.006874844431877136 -0.005630108993500471 -0.004356672987341881 -0.003114675637334585 -0.0018727072747424245 -0.0006360022816807032; -0.009377219714224339 -0.008129705674946308 -0.006879944354295731 -0.0056021311320364475 -0.004373644012957811 -0.0031239890959113836 -0.0018770528258755803 -0.0006391596980392933; -0.009402246214449406 -0.008126664906740189 -0.006889828015118837 -0.0056394655257463455 -0.004398588556796312 -0.003097717883065343 -0.0018551003886386752 -0.0006319935782812536; -0.0093635693192482 -0.008128244429826736 -0.006858752574771643 -0.005654337350279093 -0.004399511963129044 -0.003135736333206296 -0.0018735157791525126 -0.0006095115095376968; -0.009358158335089684 -0.00813781563192606 -0.00687870429828763 -0.005640540737658739 -0.0043467385694384575 -0.003102238057181239 -0.0018840257544070482 -0.0006144935032352805; -0.009359370917081833 -0.0081191286444664 -0.006896269042044878 -0.0056328852660954 -0.0043745520524680614 -0.0031102497596293688 -0.0018773037008941174 -0.000647696026135236; -0.009369093924760818 -0.008119771257042885 -0.0068897888995707035 -0.005627855192869902 -0.0043789418414235115 -0.003115949686616659 -0.0018787783337756991 -0.0006310289027169347; -0.009372229687869549 -0.008107149042189121 -0.006874571088701487 -0.005624568555504084 -0.0043890392407774925 -0.00314612896181643 -0.0018576356815174222 -0.0006241352530196309; -0.009384216740727425 -0.008107880130410194 -0.0068638320080935955 -0.005619054660201073 -0.004384511150419712 -0.0031303816940635443 -0.0018681040965020657 -0.0006025886395946145; -0.00941984262317419 -0.008138112723827362 -0.006879811175167561 -0.0056402538903057575 -0.004365067463368177 -0.003122043563053012 -0.0018772634211927652 -0.0006239385693334043; -0.009368392638862133 -0.008136858232319355 -0.006884818430989981 -0.005608099978417158 -0.00436245184391737 -0.0031211739405989647 -0.0018849076004698873 -0.0006398294935934246; -0.009396594949066639 -0.008095677010715008 -0.0068850950337946415 -0.00565608125180006 -0.004361769184470177 -0.003120362525805831 -0.0018870101775974035 -0.0006131930276751518; -0.00939007569104433 -0.008143488317728043 -0.00686262222006917 -0.005648356396704912 -0.004386249929666519 -0.0031589805148541927 -0.0018685862887650728 -0.0006163188954815269; -0.007483009714633226 -0.006258298177272081 -0.005027142819017172 -0.003772205440327525 -0.0024916529655456543 -0.001266748527996242 1.0881363778025843e-5 0.0012548405211418867; -0.005404293071478605 -0.004183188080787659 -0.002924795961007476 -0.0016786959022283554 -0.0004176758520770818 0.0008289137622341514 0.002098437398672104 0.0033375455532222986; -0.0033307268749922514 -0.00205042096786201 -0.000822564004920423 0.00040127552347257733 0.0016561722150072455 0.002903698943555355 0.004162593744695187 0.0054303305223584175; -0.0012468580389395356 1.0039630069513805e-6 0.0012538980226963758 0.0024891963694244623 0.0037525724619627 0.004994701128453016 0.0062737856060266495 0.007473589852452278; 0.0006469304789789021 0.001864010700955987 0.003130016615614295 0.004364616237580776 0.005622852127999067 0.006867407355457544 0.008133192546665668 0.009360123425722122; 0.0006257336935959756 0.001867746701464057 0.003106050891801715 0.0043603102676570415 0.005640673451125622 0.006880881264805794 0.008142120204865932 0.009365905076265335; 0.0006447876221500337 0.0018856535898521543 0.00313668348826468 0.004365024622529745 0.005657101050019264 0.006875602528452873 0.008133899420499802 0.009403404779732227; 0.0006197561742737889 0.0018674676539376378 0.003140059532597661 0.00438249297440052 0.005617752205580473 0.006867764983326197 0.008141123689711094 0.009360124357044697; 0.000604187254793942 0.0018840712727978826 0.0031068732496351004 0.004374019801616669 0.0056394911371171474 0.006882910616695881 0.00810366403311491 0.00937620084732771; 0.0006089985836297274 0.0018966819625347853 0.003146605333313346 0.004358712118119001 0.005633433349430561 0.006875517312437296 0.008116352371871471 0.009370574727654457; 0.000641966238617897 0.0018742791144177318 0.0031160900834947824 0.004364819265902042 0.00560756865888834 0.00686896126717329 0.00814610905945301 0.009373832494020462; 0.0006054927362129092 0.0018679184140637517 0.0031443859916180372 0.0043645561672747135 0.005637176334857941 0.006889439187943935 0.008110197260975838 0.00936732068657875; 0.0006238087080419064 0.0018792329356074333 0.003107758704572916 0.004374745301902294 0.005628910847008228 0.006876782048493624 0.008117711171507835 0.009342540055513382; 0.0006145709776319563 0.0018588713137432933 0.0031427224166691303 0.0043785544112324715 0.005621681455522776 0.006869042757898569 0.008123455569148064 0.009393148124217987; 0.000629922142252326 0.0018899011192843318 0.003135323990136385 0.004384237341582775 0.005611997563391924 0.006866921670734882 0.00812771450728178 0.009365221485495567; 0.000625920481979847 0.0018900780705735087 0.003115298692137003 0.004370887763798237 0.005604783538728952 0.00687754200771451 0.00809602439403534 0.009351806715130806; 0.0006134279537945986 0.001846753410063684 0.003107776865363121 0.004374309442937374 0.005624712910503149 0.006853847298771143 0.008126676082611084 0.009351593442261219; 0.0006417796248570085 0.0018723856192082167 0.0030992908868938684 0.004377694334834814 0.005629249382764101 0.006871939171105623 0.008131940849125385 0.009395458735525608; 0.0006118653691373765 0.0018852909561246634 0.0031118099577724934 0.0043873474933207035 0.005636051297187805 0.00689195841550827 0.008131412789225578 0.009377086535096169; 0.0006376035162247717 0.0018599324394017458 0.003102721180766821 0.004399364814162254 0.005612791981548071 0.006870623677968979 0.008114580996334553 0.009380686096847057; 0.0006158123142085969 0.0018750850576907396 0.0031293556094169617 0.004382328595966101 0.005628719925880432 0.0068618799559772015 0.00812878180295229 0.009375032968819141; 0.000615693221334368 0.001869112835265696 0.003112326143309474 0.004365712404251099 0.005628941114991903 0.006858857814222574 0.008116712793707848 0.009358997456729412; 0.0006062675383873284 0.001889210194349289 0.0031209459993988276 0.004383230581879616 0.005621587857604027 0.006896967068314552 0.008134615607559681 0.009370669722557068; 0.0006380305858328938 0.0018822143319994211 0.003130502998828888 0.00435604527592659 0.005641189869493246 0.006883346941322088 0.008126867935061455 0.009398505091667175; 0.0006117119919508696 0.0018818473909050226 0.0031297747045755386 0.004383053630590439 0.005644377786666155 0.006860740017145872 0.00814002938568592 0.009389972314238548; 0.0006371380295604467 0.00188443495426327 0.003107279073446989 0.004387818276882172 0.005623304285109043 0.006871961057186127 0.0081171290948987 0.00937518198043108])
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.