Skip to content

Commit

Permalink
refactor to prep for AIDA HET calibs
Browse files Browse the repository at this point in the history
  • Loading branch information
amylu00 committed Dec 5, 2024
1 parent ee7d3ac commit da55f8e
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 141 deletions.
4 changes: 2 additions & 2 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[AIDA_ice_nucleation]
git-tree-sha1 = "4a298d3558691217adb253b4053611931d62c5c2"
git-tree-sha1 = "91a1a51fb6ebb54282e65de1a2aace5e4ef1c45a"
lazy = true

[[AIDA_ice_nucleation.download]]
sha256 = "b513219566a3d1125acf1515f0d80b5d212f2bb78acead15137dfff47b503f9d"
sha256 = "df37e510212e328c30f052938537ac29dd217206c266c501c2fb797faa3f4c8a"
url = "https://caltech.box.com/shared/static/imo0pyr6o0m9txu8racztmt7lz5n9xf1.gz"
1 change: 1 addition & 0 deletions papers/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ClimaUtilities = "b3f4f4ca-9299-4f7f-bd9b-81e1242a7513"
CloudMicrophysics = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
EnsembleKalmanProcesses = "aa8a2aa5-91d8-4396-bcef-d4f2ec43552d"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
214 changes: 91 additions & 123 deletions papers/ice_nucleation_2024/AIDA_calibrations.jl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[AIDA_ice_nucleation]
git-tree-sha1 = "4a298d3558691217adb253b4053611931d62c5c2"
lazy = true
git-tree-sha1 = "91a1a51fb6ebb54282e65de1a2aace5e4ef1c45a"

[[AIDA_ice_nucleation.download]]
sha256 = "b513219566a3d1125acf1515f0d80b5d212f2bb78acead15137dfff47b503f9d"
sha256 = "df37e510212e328c30f052938537ac29dd217206c266c501c2fb797faa3f4c8a"
url = "https://caltech.box.com/shared/static/imo0pyr6o0m9txu8racztmt7lz5n9xf1.gz"
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# of a function in CloudMicrophysics that is called by ClimaAtmos). For more info, please
# visit the ClimaArtifacts.jl repo on GitHub!

# To use in VS Code, first activate the AIDA_data_artifact environment.
# In terminal, make sure your pwd is in AIDA_data_artifact. Then,
# activate Julia at --project=papers/ice_nucleation_2024/AIDA_data_artifact.
# You are in the right place if you enter the shell (tap ; on keyboard) and
# see that you are in the AIDA_data_artifact folder (NOT CloudMicrophysics.jl)
# Then, copy and paste the following script to the Julia REPL.
# To use in terminal, activate Julia at --project=papers/ice_nucleation_2024/AIDA_data_artifact.
# Then, copy and paste the following script in your now opened Julia REPL.

# If you do not already have ClimaArtifactsHelper, go into the Julia REPL and type:
# Pkg.develop(url="https://github.com/CliMA/ClimaArtifacts.git", subdir="ClimaArtifactsHelper.jl")
Expand All @@ -25,7 +26,7 @@ create_artifact_guided(data_folder; artifact_name = data_set_name)

# After getting an updated "OutputArtifacts.toml" file in this folder,
# Add it to the list of artifacts in CloudMicrophysics.jl's Artifact.toml file.
# Add `lazy = true` under the `git-tree-sha1` line in Artifact.toml i fyou would like
# Add `lazy = true` under the `git-tree-sha1` line in Artifact.toml if you would like
# the artifact to be downloaded lazily.

# To use data, make sure your script has "using LazyArtifacts" at the top.
Expand Down
10 changes: 5 additions & 5 deletions papers/ice_nucleation_2024/calibration_setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,17 @@ function AIDA_IN05_IC(FT, data_file)
eₛ = TD.saturation_vapor_pressure(tps, T₀, TD.Liquid())
Sₗ = FT(e / eₛ)
elseif data_file == "in05_18_aida.edf"
Nₗ = FT(209.46 * 1e6)
Nᵢ = FT(1.53 * 1e6)
Nₗ = FT(210.28 * 1e6)
Nᵢ = FT(1.73 * 1e6)
Nₐ = FT(275 * 1e6) - Nₗ - Nᵢ
r₀ = FT(7.03467 * 1e-6)
r₀ = FT(6.99998 * 1e-6)
p₀ = FT(873.322 * 1e2)
T₀ = FT(237.175)
qₗ = FT(Nₗ * 4 / 3 * FT(π) * r₀^3 * ρₗ / FT(1.2)) # 1.2 should be ρₐ
qᵢ = FT(Nᵢ * 4 / 3 * FT(π) * r₀^3 * ρₗ / FT(1.2))
m_l = Nₗ * ρₗ * 4 * π / 3 * r₀^3
m_i = Nᵢ * ρᵢ * 4 * π / 3 * r₀^3
e = FT(28.1324)
e = FT(28.086)
qᵥ = (e / R_v / T₀) / ((p₀ - e) / (R_d * T₀) + e / R_v / T₀ + m_l + m_i)
q = TD.PhasePartition.(qᵥ + qₗ + qᵢ, qₗ, qᵢ)
Rₐ = TD.gas_constant_air(tps, q)
Expand All @@ -232,7 +232,7 @@ function AIDA_IN05_IC(FT, data_file)
elseif data_file == "in05_19_aida.edf"
Nₐ = FT(0)
Nₗ = FT(180 * 1e6)
Nᵢ = FT(0.49 * 1e6)
Nᵢ = FT(0.882 * 1e6)
r₀ = FT(6.5e-6) # !!missing in dataset!!
p₀ = FT(724.545 * 1e2)
T₀ = FT(237.639)
Expand Down
5 changes: 2 additions & 3 deletions parcel/ParcelCommon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ S_i(tps, T, S_liq) = ξ(tps, T) * S_liq

# Interpolating for cooling/expansion rate
function AIDA_rate(model_t, data_t, data)
index = Int32(model_t) + 1
data_at_t = Intp.linear_interpolation(data_t, data)

if index < length(data) - 1
return (data_at_t(model_t + 2) - data_at_t(model_t + 1))
if model_t < data_t[end]
return (data_at_t(model_t + 1) - data_at_t(model_t))
else
return 0
end
Expand Down
2 changes: 1 addition & 1 deletion test/performance_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function benchmark_test(FT)
bench_press(
CMN.terminal_velocity,
(ice, ch2022.small_ice, ρ_air, q_ice),
350,
400,
)
bench_press(CM1.terminal_velocity, (rain, ch2022.rain, ρ_air, q_rai), 750)
bench_press(
Expand Down

0 comments on commit da55f8e

Please sign in to comment.