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{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⁻²]")
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 => 4
│ ├── stop_iteration_exceeded => -
│ ├── wall_time_limit_exceeded => e
│ └── nan_checker => }
├── 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: 18.875 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (13.128 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (9.282 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 19.849 seconds, max(u): (1.315e-01, 1.147e-01, 1.598e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 1.873 seconds, max(u): (2.259e-01, 1.715e-01, 1.803e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.767 seconds, max(u): (3.026e-01, 2.198e-01, 1.722e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.843 seconds, max(u): (3.758e-01, 2.820e-01, 1.836e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 1.758 seconds, max(u): (4.589e-01, 4.282e-01, 1.783e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 1.856 seconds, max(u): (5.783e-01, 7.636e-01, 2.269e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 1.760 seconds, max(u): (8.526e-01, 1.180e+00, 3.325e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.779 seconds, max(u): (1.244e+00, 1.388e+00, 4.452e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 1.869 seconds, max(u): (1.447e+00, 1.319e+00, 5.244e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 1.765 seconds, max(u): (1.464e+00, 1.476e+00, 4.427e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 1.828 seconds, max(u): (1.520e+00, 1.547e+00, 3.324e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 1.794 seconds, max(u): (1.474e+00, 1.365e+00, 3.309e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 1.868 seconds, max(u): (1.465e+00, 1.283e+00, 4.010e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 1.823 seconds, max(u): (1.449e+00, 1.381e+00, 3.134e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 50.867 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 50.886 seconds
Visualization
All that's left is to make a pretty movie. Actually, we make two visualizations here. First, we illustrate how to make a 3D visualization with Makie
's Axis3
and Makie.surface
. Then we make a movie in 2D. We use CairoMakie
in this example, but note that using GLMakie
is more convenient on a system with OpenGL, as figures will be displayed on the screen.
using CairoMakie
Three-dimensional visualization
We load the saved buoyancy output on the top, north, and east surface as FieldTimeSeries
es.
filename = "baroclinic_adjustment"
sides = keys(slicers)
slice_filenames = NamedTuple(side => filename * "_$(side)_slice.jld2" for side in sides)
b_timeserieses = (east = FieldTimeSeries(slice_filenames.east, "b"),
north = FieldTimeSeries(slice_filenames.north, "b"),
top = FieldTimeSeries(slice_filenames.top, "b"))
B_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "b")
times = B_timeseries.times
grid = B_timeseries.grid
48×48×8 RectilinearGrid{Float64, Periodic, Bounded, Bounded} on CPU with 3×3×3 halo
├── Periodic x ∈ [0.0, 1.0e6) regularly spaced with Δx=20833.3
├── Bounded y ∈ [-500000.0, 500000.0] regularly spaced with Δy=20833.3
└── Bounded z ∈ [-1000.0, 0.0] regularly spaced with Δz=125.0
We build the coordinates. We rescale horizontal coordinates to kilometers.
xb, yb, zb = nodes(b_timeserieses.east)
xb = xb ./ 1e3 # convert m -> km
yb = yb ./ 1e3 # convert m -> km
Nx, Ny, Nz = size(grid)
x_xz = repeat(x, 1, Nz)
y_xz_north = y[end] * ones(Nx, Nz)
z_xz = repeat(reshape(z, 1, Nz), Nx, 1)
x_yz_east = x[end] * ones(Ny, Nz)
y_yz = repeat(y, 1, Nz)
z_yz = repeat(reshape(z, 1, Nz), grid.Ny, 1)
x_xy = x
y_xy = y
z_xy_top = z[end] * ones(grid.Nx, grid.Ny)
Then we create a 3D axis. We use zonal_slice_displacement
to control where the plot of the instantaneous zonal average flow is located.
fig = Figure(size = (1600, 800))
zonal_slice_displacement = 1.2
ax = Axis3(fig[2, 1],
aspect=(1, 1, 1/5),
xlabel = "x (km)",
ylabel = "y (km)",
zlabel = "z (m)",
xlabeloffset = 100,
ylabeloffset = 100,
zlabeloffset = 100,
limits = ((x[1], zonal_slice_displacement * x[end]), (y[1], y[end]), (z[1], z[end])),
elevation = 0.45,
azimuth = 6.8,
xspinesvisible = false,
zgridvisible = false,
protrusions = 40,
perspectiveness = 0.7)
Axis3()
We use data from the final savepoint for the 3D plot. Note that this plot can easily be animated by using Makie's Observable
. To dive into Observable
s, check out Makie.jl's Documentation.
n = length(times)
41
Now let's make a 3D plot of the buoyancy and in front of it we'll use the zonally-averaged output to plot the instantaneous zonal-average of the buoyancy.
b_slices = (east = interior(b_timeserieses.east[n], 1, :, :),
north = interior(b_timeserieses.north[n], :, 1, :),
top = interior(b_timeserieses.top[n], :, :, 1))
# Zonally-averaged buoyancy
B = interior(B_timeseries[n], 1, :, :)
clims = 1.1 .* extrema(b_timeserieses.top[n][:])
kwargs = (colorrange=clims, colormap=:deep, shading=NoShading)
surface!(ax, x_yz_east, y_yz, z_yz; color = b_slices.east, kwargs...)
surface!(ax, x_xz, y_xz_north, z_xz; color = b_slices.north, kwargs...)
surface!(ax, x_xy, y_xy, z_xy_top; color = b_slices.top, kwargs...)
sf = surface!(ax, zonal_slice_displacement .* x_yz_east, y_yz, z_yz; color = B, kwargs...)
contour!(ax, y, z, B; transformation = (:yz, zonal_slice_displacement * x[end]),
levels = 15, linewidth = 2, color = :black)
Colorbar(fig[2, 2], sf, label = "m s⁻²", height = Relative(0.4), tellheight=false)
title = "Buoyancy at t = " * string(round(times[n] / day, digits=1)) * " days"
fig[1, 1:2] = Label(fig, title; fontsize = 24, tellwidth = false, padding = (0, 0, -120, 0))
rowgap!(fig.layout, 1, Relative(-0.2))
colgap!(fig.layout, 1, Relative(-0.1))
save("baroclinic_adjustment_3d.png", fig)
Two-dimensional movie
We make a 2D movie that shows buoyancy $b$ and vertical vorticity $ζ$ at the surface, as well as the zonally-averaged zonal and meridional velocities $U$ and $V$ in the $(y, z)$ plane. First we load the FieldTimeSeries
and extract the additional coordinates we'll need for plotting
ζ_timeseries = FieldTimeSeries(slice_filenames.top, "ζ")
U_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "u")
B_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "b")
V_timeseries = FieldTimeSeries(filename * "_zonal_average.jld2", "v")
xζ, yζ, zζ = nodes(ζ_timeseries)
yv = ynodes(V_timeseries)
xζ = xζ ./ 1e3 # convert m -> km
yζ = yζ ./ 1e3 # convert m -> km
yv = yv ./ 1e3 # convert m -> km
-500.0:20.833333333333332: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!
.
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.009374166838824749 -0.008131640963256359 -0.006879489403218031 -0.005617518909275532 -0.004374624229967594 -0.003113987622782588 -0.0019052387215197086 -0.0006326503353193402; -0.009386367164552212 -0.00812625139951706 -0.006879901979118586 -0.005645452067255974 -0.004385656677186489 -0.0031336715910583735 -0.0018836569506675005 -0.000624393462203443; -0.00936147477477789 -0.008101440966129303 -0.006855867337435484 -0.005637503229081631 -0.004360043443739414 -0.0031256049405783415 -0.001878630486316979 -0.0006320104002952576; -0.009365231730043888 -0.008103038184344769 -0.006868222262710333 -0.005607191473245621 -0.0043926117941737175 -0.0031271055340766907 -0.0018865537131205201 -0.0006601595086976886; -0.00935586541891098 -0.008142529986798763 -0.006867262534797192 -0.005622495897114277 -0.004387888591736555 -0.003143695183098316 -0.0018679858185350895 -0.0006146186497062445; -0.009348494932055473 -0.00812837015837431 -0.006888482253998518 -0.0056322976015508175 -0.004373000003397465 -0.0031285386066883802 -0.0018664660165086389 -0.000612900301348418; -0.009383178316056728 -0.008145365864038467 -0.0068659307435154915 -0.005620866548269987 -0.004386524669826031 -0.003139769658446312 -0.0018808633321896195 -0.0006169165135361254; -0.009396701119840145 -0.008126984350383282 -0.006880280561745167 -0.005622399505227804 -0.0043642534874379635 -0.0031137920450419188 -0.0018384772120043635 -0.0006143167847767472; -0.009380638599395752 -0.00812329351902008 -0.0068784914910793304 -0.00564185855910182 -0.004379226826131344 -0.0031215555500239134 -0.0018467407207936049 -0.0006352211930789053; -0.00936202798038721 -0.00811144057661295 -0.0068764956668019295 -0.005631295498460531 -0.004361295606940985 -0.003118801862001419 -0.0018887667683884501 -0.0006087764631956816; -0.009367299266159534 -0.008108708076179028 -0.006864093244075775 -0.005612303968518972 -0.004415658302605152 -0.0031252994667738676 -0.0018769397865980864 -0.0006319451495073736; -0.009355805814266205 -0.008141838945448399 -0.006880889181047678 -0.0056176199577748775 -0.004371547140181065 -0.003105585929006338 -0.0018504823092371225 -0.0006414502277038991; -0.009360198862850666 -0.008098474703729153 -0.006878195330500603 -0.005626617465168238 -0.00437190430238843 -0.003158821724355221 -0.0018598086899146438 -0.0006122299237176776; -0.009376985020935535 -0.00813269056379795 -0.006880344357341528 -0.005651595536619425 -0.004367688670754433 -0.003104712814092636 -0.0018713973695412278 -0.0006033838144503534; -0.009379496797919273 -0.008114004507660866 -0.006891321856528521 -0.005633784458041191 -0.004361767787486315 -0.0031253304332494736 -0.0018947250209748745 -0.0006086917128413916; -0.009375014342367649 -0.008121117949485779 -0.006870744284242392 -0.005634600296616554 -0.004359634127467871 -0.0031189657747745514 -0.0018490342190489173 -0.0006285829585976899; -0.009383631870150566 -0.008125761523842812 -0.006862250156700611 -0.0056153847835958 -0.004370336886495352 -0.0031144041568040848 -0.0018733860924839973 -0.0006320441025309265; -0.009370693005621433 -0.00812474638223648 -0.006860949099063873 -0.0056246560998260975 -0.004375323187559843 -0.0031507823150604963 -0.0018888113554567099 -0.0006470414227806032; -0.009371806867420673 -0.008147303946316242 -0.006852154619991779 -0.005641053430736065 -0.004399868194013834 -0.0030991530511528254 -0.0018669877899810672 -0.0006331668701022863; -0.009362474083900452 -0.008130279369652271 -0.006892495788633823 -0.005652936175465584 -0.004354202654212713 -0.003112365957349539 -0.0018923288444057107 -0.000644362298771739; -0.009385718032717705 -0.008124984800815582 -0.006869241129606962 -0.0055971150286495686 -0.0043728286400437355 -0.0031265353318303823 -0.001883799908682704 -0.0006022291490808129; -0.009359204210340977 -0.008146965876221657 -0.00688524404540658 -0.005611932370811701 -0.004348507151007652 -0.003131007542833686 -0.0018559562740847468 -0.0006278615328483284; -0.007479493040591478 -0.006251024082303047 -0.004991098772734404 -0.0037460022140294313 -0.002469025319442153 -0.0012428701156750321 5.702076578018023e-6 0.0012387098977342248; -0.005420545116066933 -0.0041635590605437756 -0.0029135020449757576 -0.0016693718498572707 -0.00042290607234463096 0.0008367579430341721 0.002062989864498377 0.0033296369947493076; -0.003355031367391348 -0.002084931591525674 -0.0008497378439642489 0.0003972278500441462 0.0016754294047132134 0.0029343620408326387 0.004165041726082563 0.00542740523815155; -0.0012411668431013823 -2.2263857317739166e-6 0.0012497982243075967 0.0025045040529221296 0.0037614440079778433 0.005018384661525488 0.006263857241719961 0.007495144847780466; 0.000605622015427798 0.0018712389282882214 0.003127285512164235 0.004383389372378588 0.0056022098287940025 0.006876947823911905 0.008118859492242336 0.009374977089464664; 0.0006229372229427099 0.0018524377373978496 0.003105445299297571 0.004393149167299271 0.00561628257855773 0.006890659686177969 0.00813538022339344 0.009366320446133614; 0.0006059124716557562 0.0018678148044273257 0.0031283029820770025 0.0043731918558478355 0.005628969985991716 0.006849286612123251 0.008132902905344963 0.009356205351650715; 0.0006221050280146301 0.0018547329818829894 0.0031141063664108515 0.004369692411273718 0.005646787583827972 0.006866460666060448 0.008115386590361595 0.00936156790703535; 0.0006221707444638014 0.0018629854312166572 0.0031211036257445812 0.004381946288049221 0.005630526691675186 0.006889396347105503 0.008127345703542233 0.009375430643558502; 0.0006379397818818688 0.0018697800114750862 0.0031469331588596106 0.0043812524527311325 0.005625589285045862 0.006874960847198963 0.008148672990500927 0.009369786828756332; 0.0006316493963822722 0.0018855798989534378 0.0031336164101958275 0.004374358803033829 0.005621147807687521 0.006855342537164688 0.008137205615639687 0.009389297105371952; 0.0006397494580596685 0.0018683192320168018 0.0030942889861762524 0.004386696964502335 0.005617246031761169 0.006871077697724104 0.008130021393299103 0.009342589415609837; 0.0006213128799572587 0.0018689989810809493 0.003120088018476963 0.004359854385256767 0.005617493763566017 0.006862362381070852 0.008146772161126137 0.009389815852046013; 0.0006314588245004416 0.001883088261820376 0.00313657452352345 0.004377704579383135 0.005646213889122009 0.006908087525516748 0.008129863999783993 0.009363962337374687; 0.0006081211031414568 0.0018615598091855645 0.0031319279223680496 0.004385850857943296 0.005637405905872583 0.006859046872705221 0.008127863518893719 0.009372424334287643; 0.0006131347035989165 0.0018807247979566455 0.003117980668321252 0.004385804757475853 0.005610255524516106 0.0068793282844126225 0.00815574824810028 0.009380289353430271; 0.0006319594685919583 0.0018724853871390224 0.003117050277069211 0.004355292301625013 0.005634297151118517 0.006848841905593872 0.008136951364576817 0.009361212141811848; 0.0006364276632666588 0.001870431937277317 0.003102261805906892 0.004375168588012457 0.005633500870317221 0.0068833231925964355 0.008126568980515003 0.009378048591315746; 0.0006409501074813306 0.0018600906478241086 0.0031122828368097544 0.004376434721052647 0.005615078844130039 0.0068841842003166676 0.008092167787253857 0.00940048135817051; 0.0006231076549738646 0.0018600373296067119 0.0031038224697113037 0.00437357509508729 0.005641269963234663 0.006887868978083134 0.008114445023238659 0.009370020590722561; 0.0006055846461094916 0.001862312201410532 0.0031323556322604418 0.004349103197455406 0.005626714322715998 0.0068961153738200665 0.008134487085044384 0.009410237893462181; 0.0006526857032440603 0.0018810020992532372 0.0031128935515880585 0.0043933941051363945 0.005604722071439028 0.006838525645434856 0.00812515802681446 0.009363759309053421; 0.0006096999277360737 0.0018848484614863992 0.0031175795011222363 0.004383917432278395 0.005645460449159145 0.0068435827270150185 0.008125236257910728 0.009375202469527721; 0.0006258843932300806 0.0018916134722530842 0.00314086745493114 0.00437299907207489 0.005586579907685518 0.006883535999804735 0.008096989244222641 0.009368437342345715; 0.0006151217385195196 0.0018877385882660747 0.0031388273928314447 0.004391552414745092 0.005650149192661047 0.006875277031213045 0.00812596920877695 0.009386238642036915; 0.0006085677887313068 0.0018792974296957254 0.0031191534362733364 0.004379675257951021 0.005612468346953392 0.006883725058287382 0.008125360123813152 0.009381024166941643])
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.