|
1 |
| -import Plots as PL |
| 1 | +import CairoMakie as MK |
2 | 2 |
|
3 | 3 | import CloudMicrophysics as CM
|
4 | 4 | import CloudMicrophysics.AerosolModel as AM
|
@@ -35,62 +35,46 @@ sulfate = CMP.Sulfate(FT)
|
35 | 35 |
|
36 | 36 | mass_fractions_1 = (1.0,)
|
37 | 37 | paper_mode_1_B = AM.Mode_B(
|
38 |
| - r_dry, |
39 |
| - stdev, |
40 |
| - N_1, |
41 |
| - mass_fractions_1, |
42 |
| - (sulfate.ϵ,), |
43 |
| - (sulfate.ϕ,), |
44 |
| - (sulfate.M,), |
45 |
| - (sulfate.ν,), |
46 |
| - (sulfate.ρ,), |
| 38 | + r_dry, stdev, N_1, mass_fractions_1, |
| 39 | + (sulfate.ϵ,), (sulfate.ϕ,), (sulfate.M,), (sulfate.ν,), (sulfate.ρ,), |
47 | 40 | )
|
48 | 41 |
|
49 | 42 | N_2_range = range(0, stop = 5000 * 1e6, length = 100)
|
50 |
| -N_act_frac_B = Vector{Float64}(undef, 100) |
| 43 | +N_act_frac_B = similar(N_2_range) |
51 | 44 |
|
52 |
| -it = 1 |
53 |
| -for N_2 in N_2_range |
| 45 | +for (it, N_2) in enumerate(N_2_range) |
54 | 46 | mass_fractions_2 = (1.0,)
|
55 | 47 | paper_mode_2_B = AM.Mode_B(
|
56 |
| - r_dry, |
57 |
| - stdev, |
58 |
| - N_2, |
59 |
| - mass_fractions_2, |
60 |
| - (sulfate.ϵ,), |
61 |
| - (sulfate.ϕ,), |
62 |
| - (sulfate.M,), |
63 |
| - (sulfate.ν,), |
64 |
| - (sulfate.ρ,), |
| 48 | + r_dry, stdev, N_2, mass_fractions_2, |
| 49 | + (sulfate.ϵ,), (sulfate.ϕ,), (sulfate.M,), (sulfate.ν,), (sulfate.ρ,), |
65 | 50 | )
|
66 | 51 | AD_B = AM.AerosolDistribution((paper_mode_1_B, paper_mode_2_B))
|
67 |
| - N_act_frac_B[it] = |
68 |
| - AA.N_activated_per_mode(ap, AD_B, aip, tps, T, p, w, q_vs, FT(0), FT(0))[1] / N_1 |
69 |
| - global it += 1 |
| 52 | + N_act_frac_B[it] = AA.N_activated_per_mode(ap, AD_B, aip, tps, T, p, w, q_vs, FT(0), FT(0))[1] / N_1 |
70 | 53 | end
|
71 | 54 |
|
72 | 55 | # data read from Fig 1 in Abdul-Razzak and Ghan 2000
|
73 | 56 | # using https://automeris.io/WebPlotDigitizer/
|
74 | 57 | include(joinpath(pkgdir(CM), "docs", "src", "plots", "ARGdata.jl"))
|
75 | 58 |
|
76 |
| -PL.plot( |
77 |
| - N_2_range * 1e-6, |
78 |
| - N_act_frac_B, |
79 |
| - label = "CliMA-B", |
80 |
| - xlabel = "Mode 2 aerosol number concentration [1/cm3]", |
81 |
| - ylabel = "Mode 1 number fraction activated", |
82 |
| -) |
83 |
| -PL.scatter!( |
84 |
| - Fig1_x_obs, |
85 |
| - Fig1_y_obs, |
86 |
| - markercolor = :black, |
87 |
| - label = "paper observations", |
88 |
| -) |
89 |
| -PL.plot!( |
90 |
| - Fig1_x_param, |
91 |
| - Fig1_y_param, |
92 |
| - linecolor = :black, |
93 |
| - label = "paper parameterization", |
94 |
| -) |
| 59 | +# Create figure and axis |
| 60 | +m_to_cm = FT(100) |
| 61 | +fig = MK.with_theme(MK.theme_minimal(), linewidth = 2, fontsize = 14) do |
| 62 | + fig = MK.Figure() |
| 63 | + ax = MK.Axis(fig[1, 1]; |
| 64 | + xlabel = "Mode 2 aerosol number concentration [1/cm³]", ylabel = "Mode 1 number fraction activated", |
| 65 | + limits = (extrema(N_2_range) ./ m_to_cm^3, (0, 1)), |
| 66 | + ) |
| 67 | + |
| 68 | + # Plot the computed data |
| 69 | + MK.lines!(ax, N_2_range / m_to_cm^3, N_act_frac_B; label = "CliMA-B") |
| 70 | + # Plot the observed data points |
| 71 | + MK.scatter!(ax, Fig1_x_obs, Fig1_y_obs; label = "paper observations", color = :black, markersize = 15) |
| 72 | + # Plot the parameterization line |
| 73 | + MK.lines!(ax, Fig1_x_param, Fig1_y_param; label = "paper parameterization", color = :black) |
| 74 | + # Add legend |
| 75 | + MK.axislegend(ax, position = :rt) |
| 76 | + # Save the figure |
| 77 | + # MK.save("Abdul-Razzak_and_Ghan_fig_1.svg", fig) |
95 | 78 |
|
96 |
| -PL.savefig("Abdul-Razzak_and_Ghan_fig_1.svg") |
| 79 | + fig |
| 80 | +end |
0 commit comments