Skip to content

Commit a8cf967

Browse files
glwagnerjm-c
andauthored
Fix Corsican bug in validation test (#4070)
* Fix a bug in validation test * AdvectiveSkew -> AdvectiveFormulation * Fix wall clock definition * fix typo * Replace WENO5 with WINO(order=5) * an other little fix --------- Co-authored-by: Jean-Michel Campin <jmc@mit.edu>
1 parent 06a7c1b commit a8cf967

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

validation/mesoscale_turbulence/coarse_baroclinic_adjustment.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ stop_time = 30days
2222

2323
grid = RectilinearGrid(architecture;
2424
topology = (Bounded, Bounded, Bounded),
25-
size = (Ny, Ny, Nz),
25+
size = (Ny, Ny, Nz),
2626
x = (-Ly/2, Ly/2),
2727
y = (-Ly/2, Ly/2),
2828
z = (-Lz, 0),
@@ -49,8 +49,8 @@ model = HydrostaticFreeSurfaceModel(grid = grid,
4949
buoyancy = BuoyancyTracer(),
5050
closure = closures,
5151
tracers = (:b, :c),
52-
momentum_advection = WENO5(),
53-
tracer_advection = WENO5(),
52+
momentum_advection = WENO(order=5),
53+
tracer_advection = WENO(order=5),
5454
free_surface = ImplicitFreeSurface())
5555

5656
@info "Built $model."
@@ -140,7 +140,7 @@ bt = FieldTimeSeries(filepath, "b")
140140
ct = FieldTimeSeries(filepath, "c")
141141

142142
# Build coordinates, rescaling the vertical coordinate
143-
x, y, z = nodes((Center, Center, Center), grid)
143+
x, y, z = nodes(bt)
144144

145145
zscale = 1
146146
z = z .* zscale

validation/mesoscale_turbulence/immersed_corse_baroclinic_adjustment.jl renamed to validation/mesoscale_turbulence/immersed_coarse_baroclinic_adjustment.jl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ using Random
44
using Oceananigans
55
using Oceananigans.Units
66
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
99

1010
filename = "coarse_baroclinic_adjustment"
11+
wall_clock = Ref(time_ns())
1112

1213
function progress(sim)
1314
@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)
2122
prettytime(sim.Δt))
2223

2324
wall_clock[] = time_ns()
24-
25+
2526
return nothing
2627
end
2728

@@ -37,7 +38,7 @@ save_fields_interval = 2day
3738
stop_time = 300days
3839

3940
grid = RectilinearGrid(topology = (Flat, Bounded, Bounded),
40-
size = (Ny, Nz),
41+
size = (Ny, Nz),
4142
y = (-Ly/2, Ly/2),
4243
z = (-Lz, 0),
4344
halo = (5, 5))
@@ -50,14 +51,13 @@ grid = ImmersedBoundaryGrid(grid, GridFittedBottom(y -> y > 0 ? -Lz : -Lz/2))
5051
slope_limiter = FluxTapering(1000) # Allow very steep slopes
5152

5253
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())
5455

5556
function run_simulation(closure, grid)
56-
model = HydrostaticFreeSurfaceModel(; grid,
57+
model = HydrostaticFreeSurfaceModel(; grid, closure,
5758
coriolis = FPlane(latitude = -45),
5859
buoyancy = BuoyancyTracer(),
5960
tracer_advection = WENO(order=7),
60-
closure = adv_closure,
6161
tracers = (:b, :c))
6262

6363
@info "Built $model."
@@ -85,14 +85,10 @@ function run_simulation(closure, grid)
8585
#####
8686

8787
simulation = Simulation(model; Δt, stop_time)
88+
add_callback!(simulation, progress, IterationInterval(144))
89+
suffix = closure isa SkewAdvectionISSD ? "advective" : "diffusive"
8890

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),
9692
schedule = TimeInterval(save_fields_interval),
9793
filename = filename * "_fields_" * suffix,
9894
overwrite_existing = true)
@@ -145,10 +141,10 @@ cd = @lift ctd[$n]
145141

146142
fig = Figure(size=(1800, 700))
147143

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")
152148

153149
levels = [-0.0015 + 0.0005 * i for i in 0:19]
154150

@@ -174,4 +170,4 @@ display(fig)
174170
record(fig, filename * ".mp4", 1:Nt, framerate=8) do i
175171
@info "Plotting frame $i of $Nt"
176172
n[] = i
177-
end
173+
end

0 commit comments

Comments
 (0)