Add callback/event support for operator splitting integrator (Fixes #36) #46
+544
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements callback and event support for
OperatorSplittingIntegrator, addressing issue #36.u_modified!tracking for solution modificationssavevalues!function for callback-triggered savesDesign Decisions
As discussed in issue #36, there are two main challenges for callbacks in operator splitting:
Which integrator triggers which callback: We handle callbacks ONLY at the outer integrator level, AFTER all subproblems are solved for a timestep. This ensures callbacks have access to the full solution state.
Visibility of unknowns: By processing callbacks at the outer integrator level, callbacks can see the full solution
u, not just partial views that individual subintegrators work with.For continuous callbacks, full root-finding across split subproblems is not well-defined, so we use simplified endpoint checking (detect sign changes between
tprevandt). Users requiring precise event timing should use smaller timesteps or ensure their callback conditions align with the timestep boundaries.Test plan
u- modification propagates correctlysave_positions- saves work correctlyu_modified!functionality - flag is properly set/clearedAll tests pass locally.
cc @ChrisRackauckas
🤖 Generated with Claude Code