Skip to content

Commit d55ceb1

Browse files
Merge pull request #2155 from SciML/uprev
Reset uprev with reinitializations
2 parents 4cc0380 + bf9eab5 commit d55ceb1

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/integrators/integrator_interface.jl

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function DiffEqBase.reeval_internals_due_to_modification!(
3838
integrator::ODEIntegrator, continuous_modification = true)
3939
if integrator.isdae
4040
DiffEqBase.initialize_dae!(integrator)
41+
update_uprev!(integrator)
4142
end
4243

4344
if continuous_modification && integrator.opts.calck

src/solve.jl

+1
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ function DiffEqBase.__init(
495495
if initialize_integrator
496496
if isdae || SciMLBase.has_initializeprob(prob.f)
497497
DiffEqBase.initialize_dae!(integrator)
498+
update_uprev!(integrator)
498499
end
499500

500501
if save_start

test/interface/dae_initialize_integration.jl

+13
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,16 @@ prob = ODEProblem(_f, [0.0], (0.0, 1.0))
5959
sol = solve(prob, Tsit5())
6060
@test SciMLBase.successful_retcode(sol)
6161
@test sol[1] == [1.0]
62+
63+
prob = ODEProblem(_f, [0.0], (0.0,1.0))
64+
sol = solve(prob, Tsit5(), dt = 1e-10)
65+
@test SciMLBase.successful_retcode(sol)
66+
@test sol[1] == [1.0]
67+
@test sol[2] [0.9999999998]
68+
@test sol[end] [-1.0]
69+
70+
sol = solve(prob, Rodas5P(), dt = 1e-10)
71+
@test SciMLBase.successful_retcode(sol)
72+
@test sol[1] == [1.0]
73+
@test sol[2] [0.9999999998]
74+
@test sol[end] [-1.0]

0 commit comments

Comments
 (0)