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] = JLD2OutputWriter(model, (; b, ζ);
filename = filename * "_$(side)_slice",
schedule = TimeInterval(save_fields_interval),
overwrite_existing = true,
indices)
end
simulation.output_writers[:zonal] = JLD2OutputWriter(model, (; b=B, u=U, v=V);
filename = filename * "_zonal_average",
schedule = TimeInterval(save_fields_interval),
overwrite_existing = true)
JLD2OutputWriter scheduled on TimeInterval(12 hours):
├── filepath: baroclinic_adjustment_zonal_average.jld2
├── 3 outputs: (b, u, v)
├── array type: Array{Float64}
├── 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: 25.806 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (23.939 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (17.666 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 39.481 seconds, max(u): (1.282e-01, 1.182e-01, 1.649e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 5.506 seconds, max(u): (2.260e-01, 1.769e-01, 1.840e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 5.237 seconds, max(u): (3.066e-01, 2.564e-01, 1.837e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 5.197 seconds, max(u): (3.787e-01, 3.497e-01, 1.811e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 5.688 seconds, max(u): (4.742e-01, 4.952e-01, 2.082e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 5.318 seconds, max(u): (6.028e-01, 8.164e-01, 2.883e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 5.098 seconds, max(u): (8.933e-01, 1.024e+00, 3.255e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 5.488 seconds, max(u): (1.165e+00, 1.141e+00, 4.695e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 6.146 seconds, max(u): (1.365e+00, 1.136e+00, 4.896e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 5.458 seconds, max(u): (1.363e+00, 1.150e+00, 4.052e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 5.874 seconds, max(u): (1.410e+00, 1.249e+00, 3.120e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 5.812 seconds, max(u): (1.464e+00, 1.412e+00, 3.765e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 5.196 seconds, max(u): (1.398e+00, 1.102e+00, 2.955e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 5.740 seconds, max(u): (1.398e+00, 1.209e+00, 3.033e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 2.073 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 2.074 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.009395759459353177 -0.008125202140490683 -0.006870641679616422 -0.005613862552654408 -0.004398432094853894 -0.003123645985172793 -0.0018584006751494896 -0.0006289998651519728; -0.00933307259979311 -0.008114576372604048 -0.0069001022193930645 -0.005616301117959413 -0.00439265617050754 -0.0031248849765979215 -0.0018613415411181517 -0.0006056070247142538; -0.009368659690328083 -0.00810899331418311 -0.006850897927232989 -0.0056336492607274415 -0.004364988140825061 -0.0031339255793092504 -0.0018607191736033297 -0.0006184220894683245; -0.00937607507029529 -0.008154505726508202 -0.006871084927669937 -0.005643546815429515 -0.00439630534175471 -0.0031135998689307953 -0.0018780694187907343 -0.0006041717992224612; -0.009392218974077184 -0.00814394473538193 -0.006877309505630089 -0.005614930818989616 -0.004381504757414098 -0.0031553053913275443 -0.0018907214355250587 -0.0006151408928453864; -0.009369444203076812 -0.008112976695398495 -0.0068961463428241 -0.0056556550560444485 -0.004376135632153518 -0.0031130548601428624 -0.0018865433525360432 -0.0006247888288983495; -0.009388470329857936 -0.008115756379401639 -0.006893944371065635 -0.005600579800157761 -0.004372209022075119 -0.003127137196922867 -0.001851980901818855 -0.0006305847710664268; -0.009359288479734199 -0.00812597278439463 -0.006878359599129055 -0.005612606918676853 -0.004390044849076878 -0.0031248167089992364 -0.0018905822134002357 -0.0006205453880681766; -0.009366028674881016 -0.008111669289093418 -0.006875301400591839 -0.005613654185831071 -0.004379816660038066 -0.0031304479072342384 -0.0018710036927242063 -0.0006276519315462039; -0.009400966262367279 -0.008129197859962172 -0.006884598350681744 -0.0056405467499206115 -0.004361572863081034 -0.0031192849647918193 -0.0019090307957518044 -0.0006259141418412142; -0.009364659127460947 -0.008125175175626553 -0.006884487286917186 -0.005645023922703917 -0.004358487007563145 -0.0031248036872609333 -0.0018823945563434038 -0.0006456733418388939; -0.009411031554657452 -0.008075297621826209 -0.006886106112809491 -0.005628295325744014 -0.004360863083284135 -0.003111608816664769 -0.001863457941619725 -0.0006211508071070899; -0.009383861769217622 -0.008101052586691204 -0.006846057377302449 -0.005607590272661985 -0.004357634917316407 -0.00312017916767578 -0.0018645667101502789 -0.0006077631366717802; -0.00936940101690603 -0.008124832286873846 -0.0068739221991975805 -0.005646340464148448 -0.004379415637183799 -0.003110730273468298 -0.0018821167141679683 -0.0006228998692320841; -0.00938972849301382 -0.00812309354875024 -0.006877692714612932 -0.005598570070210282 -0.004340718866921279 -0.003135910160123189 -0.0018933037167028993 -0.0006033108320001619; -0.009381679226675 -0.008148639124854943 -0.006880025661650499 -0.005626295152392008 -0.004374043109884717 -0.003108185197546054 -0.0018709894417011368 -0.0006532177451469798; -0.009373012467698857 -0.008123584248700884 -0.006862238084333556 -0.005607140045788816 -0.004357400964710004 -0.003117060751294816 -0.0018678774163229893 -0.0006262726081566217; -0.00939362558005995 -0.008135691017451225 -0.006864155651319597 -0.005614529172917709 -0.004367572435257718 -0.0031132471201001702 -0.001844286125740683 -0.0006282052984321825; -0.009370604306702309 -0.008117265881370331 -0.006878632756576665 -0.0056444296977011975 -0.004367359192315797 -0.0031293797215194486 -0.0018672431650515033 -0.0006102685892261955; -0.009380362954369968 -0.008136185447284386 -0.0068850664236930125 -0.005625850731659947 -0.004374075227299946 -0.0031180410879555714 -0.0018640581047541331 -0.0006381660875415907; -0.009379354621757435 -0.008137449414167053 -0.0068897080259549826 -0.005634506513558815 -0.0043632642498946704 -0.0031092143726225625 -0.0018769604117661175 -0.0006558390237115505; -0.009349483874882433 -0.008127814171752519 -0.00689428535945287 -0.005651689217609698 -0.004380528659697854 -0.003138096799085601 -0.0018718930422296496 -0.0006138554173131099; -0.007509886281011482 -0.006258944618906439 -0.004999860318897944 -0.0037461137321917032 -0.0024907166008923723 -0.0012587492675442547 1.589821945963254e-5 0.0012412055148365222; -0.005424111816296671 -0.004163878236380299 -0.0029322355682671213 -0.0016721575012640245 -0.0004136087220783416 0.0008264582113195182 0.0020909041458471935 0.0033383415237571296; -0.003338725413959897 -0.002106628329343521 -0.0008361007978240897 0.0004301425943564971 0.0016427325851931587 0.002926082538334472 0.004154191905886096 0.005428120181375146; -0.0012551326553139261 -9.140751766011744e-6 0.0012455273468717151 0.0024896103590543906 0.0037392512053355787 0.005014233656440701 0.006240873664428822 0.007503622589550258; 0.0006208390172605712 0.0019019284116941887 0.0031297232258589527 0.004392119265939627 0.005633041246937307 0.006862424482029096 0.008147936891674852 0.00935504199898165; 0.0006355887748762588 0.0018631139698954918 0.003123822768667311 0.0043578896438682116 0.005618504700168628 0.006872660100621648 0.008102938456283336 0.009373527547837946; 0.0006098327233820046 0.0018841238766041906 0.0031228672383803225 0.0043812608877995705 0.005620341368715232 0.0068613219407677685 0.008126775772229373 0.00937354133571675; 0.0006418803963474921 0.0018632432337246999 0.003125652177276213 0.004383853266313027 0.005634416961148113 0.0068925578902712245 0.008121723289803371 0.009358442105701447; 0.0006278757848358064 0.0018877883660061879 0.0031422286479278437 0.004375194248441726 0.005642833092492888 0.006898386081267911 0.008122394793030759 0.009397065835490851; 0.0005972799588663586 0.0018649694200056435 0.0031044701262082307 0.004376791172946382 0.005620232978733898 0.006868962048093737 0.008143139229199745 0.009375842927657802; 0.0005975635870130027 0.0018738606713165002 0.0031392827907109912 0.004381763266687574 0.005628625914344948 0.006868802530585554 0.008113248471198502 0.009346906972706676; 0.0005970930560604287 0.0018794659851092907 0.0030979861123124433 0.004351138775189438 0.00561918889047341 0.00690298955580271 0.008115143704572137 0.009376485551386622; 0.0006338610220121289 0.0019017732149988096 0.0031306577558173447 0.004356053435490537 0.005605705289269159 0.006876402760326056 0.008108362098555935 0.009374169452917141; 0.0006259457489003829 0.001844910184856745 0.003130557381863954 0.0043808512823459945 0.005611744854533858 0.006898424760118905 0.008123733666113749 0.009376927681740699; 0.0006234985624633229 0.001853080662909087 0.0031600496535824727 0.0043731114192030055 0.005591216776256641 0.006865406691930659 0.0081323946045133 0.00935030514268354; 0.0006402144126919281 0.0018936448117422879 0.0031532989156778605 0.00439113937020362 0.005616092245183657 0.006860468246674203 0.00812963210555776 0.009384575334307607; 0.0006125103482685501 0.0018679268003652918 0.003137613910898777 0.004377557239617472 0.005659569330833485 0.0068737624337787745 0.008124632561262066 0.009388204559284597; 0.0006288689446503826 0.00189077943209505 0.003143146156347335 0.004381669266333681 0.005634848769489567 0.0068823579568437114 0.008135506145437251 0.00938222788830644; 0.00063213804231674 0.001863619328281202 0.0031458495737141864 0.0043719168342029446 0.005630876468556097 0.006868721471852458 0.008131572629385946 0.009368549239356268; 0.0006185082230448568 0.0018708170154606116 0.0031182099969240084 0.004359961986002439 0.005634761583080809 0.006900166030780536 0.008092658823512604 0.009389581605574956; 0.0006105843602072894 0.0018679352496280808 0.003128183056773379 0.004393005834338635 0.005626434658190511 0.006860185274053098 0.008112421524780733 0.009375695947067128; 0.000600928200924051 0.001893153319460773 0.0031475635589451587 0.0043797218824715755 0.005607371736552195 0.006870814108004361 0.00810593737810196 0.009378809284350342; 0.0006284767486858502 0.0018665346765471859 0.0031146084479937095 0.004380215563102404 0.005619353785011286 0.006850936941923986 0.0081237465181083 0.009353595109277697; 0.000637965108656254 0.0018637597419661944 0.0031140523298955566 0.004369977689553838 0.005633596752937654 0.006883314292427729 0.008099581185510626 0.009378866660120019; 0.0006177471173981088 0.001858005488083506 0.0031412395264417323 0.004389954952533044 0.005616958288100202 0.006887321050899471 0.008138152274742313 0.009347504782146009; 0.0006124657508064735 0.0018909998340438875 0.003137288676801493 0.00439866852027587 0.005618391440842423 0.006876571647743068 0.00812331515444378 0.009394172324281516])
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.