Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion box/Alpert_Knopf_2016_backward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ J_immer = @. CMI_het.ABIFM_J(aerosol, Δa) # m^-2 s^-1

#! format: off
# Plot results
fig = MK.Figure(resolution = (1200, 400))
fig = MK.Figure(size = (1200, 400))
ax1 = MK.Axis(fig[1, 1], ylabel = "J_immer [cm^-2 s^-1]", xlabel = "Temperature [K]", yscale = log10)
ax2 = MK.Axis(fig[1, 2], ylabel = "frozen fraction", xlabel = "Temperature [K]")
ax3 = MK.Axis(fig[1, 3], ylabel = "total A [cm^2]", xlabel = "Temperature [K]", yscale = log10)
Expand Down
2 changes: 1 addition & 1 deletion box/Alpert_Knopf_2016_forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ff_var = @. frozen_frac(sol_var[4, :], sol_var[3, :])

#! format: off
# Plot results
fig = MK.Figure(resolution = (1200, 400))
fig = MK.Figure(size = (1200, 400))
ax1 = MK.Axis(fig[1, 1], ylabel = "J_immer [cm^-2 s^-1]", xlabel = "Temperature [K]", yscale = log10)
ax2 = MK.Axis(fig[1, 2], ylabel = "frozen fraction", xlabel = "Temperature [K]")
ax3 = MK.Axis(fig[1, 3], ylabel = "total A [cm2]", xlabel = "Temperature [K]", yscale = log10)
Expand Down
20 changes: 8 additions & 12 deletions docs/src/plots/ARGplots.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import Plots

import CloudMicrophysics
import ClimaParams
import Thermodynamics
import Plots as PL

const PL = Plots
const AM = CloudMicrophysics.AerosolModel
const AA = CloudMicrophysics.AerosolActivation
const CP = ClimaParams
const CMP = CloudMicrophysics.Parameters
const TD = Thermodynamics
import Thermodynamics as TD

import CloudMicrophysics.AerosolModel as AM
import CloudMicrophysics.AerosolActivation as AA
import CloudMicrophysics.Parameters as CMP

FT = Float64

tps = Thermodynamics.Parameters.ThermodynamicsParameters(FT)
FT = Float64
tps = TD.Parameters.ThermodynamicsParameters(FT)
aip = CMP.AirProperties(FT)
ap = CMP.AerosolActivationParameters(FT)

Expand Down
18 changes: 8 additions & 10 deletions docs/src/plots/ARGplots_fig1.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import Plots

import CloudMicrophysics
import ClimaParams
import Thermodynamics
import Plots as PL

import Thermodynamics as TD

import CloudMicrophysics.AerosolModel as AM
import CloudMicrophysics.AerosolActivation as AA
import CloudMicrophysics.Parameters as CMP

const PL = Plots
const AM = CloudMicrophysics.AerosolModel
const AA = CloudMicrophysics.AerosolActivation
const CMP = CloudMicrophysics.Parameters
const TD = Thermodynamics

FT = Float64
tps = Thermodynamics.Parameters.ThermodynamicsParameters(FT)
tps = TD.Parameters.ThermodynamicsParameters(FT)
aip = CMP.AirProperties(FT)
ap = CMP.AerosolActivationParameters(FT)

Expand Down
12 changes: 5 additions & 7 deletions docs/src/plots/Baumgartner2022_fig5.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import RootSolvers as RS
import CairoMakie as MK

import CloudMicrophysics as CM
import Thermodynamics as TD
import ClimaParams as CP

const CMO = CM.Common
const CMP = CM.Parameters
import CloudMicrophysics.Common as CO
import CloudMicrophysics.Parameters as CMP

FT = Float64
tps = TD.Parameters.ThermodynamicsParameters(FT)
Expand Down Expand Up @@ -54,12 +52,12 @@ a_w_Nach = [Δa_crit + (Baumgartner_p_ice(T)) / (Nach_p_liq(T)) for T in T_range
a_w_Luo = [
Δa_crit +
(Baumgartner_p_ice(T)) /
(CMO.H2SO4_soln_saturation_vapor_pressure(H2SO4_prs, 0.0, T)) for
(CO.H2SO4_soln_saturation_vapor_pressure(H2SO4_prs, 0.0, T)) for
T in T_range
]

#! format: off
fig = MK.Figure(resolution = (800, 600))
fig = MK.Figure(size = (800, 600))
ax1 = MK.Axis(fig[1, 1], title = "Water Activity vs Temperature", ylabel = "a_w [-]", xlabel = "T [K]")
MK.lines!(ax1, BG2022_fig5_T, BG2022_fig5_aw, label = "Baumgartner2022", linestyle = :dash, color = :blue)
MK.lines!(ax1, T_range, a_w, label = "CloudMicrophysics", color = :blue)
Expand All @@ -70,7 +68,7 @@ MK.lines!(ax1, T_range, a_w_ice, label = "a_w_ice", color = :red)
MK.axislegend(position = :lt)
MK.save("Baumgartner2022_fig5.svg", fig)

fig = MK.Figure(resolution = (800, 600))
fig = MK.Figure(size = (800, 600))
ax1 = MK.Axis(fig[1, 1], title = "Saturated Vapor Pressure vs Temperature", ylabel = "Pressure [Pa]", xlabel = "T [K]")
MK.lines!(ax1, T_range, [Baumgartner_p_ice(T) for T in T_range], label = "Baumgartner's p_ice", color = :blue, linestyle = :dash)
MK.lines!(ax1, T_range, p_sat_ice, label = "CM's p_ice", color = :blue)
Expand Down
5 changes: 2 additions & 3 deletions docs/src/plots/CLOUD_Nucleation_Plots.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Plots
import Plots

import ClimaParams as CP
import CloudMicrophysics.Parameters as CMP
import CloudMicrophysics.Nucleation as Nucleation
import CloudMicrophysics.Nucleation

FT = Float64
params = CMP.H2S04NucleationParameters(FT)
Expand Down
41 changes: 19 additions & 22 deletions docs/src/plots/Cholette2019_fig1.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import ClimaParams
import CloudMicrophysics as CM
import CairoMakie as MK

import CloudMicrophysics.P3Scheme as P3
import CloudMicrophysics.Parameters as CMP
import CloudMicrophysics.Common as CO
import CairoMakie as Plt

const PSP3 = CMP.ParametersP3
import CloudMicrophysics.Parameters.ParametersP3 as PSP3

FT = Float64

Expand Down Expand Up @@ -72,10 +69,10 @@ function fig1()
colors = [:black, :blue, :red, :green]
res = 50

fig = Plt.Figure(size = (1200, 400))
fig = MK.Figure(size = (1200, 400))

#F_r = 0
ax1 = Plt.Axis(
ax1 = MK.Axis(
fig[1:7, 1:9],
title = "Fᵣ = 0",
xlabel = "Dₚ (m)",
Expand All @@ -92,8 +89,8 @@ function fig1()
P3.thresholds(p3, ρ_r, F_rs[1]),
res,
)
Plt.lines!(ax1, D_ps, V_0_ϕ, color = colors[i], label = labels[i])
Plt.lines!(
MK.lines!(ax1, D_ps, V_0_ϕ, color = colors[i], label = labels[i])
MK.lines!(
ax1,
D_ps,
V_0,
Expand All @@ -104,7 +101,7 @@ function fig1()
end

# F_r = 1
ax2 = Plt.Axis(
ax2 = MK.Axis(
fig[1:7, 10:18],
title = "Fᵣ = 1",
xlabel = "Dₚ (m)",
Expand All @@ -120,8 +117,8 @@ function fig1()
P3.thresholds(p3, ρ_r, F_rs[2]),
res,
)
Plt.lines!(ax2, D_ps, V_1_ϕ, color = colors[i], label = labels[i])
Plt.lines!(
MK.lines!(ax2, D_ps, V_1_ϕ, color = colors[i], label = labels[i])
MK.lines!(
ax2,
D_ps,
V_1,
Expand All @@ -131,20 +128,20 @@ function fig1()
)
end

Plt.Legend(
MK.Legend(
fig[4, 19:22],
[
Plt.LineElement(color = :black),
Plt.LineElement(color = :blue),
Plt.LineElement(color = :red),
Plt.LineElement(color = :green),
Plt.LineElement(color = :black, linestyle = :dash),
MK.LineElement(color = :black),
MK.LineElement(color = :blue),
MK.LineElement(color = :red),
MK.LineElement(color = :green),
MK.LineElement(color = :black, linestyle = :dash),
],
labels,
framevisible = false,
)

Plt.linkaxes!(ax1, ax2)
MK.linkaxes!(ax1, ax2)
ax1.xticks = (
[0, 0.002, 0.004, 0.006, 0.008, 0.01],
string.([0, 0.002, 0.004, 0.006, 0.008, 0.01]),
Expand All @@ -155,8 +152,8 @@ function fig1()
)


Plt.resize_to_layout!(fig)
Plt.save("Choletteetal2019_fig1.svg", fig)
MK.resize_to_layout!(fig)
MK.save("Choletteetal2019_fig1.svg", fig)
end

fig1()
46 changes: 21 additions & 25 deletions docs/src/plots/CloudDiagnostics.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CairoMakie as PL
PL.activate!(type = "svg")
import CairoMakie as MK
MK.activate!(type = "svg")

import ClimaParams as CP

Expand All @@ -16,11 +16,7 @@ cloud_liquid = CMP.CloudLiquid(FT)
cloud_ice = CMP.CloudIce(FT)

override_file = joinpath(
pkgdir(CloudMicrophysics),
"src",
"parameters",
"toml",
"SB2006_limiters.toml",
pkgdir(CloudMicrophysics), "src", "parameters", "toml", "SB2006_limiters.toml",
)
toml_dict = CP.create_toml_dict(FT; override_file)
SB = CMP.SB2006(toml_dict)
Expand Down Expand Up @@ -54,35 +50,35 @@ reff_2M_100_LH = [CMD.effective_radius_Liu_Hallet_97(cloud_liquid, ρ_air, q_li
reff_2M_1000_LH = [CMD.effective_radius_Liu_Hallet_97(cloud_liquid, ρ_air, q_liq, FT(1000 * 1e6), FT(0), FT(0)) for q_liq in q_liq_range]

# plotting
fig = PL.Figure(size = (1100, 1000), fontsize=22, linewidth=3)
fig = MK.Figure(size = (1100, 1000), fontsize=22, linewidth=3)

ax1 = PL.Axis(fig[1, 1])
ax2 = PL.Axis(fig[2, 1])
ax1 = MK.Axis(fig[1, 1])
ax2 = MK.Axis(fig[2, 1])

PL.ylims!(ax2, [-50, 40])
MK.ylims!(ax2, [-50, 40])

ax1.xlabel = "q_liq [g/kg]"
ax1.ylabel = "effective radius [μm]"
ax2.xlabel = "q_rai [g/kg]"
ax2.ylabel = "radar reflectivity [dBZ]"

#p_reff_2M_100 = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_100 * 1e6, color = :blue, linestyle = :dot)
#p_reff_2M_1000 = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_1000 * 1e6, color = :skyblue1, linestyle = :dot)
p_reff_2M_100_nolim = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_100_nolim * 1e6, color = :blue)
p_reff_2M_100_LH = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_100_LH * 1e6, color = :crimson)
#p_reff_2M_100 = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_100 * 1e6, color = :blue, linestyle = :dot)
#p_reff_2M_1000 = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_1000 * 1e6, color = :skyblue1, linestyle = :dot)
p_reff_2M_100_nolim = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_100_nolim * 1e6, color = :blue)
p_reff_2M_100_LH = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_100_LH * 1e6, color = :crimson)

p_reff_2M_1000_nolim = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_nolim * 1e6, color = :skyblue1)
p_reff_2M_1000_LH = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_LH * 1e6, color = :orange)
p_reff_2M_1000_nolim = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_nolim * 1e6, color = :skyblue1)
p_reff_2M_1000_LH = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_LH * 1e6, color = :orange)

p_Z_1M = PL.lines!(ax2, q_rain_range * 1e3, Z_1M, color = :green)
p_Z_1M = MK.lines!(ax2, q_rain_range * 1e3, Z_1M, color = :green)

p_Z_2M_100 = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_100, color = :skyblue1, linestyle = :dot)
p_Z_2M_100_nolim = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_100_nolim, color = :skyblue1)
p_Z_2M_100 = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_100, color = :skyblue1, linestyle = :dot)
p_Z_2M_100_nolim = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_100_nolim, color = :skyblue1)

p_Z_2M_10 = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_10, color = :blue, linestyle = :dot)
p_Z_2M_10_nolim = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_10_nolim, color = :blue)
p_Z_2M_10 = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_10, color = :blue, linestyle = :dot)
p_Z_2M_10_nolim = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_10_nolim, color = :blue)

PL.Legend(
MK.Legend(
fig[1, 2],
[p_reff_2M_100_nolim, p_reff_2M_100_LH, p_reff_2M_1000_nolim, p_reff_2M_1000_LH],
[
Expand All @@ -93,7 +89,7 @@ PL.Legend(
],
framevisible = false,
)
PL.Legend(
MK.Legend(
fig[2, 2],
[p_Z_1M, p_Z_2M_100, p_Z_2M_100_nolim, p_Z_2M_10, p_Z_2M_10_nolim],
[
Expand All @@ -108,4 +104,4 @@ PL.Legend(

#! format: on

PL.save("CloudDiagnostics.svg", fig)
MK.save("CloudDiagnostics.svg", fig)
2 changes: 0 additions & 2 deletions docs/src/plots/Frostenberg_fig1.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Plots as PL

import CloudMicrophysics as CM
import CloudMicrophysics.HetIceNucleation as IN
import ClimaParams as CP
import CloudMicrophysics.Parameters as CMP

FT = Float32
Expand Down
22 changes: 10 additions & 12 deletions docs/src/plots/HomFreezingPlots.jl
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
import CairoMakie as MK

import Thermodynamics as TD
import CloudMicrophysics as CM
import ClimaParams as CP

const CMO = CM.Common
const CMI = CM.HomIceNucleation
const CMP = CM.Parameters
import CloudMicrophysics.Common as CO
import CloudMicrophysics.HomIceNucleation as CMI
import CloudMicrophysics.Parameters as CMP

FT = Float64
const tps = TD.Parameters.ThermodynamicsParameters(FT)
const H2SO4_prs = CMP.H2SO4SolutionParameters(FT)
const ip = CMP.IceNucleationParameters(FT)
tps = TD.Parameters.ThermodynamicsParameters(FT)
H2SO4_prs = CMP.H2SO4SolutionParameters(FT)
ip = CMP.IceNucleationParameters(FT)

# Initializing
T_range = range(229.0, stop = 234.5, length = 50) # air temperature
x_sulph = Vector{FT}([0.03, 0.04, 0.06]) # wt% sulphuric acid in droplets

# Solving for Δa and J values
Δa1 = [
CMO.a_w_xT(H2SO4_prs, tps, x_sulph[1], T) - CMO.a_w_ice(tps, T) for
CO.a_w_xT(H2SO4_prs, tps, x_sulph[1], T) - CO.a_w_ice(tps, T) for
T in T_range
]
Δa2 = [
CMO.a_w_xT(H2SO4_prs, tps, x_sulph[2], T) - CMO.a_w_ice(tps, T) for
CO.a_w_xT(H2SO4_prs, tps, x_sulph[2], T) - CO.a_w_ice(tps, T) for
T in T_range
]
Δa3 = [
CMO.a_w_xT(H2SO4_prs, tps, x_sulph[3], T) - CMO.a_w_ice(tps, T) for
CO.a_w_xT(H2SO4_prs, tps, x_sulph[3], T) - CO.a_w_ice(tps, T) for
T in T_range
]

Expand Down Expand Up @@ -60,7 +58,7 @@ Baum_Delta_a = [0.26, 0.27, 0.28, 0.29, 0.3, 0.32, 0.33, 0.339]
Baum_J = [4.25e-5, 0.306, 454.09, 2.06e5, 6.31e7, 1.8e12, 4.45e14, 1.69e17]

# Plotting
fig = MK.Figure(resolution = (800, 500))
fig = MK.Figure(size = (800, 500))
ax1 = MK.Axis(
fig[1, 1],
ylabel = "log10(J) with J in SI units",
Expand Down
5 changes: 2 additions & 3 deletions docs/src/plots/Kirkby_organic_nucleation_plots.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Plots
import Plots

import ClimaParams as CP
import CloudMicrophysics.Parameters as CMP
import CloudMicrophysics.Nucleation as Nucleation
import CloudMicrophysics.Nucleation

FT = Float64
params = CMP.OrganicNucleationParameters(FT)
Expand Down
7 changes: 3 additions & 4 deletions docs/src/plots/KnopfAlpert2013_fig1.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import Plots as PL

import Thermodynamics as TD
import CloudMicrophysics as CM
import CloudMicrophysics.Common as CO
import CloudMicrophysics.HetIceNucleation as IN
import CloudMicrophysics.Parameters as CMP

FT = Float64
const tps = TD.Parameters.ThermodynamicsParameters(FT)
const H2SO4_prs = CMP.H2SO4SolutionParameters(FT)
const kaolinite = CMP.Kaolinite(FT) # dust type
tps = TD.Parameters.ThermodynamicsParameters(FT)
H2SO4_prs = CMP.H2SO4SolutionParameters(FT)
kaolinite = CMP.Kaolinite(FT) # dust type

# Initializing
T_range = range(210, stop = 232, length = 100) # air temperature
Expand Down
Loading
Loading