Skip to content

Commit 69eb333

Browse files
committed
Tighten default tolerances & split tolerances for stability
1 parent 5aa61fb commit 69eb333

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/flash.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171
function flash_2ph_impl!(storage, K, eos, c, V = NaN;
7272
method = SSIFlash(),
7373
verbose::Bool = false,
74-
maxiter::Int = 20000,
74+
maxiter::Int = 25000,
7575
tolerance::Float64 = 1e-8,
7676
extra_out::Bool = false,
7777
update_forces::Bool = true,

src/stability.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ xy_value(z, K, ::Val{false}) = z/K
7474
In-place version of [`stability_2ph`](@ref). `storage` should be allocated by `flash_storage`.
7575
"""
7676
function michelsen_test!(c_inside, f_z, f_xy, xy, z, K, eos, cond, forces, inside_is_vapor;
77-
tol_equil = 1e-10, tol_trivial = 1e-5, maxiter = 1000)
77+
tol_equil = 1e-10,
78+
tol_trivial = tol_equil,
79+
tol_sat = tol_trivial,
80+
maxiter = 1000
81+
)
7882
trivial = false
7983
S = 1.0
8084
iter = 0
@@ -114,6 +118,6 @@ function michelsen_test!(c_inside, f_z, f_xy, xy, z, K, eos, cond, forces, insid
114118
@warn "Stability test failed to converge in $maxiter iterations. Assuming stability." cond xy K_norm R_norm K
115119
end
116120
end
117-
stable = trivial || S <= 1 + tol_trivial
121+
stable = trivial || S <= 1.0 + tol_sat
118122
return (stable, trivial, iter)
119123
end

0 commit comments

Comments
 (0)