@@ -4,10 +4,11 @@ using Random
4
4
using Oceananigans
5
5
using Oceananigans. Units
6
6
using GLMakie
7
- using Oceananigans. TurbulenceClosures: IsopycnalSkewSymmetricDiffusivity
8
- using Oceananigans. TurbulenceClosures: FluxTapering, DiffusiveFormulation, AdvectiveSkewClosure
7
+ using Oceananigans. TurbulenceClosures: IsopycnalSkewSymmetricDiffusivity, SkewAdvectionISSD
8
+ using Oceananigans. TurbulenceClosures: FluxTapering, DiffusiveFormulation, AdvectiveFormulation
9
9
10
10
filename = " coarse_baroclinic_adjustment"
11
+ wall_clock = Ref (time_ns ())
11
12
12
13
function progress (sim)
13
14
@printf (" [%05.2f%%] i: %d, t: %s, wall time: %s, max(u): (%6.3e, %6.3e, %6.3e) m/s, next Δt: %s\n " ,
@@ -21,7 +22,7 @@ function progress(sim)
21
22
prettytime (sim. Δt))
22
23
23
24
wall_clock[] = time_ns ()
24
-
25
+
25
26
return nothing
26
27
end
27
28
@@ -37,7 +38,7 @@ save_fields_interval = 2day
37
38
stop_time = 300 days
38
39
39
40
grid = RectilinearGrid (topology = (Flat, Bounded, Bounded),
40
- size = (Ny, Nz),
41
+ size = (Ny, Nz),
41
42
y = (- Ly/ 2 , Ly/ 2 ),
42
43
z = (- Lz, 0 ),
43
44
halo = (5 , 5 ))
@@ -50,14 +51,13 @@ grid = ImmersedBoundaryGrid(grid, GridFittedBottom(y -> y > 0 ? -Lz : -Lz/2))
50
51
slope_limiter = FluxTapering (1000 ) # Allow very steep slopes
51
52
52
53
adv_closure = IsopycnalSkewSymmetricDiffusivity (; κ_skew, slope_limiter)
53
- dif_closure = IsopycnalSkewSymmetricDiffusivity (; κ_skew, slope_limiter, skew_fluxes_formulation = DiffusiveFormulation ())
54
+ dif_closure = IsopycnalSkewSymmetricDiffusivity (; κ_skew, slope_limiter, skew_flux_formulation = DiffusiveFormulation ())
54
55
55
56
function run_simulation (closure, grid)
56
- model = HydrostaticFreeSurfaceModel (; grid,
57
+ model = HydrostaticFreeSurfaceModel (; grid, closure,
57
58
coriolis = FPlane (latitude = - 45 ),
58
59
buoyancy = BuoyancyTracer (),
59
60
tracer_advection = WENO (order= 7 ),
60
- closure = adv_closure,
61
61
tracers = (:b , :c ))
62
62
63
63
@info " Built $model ."
@@ -85,14 +85,10 @@ function run_simulation(closure, grid)
85
85
# ####
86
86
87
87
simulation = Simulation (model; Δt, stop_time)
88
+ add_callback! (simulation, progress, IterationInterval (144 ))
89
+ suffix = closure isa SkewAdvectionISSD ? " advective" : " diffusive"
88
90
89
- wall_clock = Ref (time_ns ())
90
-
91
- add_callback! (simulation, progress, IterationInterval (10 ))
92
-
93
- suffix = closure isa AdvectiveSkewClosure ? " advective" : " diffusive"
94
-
95
- simulation. output_writers[:fields ] = JLD2OutputWriter (model, merge (model. velocities, model. tracers),
91
+ simulation. output_writers[:fields ] = JLD2OutputWriter (model, merge (model. velocities, model. tracers),
96
92
schedule = TimeInterval (save_fields_interval),
97
93
filename = filename * " _fields_" * suffix,
98
94
overwrite_existing = true )
@@ -145,10 +141,10 @@ cd = @lift ctd[$n]
145
141
146
142
fig = Figure (size= (1800 , 700 ))
147
143
148
- axua = Axis (fig[2 , 1 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " Zonal velocity" )
149
- axca = Axis (fig[3 , 1 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " Tracer concentration" )
150
- axud = Axis (fig[2 , 2 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " Zonal velocity" )
151
- axcd = Axis (fig[3 , 2 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " Tracer concentration" )
144
+ axua = Axis (fig[2 , 1 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " GM_Adv: Zonal velocity" )
145
+ axca = Axis (fig[3 , 1 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " GM_Adv: Tracer concentration" )
146
+ axud = Axis (fig[2 , 2 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " GM_Dif: Zonal velocity" )
147
+ axcd = Axis (fig[3 , 2 ], xlabel= " y (km)" , ylabel= " z (km)" , title= " GM_Dif: Tracer concentration" )
152
148
153
149
levels = [- 0.0015 + 0.0005 * i for i in 0 : 19 ]
154
150
@@ -174,4 +170,4 @@ display(fig)
174
170
record (fig, filename * " .mp4" , 1 : Nt, framerate= 8 ) do i
175
171
@info " Plotting frame $i of $Nt "
176
172
n[] = i
177
- end
173
+ end
0 commit comments