Implement the drift-kick-drift form of the Leapfrog method #2566
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.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
The kick-drift-kick form of the Leapfrog method (currently implemented as
VerletLeapfrog
) looks like this:The evaluation of$f_2$ requires that it does not depend on $u$ . If it does, we can add an intermediate step to compute $u^{1/2}$ .$f_1$ requires that it does not depend on $v$ , otherwise the whole thing doesn't work because we need $v^1$ to compute $v^1$ .
The second evaluation of
It can easily be demonstrated that we lose second order accuracy like this:
In this case, we can use the drift-kick-drift form, which is commonly used in Smoothed Particle Hydrodynamics, where viscosity makes$f_1$ depend on the velocity.
This form looks like this:
Now, if$f_1$ depends on $v$ , we can just add a half step for $v$ as well:
This is exactly what I implemented in this PR.$f_2$ does not depend on $u$ , this can all be written down cleanly and yields the desired order of convergence:
If
The cited paper by Verlet does not mention the leapfrog formulation, so I added a paper by Monaghan, which nicely explains the different forms of leapfrog in Section 5.3.
For a Smoothed Particle Hydrodynamics simulation with TrixiParticles.jl, this allows me to use a 5x larger time step than
VerletLeapfrog
, at (with #2559) 2x moref1
evaluations per step, resulting in a 2.7x speedup.