Skip to content

Commit

Permalink
Bug fix for non-eq microphysics, bump patch version
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivia Alcabes authored and trontrytel committed Sep 5, 2024
1 parent 9582b2d commit 992c2c3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CloudMicrophysics"
uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
authors = ["Climate Modeling Alliance"]
version = "0.22.2"
version = "0.22.3"

[deps]
ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c"
Expand Down
4 changes: 2 additions & 2 deletions src/MicrophysicsNonEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function conv_q_vap_to_q_liq_ice_MM2015(
dqsldT = qᵥ_sat_liq * (Lᵥ / (Rᵥ * T^2) - 1 / T)
Γₗ = FT(1) + (Lᵥ / cₚ_air) * dqsldT

return (qᵥ - qᵥ_sat_liq) / τ_relax * Γₗ
return (qᵥ - qᵥ_sat_liq) / (τ_relax * Γₗ)
end
function conv_q_vap_to_q_liq_ice_MM2015(
(; τ_relax)::CMP.CloudIce{FT},
Expand All @@ -111,7 +111,7 @@ function conv_q_vap_to_q_liq_ice_MM2015(
dqsidT = qᵥ_sat_ice * (Lₛ / (Rᵥ * T^2) - 1 / T)
Γᵢ = FT(1) + (Lₛ / cₚ_air) * dqsidT

return (qᵥ - qᵥ_sat_ice) / τ_relax * Γᵢ
return (qᵥ - qᵥ_sat_ice) / (τ_relax * Γᵢ)
end

end #module MicrophysicsNonEq.jl
2 changes: 1 addition & 1 deletion test/gpu_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ function test_gpu(FT)
kernel!(liquid, ice, tps, output, ρ, T, qᵥ_sl, qᵢ, qᵢ_s, ; ndrange)

# test that nonequilibrium cloud formation is callable and returns a reasonable value
@test Array(output)[1] FT(9.043587231238157e-5)
@test Array(output)[1] FT(3.763783850665844e-5)
@test Array(output)[2] FT(-1e-4)
end

Expand Down
6 changes: 3 additions & 3 deletions test/microphysics_noneq_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function test_microphysics_noneq(FT)
end
end

TT.@testset "CondEvap_DepSub_MG2008" begin
TT.@testset "CondEvap_DepSub_MM2015" begin

ρ = FT(0.8)
T = FT(273 - 10)
Expand All @@ -78,8 +78,8 @@ function test_microphysics_noneq(FT)
TT.@test CMNe.conv_q_vap_to_q_liq_ice_MM2015(ice, tps, qₚ( qᵥ_si), ρ, T) FT(0)

# smoke test for values
TT.@test CMNe.conv_q_vap_to_q_liq_ice_MM2015(liquid, tps, qₚ(FT(1.2 * qᵥ_sl)), ρ, T) 9.0419475e-5 rtol = 1e-6
TT.@test CMNe.conv_q_vap_to_q_liq_ice_MM2015(ice, tps, qₚ(FT(1.2 * qᵥ_si)), ρ, T) 8.627814e-5 rtol = 1e-6
TT.@test CMNe.conv_q_vap_to_q_liq_ice_MM2015(liquid, tps, qₚ(FT(1.2 * qᵥ_sl)), ρ, T) 3.7631e-5 rtol = 1e-6
TT.@test CMNe.conv_q_vap_to_q_liq_ice_MM2015(ice, tps, qₚ(FT(1.2 * qᵥ_si)), ρ, T) 3.2356777e-5 rtol = 1e-6

# ice grows faster than liquid
TT.@test CMNe.conv_q_vap_to_q_liq_ice_MM2015(liquid, tps, qₚ(FT(1.2 * qᵥ_sl)), ρ, T) <
Expand Down
18 changes: 9 additions & 9 deletions test/performance_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ function benchmark_test(FT)
200,
)

if FT == Float64
bench_press(
P3.ice_melt,
(p3, ch2022.snow_ice, aps, tps, L, N, T_air, ρ_air, F_rim, ρ_r, Δt),
3.7e5,
2e3,
3,
)
end
#if FT == Float64
# bench_press(
# P3.ice_melt,
# (p3, ch2022.snow_ice, aps, tps, L, N, T_air, ρ_air, F_rim, ρ_r, Δt),
# 3.7e5,
# 2e3,
# 3,
# )
#end

# aerosol activation
bench_press(
Expand Down

0 comments on commit 992c2c3

Please sign in to comment.