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: 38.996 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (37.484 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (29.280 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 56.769 seconds, max(u): (1.283e-01, 1.313e-01, 1.594e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 1.085 seconds, max(u): (2.291e-01, 2.088e-01, 1.888e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.095 seconds, max(u): (2.909e-01, 3.061e-01, 1.959e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.072 seconds, max(u): (3.652e-01, 4.316e-01, 2.018e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 1.155 seconds, max(u): (4.578e-01, 5.907e-01, 1.837e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 1.320 seconds, max(u): (6.005e-01, 8.488e-01, 2.745e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 911.034 ms, max(u): (8.689e-01, 1.143e+00, 3.069e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.000 seconds, max(u): (1.230e+00, 1.128e+00, 4.748e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 896.471 ms, max(u): (1.304e+00, 1.199e+00, 5.199e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 921.249 ms, max(u): (1.549e+00, 1.203e+00, 4.201e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 907.165 ms, max(u): (1.532e+00, 1.191e+00, 3.676e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 931.960 ms, max(u): (1.556e+00, 1.311e+00, 3.423e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 910.788 ms, max(u): (1.543e+00, 1.237e+00, 5.654e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 827.035 ms, max(u): (1.372e+00, 1.212e+00, 5.036e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 0 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 1.430 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.009378870949149132 -0.008133185096085072 -0.006892800331115723 -0.0056208460591733456 -0.004401396960020065 -0.0031132050789892673 -0.0018798868404701352 -0.0006035024998709559; -0.009357878938317299 -0.008110166527330875 -0.006868281401693821 -0.005645352881401777 -0.0043948497623205185 -0.003099163994193077 -0.001859119744040072 -0.0006199991912581027; -0.009365946985781193 -0.008120625279843807 -0.006886162795126438 -0.005640956107527018 -0.004366383887827396 -0.003111243713647127 -0.0018760320963338017 -0.0006347960443235934; -0.009383227676153183 -0.00808348786085844 -0.006870883051306009 -0.005622851196676493 -0.004360992461442947 -0.0031078036408871412 -0.00187461799941957 -0.0006150283152237535; -0.009363491088151932 -0.008128855377435684 -0.006881595589220524 -0.00561509421095252 -0.004381055943667889 -0.003112121019512415 -0.001870265114121139 -0.0006188391707837582; -0.009394301101565361 -0.008137627504765987 -0.006857124622911215 -0.005612187087535858 -0.004360361024737358 -0.00313017750158906 -0.0019020701292902231 -0.0006021931185387075; -0.009374949149787426 -0.00813088845461607 -0.006878210697323084 -0.005627595353871584 -0.004354359116405249 -0.0031120660714805126 -0.001852712593972683 -0.0006363081047311425; -0.00935318972915411 -0.00811860989779234 -0.006877757143229246 -0.005610747262835503 -0.004402033518999815 -0.003139655804261565 -0.00186575623229146 -0.0005977210821583867; -0.00936082098633051 -0.008119883015751839 -0.006876600906252861 -0.005630115978419781 -0.004364462569355965 -0.003118169028311968 -0.0018687988631427288 -0.0006019131978973746; -0.009379605762660503 -0.0081397145986557 -0.00686977943405509 -0.005630142521113157 -0.004364924505352974 -0.003125232644379139 -0.0018695967737585306 -0.0006175072048790753; -0.009378447197377682 -0.008119065314531326 -0.006885418202728033 -0.0056180586107075214 -0.004388095811009407 -0.0031155941542237997 -0.0018878887640312314 -0.0006412593647837639; -0.009388494305312634 -0.008137824945151806 -0.006865907926112413 -0.005637631751596928 -0.004375657998025417 -0.0031209271401166916 -0.0018861808348447084 -0.0006087616202421486; -0.009368333965539932 -0.008118036203086376 -0.006899108644574881 -0.0056341588497161865 -0.004377369768917561 -0.0031218500807881355 -0.0018982401816174388 -0.0006195905734784901; -0.00935267098248005 -0.008121216669678688 -0.00688221724703908 -0.00560473557561636 -0.004375162068754435 -0.0031115778256207705 -0.0018805362051352859 -0.0006331229815259576; -0.00938576739281416 -0.008147790096700191 -0.006888007279485464 -0.00562357809394598 -0.004376325756311417 -0.003148060292005539 -0.0018726804992184043 -0.0006216999609023333; -0.009372982196509838 -0.008132100105285645 -0.006863649934530258 -0.005617375485599041 -0.004387895110994577 -0.003112886566668749 -0.001872051041573286 -0.0006175097660161555; -0.00938896369189024 -0.008113245479762554 -0.006869971286505461 -0.005612052511423826 -0.004381755832582712 -0.003128473414108157 -0.0018663437804207206 -0.0006354908109642565; -0.009382138960063457 -0.008098188787698746 -0.00688564358279109 -0.005635607056319714 -0.004395685624331236 -0.0031083934009075165 -0.001852581393904984 -0.0006200686912052333; -0.009391246363520622 -0.008130550384521484 -0.006867812946438789 -0.005628514569252729 -0.004363865591585636 -0.003108133329078555 -0.0018722278764471412 -0.0006421213038265705; -0.009390583261847496 -0.008109049871563911 -0.006865271832793951 -0.005626933183521032 -0.0043821935541927814 -0.003137405728921294 -0.0018698504427447915 -0.0006316141807474196; -0.00935678742825985 -0.008122262544929981 -0.006903944071382284 -0.005606057122349739 -0.004367793444544077 -0.0031131862197071314 -0.0018655093153938651 -0.0006298776715993881; -0.009375653229653835 -0.00814304780215025 -0.0068868729285895824 -0.005641559604555368 -0.00436746422201395 -0.0031472835689783096 -0.0018820201512426138 -0.0006253302562981844; -0.007502408232539892 -0.006262017413973808 -0.00499615678563714 -0.003736688755452633 -0.002501795534044504 -0.0012512169778347015 1.4544188161380589e-5 0.0012328756274655461; -0.005433660466223955 -0.004184274468570948 -0.002921390812844038 -0.0016582313692197204 -0.0004073108430020511 0.0008475056383758783 0.002105207648128271 0.0033126662019640207; -0.003353799693286419 -0.0020849076099693775 -0.0008208626531995833 0.0004020234919153154 0.0016350438818335533 0.0029120040126144886 0.004150689113885164 0.005429079756140709; -0.0012312226463109255 1.1804773748735897e-5 0.001265686354599893 0.002493259496986866 0.0037668345030397177 0.005005975719541311 0.00623654667288065 0.007491974160075188; 0.0006254184991121292 0.001885825302451849 0.003128727898001671 0.004398731514811516 0.005621352698653936 0.006893787067383528 0.008132385089993477 0.009379599243402481; 0.0006132532726041973 0.0018379177199676633 0.003136990126222372 0.004371982999145985 0.0056041572242975235 0.0068680644035339355 0.008111074566841125 0.00939448643475771; 0.0006345469737425447 0.001893098116852343 0.0030979870352894068 0.004368932452052832 0.005624605808407068 0.006899588275700808 0.008136897347867489 0.009369779378175735; 0.000599111313931644 0.001865771017037332 0.003168382914736867 0.004388702567666769 0.005598279647529125 0.006872181314975023 0.008117943070828915 0.009386006742715836; 0.0006342676933854818 0.0019019778119400144 0.0031186731066554785 0.0043886457569897175 0.005630347412079573 0.006872121710330248 0.008112774230539799 0.00936560332775116; 0.0006415724637918174 0.0018584680510684848 0.0031120143830776215 0.004379423335194588 0.005623910576105118 0.00689198262989521 0.008122053928673267 0.009398344904184341; 0.0006270813755691051 0.0018969455268234015 0.003140012500807643 0.004380147438496351 0.005615781992673874 0.006876200903207064 0.008115636184811592 0.009386618621647358; 0.000630255788564682 0.001850573462434113 0.0031228018924593925 0.004372750874608755 0.005642872769385576 0.006848793011158705 0.008157581090927124 0.009369101375341415; 0.0006033745012246072 0.001899031805805862 0.0031070264521986246 0.004372893832623959 0.005650085397064686 0.006872120313346386 0.008137702941894531 0.00938228890299797; 0.0006229876889847219 0.0018950768280774355 0.003121150191873312 0.004393574316054583 0.005595820490270853 0.0068684713914990425 0.008131562732160091 0.009379382245242596; 0.0006408627959899604 0.0018720764201134443 0.003154051722958684 0.00438308110460639 0.005621450487524271 0.006894387304782867 0.008135314099490643 0.009386041201651096; 0.0006305930437520146 0.0018771591130644083 0.0031345109455287457 0.004376609344035387 0.0056207627058029175 0.0068893032148480415 0.008159064687788486 0.009388775564730167; 0.0006006283219903708 0.0018969342345371842 0.0031106327660381794 0.004394087009131908 0.0056449975818395615 0.006867390591651201 0.008137608878314495 0.009355142712593079; 0.0006266008713282645 0.0018745053093880415 0.0031170984730124474 0.004368968307971954 0.005598276387900114 0.006887589115649462 0.008111325092613697 0.009353229776024818; 0.0006365131121128798 0.001880698255263269 0.003099442459642887 0.004380065016448498 0.005638757720589638 0.0068789515644311905 0.008117806166410446 0.009405234828591347; 0.0006210976280272007 0.00186453468631953 0.003100220812484622 0.004370072856545448 0.0056101856753230095 0.006872141268104315 0.008125447668135166 0.009372679516673088; 0.0006433356320485473 0.0018738422077149153 0.003126859664916992 0.004336779471486807 0.00563277630135417 0.006870748940855265 0.008149887435138226 0.00938626192510128; 0.0006157575990073383 0.0018445226596668363 0.003133041551336646 0.004370964132249355 0.005644930060952902 0.0068521020002663136 0.008134324103593826 0.009347590617835522; 0.0005981043796055019 0.00188726547639817 0.003099493682384491 0.004375498276203871 0.005600270815193653 0.006881890818476677 0.008142292499542236 0.009389379993081093; 0.0006198337068781257 0.0018752223113551736 0.003127999836578965 0.00437303027138114 0.005631012376397848 0.006864826660603285 0.008111963979899883 0.009380332194268703; 0.000633418036159128 0.0018625413067638874 0.003126392373815179 0.004357767757028341 0.005615433678030968 0.006874884013086557 0.0081089548766613 0.00935437623411417; 0.0006312357145361602 0.0018973414553329349 0.003128395415842533 0.004394099581986666 0.005599311087280512 0.006871029734611511 0.008123881183564663 0.00938674621284008])
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.