Closed frenkield closed 4 months ago
I think the solver is reinitializing the solver state (integrator.u
) when the callback is triggered. And so the behavior makes sense. However, there are still a few mysteries here:
DImplicitEuler
appears to do a reinitialization before running affect!()
.u
is already consistent (or very close to consistent), it's strange that reinitialization has such a large impact.The code that manages this reinitialization is in OrdinaryDiffEq
. So I'm going to relocate this issue to that project.
When using continuous callbacks with
DAEProblem
andDImplicitEuler
, the values inintegrator.u
don't match the values computed by the root finder in thecondition()
function. The root finder successfully computes the correct root but then this root is not passed on to theaffect!()
function.With
IDA
, however, everything works as expected.Expected behavior
When a
ContinuousCallback
is triggered, the values inintegrator.u
(in the call toaffect!(integrator)
) should be identical to the root found in thecondition()
function.With
IDA
this is the case. This is demonstrated in the example output below.Also note that sometimes
DImplicitEuler
does in fact pass on the correct root.Minimal Reproducible Example 👇
Output (abbreviated)
Output of
using Pkg; Pkg.status()
Output of
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Output of
versioninfo()