ODE.jl icon indicating copy to clipboard operation
ODE.jl copied to clipboard

WIP: symplectic solver based on velocity verlet

Open acroy opened this issue 10 years ago • 10 comments

This PR adds two functions, verlet_fixed and verlet_hh2, which implement the velocity Verlet method with fixed and adaptive time-steps, respectively. The latter uses an estimate of the error based on comparing a full step with two half-steps. This function is exported as verlet.

The interface is largely compatible with the proposal in #7. The main difference is, that "velocity" and "position" are specified (and returned) separately, instead of having one solution vector. Moreover, the acceleration (or force) currently only depends on time and position.

There are still some other things to do (absolute and relative tolerances, intermediate steps in tspan, ...), which partly depend on the outcome of #7.

Examples can be found here: harmonic oscillator and pendulum

Comments and suggestions are very welcome.

acroy avatar Jan 27 '14 11:01 acroy

cc: @tlycken, @stevengj, @pao

acroy avatar Jan 27 '14 11:01 acroy

@jiahao : Thanks for the comments. I will fix the typos in the next iteration. The indentation issue is odd, because locally I have four spaces. Is there any git(hub) magic one should know?

acroy avatar Jan 27 '14 19:01 acroy

@acroy, it's nothing to do with github, it's just that you're using tab characters instead of spaces. In official Julia projects, the standard is to use 4 spaces instead of tab characters. Most IDEs/editors can be set up to do this automatically.

Cheers!

kmsquire avatar Jan 27 '14 20:01 kmsquire

@kmsquire : Thanks! Indentation fixed in last commit.

acroy avatar Jan 27 '14 20:01 acroy

Haven't had time to kick the tires, really, but this seems good. An adaptive AND symplectic method really does add value to the suite. I'll get back with more input when I have the time =)

tomasaschan avatar Jan 29 '14 17:01 tomasaschan

@tlycken : that would be great. I should add that from reading a bit about adaptive symplectic methods, I got the impression that methods based on rescaling time (like here) actually seem to be preferred...

acroy avatar Jan 29 '14 20:01 acroy

Another reference is Hairer, Wanner & Lubich, 2002, chapter VIII.

mauro3 avatar Dec 30 '15 11:12 mauro3

Is there actually a reason this was never merged?

mauro3 avatar Oct 31 '16 09:10 mauro3

Good question ;-) I guess there might be two reasons: 1) Although the method works it is very crude IMO and 2) We never settled the API - for example, the current version doesn't use "the right-hand side" of the ODEs, but rather the force...

On Mon, 31 Oct 2016 at 10:37, Mauro [email protected] wrote:

Is there actually a reason this was never merged?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuliaDiffEq/ODE.jl/pull/10#issuecomment-257250286, or mute the thread https://github.com/notifications/unsubscribe-auth/AF4onbpKZT0GjuDAWYAa36gWdMGXGAfxks5q5bbrgaJpZM4BcwFy .

acroy avatar Oct 31 '16 11:10 acroy

Thanks for the clarification. Leave open or close?

mauro3 avatar Oct 31 '16 12:10 mauro3