Skip to content

Commit

Permalink
Merge pull request #454 from CliMA/oa/noneq_formulation1_bugfix
Browse files Browse the repository at this point in the history
bug fix to nonequilibrium MM2015 formulation
  • Loading branch information
trontrytel authored Sep 5, 2024
2 parents 9582b2d + 992c2c3 commit 214761a
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

2 comments on commit 214761a

@trontrytel
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114623

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.22.3 -m "<description of version>" 214761aebb7fb1ef50169bef3c08a121cb25a5c6
git push origin v0.22.3

Please sign in to comment.