Skip to content

Commit

Permalink
Fix a bug for upper limit of q_v_sat in relations.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Jul 17, 2024
1 parent 8587938 commit 207dba2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Thermodynamics"
uuid = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
authors = ["Climate Modeling Alliance"]
version = "0.12.6"
version = "0.12.7"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
2 changes: 1 addition & 1 deletion src/relations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ Compute the saturation specific humidity, given
q_v_sat = if p - p_v_sat eps(FT)
R_d / R_v * (1 - q_tot) * p_v_sat / (p - p_v_sat)
else
FT(1) / eps(FT)
FT(1) + eps(FT)
end
return q_v_sat
end
Expand Down
9 changes: 9 additions & 0 deletions test/relations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ end
q_tot = FT(0.23)
ρ = FT(1.0)
ρ_v_triple = _press_triple / _R_v / _T_triple
p_v_tripleminus = FT(0.99) * _press_triple
@test saturation_vapor_pressure(param_set, _T_triple, Liquid())
_press_triple
@test saturation_vapor_pressure(param_set, _T_triple, Ice()) _press_triple
Expand All @@ -193,6 +194,14 @@ end
phase_type,
) == _R_d / _R_v * (1 - q_tot) * _press_triple / (p - _press_triple)

@test TD.q_vap_saturation_from_pressure(
param_set,
q_tot,
p_v_tripleminus,
_T_triple,
phase_type,
) > FT(1)

phase_type = PhaseNonEquil
@test q_vap_saturation(
param_set,
Expand Down

0 comments on commit 207dba2

Please sign in to comment.