-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculate_b_gradient_effective_AMD_WENO9AMD.jl
75 lines (50 loc) · 3.03 KB
/
calculate_b_gradient_effective_AMD_WENO9AMD.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using Oceananigans
using CairoMakie
using Loess
FILE_DIRS = [
"./LES/linearb_turbulencestatistics_dbdz_1.953125e-5_QU_-0.0005_QB_1.0e-7_b_0.0_AMD_Lxz_64.0_128.0_Nxz_32_64_f",
"./LES/linearb_turbulencestatistics_dbdz_1.953125e-5_QU_-0.0005_QB_1.0e-7_b_0.0_WENO9AMD_Lxz_64.0_128.0_Nxz_32_64_f",
"./LES/linearb_turbulencestatistics_dbdz_1.953125e-5_QU_-0.0005_QB_1.0e-7_b_0.0_AMD_Lxz_64.0_128.0_Nxz_64_128_f",
"./LES/linearb_turbulencestatistics_dbdz_1.953125e-5_QU_-0.0005_QB_1.0e-7_b_0.0_WENO9AMD_Lxz_64.0_128.0_Nxz_64_128_f",
"./LES/linearb_turbulencestatistics_dbdz_1.953125e-5_QU_-0.0005_QB_1.0e-7_b_0.0_AMD_Lxz_64.0_128.0_Nxz_128_256_f",
"./LES/linearb_turbulencestatistics_dbdz_1.953125e-5_QU_-0.0005_QB_1.0e-7_b_0.0_WENO9AMD_Lxz_64.0_128.0_Nxz_128_256_f",
]
labels = [
"AMD + Centered 2nd Order, 2m resolution",
"AMD + WENO, 2m resolution",
"AMD + Centered 2nd Order, 1m resolution",
"AMD + WENO, 1m resolution",
"AMD + Centered 2nd Order, 0.5m resolution",
"AMD + WENO, 0.5m resolution",
]
bbar_datas = [FieldTimeSeries("$(FILE_DIR)/instantaneous_timeseries.jld2", "bbar") for FILE_DIR in FILE_DIRS]
Δzs = [bbar_data.grid.Δzᵃᵃᶜ for bbar_data in bbar_datas]
Nzs = [bbar_data.grid.Nz for bbar_data in bbar_datas]
times = [bbar_data.times for bbar_data in bbar_datas]
zFs = [bbar_data.grid.zᵃᵃᶠ[1:Nz+1] for (bbar_data, Nz) in zip(bbar_datas, Nzs)]
zFs_Δb = [zF[2:end-1] for zF in zFs]
Δbs = [(interior(data)[1, 1, 2:end, :] .- interior(data)[1, 1, 1:end-1, :]) ./ Δz for (data, Δz) in zip(bbar_datas, Δzs)]
Δbs_argmax = [argmax(Δb, dims=1)[:] for Δb in Δbs]
Δbs_max = [Δb[argmax] for (Δb, argmax) in zip(Δbs, Δbs_argmax)]
zFs_max = [[zF[argmax[1]] for argmax in Δb_argmax] for (zF, Δb_argmax) in zip(zFs_Δb, Δbs_argmax)]
times_fit = [range(extrema(time)..., step=maximum(time)/1000) for time in times]
loess_model_Δbs = [loess(time, Δb_max, span=0.5) for (time, Δb_max) in zip(times, Δbs_max)]
Δbs_fit = [predict(model, time) for (model, time) in zip(loess_model_Δbs, times_fit)]
loess_model_zFs = [loess(time, zF_max) for (time, zF_max) in zip(times, zFs_max)]
zFs_fit = [predict(model, time) for (model, time) in zip(loess_model_zFs, times_fit)]
with_theme(theme_latexfonts()) do
fig = Figure(size=(1200, 700))
axΔb = Axis(fig[1, 1], ylabel="Maximum buoyancy gradient in the vertical (s⁻²)", xlabel="Time (days)")
axzF = Axis(fig[1, 2], ylabel="z-location of maximum buoyancy gradient (m)", xlabel="Time (days)")
for (Δb_fit, time, label) in zip(Δbs_fit, times_fit, labels)
lines!(axΔb, time ./ 86400, Δb_fit, label=label)
end
for (zF_fit, time, label) in zip(zFs_fit, times_fit, labels)
lines!(axzF, time ./ 86400, zF_fit, label=label)
end
Legend(fig[2, :], axzF, orientation=:horizontal, nbanks=2)
hidedecorations!(axΔb, ticks=false, label=false, ticklabels=false)
hidedecorations!(axzF, ticks=false, label=false, ticklabels=false)
display(fig)
save("./Data/MLD_AMD_WENO9AMD_resolution.png", fig, px_per_unit=8)
end