Skip to content

Commit

Permalink
Merge #139
Browse files Browse the repository at this point in the history
139: Use SolutionTolerance instead of ResidualTolerance r=charleskawczynski a=charleskawczynski

This PR replaces the `RootSolvers.ResidualTolerance` with `RootSolvers.SolutionTolerance`. Closes #135, #134, #130.

Co-authored-by: Charles Kawczynski <[email protected]>
  • Loading branch information
bors[bot] and charleskawczynski authored Oct 5, 2022
2 parents 83b2515 + 09bfc3f commit d7d03c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 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.9.6"
version = "0.9.7"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
12 changes: 3 additions & 9 deletions src/relations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1487,9 +1487,7 @@ function saturation_adjustment(
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, sat_adjust_method, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
cv_d::FT = TP.cv_d(param_set)
# Convert temperature tolerance to a convergence criterion on internal energy residuals
tol = RS.ResidualTolerance(temperature_tol * cv_d)
tol = RS.SolutionTolerance(temperature_tol)

T_1 = max(_T_min, air_temperature(param_set, e_int, PhasePartition(q_tot))) # Assume all vapor
q_v_sat = q_vap_saturation(param_set, T_1, ρ, phase_type)
Expand Down Expand Up @@ -1589,9 +1587,7 @@ function saturation_adjustment_given_peq(
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, sat_adjust_method, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
cv_d = FT(TP.cv_d(param_set))
# Convert temperature tolerance to a convergence criterion on internal energy residuals
tol = RS.ResidualTolerance(temperature_tol * cv_d)
tol = RS.SolutionTolerance(temperature_tol)

T_1 = max(_T_min, air_temperature(param_set, e_int, PhasePartition(q_tot))) # Assume all vapor
ρ_T(T) = air_density(param_set, T, p, PhasePartition(q_tot))
Expand Down Expand Up @@ -1694,9 +1690,7 @@ function saturation_adjustment_given_phq(
T_guess::Union{FT, Nothing} = nothing,
) where {FT <: Real, sat_adjust_method, phase_type <: PhaseEquil}
_T_min::FT = TP.T_min(param_set)
cp_d::FT = TP.cp_d(param_set)
# Convert temperature tolerance to a convergence criterion on internal energy residuals
tol = RS.ResidualTolerance(temperature_tol * cp_d)
tol = RS.SolutionTolerance(temperature_tol)

T_1 = max(
_T_min,
Expand Down

0 comments on commit d7d03c0

Please sign in to comment.