Skip to content

Commit 15ddc71

Browse files
authored
Merge pull request #613 from CliMA/he/rft-activity-based-deposition
rft: activity-based deposition plots
2 parents d896da5 + c1d6260 commit 15ddc71

File tree

1 file changed

+51
-59
lines changed

1 file changed

+51
-59
lines changed
Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Plots as PL
1+
import CairoMakie as MK
22

33
import CloudMicrophysics as CM
44
import CloudMicrophysics.Common as CO
@@ -7,19 +7,17 @@ import CloudMicrophysics.Parameters as CMP
77
import CloudMicrophysics.ThermodynamicsInterface as TDI
88

99
FT = Float32
10-
const tps = TDI.TD.Parameters.ThermodynamicsParameters(FT)
11-
const feldspar = CMP.Feldspar(FT)
12-
const ferrihydrite = CMP.Ferrihydrite(FT)
13-
const kaolinite = CMP.Kaolinite(FT)
10+
tps = TDI.TD.Parameters.ThermodynamicsParameters(FT)
11+
feldspar = CMP.Feldspar(FT)
12+
ferrihydrite = CMP.Ferrihydrite(FT)
13+
kaolinite = CMP.Kaolinite(FT)
1414

1515
# Initializing
16+
m_to_cm = 100
1617
Δa_w = range(FT(0), stop = FT(0.32), length = 50) # difference in solution and ice water activity
17-
J_feldspar = @. IN.deposition_J(feldspar, Δa_w) # J in SI units
18-
log10J_converted_feldspar = @. log10(J_feldspar * 1e-4) # converts J into cm^-2 s^-1 and takes log
18+
J_feldspar = @. IN.deposition_J(feldspar, Δa_w) # J, in SI units (m⁻² s⁻¹)
1919
J_ferrihydrite = @. IN.deposition_J(ferrihydrite, Δa_w)
20-
log10J_converted_ferrihydrite = @. log10(J_ferrihydrite * 1e-4)
2120
J_kaolinite = @. IN.deposition_J(kaolinite, Δa_w)
22-
log10J_converted_kaolinite = @. log10(J_kaolinite * 1e-4)
2321

2422
# Alpert et al 2022 Figure 6
2523
# https://doi.org/10.1039/d1ea00077b
@@ -30,58 +28,52 @@ log10J_converted_kaolinite = @. log10(J_kaolinite * 1e-4)
3028
# China et al 2017 figure S5
3129
# using https://automeris.io/WebPlotDigitizer/
3230

33-
#! format: off
34-
Alpert2022_Feldspar_Delta_a = [0.019459, 0.256216]
35-
Alpert2022_Feldspar_log10J = [1.039735, 4.165563]
31+
Alpert2022_Feldspar_Δa = [0.019459, 0.256216]
32+
Alpert2022_Feldspar_J = exp10.([1.039735, 4.165563])
3633

37-
Alpert2022_Ferrihydrite_Delta_a = [0.0989189, 0.336486]
38-
Alpert2022_Ferrihydrite_log10J = [1.2781457, 4.21854]
34+
Alpert2022_Ferrihydrite_Δa = [0.0989189, 0.336486]
35+
Alpert2022_Ferrihydrite_J = exp10.([1.2781457, 4.21854])
3936

40-
China2017_Delta_a = [0.01918, 0.02398, 0.02518, 0.03537, 0.07314, 0.07794, 0.10252, 0.10492, 0.1217, 0.1307, 0.15588, 0.16787, 0.20264, 0.23981, 0.256, 0.27638]
41-
China2017_log10J = [-4.36923, -5.07692, -1.38462, -0.64615, 1.2, 1.35385, -0.58462, 1.90769, 2.06154, 2.24615, 2.52308, 0, 2.46154, 3.32308, 4, 4.43077, 5.26154]
42-
#! format: on
37+
China2017_Δa = [
38+
0.029478, 0.033209, 0.034328, 0.043657, 0.045149, 0.079851, 0.084701, 0.10896, 0.11082, 0.12687,
39+
0.13545, 0.1597, 0.1709, 0.20448, 0.2403, 0.25597, 0.27575]
40+
China2017_J =
41+
exp10.([
42+
-4.4108, -5.0923, -1.4199, -0.65547, 1.1709, 1.3786, -0.56696, 1.9061, 2.067, 2.2509,
43+
2.5335, -0.010108, 2.5005, 3.3701, 4.0395, 4.4841, 5.3108,
44+
])
45+
China2017_J_perror =
46+
exp10.([
47+
-2.0831, -2.7646, 0.94809, 1.6724, 3.5388, 3.7064, 1.7407, 4.2339, 4.3949, 5.2609,
48+
5.5436, 2.3579, 5.4905, 5.6377, 5.6248, 5.8687, 6.555,
49+
])
50+
China2017_J_merror =
51+
exp10.([
52+
-5.7353, -6.3766, -2.684, -1.9597, -0.093296, 0.074277, -1.8713, 0.60178, 0.76277, 0.80605,
53+
1.0888, -1.2743, 1.0155, 1.9253, 2.6348, 3.0794, 3.9463,
54+
])
4355

44-
PL.plot(
45-
Δa_w,
46-
log10J_converted_feldspar,
47-
label = "CM.jl Feldspar",
48-
xlabel = "Delta a_w [unitless]",
49-
ylabel = "log10(J) [cm^-2 s^-1]",
50-
linestyle = :dash,
51-
linecolor = :cyan,
52-
)
53-
PL.plot!(
54-
Δa_w,
55-
log10J_converted_ferrihydrite,
56-
label = "CM.jl Ferrihydrite",
57-
linestyle = :dash,
58-
linecolor = :pink,
59-
)
60-
PL.plot!(
61-
Δa_w,
62-
log10J_converted_kaolinite,
63-
label = "CM.jl Kaolinite",
64-
linestyle = :dash,
65-
linecolor = :orange,
66-
)
67-
PL.plot!(
68-
Alpert2022_Feldspar_Delta_a,
69-
Alpert2022_Feldspar_log10J,
70-
linecolor = :blue,
71-
label = "Alpert2022 Feldspar",
72-
)
73-
PL.plot!(
74-
Alpert2022_Ferrihydrite_Delta_a,
75-
Alpert2022_Ferrihydrite_log10J,
76-
linecolor = :red,
77-
label = "Alpert2022 Ferrihydrite",
78-
)
79-
PL.scatter!(
80-
China2017_Delta_a,
81-
China2017_log10J,
82-
markercolor = :yellow,
83-
markersize = 2,
84-
label = "China2017 Kaolinite",
56+
# Create figure and axis
57+
blue, orange, green, pink, cyan, red, yellow = MK.Makie.wong_colors()
58+
fig = MK.Figure()
59+
ax = MK.Axis(fig[1, 1], xlabel = "Δa_w [unitless]", ylabel = "J [cm⁻² s⁻¹]"; yscale = MK.log10)
60+
61+
# Plot CM.jl model lines
62+
MK.lines!(ax, Δa_w, J_feldspar / m_to_cm^2; label = "CM.jl Feldspar", linestyle = :dash, color = cyan)
63+
MK.lines!(ax, Δa_w, J_ferrihydrite / m_to_cm^2; label = "CM.jl Ferrihydrite", linestyle = :dash, color = pink)
64+
MK.lines!(ax, Δa_w, J_kaolinite / m_to_cm^2; label = "CM.jl Kaolinite", linestyle = :dash, color = green)
65+
66+
# Plot Alpert 2022 data
67+
MK.lines!(ax, Alpert2022_Feldspar_Δa, Alpert2022_Feldspar_J, color = blue, label = "Alpert2022 Feldspar")
68+
MK.lines!(ax, Alpert2022_Ferrihydrite_Δa, Alpert2022_Ferrihydrite_J; color = red, label = "Alpert2022 Ferrihydrite")
69+
70+
# Plot China 2017 scatter data
71+
MK.rangebars!(ax, China2017_Δa, China2017_J_merror, China2017_J_perror; whiskerwidth = 5, color = yellow)
72+
MK.scatter!(ax, China2017_Δa, China2017_J;
73+
color = yellow, markersize = 4, strokewidth = 0.5, label = "China2017 Kaolinite",
8574
)
8675

87-
PL.savefig("water_activity_depo_nuc.svg")
76+
# Add legend
77+
MK.axislegend(ax, position = :rb)
78+
79+
MK.save("water_activity_depo_nuc.svg", fig)

0 commit comments

Comments
 (0)