Skip to content

Commit 17bdda9

Browse files
committed
Merge branch 'main' of https://github.com/CliMA/CloudMicrophysics.jl into al/immer_hom_parcel
2 parents 8d885c6 + 8546e18 commit 17bdda9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+908
-495
lines changed

.buildkite/JuliaProject.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[extras]
2+
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
3+
4+
[preferences.CUDA_Runtime_jll]
5+
version = "local"

.buildkite/pipeline.yml

+23-36
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,43 @@
1+
agents:
2+
queue: central
3+
slurm_mem: 8G
4+
modules: julia/1.9.3 cuda/11.8 ucx/1.14.1_cuda-11.8 openmpi/4.1.5_cuda-11.8 hdf5/1.12.2-ompi415 nsight-systems/2023.2.1
5+
16
env:
2-
JULIA_VERSION: "1.9.2"
3-
OPENMPI_VERSION: "4.0.4"
7+
JULIA_LOAD_PATH: "${JULIA_LOAD_PATH}:${BUILDKITE_BUILD_CHECKOUT_PATH}/.buildkite"
48
OPENBLAS_NUM_THREADS: 1
9+
JULIA_NVTX_CALLBACKS: gc
10+
OMPI_MCA_opal_warn_on_missing_libcuda: 0
11+
JULIA_CPU_TARGET: 'broadwell;skylake'
512

613
steps:
7-
- label: "init :computer:"
8-
key: "init_cpu_env"
14+
- label: "initialize"
15+
key: "initialize"
916
command:
10-
- "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
11-
- "julia --project -e 'using Pkg; Pkg.precompile(;strict=true)'"
12-
- "julia --project -e 'using Pkg; Pkg.status()'"
13-
agents:
14-
config: cpu
15-
queue: central
16-
slurm_ntasks: 1
17+
- echo "--- Instantiate project"
18+
- julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'
1719

18-
- label: "init :flower_playing_cards:"
19-
key: "init_gpu_env"
20-
command:
21-
- "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
22-
- "julia --project -e 'using Pkg; Pkg.precompile()'"
20+
- echo "--- Instantiate test"
21+
- julia --project=test -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'
2322

24-
# force the initialization of the CUDA runtime as it is lazily loaded by default
25-
- "julia --project=test -e 'using Pkg; Pkg.develop(path=\".\"); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'"
26-
- "julia --project=test -e 'using CUDA; CUDA.versioninfo()'"
27-
- "julia --project=test -e 'using CUDA; CUDA.precompile_runtime()'"
28-
- "julia --project=test -e 'using Pkg; Pkg.status()'"
23+
- julia --project=test -e 'using CUDA; CUDA.precompile_runtime()'
24+
- julia --project=test -e 'using Pkg; Pkg.status()'
2925
agents:
30-
config: gpu
31-
queue: central
32-
slurm_ntasks: 1
33-
slurm_gres: "gpu:1"
26+
slurm_gpus: 1
27+
slurm_cpus_per_task: 8
28+
env:
29+
JULIA_NUM_PRECOMPILE_TASKS: 8
3430

3531
- wait
3632

3733
- label: ":computer: unit tests"
3834
key: "cpu_unittests"
3935
command:
40-
- "julia --project=test -e 'using Pkg; Pkg.develop(path=\".\"); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'"
4136
- "julia --project=test --color=yes test/runtests.jl"
42-
agents:
43-
config: cpu
44-
queue: central
45-
slurm_ntasks: 1
4637

47-
- label: ":flower_playing_cards: unit tests"
38+
- label: ":flower_playing_cards: GPU unit tests"
4839
key: "gpu_unittests"
4940
command:
50-
- "julia --project=test -e 'using Pkg; Pkg.develop(path=\".\"); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'"
5141
- "julia --project=test --color=yes test/gpu_tests.jl"
5242
agents:
53-
config: gpu
54-
queue: central
55-
slurm_ntasks: 1
56-
slurm_gres: "gpu:1"
43+
slurm_gpus: 1

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
1616
CLIMAParameters = "0.7.15"
1717
DocStringExtensions = "0.8, 0.9"
1818
ForwardDiff = "0.10"
19-
KernelAbstractions = "0.8, 0.9"
19+
KernelAbstractions = "0.9"
2020
RootSolvers = "0.3, 0.4"
2121
SpecialFunctions = "1, 2"
2222
Thermodynamics = "0.9, 0.10, 0.11"

docs/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
77
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
88
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
99
RootSolvers = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74"
10+
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1011
Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
1112

1213
[compat]

docs/make.jl

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pages = Any[
1515
"Non-equilibrium cloud formation" => "MicrophysicsNonEq.md",
1616
"Smooth transition at thresholds" => "ThresholdsTransition.md",
1717
"Aerosol activation" => "AerosolActivation.md",
18-
"ARG2000 activation example" => "ARG2000_example.md",
1918
"Water Activity" => "WaterActivity.md",
2019
"Ice Nucleation" => "IceNucleation.md",
2120
"Aerosol Nucleation" => "AerosolNucleation.md",

docs/src/API.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CurrentModule = CloudMicrophysics
88
```@docs
99
Parameters.CloudMicrophysicsParameters0M
1010
Parameters.CloudMicrophysicsParametersP3
11+
Parameters.H2SO4SolutionParameters
1112
```
1213

1314
# Non-equilibrium cloud formation

docs/src/ARG2000_example.md

-18
This file was deleted.

docs/src/AerosolActivation.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ end
346346
347347
# data read from Fig 1 in Abdul-Razzak and Ghan 2000
348348
# using https://automeris.io/WebPlotDigitizer/
349-
include("ARGdata.jl")
349+
include("plots/ARGdata.jl")
350350
351351
PL.plot(N_2_range * 1e-6, N_act_frac_B, label="CliMA-B", xlabel="Mode 2 aerosol number concentration [1/cm3]", ylabel="Mode 1 number fraction activated")
352352
PL.scatter!(Fig1_x_obs, Fig1_y_obs, markercolor = :black, label="paper observations")
@@ -355,3 +355,20 @@ PL.plot!(Fig1_x_param, Fig1_y_param, linecolor = :black, label="paper parameteri
355355
PL.savefig("Abdul-Razzak_and_Ghan_fig_1.svg")
356356
```
357357
![](Abdul-Razzak_and_Ghan_fig_1.svg)
358+
359+
## Example of Aerosol Activation from ARG2000
360+
361+
The figures below have been reproduced from [Abdul-RazzakandGhan2000](@cite)
362+
using the aerosol activation parameterization implemented in this project.
363+
364+
```@example
365+
include("plots/ARGplots.jl")
366+
make_ARG_figX(2)
367+
make_ARG_figX(3)
368+
make_ARG_figX(4)
369+
make_ARG_figX(5)
370+
```
371+
![](Abdul-Razzak_and_Ghan_fig_2.svg)
372+
![](Abdul-Razzak_and_Ghan_fig_3.svg)
373+
![](Abdul-Razzak_and_Ghan_fig_4.svg)
374+
![](Abdul-Razzak_and_Ghan_fig_5.svg)

docs/src/AerosolNucleation.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The values of free parameters ``p``, ``u``, ``v``, ``w``, and ``a`` are defined
6060
Below figure reproduces results from [Dunne2016](@cite) without negative ion concentrations.
6161

6262
```@example
63-
include("nucleation_plotting/CLOUD_Nucleation_Plots.jl")
63+
include("plots/CLOUD_Nucleation_Plots.jl")
6464
```
6565
![](CLOUD_nucleation.svg)
6666

@@ -71,7 +71,7 @@ Below we show a comparison between the Vehkamaki et al 2002 parameterization
7171
and the Dunne et al 2016 parameterization for two relative humidities.
7272

7373
```@example
74-
include("nucleation_plotting/compare_vehkamaki_CLOUD_nucleation.jl")
74+
include("plots/compare_vehkamaki_CLOUD_nucleation.jl")
7575
```
7676
![](CLOUD_Vehk_comparison_236.svg)
7777
![](CLOUD_Vehk_comparison_298.svg)
@@ -114,7 +114,7 @@ k_{MT,OH} = 1.2 \; 10^{-11} \; exp(444/T)
114114
### Example plots
115115

116116
```@example
117-
include("nucleation_plotting/Kirkby_organic_nucleation_plots.jl")
117+
include("plots/Kirkby_organic_nucleation_plots.jl")
118118
```
119119
![](Kirkby_organic_nucleation.svg)
120120
## Nucleation of organics with sulfuric acid
@@ -139,7 +139,7 @@ An empirical derivation is given by:
139139

140140
Below is a plot reproducing the results from [Riccobono2014](@cite), with a constant `H_2SO_4` concentration of `2.6e6 cm\^{-3}.
141141
```@example
142-
include("nucleation_plotting/Riccobono_mixed_nucleation_plots.jl")
142+
include("plots/Riccobono_mixed_nucleation_plots.jl")
143143
```
144144
![](Riccobono_nucleation.svg)
145145

@@ -173,7 +173,7 @@ m = \frac{log(CG(d_x) / CG(d_1))}{(log(d_x / d_1)}
173173
### Example plots
174174

175175
```@example
176-
include("nucleation_plotting/lehtinen_apparent_nucleation_rate.jl")
176+
include("plots/lehtinen_apparent_nucleation_rate.jl")
177177
```
178178
![](apparent_nucleation.svg)
179179

docs/src/IceNucleation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ The following plot shows ``J`` as a function of ``\Delta a_w`` as compared to
9292
of ``\Delta a_w``, with no implications of whether ``\Delta a_w`` is properly
9393
parameterized. For more on water activity, please see above section.
9494
```@example
95-
include("ice_nucleation_plots/KnopfAlpert2013_fig1.jl")
95+
include("plots/KnopfAlpert2013_fig1.jl")
9696
```
9797
![](Knopf_Alpert_fig_1.svg)
9898

9999
The following plot shows J as a function of temperature as compared to figure 5a in Knopf & Alpert 2013.
100100

101101
```@example
102-
include("ice_nucleation_plots/KnopfAlpert2013_fig5.jl")
102+
include("plots/KnopfAlpert2013_fig5.jl")
103103
```
104104
![](KnopfAlpert2013_fig5.svg)
105105
Note that water activity of the droplet was assumed equal to relative humidity so that:
@@ -144,7 +144,7 @@ Here is a comparison of our parameterization of ``J_{hom}`` compared to Koop 200
144144
Koop 2000 uses the difference in chemical potential.
145145

146146
```@example
147-
include("ice_nucleation_plots/HomFreezingPlots.jl")
147+
include("plots/HomFreezingPlots.jl")
148148
```
149149
![](HomFreezingPlots.svg)
150150

docs/src/Microphysics1M.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Here we plot the terminal velocity formulae from the current default 1-moment sc
166166
We also show the aspect ratio of snow particles.
167167

168168
```@example
169-
include("TerminalVelocityComparisons.jl")
169+
include("plots/TerminalVelocityComparisons.jl")
170170
```
171171
![](1M_individual_terminal_velocity_comparisons.svg)
172172

@@ -772,7 +772,7 @@ const param_set = cloud_microphysics_parameters(toml_dict)
772772
thermo_params = CMP.thermodynamics_params(param_set)
773773
774774
const air_props = CMT.AirProperties(FT)
775-
const liquid = CMT.LiquidType()
775+
const liquid = CMT.LiquidType(FT)
776776
const ice = CMT.IceType(FT)
777777
const rain = CMT.RainType(FT)
778778
const snow = CMT.SnowType(FT)

docs/src/Microphysics2M.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,16 @@ The default free parameter values are:
355355
|``\alpha_r`` | ``159 \, m \cdot s^{-1} \cdot kg^{-\beta_r}`` |
356356
|``\alpha_r`` | ``0.266`` |
357357

358+
!!! note
359+
In our implementation we approximate the incomplete gamma function in order to get good
360+
performance on the GPU. Below we show the evaporation rates for the number concnetration
361+
and mass using both the exact and approximated gamma function
362+
363+
```@example
364+
include("plots/RainEvapoartionSB2006.jl")
365+
```
366+
![](SB2006_rain_evaporation.svg)
367+
358368
## Additional 2-moment microphysics options
359369

360370
### Terminal Velocity
@@ -404,7 +414,7 @@ We also compare bulk number weighted [ND] and mass weighted [MD]
404414
terminal velocities for both formulas integrated over the size distribution from [SeifertBeheng2006](@cite).
405415
We also show the mass weighted terminal velocity from the 1-moment scheme.
406416
```@example
407-
include("TerminalVelocityComparisons.jl")
417+
include("plots/TerminalVelocityComparisons.jl")
408418
```
409419
![](2M_terminal_velocity_comparisons.svg)
410420

@@ -643,20 +653,20 @@ toml_dict = CP.create_toml_dict(FT; dict_type = "alias")
643653
const param_set = cloud_microphysics_parameters(toml_dict)
644654
thermo_params = CMP.thermodynamics_params(param_set)
645655
646-
const liquid = CMT.LiquidType()
656+
const liquid = CMT.LiquidType(FT)
647657
const rain = CMT.RainType(FT)
648658
649659
const KK2000 = CMT.KK2000Type()
650660
const B1994 = CMT.B1994Type()
651661
const TC1980 = CMT.TC1980Type()
652662
const LD2004 = CMT.LD2004Type()
653-
const VarTimeScaleAcnv = CMT.VarTimeScaleAcnvType()
654663
const SB2006 = CMT.SB2006Type()
655664
const acnv_SB2006 = CMT.AutoconversionSB2006(FT)
656665
const acnv_KK2000 = CMT.AutoconversionKK2000(FT)
657666
const acnv_B1994 = CMT.AutoconversionB1994(FT)
658667
const acnv_TC1980 = CMT.AutoconversionTC1980(FT)
659668
const acnv_LD2004 = CMT.AutoconversionLD2004(FT)
669+
const acnv_TSc = CMT.AutoconversionVarTimescale(FT)
660670
const rain_acnv_1m = CMT.Autoconversion1M(FT, rain)
661671
const accretion_KK2000 = CMT.AccretionKK2000(FT)
662672
const accretion_B1994 = CMT.AccretionB1994(FT)
@@ -665,7 +675,7 @@ const accretion_SB2006 = CMT.AccretionSB2006(FT)
665675
const ce = CMT.CollisionEfficiency(FT)
666676
667677
668-
include(joinpath(pkgdir(CloudMicrophysics), "docs", "src", "Wooddata.jl"))
678+
include(joinpath(pkgdir(CloudMicrophysics), "docs", "src", "plots", "Wooddata.jl"))
669679
670680
# Example values
671681
q_liq_range = range(1e-8, stop=1e-3, length=1000)
@@ -679,15 +689,15 @@ q_liq_KK2000 = [CM2.conv_q_liq_to_q_rai(acnv_KK2000, q_liq, ρ_air, N_d = 1e8) f
679689
q_liq_B1994 = [CM2.conv_q_liq_to_q_rai(acnv_B1994, q_liq, ρ_air, N_d = 1e8) for q_liq in q_liq_range]
680690
q_liq_TC1980 = [CM2.conv_q_liq_to_q_rai(acnv_TC1980, q_liq, ρ_air, N_d = 1e8) for q_liq in q_liq_range]
681691
q_liq_LD2004 = [CM2.conv_q_liq_to_q_rai(acnv_LD2004, q_liq, ρ_air, N_d = 1e8) for q_liq in q_liq_range]
682-
q_liq_VarTimeScaleAcnv = [CM2.conv_q_liq_to_q_rai(param_set, VarTimeScaleAcnv, q_liq, ρ_air, N_d = 1e8) for q_liq in q_liq_range]
692+
q_liq_VarTimeScaleAcnv = [CM2.conv_q_liq_to_q_rai(acnv_TSc, q_liq, ρ_air, N_d = 1e8) for q_liq in q_liq_range]
683693
q_liq_SB2006 = [CM2.autoconversion(acnv_SB2006, q_liq, q_rai, ρ_air, 1e8).dq_rai_dt for q_liq in q_liq_range]
684694
q_liq_K1969 = [CM1.conv_q_liq_to_q_rai(rain_acnv_1m, q_liq) for q_liq in q_liq_range]
685695
686696
N_d_KK2000 = [CM2.conv_q_liq_to_q_rai(acnv_KK2000, 5e-4, ρ_air, N_d = N_d) for N_d in N_d_range]
687697
N_d_B1994 = [CM2.conv_q_liq_to_q_rai(acnv_B1994, 5e-4, ρ_air, N_d = N_d) for N_d in N_d_range]
688698
N_d_TC1980 = [CM2.conv_q_liq_to_q_rai(acnv_TC1980, 5e-4, ρ_air, N_d = N_d) for N_d in N_d_range]
689699
N_d_LD2004 = [CM2.conv_q_liq_to_q_rai(acnv_LD2004, 5e-4, ρ_air, N_d = N_d) for N_d in N_d_range]
690-
N_d_VarTimeScaleAcnv = [CM2.conv_q_liq_to_q_rai(param_set, VarTimeScaleAcnv, 5e-4, ρ_air, N_d = N_d) for N_d in N_d_range]
700+
N_d_VarTimeScaleAcnv = [CM2.conv_q_liq_to_q_rai(acnv_TSc, 5e-4, ρ_air, N_d = N_d) for N_d in N_d_range]
691701
N_d_SB2006 = [CM2.autoconversion(acnv_SB2006, q_liq, q_rai, ρ_air, N_d).dq_rai_dt for N_d in N_d_range]
692702
693703
accKK2000_q_liq = [CM2.accretion(accretion_KK2000, q_liq, q_rai, ρ_air) for q_liq in q_liq_range]

docs/src/P3Scheme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ where all variables from the m(D) regime are as defined above, and:
123123
Below we show the m(D) regime, replicating Figures 1 (a) and (b) from [MorrisonMilbrandt2015](@cite).
124124
We also show a(D).
125125
```@example
126-
include("P3SchemePlots.jl")
126+
include("plots/P3SchemePlots.jl")
127127
```
128128
![](MorrisonandMilbrandtFig1a.svg)
129129
![](MorrisonandMilbrandtFig1b.svg)

docs/src/PrecipitationSusceptibility.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ Where $R$ is the set of all process rates that contribute to precipitation produ
2626
Example reproducing Fig. 2 From [Glassmeier2016](@cite):
2727

2828
```@example
29-
include("PrecipitationSusceptibilityPlots.jl")
29+
include("plots/PrecipitationSusceptibilityPlots.jl")
3030
```
3131
![](Glassmeier-Lohmann_Fig2.svg)

docs/src/WaterActivity.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ To verify that our parameterizations for ``p_{i,sat}`` and ``p_{sat}`` from
7878
implementations of ``p_{i,sat}`` and ``p_{sat}`` (``p_{sat}`` labelled as
7979
``p_{liq}`` to emphasize ice vs liquid phase of the pure water).
8080
```@example
81-
include("water_activity_plots/Baumgartner2022_fig5.jl")
81+
include("plots/Baumgartner2022_fig5.jl")
8282
```
8383
![](vap_pressure_vs_T.svg)
8484

@@ -100,7 +100,7 @@ Another plot to test if our parameterization is reasonable is plotting against o
100100
droplet is used but setting concentration of H2SO4 to zero. ``using \mu`` refers to the parameterization
101101
used in [Koop2000](@cite) where water activity is dependent on chemical potential.
102102
```@example
103-
include("water_activity_plots/T_vs_wateractivity.jl")
103+
include("plots/T_vs_wateractivity.jl")
104104
```
105105
![](T_vs_wateractivity.svg)
106106
Taking the difference between any pair of blue and green lines will give a ``\Delta a_w(T)``.
File renamed without changes.

docs/src/ARGplots.jl docs/src/plots/ARGplots.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ toml_dict = CP.create_toml_dict(FT; dict_type = "alias")
1717
const param_set = cloud_microphysics_parameters(toml_dict)
1818
thermo_params = CMP.thermodynamics_params(param_set)
1919

20-
include("ARGdata.jl")
20+
include("plots/ARGdata.jl")
2121

2222
# Atmospheric conditions
2323
T = 294.0 # air temperature

0 commit comments

Comments
 (0)