Skip to content

Commit d8a1384

Browse files
Update downstream_events.jl
1 parent 760af59 commit d8a1384

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/downstream/downstream_events.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ end
88

99
prob = ODEProblem(f,u0,tspan)
1010

11+
function condition(u,t,integrator) # Event when event_f(u,t,k) == 0
12+
u[1]
13+
end
14+
1115
affect! = nothingf =
1216
affect_neg! = function (integrator)
1317
integrator.u = ArrayPartition(SVector{1}(integrator.u[1]), SVector{1}(-integrator.u[2]))
1418
end
1519

1620
callback = ContinuousCallback(condition,affect!,affect_neg!,interp_points=100)
1721

18-
sol = solve(prob,Tsit5(),callback=callback,adaptive=false,dt=1/4)
22+
sol = solve(prob,Tsit5(),callback=callback,adaptive=false,dt=1/4)

0 commit comments

Comments
 (0)