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.783 seconds, max(u): (0.000e+00, 0.000e+00, 0.000e+00) m/s, next Δt: 20 minutes
[ Info: ... simulation initialization complete (13.292 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (9.128 seconds).
[06.94%] i: 100, t: 1.389 days, wall time: 19.653 seconds, max(u): (1.275e-01, 1.153e-01, 1.567e-03) m/s, next Δt: 20 minutes
[13.89%] i: 200, t: 2.778 days, wall time: 1.879 seconds, max(u): (2.207e-01, 1.684e-01, 1.773e-03) m/s, next Δt: 20 minutes
[20.83%] i: 300, t: 4.167 days, wall time: 1.791 seconds, max(u): (2.939e-01, 2.258e-01, 1.757e-03) m/s, next Δt: 20 minutes
[27.78%] i: 400, t: 5.556 days, wall time: 1.882 seconds, max(u): (3.813e-01, 3.165e-01, 1.689e-03) m/s, next Δt: 20 minutes
[34.72%] i: 500, t: 6.944 days, wall time: 1.794 seconds, max(u): (4.316e-01, 4.146e-01, 1.824e-03) m/s, next Δt: 20 minutes
[41.67%] i: 600, t: 8.333 days, wall time: 1.799 seconds, max(u): (5.526e-01, 5.913e-01, 2.206e-03) m/s, next Δt: 20 minutes
[48.61%] i: 700, t: 9.722 days, wall time: 1.872 seconds, max(u): (7.401e-01, 9.613e-01, 3.158e-03) m/s, next Δt: 20 minutes
[55.56%] i: 800, t: 11.111 days, wall time: 1.787 seconds, max(u): (1.109e+00, 1.087e+00, 4.493e-03) m/s, next Δt: 20 minutes
[62.50%] i: 900, t: 12.500 days, wall time: 1.759 seconds, max(u): (1.396e+00, 1.037e+00, 4.614e-03) m/s, next Δt: 20 minutes
[69.44%] i: 1000, t: 13.889 days, wall time: 1.842 seconds, max(u): (1.282e+00, 9.545e-01, 4.659e-03) m/s, next Δt: 20 minutes
[76.39%] i: 1100, t: 15.278 days, wall time: 1.783 seconds, max(u): (1.457e+00, 1.125e+00, 3.194e-03) m/s, next Δt: 20 minutes
[83.33%] i: 1200, t: 16.667 days, wall time: 1.845 seconds, max(u): (1.237e+00, 1.161e+00, 3.313e-03) m/s, next Δt: 20 minutes
[90.28%] i: 1300, t: 18.056 days, wall time: 1.783 seconds, max(u): (1.298e+00, 1.312e+00, 3.937e-03) m/s, next Δt: 20 minutes
[97.22%] i: 1400, t: 19.444 days, wall time: 1.769 seconds, max(u): (1.467e+00, 1.258e+00, 3.304e-03) m/s, next Δt: 20 minutes
[ Info: Simulation is stopping after running for 50.673 seconds.
[ Info: Simulation time 20 days equals or exceeds stop time 20 days.
[ Info: Simulation completed in 50.692 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.00935437623411417 -0.008140024729073048 -0.006897307466715574 -0.0056254807859659195 -0.004371292423456907 -0.003122636815533042 -0.0018666310934349895 -0.0006290137534961104; -0.009367413818836212 -0.00812384020537138 -0.006863469257950783 -0.005604922771453857 -0.0043724942952394485 -0.0031025120988488197 -0.0018887057667598128 -0.0006331963813863695; -0.009406502358615398 -0.008119962178170681 -0.006864719092845917 -0.005633824039250612 -0.004357714205980301 -0.0031262822449207306 -0.0018820001278072596 -0.0006019157008267939; -0.009398605674505234 -0.008100840263068676 -0.006872917525470257 -0.005621494725346565 -0.004382423125207424 -0.003097434528172016 -0.0018835065420717 -0.0006305125425569713; -0.009362133219838142 -0.008142405189573765 -0.006869493518024683 -0.005634472239762545 -0.004353937692940235 -0.00313021382316947 -0.001868960214778781 -0.000608188915066421; -0.009405284188687801 -0.008130038157105446 -0.006882164161652327 -0.005616359878331423 -0.004359805025160313 -0.003128519281744957 -0.001899463590234518 -0.0006345746223814785; -0.009351814165711403 -0.008138115517795086 -0.006861045025289059 -0.005607240833342075 -0.004396661650389433 -0.0031403806060552597 -0.0018839461263269186 -0.0006165328668430448; -0.009376196190714836 -0.00812679436057806 -0.006861536297947168 -0.005635828245431185 -0.004355055745691061 -0.0031122846994549036 -0.0018880910938605666 -0.0006176021997816861; -0.009388254024088383 -0.008153892122209072 -0.006864587310701609 -0.005627330858260393 -0.00439278781414032 -0.003109206911176443 -0.0018771791364997625 -0.0006436325493268669; -0.009368502534925938 -0.00814748927950859 -0.006860585883259773 -0.005614019464701414 -0.004368477500975132 -0.0031528000254184008 -0.0019084839150309563 -0.0006154543370939791; -0.009360382333397865 -0.008097716607153416 -0.006861768197268248 -0.00562965776771307 -0.004371204413473606 -0.003134605009108782 -0.0018505011685192585 -0.0006351908086799085; -0.009398011490702629 -0.008123924024403095 -0.006882790010422468 -0.005622171331197023 -0.004377798177301884 -0.003133675316348672 -0.001874466659501195 -0.0006515443092212081; -0.009372659027576447 -0.00809301994740963 -0.006905853748321533 -0.005631372332572937 -0.0043752798810601234 -0.0031198407523334026 -0.0018748353468254209 -0.0006209851708263159; -0.00935441255569458 -0.008119222708046436 -0.0068753501400351524 -0.0056100510992109776 -0.004404736682772636 -0.00313013419508934 -0.0018892129883170128 -0.0006247637793421745; -0.009351001121103764 -0.008127010427415371 -0.006873144768178463 -0.005623745732009411 -0.004392354749143124 -0.0031083659268915653 -0.0018483024323359132 -0.0006359056569635868; -0.009390232153236866 -0.008133294060826302 -0.006890017539262772 -0.005622335243970156 -0.004360883496701717 -0.0031314885709434748 -0.0018799531972035766 -0.000623436993919313; -0.00937502458691597 -0.008142856881022453 -0.006838798988610506 -0.005630114581435919 -0.004375845659524202 -0.0031378779094666243 -0.0018758955411612988 -0.0006113808485679328; -0.009366624988615513 -0.008138611912727356 -0.006870610639452934 -0.0056466409005224705 -0.004374716896563768 -0.003118186490610242 -0.0018645066302269697 -0.000601760926656425; -0.009422928094863892 -0.00811673328280449 -0.006877418141812086 -0.005629770457744598 -0.0043547265231609344 -0.0031179231591522694 -0.0018718757200986147 -0.0006414237432181835; -0.009373661130666733 -0.008130796253681183 -0.006881921086460352 -0.005621189251542091 -0.004352726973593235 -0.0031106253154575825 -0.001883958699181676 -0.0006273687467910349; -0.00938507355749607 -0.008115900680422783 -0.00688397279009223 -0.005623620003461838 -0.0043800449930131435 -0.0030900160782039165 -0.0018724387045949697 -0.0006151677807793021; -0.0093860337510705 -0.008102696388959885 -0.006898326333612204 -0.005627830978482962 -0.004391251597553492 -0.0031195266637951136 -0.0018387198215350509 -0.0006074311677366495; -0.007518458645790815 -0.006234887987375259 -0.0049940370954573154 -0.003749372437596321 -0.002490891609340906 -0.0012500638840720057 -1.3554176803154405e-5 0.0012612579157575965; -0.005396674852818251 -0.004165408667176962 -0.0029118682723492384 -0.0016515671741217375 -0.00041228721966035664 0.0008220390882343054 0.0021046558395028114 0.003351552179083228; -0.0033352107275277376 -0.0020814472809433937 -0.0008333976729772985 0.0003912458778358996 0.0016679915133863688 0.002909228438511491 0.004150920547544956 0.005417744163423777; -0.001201454782858491 -1.206738488690462e-5 0.0012593950377777219 0.002528807846829295 0.003761628409847617 0.0050002592615783215 0.006235431879758835 0.007512754760682583; 0.0006364642758853734 0.0018778009107336402 0.003128048265352845 0.0043657259084284306 0.005631091073155403 0.006858946289867163 0.008155548945069313 0.00937870517373085; 0.0006137876189313829 0.001869400031864643 0.003142134053632617 0.004405129700899124 0.005616968031972647 0.006874747108668089 0.008106917142868042 0.009370449930429459; 0.0006270897574722767 0.001858377829194069 0.0031386958435177803 0.004379107151180506 0.005654620472341776 0.0068730320781469345 0.00813321303576231 0.009377220645546913; 0.0006363600259646773 0.0018662180518731475 0.0031250629108399153 0.004369793925434351 0.005602123215794563 0.006861787289381027 0.008124785497784615 0.009359064511954784; 0.0006059467559680343 0.001875337678939104 0.003142548492178321 0.004386239219456911 0.005632210522890091 0.006872443947941065 0.00814589112997055 0.00936389621347189; 0.0006339813116937876 0.001868744846433401 0.0031283246353268623 0.004376334138214588 0.00562400883063674 0.006856091786175966 0.008124256506562233 0.009392010048031807; 0.0006286422722041607 0.0018983655609190464 0.0031261593103408813 0.004338743630796671 0.005613067653030157 0.006880359724164009 0.00812702439725399 0.009365334175527096; 0.0006092499825172126 0.0018529114313423634 0.003147123148664832 0.004380475264042616 0.0056543536484241486 0.0068826694041490555 0.00812810193747282 0.009386386722326279; 0.000622969469986856 0.00186658906750381 0.0031493278220295906 0.00439196964725852 0.0056256502866744995 0.0068868836387991905 0.00813777931034565 0.009387467987835407; 0.0006353652570396662 0.0018632675055414438 0.0031296000815927982 0.004361496772617102 0.005620406940579414 0.006888916715979576 0.008167353458702564 0.00938129611313343; 0.0006243573734536767 0.001883097575046122 0.003128723008558154 0.004368812311440706 0.005639580078423023 0.006877942476421595 0.008130963891744614 0.00939240213483572; 0.0006307681906037033 0.0018736382480710745 0.0031160505022853613 0.004362915642559528 0.005615188740193844 0.006881080102175474 0.008121784776449203 0.009391228668391705; 0.0006258438224904239 0.0018707946874201298 0.00313300802372396 0.004404953680932522 0.005625840276479721 0.006864570081233978 0.008129222318530083 0.009348119609057903; 0.0006217843038029969 0.0018813133938238025 0.003154147183522582 0.004359251353889704 0.005603961180895567 0.0068640029057860374 0.008119238540530205 0.009361459873616695; 0.0006359916878864169 0.001848026062361896 0.0031331891659647226 0.00437181955203414 0.005617913324385881 0.006861429661512375 0.008111287839710712 0.00935257039964199; 0.0006275841151364148 0.0018668953562155366 0.0031143890228122473 0.004386586602777243 0.005622630473226309 0.006880335044115782 0.008166803978383541 0.009372835047543049; 0.0006134295254014432 0.0018700668588280678 0.003154066391289234 0.004369520582258701 0.005656936671584845 0.006882137153297663 0.008162950165569782 0.009381290525197983; 0.0006164786173030734 0.0018711473094299436 0.003129471093416214 0.0043707313016057014 0.0056403945200145245 0.006876657251268625 0.008131839334964752 0.00937714520841837; 0.0006352040218189359 0.0018651883583515882 0.003114693332463503 0.004390004090964794 0.005606695543974638 0.006875869818031788 0.008126291446387768 0.009346384555101395; 0.0006060077575966716 0.0018693653400987387 0.0030935604590922594 0.004347444511950016 0.005629449617117643 0.006888628005981445 0.008129939436912537 0.00936698168516159; 0.0006352594937197864 0.001886399812065065 0.003134931204840541 0.004397276788949966 0.005616240669041872 0.006875163409858942 0.008132195100188255 0.009387929923832417; 0.0006189725827425718 0.0018625612137839198 0.003116622334346175 0.004397301003336906 0.0056044189259409904 0.006849898025393486 0.00812412891536951 0.009355270303785801])
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.