Gary,
I'm working on a solar-system dynamics package using VPython, so I've
been dealing with these issues for several weeks now-- although I'm
not familiar with scipy's solver. Which integration method is best
(an RK variant or a symplectic integrator) depends on what type of
information you need to extract from the model. But in all cases the
accuracy is controlled by the time step.
Several of the best integration routines make use of backward time
steps to reduce errors. You must find a way of hiding these steps
from the animation; else your objects will do a "cha-cha" dance when
they should be moving in the direction of the current velocity. Many
of the integrators in the RK family use variable step sizes to improve
accuracy. If directly connected to the animation, these integrators
will cause your particles to speed up and slow down with the varying
time step, masking the particles' true changes in speed. If you use
of these integrators, you must find a way to disconnect the integrator
from the animation.
I don't know the details of your simulation. In my experience, aside
from the usual places (square roots and cross products), the
performance hit comes in the routine that updates the forces, not the
integrator. If the particles are interacting, you will need to find
the particle-particle distance for each pair in order to update the
forces. So the computational effort required to update the forces
scales with the square of the number of particles. The good news
though is that the accuracy is nearly at machine precision. If you
have a simulation with a large number of particles, there are several
strategies that can improve performance by avoiding direct force
calculations-- although at a cost in accuracy. The best solution
depends on the details of your problem.
Hope this helps.
--
Rodney Dunning
rdu...@bs...
Assistant Professor of Physics
Birmingham-Southern College
|