Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailmints committed Jul 2, 2023
1 parent 8b0c706 commit 92d2e02
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion test/experiments/KiD_driver/run_KiD_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function run_KiD_simulation(::Type{FT}, opts) where {FT}
callback = callbacks,
progress = true,
progress_message = (dt, u, p, t) -> t,
);
)

# Some basic plots
if opts["plotting_flag"] == true
Expand Down
24 changes: 19 additions & 5 deletions test/plotting_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,27 @@ function plot_final_aux_profiles(z_centers, aux, precip; output = "output")
p4 = Plots.plot(T_end, z_centers, xlabel = "T [K]", ylabel = "z [m]")
p5 = Plots.plot(q_rai_end .* 1e3, z_centers, xlabel = "q_rai [g/kg]", ylabel = "z [m]")
p6 = Plots.plot(q_sno_end .* 1e3, z_centers, xlabel = "q_sno [g/kg]", ylabel = "z [m]")

p7 = Plots.plot(xlabel = "precipitation susceptibility", ylabel = "z [m]")
if precip isa KID.Precipitation2M
precip_sus_aut = CMPS.precipitation_susceptibility_autoconversion.(Ref(aux.params.microphys_params),
Ref(precip.rain_formation), q_liq_end, q_rai_end, ρ_end, N_liq_end)
precip_sus_acc = CMPS.precipitation_susceptibility_accretion.(Ref(aux.params.microphys_params),
Ref(precip.rain_formation), q_liq_end, q_rai_end, ρ_end, N_liq_end)
precip_sus_aut =
CMPS.precipitation_susceptibility_autoconversion.(
Ref(aux.params.microphys_params),
Ref(precip.rain_formation),
q_liq_end,
q_rai_end,
ρ_end,
N_liq_end,
)
precip_sus_acc =
CMPS.precipitation_susceptibility_accretion.(
Ref(aux.params.microphys_params),
Ref(precip.rain_formation),
q_liq_end,
q_rai_end,
ρ_end,
N_liq_end,
)
Plots.plot!([r.d_ln_pp_d_ln_q_liq for r in precip_sus_aut], z_centers, label = "aut, q_liq", color = :red)
Plots.plot!([r.d_ln_pp_d_ln_q_rai for r in precip_sus_aut], z_centers, label = "aut, q_rai", color = :brown)
Plots.plot!([r.d_ln_pp_d_ln_q_liq for r in precip_sus_acc], z_centers, label = "acc, q_liq", color = :blue)
Expand Down
16 changes: 11 additions & 5 deletions test/precip_production_tests/test_precip_production.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ Nd_range = FT.(range(1e5, 1e8, 10))
# xlabel = "Prescribed Nd", ylabel = "Precipitation Production Metric")
# Plots.png(p, joinpath(path, "precip_production.png"))

precip_sus = Nd_range ./ total_precipitation_production.(Nd_range) .*
FiniteDiff.finite_difference_derivative.(total_precipitation_production, Nd_range)

p = Plots.plot(Nd_range, precip_sus,
xlabel = "Prescribed Nd", ylabel = "Precipitation Susceptibility", label = "Observed (KiD)")
precip_sus =
Nd_range ./ total_precipitation_production.(Nd_range) .*
FiniteDiff.finite_difference_derivative.(total_precipitation_production, Nd_range)

p = Plots.plot(
Nd_range,
precip_sus,
xlabel = "Prescribed Nd",
ylabel = "Precipitation Susceptibility",
label = "Observed (KiD)",
)

expected_precip_sus = fill!(similar(Nd_range), -2)
Plots.plot!(Nd_range, expected_precip_sus, label = "Expected (Glassmeier & Lohmann)")
Expand Down

0 comments on commit 92d2e02

Please sign in to comment.