-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add terminal velocities to P3 scheme
- Loading branch information
1 parent
edd1fde
commit b89e85f
Showing
11 changed files
with
555 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import ClimaParams | ||
import CloudMicrophysics as CM | ||
import CloudMicrophysics.P3Scheme as P3 | ||
import CloudMicrophysics.Parameters as CMP | ||
import CairoMakie as Plt | ||
|
||
const PSP3 = CMP.ParametersP3 | ||
|
||
FT = Float64 | ||
|
||
p3 = CMP.ParametersP3(FT) | ||
|
||
function get_values( | ||
p3::PSP3, | ||
Chen2022::CMP.Chen2022VelTypeSnowIce, | ||
q::FT, | ||
N::FT, | ||
ρ_a::FT, | ||
x_resolution::Int, | ||
y_resolution::Int, | ||
) where {FT} | ||
F_rs = range(FT(0), stop = FT(1 - eps(FT)), length = x_resolution) | ||
ρ_rs = range(FT(25), stop = FT(975), length = y_resolution) | ||
|
||
V_m = zeros(x_resolution, y_resolution) | ||
D_m = zeros(x_resolution, y_resolution) | ||
|
||
for i in 1:x_resolution | ||
for j in 1:y_resolution | ||
F_r = F_rs[i] | ||
ρ_r = ρ_rs[j] | ||
|
||
V_m[i, j] = | ||
P3.terminal_velocity(p3, Chen2022, q, N, ρ_r, F_r, ρ_a)[2] | ||
# get D_m in mm for plots | ||
D_m[i, j] = 1e3 * P3.D_m(p3, q, N, ρ_r, F_r) | ||
end | ||
end | ||
return (; F_rs, ρ_rs, V_m, D_m) | ||
end | ||
|
||
function make_axis_top(fig, col, title) | ||
return Plt.Axis( | ||
fig[1, col], | ||
xlabel = "F_r", | ||
ylabel = "ρ_r", | ||
title = title, | ||
width = 350, height = 350, | ||
limits = (0, 1.0, 25, 975), | ||
xticks = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0], | ||
yticks = [200, 400, 600, 800], | ||
) | ||
end | ||
function make_axis_bottom(fig, col, title) | ||
return Plt.Axis( | ||
fig[3, col], | ||
height = 350, | ||
width = 350, | ||
xlabel = "F_r", | ||
ylabel = "ρ_r", | ||
title = title, | ||
) | ||
end | ||
|
||
function figure_2() | ||
Chen2022 = CMP.Chen2022VelType(FT) | ||
# density of air in kg/m^3 | ||
ρ_a = FT(1.2) #FT(1.293) | ||
# small D_m | ||
q_s = FT(0.0008) | ||
N_s = FT(1e6) | ||
# medium D_m | ||
q_m = FT(0.22) | ||
N_m = FT(1e6) | ||
# large D_m | ||
q_l = FT(0.7) | ||
N_l = FT(1e6) | ||
# get V_m and D_m | ||
xres = 100 | ||
yres = 100 | ||
(F_rs, ρ_rs, V_ms, D_ms) = get_values(p3, Chen2022.snow_ice, q_s, N_s, ρ_a, xres, yres) | ||
(F_rm, ρ_rm, V_mm, D_mm) = get_values(p3, Chen2022.snow_ice, q_m, N_m, ρ_a, xres, yres) | ||
(F_rl, ρ_rl, V_ml, D_ml) = get_values(p3, Chen2022.snow_ice, q_l, N_l, ρ_a, xres, yres) | ||
|
||
fig = Plt.Figure() | ||
|
||
# Plot velocities as in Fig 2 in Morrison and Milbrandt 2015 | ||
|
||
args = (color = :black, labels = true, levels = 3, linewidth = 1.5, labelsize = 18) | ||
|
||
ax1 = make_axis_top(fig, 1, "Small Dₘ") | ||
hm = Plt.contourf!(ax1, F_rs, ρ_rs, V_ms, levels = 0.402:0.001:0.413) | ||
Plt.contour!(ax1, F_rs, ρ_rs, D_ms; args...) | ||
Plt.Colorbar(fig[2, 1], hm, vertical = false) | ||
|
||
ax2 = make_axis_top(fig, 2, "Medium Dₘ") | ||
hm = Plt.contourf!(ax2, F_rm, ρ_rm, V_mm, levels = 2:0.1:4) | ||
Plt.contour!(ax2, F_rm, ρ_rm, D_mm; args...) | ||
Plt.Colorbar(fig[2, 2], hm, vertical = false) | ||
|
||
ax3 = make_axis_top(fig, 3, "Large Dₘ") | ||
hm = Plt.contourf!(ax3, F_rl, ρ_rl, V_ml, levels = 2:0.2:5) | ||
Plt.contour!(ax3, F_rl, ρ_rl, D_ml; args...) | ||
Plt.Colorbar(fig[2, 3], hm, vertical = false) | ||
|
||
Plt.linkxaxes!(ax1, ax2) | ||
Plt.linkxaxes!(ax2, ax3) | ||
Plt.linkyaxes!(ax1, ax2) | ||
Plt.linkyaxes!(ax2, ax3) | ||
|
||
## Plot D_m as second row of comparisons | ||
|
||
ax4 = make_axis_bottom(fig, 1, "Small Dₘ vs F_r and ρ_r") | ||
hm = Plt.contourf!(ax4, F_rs, ρ_rs, D_ms) | ||
Plt.Colorbar(fig[4, 1], hm, vertical = false) | ||
|
||
ax5 = make_axis_bottom(fig, 2, "Medium Dₘ vs F_r and ρ_r") | ||
hm = Plt.contourf!(ax5, F_rm, ρ_rm, D_mm) | ||
Plt.Colorbar(fig[4, 2], hm, vertical = false) | ||
|
||
ax6 = make_axis_bottom(fig, 3, "Large Dₘ vs F_r and ρ_r") | ||
hm = Plt.contourf!(ax6, F_rl, ρ_rl, D_ml) | ||
Plt.Colorbar(fig[4, 3], hm, vertical = false) | ||
|
||
Plt.linkxaxes!(ax1, ax4) | ||
Plt.linkxaxes!(ax4, ax5) | ||
Plt.linkxaxes!(ax5, ax6) | ||
Plt.linkyaxes!(ax1, ax4) | ||
Plt.linkyaxes!(ax4, ax5) | ||
Plt.linkyaxes!(ax5, ax6) | ||
|
||
Plt.resize_to_layout!(fig) | ||
Plt.save("MorrisonandMilbrandtFig2.svg", fig) | ||
end | ||
|
||
# Terminal Velocity figure | ||
figure_2() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.