@@ -28,14 +28,13 @@ using Oceananigans.Models: ShallowWaterModel
28
28
29
29
# ## Two-dimensional domain
30
30
#
31
- # The shallow water model is a two-dimensional model and thus the number of vertical
32
- # points `Nz` must be set to one. Note that ``L_z`` is the mean depth of the fluid.
31
+ # The shallow water model is two-dimensional and uses grids that are `Flat`
32
+ # in the vertical direction. We use length scales non-dimensionalized by the width
33
+ # of the Bickley jet.
33
34
34
- Lx, Ly, Lz = 2 π, 20 , 10
35
- Nx, Ny = 128 , 128
36
-
37
- grid = RectilinearGrid (size = (Nx, Ny),
38
- x = (0 , Lx), y = (- Ly/ 2 , Ly/ 2 ),
35
+ grid = RectilinearGrid (size = (48 , 128 ),
36
+ x = (0 , 2 π),
37
+ y = (- 10 , 10 ),
39
38
topology = (Periodic, Bounded, Flat))
40
39
41
40
# ## Building a `ShallowWaterModel`
@@ -59,12 +58,13 @@ model = ShallowWaterModel(; grid, coriolis, gravitational_acceleration,
59
58
# geostrophically balanced Bickely jet with maximum speed of ``U`` and maximum
60
59
# free-surface deformation of ``Δη``,
61
60
62
- U = 1 # Maximum jet velocity
61
+ U = 1 # Maximum jet velocity
62
+ H = 10 # Reference depth
63
63
f = coriolis. f
64
64
g = gravitational_acceleration
65
65
Δη = f * U / g # Maximum free-surface deformation as dictated by geostrophy
66
66
67
- h̄ (x, y, z) = Lz - Δη * tanh (y)
67
+ h̄ (x, y, z) = H - Δη * tanh (y)
68
68
ū (x, y, z) = U * sech (y)^ 2
69
69
70
70
# The total height of the fluid is ``h = L_z + \eta``. Linear stability theory predicts that
@@ -116,10 +116,10 @@ set!(model, uh = uhⁱ)
116
116
# ## Running a `Simulation`
117
117
#
118
118
# We pick the time-step so that we make sure we resolve the surface gravity waves, which
119
- # propagate with speed of the order ``\sqrt{g L_z }``. That is, with `Δt = 1e-2` we ensure
120
- # that `` \sqrt{g L_z } Δt / Δx, \sqrt{g L_z } Δt / Δy < 0.7``.
119
+ # propagate with speed of the order ``\sqrt{g H }``. That is, with `Δt = 1e-2` we ensure
120
+ # that `` \sqrt{g H } Δt / Δx, \sqrt{g H } Δt / Δy < 0.7``.
121
121
122
- simulation = Simulation (model, Δt = 1e-2 , stop_time = 150 )
122
+ simulation = Simulation (model, Δt = 1e-2 , stop_time = 100 )
123
123
124
124
# ## Prepare output files
125
125
#
@@ -136,7 +136,7 @@ perturbation_norm(args...) = norm(v)
136
136
fields_filename = joinpath (@__DIR__ , " shallow_water_Bickley_jet_fields.nc" )
137
137
simulation. output_writers[:fields ] = NetCDFOutputWriter (model, (; ω, ω′),
138
138
filename = fields_filename,
139
- schedule = TimeInterval (1 ),
139
+ schedule = TimeInterval (2 ),
140
140
overwrite_existing = true )
141
141
142
142
# Build the `output_writer` for the growth rate, which is a scalar field.
@@ -170,11 +170,7 @@ nothing # hide
170
170
171
171
fig = Figure (resolution = (1200 , 660 ))
172
172
173
- axis_kwargs = (xlabel = " x" ,
174
- ylabel = " y" ,
175
- aspect = AxisAspect (1 ),
176
- limits = ((0 , Lx), (- Ly/ 2 , Ly/ 2 )))
177
-
173
+ axis_kwargs = (xlabel = " x" , ylabel = " y" )
178
174
ax_ω = Axis (fig[2 , 1 ]; title = " Total vorticity, ω" , axis_kwargs... )
179
175
ax_ω′ = Axis (fig[2 , 3 ]; title = " Perturbation vorticity, ω - ω̄" , axis_kwargs... )
180
176
203
199
frames = 1 : length (times)
204
200
205
201
record (fig, " shallow_water_Bickley_jet.mp4" , frames, framerate= 12 ) do i
206
- msg = string (" Plotting frame " , i, " of " , frames[end ])
207
- print (msg * " \r " )
208
202
n[] = i
209
203
end
210
204
nothing # hide
@@ -230,7 +224,7 @@ nothing # hide
230
224
231
225
using Polynomials: fit
232
226
233
- I = 6000 : 7000
227
+ I = 5000 : 6000
234
228
235
229
degree = 1
236
230
linear_fit_polynomial = fit (t[I], log .(norm_v[I]), degree, var = :t )
0 commit comments