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: 30.816 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (29.280 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (20.742 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 42.521 seconds, max(u): (1.255e-01, 1.169e-01, 1.623e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 751.692 ms, max(u): (2.220e-01, 1.731e-01, 1.782e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 623.130 ms, max(u): (3.162e-01, 2.315e-01, 2.003e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 715.407 ms, max(u): (4.082e-01, 3.665e-01, 1.848e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 572.665 ms, max(u): (5.025e-01, 5.541e-01, 2.014e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 619.178 ms, max(u): (6.310e-01, 8.997e-01, 2.646e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 682.756 ms, max(u): (9.703e-01, 1.155e+00, 3.570e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 659.795 ms, max(u): (1.356e+00, 1.283e+00, 4.738e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 645.629 ms, max(u): (1.412e+00, 1.139e+00, 4.763e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 645.306 ms, max(u): (1.272e+00, 1.063e+00, 3.656e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 590.622 ms, max(u): (1.428e+00, 1.084e+00, 3.606e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 619.008 ms, max(u): (1.386e+00, 1.478e+00, 3.472e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 616.546 ms, max(u): (1.323e+00, 1.228e+00, 3.310e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 678.889 ms, max(u): (1.276e+00, 1.174e+00, 3.142e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 1.046 minutes.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.047 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.009373282082378864 -0.008095555007457733 -0.006857345812022686 -0.005645685363560915 -0.004389951005578041 -0.0031142649240791798 -0.0018855961970984936 -0.000602748419623822; -0.009396099485456944 -0.008132428862154484 -0.006848553195595741 -0.005630833562463522 -0.00436757504940033 -0.0031295635271817446 -0.0018459554994478822 -0.0006373692885972559; -0.009402873925864697 -0.008112818002700806 -0.006860360503196716 -0.005622917786240578 -0.004365190397948027 -0.003142140107229352 -0.0018867410253733397 -0.0006050300435163081; -0.009390270337462425 -0.008107165805995464 -0.006893563084304333 -0.0056146178394556046 -0.004384877625852823 -0.0031249364838004112 -0.0018911026418209076 -0.0006300774984993041; -0.009376331232488155 -0.008141845464706421 -0.006888577248901129 -0.005644690711051226 -0.004355887416750193 -0.0030842567794024944 -0.0018755185883492231 -0.0006128635141067207; -0.00938261765986681 -0.008126302622258663 -0.006878888234496117 -0.0056145284324884415 -0.004360147751867771 -0.0031270463950932026 -0.0018926960183307528 -0.000635128584690392; -0.009389037266373634 -0.00810910016298294 -0.00687963655218482 -0.0056090508587658405 -0.004360072780400515 -0.003164292313158512 -0.0018813794013112783 -0.0006558867171406746; -0.009397974237799644 -0.008099724538624287 -0.0068830219097435474 -0.00562764098867774 -0.004372935276478529 -0.0030921741854399443 -0.0018936297856271267 -0.0006148687680251896; -0.009373212233185768 -0.008117754943668842 -0.006877693347632885 -0.005612245295196772 -0.004371536895632744 -0.0031312189530581236 -0.0018667887197807431 -0.0006254146574065089; -0.009382802993059158 -0.008136906661093235 -0.006865576840937138 -0.005624548066407442 -0.004374025389552116 -0.0031254771165549755 -0.0018834129441529512 -0.0006114721181802452; -0.009353400208055973 -0.008109142072498798 -0.006883713416755199 -0.0056164157576859 -0.004381316713988781 -0.003119327360764146 -0.0018785108113661408 -0.0006241095834411681; -0.009407800622284412 -0.008133972994983196 -0.006912391632795334 -0.005619863513857126 -0.004396521020680666 -0.0030952845700085163 -0.0018874868983402848 -0.0006056973361410201; -0.009362305514514446 -0.008116540499031544 -0.006866633426398039 -0.005626038182526827 -0.004384977743029594 -0.0031328166369348764 -0.0018662790535017848 -0.0006432012305594981; -0.009365753270685673 -0.008156615309417248 -0.006869617849588394 -0.00564537663012743 -0.004395938012748957 -0.0031310925260186195 -0.0018807717133313417 -0.0006138751632533967; -0.009368937462568283 -0.008114077150821686 -0.0068827527575194836 -0.005642513744533062 -0.004386003129184246 -0.003116724081337452 -0.0018425164744257927 -0.0006354318466037512; -0.00938053522258997 -0.008154179900884628 -0.0068510654382407665 -0.005630383267998695 -0.0043945033103227615 -0.003104523988440633 -0.0018752585165202618 -0.0006178582552820444; -0.009370739571750164 -0.008126873522996902 -0.006875006482005119 -0.0056199380196630955 -0.004375866614282131 -0.0031174563337117434 -0.0018618707545101643 -0.0006160641205497086; -0.009353668428957462 -0.008128614164888859 -0.006864104885607958 -0.005620145238935947 -0.0043756733648478985 -0.003118626307696104 -0.0018634559819474816 -0.0006020162836648524; -0.009383835829794407 -0.008157191798090935 -0.0068678841926157475 -0.0056281923316419125 -0.004408618435263634 -0.0031311102211475372 -0.0018749908776953816 -0.0006082822219468653; -0.009383780881762505 -0.008114760741591454 -0.006858269218355417 -0.005628495942801237 -0.00438548531383276 -0.0031174009200185537 -0.0018835134105756879 -0.0006334277568385005; -0.009381278418004513 -0.00812079943716526 -0.006869172677397728 -0.005600858014076948 -0.0043981196358799934 -0.0031276033259928226 -0.0018775390926748514 -0.0006020389846526086; -0.00938835833221674 -0.008108909241855145 -0.00691237673163414 -0.0056540039367973804 -0.004372053779661655 -0.0031362692825496197 -0.0018606965895742178 -0.0006447131745517254; -0.007511585485190153 -0.00623099971562624 -0.005006994120776653 -0.003727007657289505 -0.002499776193872094 -0.0012584282085299492 1.4175522665027529e-5 0.0012725431006401777; -0.005427371244877577 -0.004151605069637299 -0.002908692229539156 -0.001673820079304278 -0.00039900949923321605 0.0008356870384886861 0.002101527526974678 0.003347609657794237; -0.003330582519993186 -0.002081724815070629 -0.0008442897233180702 0.0004113618633709848 0.0016706634778529406 0.002953874645754695 0.004181520082056522 0.005442720837891102; -0.0012427325127646327 4.922642801830079e-6 0.0012349195312708616 0.002481286646798253 0.0037324687000364065 0.00501742959022522 0.00626087561249733 0.007478505373001099; 0.0006377025274559855 0.0018455226672813296 0.003134974045678973 0.004362256731837988 0.005627001635730267 0.006877177860587835 0.008128869347274303 0.009382911026477814; 0.0006069006631150842 0.0018720284570008516 0.0031252936460077763 0.004374081734567881 0.005639617331326008 0.006859393324702978 0.008115570992231369 0.009391461499035358; 0.000631963659543544 0.0018946739146485925 0.003130007768049836 0.004355421755462885 0.005623871460556984 0.006874992046505213 0.008116117678582668 0.009372959844768047; 0.0006118160090409219 0.0018635215237736702 0.0031321404967457056 0.004404786042869091 0.005621274001896381 0.0068845986388623714 0.008128976449370384 0.009373749606311321; 0.0006088134250603616 0.001861298456788063 0.0031471422407776117 0.004376864992082119 0.005605383310467005 0.006879997905343771 0.008129337802529335 0.009367555379867554; 0.0006022382876835763 0.0018808444729074836 0.0031319987028837204 0.004375128075480461 0.005639004521071911 0.0068615153431892395 0.008129764348268509 0.009326720610260963; 0.0006146591622382402 0.001853595837019384 0.0031415026169270277 0.0043883128091692924 0.005643702577799559 0.0068749478086829185 0.008113640360534191 0.009380460716784; 0.0006189262494444847 0.001870861742645502 0.0031319595873355865 0.0043715680949389935 0.00562612060457468 0.0068587358109653 0.008126012980937958 0.009376134723424911; 0.000639512378256768 0.0018888928461819887 0.003131078789010644 0.004385976120829582 0.005634944420307875 0.006870678160339594 0.008114894852042198 0.009362198412418365; 0.0006219829083420336 0.001890219165943563 0.003114697989076376 0.0043626269325613976 0.00560560030862689 0.006899982690811157 0.008116309531033039 0.009358027949929237; 0.0006247180863283575 0.0018658916233107448 0.0031308764591813087 0.0043903072364628315 0.005604305770248175 0.0068782661110162735 0.008120634593069553 0.00938400998711586; 0.0006206110119819641 0.0018658029148355126 0.003122262889519334 0.004359507001936436 0.005612561013549566 0.006861239206045866 0.008119520731270313 0.009383585304021835; 0.0006425666506402194 0.001879027346149087 0.0031370436772704124 0.004372917115688324 0.005628430284559727 0.006890194956213236 0.008111268281936646 0.00938331987708807; 0.0006152624846436083 0.0019015384605154395 0.0031371398363262415 0.004389297682791948 0.005630351137369871 0.006861804984509945 0.008101175539195538 0.009397446177899837; 0.0006391149945557117 0.001881730044260621 0.003140991786494851 0.004388284403830767 0.0056474884040653706 0.006888537667691708 0.008143175393342972 0.009388222359120846; 0.000622392341028899 0.0018621025374159217 0.0031313649378716946 0.004395695868879557 0.005610378924757242 0.006862706504762173 0.008121772669255733 0.009370546787977219; 0.0006257710629142821 0.001889711944386363 0.003131193807348609 0.004397775046527386 0.005656624678522348 0.006874043494462967 0.008118744939565659 0.009394657798111439; 0.0006486147758550942 0.0018799182726070285 0.003115603933110833 0.004379871301352978 0.005612833891063929 0.006880875676870346 0.008105136454105377 0.009356861934065819; 0.000597531208768487 0.0018793799681589007 0.0031286892481148243 0.004381575156003237 0.0056197321973741055 0.006876558996737003 0.008092434145510197 0.009376637637615204; 0.0006142318015918136 0.0018878993578255177 0.0031193289905786514 0.004361310042440891 0.005608926527202129 0.006874948740005493 0.008146822452545166 0.009361912496387959; 0.000636410026345402 0.0018782251281663775 0.0031225921120494604 0.00438484875485301 0.005599173717200756 0.00687438203021884 0.008126204833388329 0.009388014674186707; 0.0006205203244462609 0.001853317953646183 0.0031171871814876795 0.004372591618448496 0.0056336610578000546 0.00689143780618906 0.008106933906674385 0.009382488206028938])
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.