-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add the Störmer-Verlet method + symplectic test changes #303
base: main
Are you sure you want to change the base?
Conversation
|
||
yhalf_1 = (y0_1 ** ω + term_1.vf_prod(t0, y0_2, args, control1_half_1) ** ω).ω | ||
y1_2 = (y0_2 ** ω + term_2.vf_prod(midpoint, yhalf_1, args, control2) ** ω).ω | ||
y1_1 = (yhalf_1 ** ω + term_1.vf_prod(t1, y1_2, args, control1_half_2 ** ω)).ω |
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.
Isn't this just semi-implicit Euler written in kick-drift-kick form? (I.e. offset by half a step.) Justification: it looks to me like y1_2
on this step is y0_2
on the next step, so the term_1.vf_prod(...)
evaluations happen at the same point twice. (Which also means that this is increasing runtime/compiletime.)
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.
This is pretty subtle actually. long story short: the half step difference has an impact, and they are indeed different (you can check numerically, Störmer-Verlet is order 2, symplectic Euler is order 1.)
Störmer-Verlet is the composition of the symplectic euler method and it's adjoint (reverse method,) ie. it is both variants of symplectic Euler stacked with step-size
The implementation in non kick-drift-kick form, ie.
is distinct from symplectic Euler primarily because of the initialization. Looking at the second-order diffeq case (
and for Störmer-Verlet it's:
This is pretty much the only difference for these two though, and the non kick-drift-kick (often called the leapfrog-Verlet implementation, ugh) is definitely the better one when we don't care about knowing step
, hence the more expensive kick-drift-kick implementation.
If you see a way to switch to the leapfrog-Verlet implementation though by all means I'll do that instead.
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.
Also, you might find it interesting that Hairer wrote a long article about Störmer-Verlet as a precursor to "Geometric Numerical Integration," where he used the method to demonstrate a bunch of the ideas later expanded on in the book
Changes:
all_symplectic_solvers
totest/helpers
.test_semi_implicit_euler
to a parameterised testtest_symplectic_solvers
which includes Störmer-Verlettest_symplectic_ode_order
similar totest_ode_order
using a simple harmonic oscillator as the base problem instead of the linear equation intest_ode_order
.Störmer-Verlet is implemented in the general partitioned form updating
p
andq
with generic vector fieldsf(p)
andg(q)
rather than the more common version which assumesg(q) = q
. This is consistent with the Diffrax implementation ofSemiImplicitEuler
.