Skip to content

Commit 2c02be9

Browse files
authored
Guard cloud terminal velocity against negative N or q (#627)
1 parent b843f2d commit 2c02be9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CloudMicrophysics"
22
uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
33
authors = ["Climate Modeling Alliance"]
4-
version = "0.26.3"
4+
version = "0.26.4"
55

66
[deps]
77
ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c"

src/Microphysics2M.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@ function cloud_terminal_velocity(
623623
q_liq, ρₐ, N_liq,
624624
) where {FT}
625625

626+
if N_liq < eps(FT) || q_liq < eps(FT)
627+
return (FT(0), FT(0))
628+
end
629+
626630
(; νc, μc) = pdf_c
627631
(; Bc) = pdf_cloud_parameters_mass(pdf_c, q_liq, ρₐ, N_liq)
628632

@@ -634,9 +638,6 @@ function cloud_terminal_velocity(
634638
q_liq < eps(FT) ? FT(0) :
635639
terminal_velocity_prefactor * DT.generalized_gamma_Mⁿ(νc, μc, Bc, N_liq, FT(5 / 3)) / ρₐ / q_liq
636640

637-
if q_liq >= 5e-3
638-
@show terminal_velocity_prefactor, vt0, vt1
639-
end
640641
return (vt0, vt1)
641642

642643
end

0 commit comments

Comments
 (0)