VPNBody: Speed Tips
Home > Speed Tips
Python programs normally run much slower than similar programs written in Fortran or C. VPNBody is not well-suited for very long-term integrations involving more than four objects. If you plan on using VPNBody in undergraduate research projects, I suggest the following when running VPNBody in data mode:
- Use the largest-possible time step, specified with the TIME_STEP keyword in the input file. I have found it helpful to run VPNBody in visual mode with several different time steps. Since the relative energy error is reported on the screen, I can quickly determine the largest time step that will give me a reasonable error.
- Focus your attention on rapidly-evolving systems, such as exosystems containing only two or three planets with very eccentric orbits.
- Do not model planets that orbit very close to the parent star. They require a very small time step that slows down the program's execution speed. Absorb the mass of the inner planet into the mass of the parent star, and make the implicit assumption that the inner planet's orbit will not evolve during the integration period.
- If possible, use a third- or second-order integration method. Such methods make fewer calls to the subroutine that updates the planets' accelerations--this subroutine is the primary bottleneck in the VPNBody code (or any in solar-system code). Profiling indicates that VPNBody spends nearly 50% of its time in this subroutine.
- Increase the DATA_STEP argument as much as possible. This will reduce the amount of data written to the output files, improving the program's performance. (Converting Cartesian position and velocity vectors to keplarian orbital elements is a computationally expensive step.)
- If you need to perform very-long term simulations, especially on systems containing several objects, you will need to work a high-performance Fortran or C code, preferably on a Linux or Unix machine. Follow this link for a list of excellent software packages written in Fortran and C.