[Bf-committers] Verlet integration patch (Farsthary)

Raul Fernandez Hernandez raulf at info.upr.edu.cu
Mon Nov 23 15:57:34 CET 2009


Hi Jahka :)


> The overall idea looks nice, but the patch isn't complete. For example the
> oldpos and diff vectors aren't declared anywhere and oldpos isn't even
> defined in the patch. Besides isn't oldpos just pa->prev_state.loc?

 Ops! sorry, is that I have deleted manually some parts for better
readability but seems I screw things :)

 I didn´t knew the full state of particles, that´s why I created those
variables, but  pa->prev_state.co works fine :)

>  I'd
> also like to see vector macros used in the calculation like with the other
> integration methods (you should always try to stick to the surrounding
> code's style when poking around somebody else's code).

 Also I let the code without macros for readability also, but is corrected
now


> And while it's true that the error per timestep is fourth order (meaning
> third order total accumulated error) for location, the error per timestep
> for velocity (which you btw use to calculate the location) is second order
> (first order total accumulated error!), so I'm not convinced it's better
> than midpoint for all cases and without proper testing I can't yet comment
> on making verlet the default integration method, but I'll be happy to
> apply the patch once the couple of code issues I mentioned above are
> fixed. The question about making it default can be addressed later.
>
> jahka

  I guess you should try it, the simples set up with particles is a
colider ground with no friction/damping and particles with no
drag/damping etc, a conservative enviroment, the midpont integrator (and
the Euler and RK4) gives increasing bounces with time, not preserving
particle energy, the Verlet integrator implemented here do conserve
energy, and that is just the simples set up.

  Also try to test it with lost of particles interacting each other and
you will notice and speed boost

    I have edited the patch and applied your suggested changes, Thanks a
lot :)

   http://www.pasteall.org/9364/diff

 Of course, the default sugestion was just that, a suggestion and could be
discussed later once performed several tests

                                     Cheers Farsthary



More information about the Bf-committers mailing list