@@ -214,15 +214,9 @@ run!(simulation)
214214
215215using CairoMakie
216216
217- xb, yb, zb = nodes (B)
218- xω, yω, zω = nodes (ωy)
219- xv, yv, zv = nodes (V)
220-
221217# Read in the simulation's `output_writer` for the two-dimensional fields and then create an
222218# animation showing the ``y``-component of vorticity.
223219
224- ds = NCDataset (simulation. output_writers[:fields ]. filepath, " r" )
225-
226220fig = Figure (size = (800 , 600 ))
227221
228222axis_kwargs = (xlabel = " Across-slope distance (m)" ,
@@ -234,21 +228,22 @@ ax_v = Axis(fig[3, 1]; title = "Along-slope velocity (v)", axis_kwargs...)
234228
235229n = Observable (1 )
236230
237- ωy = @lift ds[" ωy" ][:, :, $ n]
238- B = @lift ds[" B" ][:, :, $ n]
239- ωlim = 0.015
240- hm_ω = heatmap! (ax_ω, xω, zω, ωy, colorrange = (- ωlim, + ωlim), colormap = :balance )
241- Colorbar (fig[2 , 2 ], hm_ω; label = " s⁻¹" )
242- ct_b = contour! (ax_ω, xb, zb, B, levels= - 1e-3 : 5e-5 : 1e-3 , color= :black )
231+ ωy_timeseries = FieldTimeSeries (simulation. output_writers[:fields ]. filepath, " ωy" )
232+ B_timeseries = FieldTimeSeries (simulation. output_writers[:fields ]. filepath, " B" )
233+ V_timeseries = FieldTimeSeries (simulation. output_writers[:fields ]. filepath, " V" )
243234
244- V = @lift ds[" V" ][:, :, $ n]
245- V_max = @lift maximum (abs, ds[" V" ][:, :, $ n])
235+ ωy = @lift ωy_timeseries[$ n]
236+ B = @lift B_timeseries[$ n]
237+ hm_ω = heatmap! (ax_ω, ωy, colorrange = (- 0.015 , + 0.015 ), colormap = :balance )
238+ Colorbar (fig[2 , 2 ], hm_ω; label = " s⁻¹" )
239+ ct_b = contour! (ax_ω, B, levels= - 1e-3 : 5e-5 : 1e-3 , color= :black )
246240
247- hm_v = heatmap! (ax_v, xv, zv, V, colorrange = (- V∞, + V∞), colormap = :balance )
241+ V = @lift V_timeseries[$ n]
242+ hm_v = heatmap! (ax_v, V, colorrange = (- V∞, + V∞), colormap = :balance )
248243Colorbar (fig[3 , 2 ], hm_v; label = " m s⁻¹" )
249- ct_b = contour! (ax_v, xb, zb, B, levels= - 1e-3 : 5e-5 : 1e-3 , color= :black )
244+ ct_b = contour! (ax_v, B, levels= - 1e-3 : 5e-5 : 1e-3 , color= :black )
250245
251- times = collect (ds[ " time " ])
246+ times = ωy_timeseries . times
252247title = @lift " t = " * string (prettytime (times[$ n]))
253248fig[1 , :] = Label (fig, title, fontsize= 20 , tellwidth= false )
254249
265260nothing # hide
266261
267262# 
268-
269- # Don't forget to close the NetCDF file!
270-
271- close (ds)
0 commit comments