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.UnitsGrid
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.0Model
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⁻²]")
figSimulation
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
├── run_wall_time: 0 seconds
├── run_wall_time / 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 entriesWe 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.6 KiBNow 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: 28.783 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (9.143 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (4.204 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 11.985 seconds, max(u): (1.280e-01, 1.182e-01, 1.479e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 796.985 ms, max(u): (2.209e-01, 1.873e-01, 1.806e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 830.945 ms, max(u): (2.991e-01, 2.364e-01, 1.968e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 801.888 ms, max(u): (3.911e-01, 3.227e-01, 1.979e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 814.524 ms, max(u): (4.805e-01, 4.337e-01, 1.779e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 783.444 ms, max(u): (6.026e-01, 5.617e-01, 2.090e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 784.530 ms, max(u): (8.169e-01, 7.651e-01, 2.418e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 766.858 ms, max(u): (1.086e+00, 9.627e-01, 3.673e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 781.760 ms, max(u): (1.359e+00, 1.072e+00, 3.937e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 790.585 ms, max(u): (1.197e+00, 1.154e+00, 4.595e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 810.142 ms, max(u): (1.367e+00, 1.062e+00, 5.444e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 830.581 ms, max(u): (1.471e+00, 1.144e+00, 5.215e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 789.293 ms, max(u): (1.201e+00, 1.374e+00, 4.000e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 806.622 ms, max(u): (1.308e+00, 1.415e+00, 3.287e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 27.626 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 27.645 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 CairoMakieThree-dimensional visualization
We load the saved buoyancy output on the top, north, and east surface as FieldTimeSerieses.
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.grid48×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.0We 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 Observables, check out Makie.jl's Documentation.
n = length(times)41Now 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.0Next, 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.009368912316858768 -0.008131732232868671 -0.006858442910015583 -0.005608024075627327 -0.004376914817839861 -0.0031002822797745466 -0.0018791410839185119 -0.0006797277019359171; -0.009375177323818207 -0.008152134716510773 -0.006899186875671148 -0.005616056267172098 -0.004372225143015385 -0.0031323961447924376 -0.0018898557173088193 -0.0006074237753637135; -0.009373183362185955 -0.00813749898225069 -0.0068533639423549175 -0.005633597727864981 -0.004362992476671934 -0.0031086569651961327 -0.0018927197670564055 -0.0006271573947742581; -0.009374896064400673 -0.008116282522678375 -0.0068873749114573 -0.0056191314943134785 -0.00437195273116231 -0.0031282808631658554 -0.001883871154859662 -0.0006033324170857668; -0.009374227374792099 -0.008125172927975655 -0.0068946764804422855 -0.005613869056105614 -0.004392783623188734 -0.0031235739588737488 -0.0018583220662549138 -0.0006377528188750148; -0.009370878338813782 -0.008133264258503914 -0.0068883104249835014 -0.005617447197437286 -0.004377389792352915 -0.0031269961036741734 -0.0018701410153880715 -0.0006151528796181083; -0.009345361031591892 -0.00811686273664236 -0.0068453638814389706 -0.005622217897325754 -0.004362671170383692 -0.0031125720124691725 -0.0018819704419001937 -0.000594744342379272; -0.009370781481266022 -0.008104735985398293 -0.006873144768178463 -0.005645627621561289 -0.0043741329573094845 -0.0031188863795250654 -0.001854888629168272 -0.0006104940548539162; -0.009381767362356186 -0.008138379082083702 -0.006876881700009108 -0.00560740428045392 -0.0043539986945688725 -0.003118795109912753 -0.001884441589936614 -0.000616063829511404; -0.009363045915961266 -0.008117240853607655 -0.006870821584016085 -0.005642178002744913 -0.004375908058136702 -0.003102737944573164 -0.0018772466573864222 -0.0006014198297634721; -0.009366264566779137 -0.00813246238976717 -0.006865951232612133 -0.005609543528407812 -0.004383152350783348 -0.003135514445602894 -0.0018442671280354261 -0.000622528197709471; -0.00938454270362854 -0.008123217150568962 -0.006893964484333992 -0.005623428151011467 -0.004395247437059879 -0.0031348620541393757 -0.0018591205589473248 -0.0006282574613578618; -0.009383115917444229 -0.008112496696412563 -0.006874364335089922 -0.005629988852888346 -0.004395045805722475 -0.00311933271586895 -0.0018528912914916873 -0.000622580002527684; -0.009373156353831291 -0.008129145950078964 -0.006864914204925299 -0.005620374344289303 -0.004335369449108839 -0.0031368464697152376 -0.0018673890735954046 -0.0006276924978010356; -0.009392664767801762 -0.008100777864456177 -0.006872271653264761 -0.005617809947580099 -0.004404206294566393 -0.0031068797688931227 -0.0018771312898024917 -0.000600260857027024; -0.009383817203342915 -0.008105809800326824 -0.006880016531795263 -0.005631129257380962 -0.004384724423289299 -0.003124046139419079 -0.0018919032299891114 -0.000634636846370995; -0.009382147341966629 -0.008098198100924492 -0.006878658663481474 -0.005634340923279524 -0.00436518806964159 -0.0031478223390877247 -0.0018826565938070416 -0.0006479755975306034; -0.009380394592881203 -0.008123968727886677 -0.006836174987256527 -0.005620235577225685 -0.00436682952567935 -0.0031337542459368706 -0.0018993577687069774 -0.0006160122575238347; -0.00938713550567627 -0.008139470592141151 -0.006891587749123573 -0.0056463005021214485 -0.004363651387393475 -0.0031254016794264317 -0.0018904177704825997 -0.0006238847854547203; -0.009391711093485355 -0.008156540803611279 -0.006836563814431429 -0.005638659466058016 -0.004385063890367746 -0.003130558645352721 -0.0018902786541730165 -0.0006256457418203354; -0.00936330109834671 -0.008130279369652271 -0.0068809096701443195 -0.0056315818801522255 -0.004376835189759731 -0.0031393314711749554 -0.0018742455868050456 -0.0006434549577534199; -0.009373083710670471 -0.008129681460559368 -0.006849460303783417 -0.005598051473498344 -0.004354420583695173 -0.003136404324322939 -0.0018930010264739394 -0.0005992445512674749; -0.007513864431530237 -0.006241612136363983 -0.004999165423214436 -0.003715655067935586 -0.002504037693142891 -0.0012636330211535096 -3.388174263818655e-6 0.0012475894764065742; -0.00540944654494524 -0.004146149847656488 -0.0029053264297544956 -0.0016625071875751019 -0.0004138677613809705 0.000828973192255944 0.002059590769931674 0.0033394929487258196; -0.0033443430438637733 -0.002084837993606925 -0.000837920350022614 0.0004064367967657745 0.001674075610935688 0.002912865485996008 0.004154466092586517 0.005414048675447702; -0.0012587063247337937 -2.8001995815429837e-5 0.001247410080395639 0.002482569543644786 0.003754886332899332 0.005007847212255001 0.006235464010387659 0.007485709618777037; 0.0006353904609568417 0.0019058198668062687 0.0031402467284351587 0.0043778489343822 0.005631424020975828 0.0068553127348423 0.008133002556860447 0.009365604259073734; 0.000615713361185044 0.001877293805591762 0.003107860218733549 0.004387719556689262 0.005617763381451368 0.006874326150864363 0.008111640810966492 0.00938007328659296; 0.0006187237449921668 0.001891320920549333 0.003115871688351035 0.004383135121315718 0.00560376513749361 0.006855603773146868 0.008145430125296116 0.009369084611535072; 0.0006092559196986258 0.0018652809085324407 0.0031267229933291674 0.0043576485477387905 0.005635561887174845 0.006872163619846106 0.008120724931359291 0.009342111647129059; 0.0006423047161661088 0.0018890416249632835 0.0030955185648053885 0.00439338618889451 0.005628074053674936 0.00686198053881526 0.008119814097881317 0.00936471950262785; 0.0006110006361268461 0.0018933169776573777 0.0031366017647087574 0.004375544376671314 0.005632943008095026 0.006883063353598118 0.008107185363769531 0.00938570685684681; 0.0006349534378387034 0.0018897891277447343 0.0031075230799615383 0.004378003533929586 0.005615052301436663 0.006871938705444336 0.008125619031488895 0.009388981387019157; 0.0006210586871020496 0.001859631622210145 0.0031352152582257986 0.00435928488150239 0.005623351316899061 0.006856569088995457 0.008122051134705544 0.00938845332711935; 0.0006769881583750248 0.0018791264155879617 0.003136066719889641 0.004362564533948898 0.005637647118419409 0.006864616181701422 0.008124799467623234 0.00937733519822359; 0.0006136096781119704 0.0018884718883782625 0.0031515490263700485 0.004372516181319952 0.005647694226354361 0.006888539530336857 0.00811393279582262 0.009360132738947868; 0.0006131280097179115 0.0018680366920307279 0.003092598868533969 0.004388216882944107 0.005638929083943367 0.006885660346597433 0.008109666407108307 0.00936481636017561; 0.0006382692954503 0.0018720475491136312 0.003113920334726572 0.004365270026028156 0.0056303744204342365 0.006893846672028303 0.008143244311213493 0.009349980391561985; 0.0006472013192251325 0.0018660081550478935 0.0031299686525017023 0.004357772879302502 0.005624155979603529 0.006891914643347263 0.008106913417577744 0.00937686301767826; 0.00061792106134817 0.0018473173258826137 0.0031150442082434893 0.004358293954282999 0.005616398993879557 0.006890706717967987 0.008138814941048622 0.009373120032250881; 0.0006285429699346423 0.0018634373554959893 0.0031127589754760265 0.0043552531860768795 0.005627068690955639 0.0068789259530603886 0.00813340675085783 0.009363144636154175; 0.0006238340283744037 0.001884814235381782 0.0031003025360405445 0.004378811921924353 0.005651936866343021 0.0068738339468836784 0.008121906779706478 0.009387263096868992; 0.0006216200417838991 0.0018804509891197085 0.003115279832854867 0.004364495165646076 0.005656093824654818 0.0068863495253026485 0.008141877129673958 0.009399035945534706; 0.0006342313718050718 0.0018816429655998945 0.0031154120806604624 0.004374430514872074 0.005667227786034346 0.006882028188556433 0.008117913268506527 0.009374643675982952; 0.0006462669698521495 0.0018964469200000167 0.0031419196166098118 0.004398323129862547 0.0056275781244039536 0.006863991729915142 0.008113917894661427 0.009345869533717632; 0.0006525490898638964 0.0018457048572599888 0.0031293954234570265 0.004386925604194403 0.0056363665498793125 0.006864284165203571 0.008119776844978333 0.009360674768686295; 0.0006132778362371027 0.0018998578889295459 0.003132260637357831 0.0043754298239946365 0.005629032384604216 0.006889725103974342 0.00809441413730383 0.00938420370221138; 0.0006177844479680061 0.0018760469974949956 0.003117867512628436 0.004369806498289108 0.0056273057125508785 0.006854257080703974 0.008116107434034348 0.009376214817166328])
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
endThis page was generated using Literate.jl.