Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aux_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ See: https://stackoverflow.com/questions/14687665/very-slow-stdpow-for-bases-ver
Smallest acceptable number that is different than zero.
"""
ϵ_numerics(FT) = sqrt(floatmin(FT))
ϵ_numerics(::Type{<:Integer}) = 0
12 changes: 12 additions & 0 deletions test/correctness.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ using the non-deprecated functional API (no `PhasePartition`/state types).
q_any = FT(0.01)
r = TD.specific_humidity_to_mixing_ratio(q_any, q_tot)
@test r ≈ q_any / (1 - q_tot)

# Regression test for relative_humidity with default integer arguments
# (Ensures internal type stability when q_liq/q_ice default to Int 0)
T_rh = FT(300)
p_rh = FT(1e5)
rh = TD.relative_humidity(param_set, T_rh, p_rh, q_tot)

# Expected value using explicit floats
p_vap = TD.partial_pressure_vapor(param_set, p_rh, q_tot, FT(0), FT(0))
p_sat = TD.saturation_vapor_pressure(param_set, T_rh, FT(0), FT(0))
rh_expected = p_vap / p_sat
@test rh ≈ rh_expected
end

@testset "Reference temperature invariance ($FT)" begin
Expand Down
Loading