-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize VerletLeapfrog
method
#2559
base: master
Are you sure you want to change the base?
Conversation
Yeah that looks right, seems it just got over simplified. The interpolation should be specialized though so that it goes to linear instead of Hermite then, since the derivative would be off. Or a special centered Hermite would need to be used. |
To be honest, I have no idea what I need to change to make this use a linear interpolation. Could you point me to the code that I need to change? |
I just realized we were doing that a bit bespoke. Set this branch up on top of #2560 with the trait and I think it's good to go. |
011744d
to
499de20
Compare
Like so? |
@@ -171,7 +174,7 @@ end | |||
# v(t+Δt) = v(t) + 1/2*(a(t)+a(t+Δt))*Δt | |||
du = duprev + dt * (half * ku + half * kdu) | |||
|
|||
OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) | |||
OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this was a bug with the VelocityVerlet
method.
Rebase onto the latest master and I think this is good to go. |
b3c3b7e
to
3c7197b
Compare
Test fails. |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
The
VerletLeapfrog
method is currently using the genericSymplectic2Cache
implementation:OrdinaryDiffEq.jl/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl
Lines 222 to 246 in 4b29bab
This contains 3 calls to
f1
and 2 calls tof2
. The kick-drift-kick scheme of the Leapfrog method only requires a single call tof1
and a single call tof2
in each step, which is the main selling point of the method, making the current implementation basically useless.I implemented an optimized step for this method, following the
VelocityVerlet
method, which also has its own step function.