Skip to content

Commit 057afee

Browse files
committed
fix harddae
1 parent de4a69a commit 057afee

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

test/regression/hard_dae.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using OrdinaryDiffEq
22
using LinearAlgebra
3-
using NLsolve
43
using Test
54

65
p_inv = [500.0
@@ -233,7 +232,7 @@ function hardstop!(du, u, p, t)
233232
pm, pg = p
234233
y, f_wall, dy = u
235234
du[1] = dy
236-
du[2] = ifelse(y <= 0, y, f_wall)
235+
du[2] = ifelse(y < 0, y, f_wall)
237236
du[3] = (-ifelse(t < 2, -pg * pm, pg * pm) - f_wall) / (-pm)
238237
end
239238

@@ -270,6 +269,6 @@ for prob in [prob1, prob2], alg in [simple_implicit_euler, alg_switch]
270269
sol = solve(prob, alg, callback = cb, dt = 1 / 2^10, adaptive = false)
271270
@test sol.retcode == ReturnCode.Success
272271
@test sol(0, idxs = 1) == 5
273-
@test sol(2, idxs = 1) == 0
272+
@test sol(2-2^-10, idxs = 1) == 0
274273
@test sol(4, idxs = 1) > 10
275274
end

0 commit comments

Comments
 (0)