Skip to content

Commit

Permalink
Remove use of T_min in SA
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Feb 9, 2024
1 parent 8806d64 commit 55adcff
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/relations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1569,16 +1569,13 @@ See also [`saturation_adjustment`](@ref).
relative_temperature_tol::FT,
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, sat_adjust_method, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
tol = RS.RelativeSolutionTolerance(relative_temperature_tol)

T_1 = max(_T_min, air_temperature(param_set, e_int, PhasePartition(q_tot))) # Assume all vapor
if T_1 _T_min
q_v_sat = q_vap_saturation(param_set, T_1, ρ, phase_type)
unsaturated = q_tot <= q_v_sat
if unsaturated
return T_1
end
T_1 = air_temperature(param_set, e_int, PhasePartition(q_tot)) # Assume all vapor
q_v_sat = q_vap_saturation(param_set, T_1, ρ, phase_type)
unsaturated = q_tot <= q_v_sat
if unsaturated
return T_1
end
_T_freeze::FT = TP.T_freeze(param_set)
@inline e_int_sat(T) =
Expand Down Expand Up @@ -1709,15 +1706,14 @@ See also [`saturation_adjustment`](@ref).
relative_temperature_tol::FT,
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, sat_adjust_method, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
tol = RS.RelativeSolutionTolerance(relative_temperature_tol)

T_1 = max(_T_min, air_temperature(param_set, e_int, PhasePartition(q_tot))) # Assume all vapor
T_1 = air_temperature(param_set, e_int, PhasePartition(q_tot)) # Assume all vapor
@inline ρ_T(T) = air_density(param_set, T, p, PhasePartition(q_tot))
ρ_1 = ρ_T(T_1)
q_v_sat = q_vap_saturation(param_set, T_1, ρ_1, phase_type)
unsaturated = q_tot <= q_v_sat
if unsaturated && T_1 _T_min
if unsaturated
return T_1
end
_T_freeze::FT = TP.T_freeze(param_set)
Expand Down Expand Up @@ -1814,18 +1810,14 @@ See also [`saturation_adjustment`](@ref).
relative_temperature_tol::FT,
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, sat_adjust_method, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
tol = RS.RelativeSolutionTolerance(relative_temperature_tol)

T_1 = max(
_T_min,
air_temperature_from_enthalpy(param_set, h, PhasePartition(q_tot)),
) # Assume all vapor
T_1 = air_temperature_from_enthalpy(param_set, h, PhasePartition(q_tot)) # Assume all vapor
@inline ρ_T(T) = air_density(param_set, T, p, PhasePartition(q_tot))
ρ_1 = ρ_T(T_1)
q_v_sat = q_vap_saturation(param_set, T_1, ρ_1, phase_type)
unsaturated = q_tot <= q_v_sat
if unsaturated && T_1 _T_min
if unsaturated
return T_1
end
_T_freeze::FT = TP.T_freeze(param_set)
Expand Down Expand Up @@ -2043,12 +2035,11 @@ See also [`saturation_adjustment`](@ref).
tol::RS.AbstractTolerance,
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
@inline air_temp(q) = air_temperature_given_ρθq(param_set, ρ, θ_liq_ice, q)
T_1 = max(_T_min, air_temp(PhasePartition(q_tot))) # Assume all vapor
T_1 = air_temp(PhasePartition(q_tot)) # Assume all vapor
q_v_sat = q_vap_saturation(param_set, T_1, ρ, phase_type)
unsaturated = q_tot <= q_v_sat
if unsaturated && T_1 _T_min
if unsaturated
return T_1
end
T_2 = air_temp(PhasePartition(q_tot, FT(0), q_tot)) # Assume all ice
Expand Down

0 comments on commit 55adcff

Please sign in to comment.