Skip to main content
SearchLogin or Signup

Swiftest: Modernizing a classic n-body integrator with Object Oriented Fortran

Presentation #411.03 in the session “Origins, Formation and Dynamical Systems”. Cross-listed as presentation #201.06.

Published onOct 03, 2021
Swiftest: Modernizing a classic n-body integrator with Object Oriented Fortran

The Swift family of n-body integrators is a powerful tool that is widely used in planetary sciences. Swift was originally written in Fortran 77, and a more modern Fortran 90 version called Swifter was released in 2005. Among the major differences between Swifter and Swift are the use of linked list data structures for particles rather than the static arrays used by Swift, and the use of integrator-specific derived types. The Swift integrators have proven to be useful foundations for developing numerical tools to explore phenomenon such as collisional evolution (e.g. LIPAD), ring-satellite interactions (HydroSyMBA), and more. While the integrators themselves are robust, attempts to upgrade and improve the codebase, such as taking advantage of the parallelization offered in modern computer clusters, have met with mixed success.

Here we present our efforts to update the Swift/Swifter codebase using Object Oriented Programming capabilities that were added to the Fortran 2003 standard. In Object-Oriented Fortran (OOF), derived types can be defined with type-bound procedures, and extended types inherit properties of their parent type. Using the integrator-specific derived types of Swifter as a foundation, we have developed a new codebase called “Swiftest” that retains the core algorithms of Swift, but takes advantage of the advanced features of OOF. We have also re-written the Swifter types to use allocatable arrays in an “array in type” model, as opposed to the “array of type” model used by Swifter. These changes allow for much easier code reuse, making Swiftest a much more streamlined and easier to extend codebase than its predecessors.

Aside from changing the code architecture, we have also been steadily adding in new capabilities to the code, such as the addition of relativistic effects (tested in the WHM and RMVS integrators), fragmentation (SyMBA), tides, and a fluid ring model based on the Python RINGMOONS code previously developed at Purdue. In addition, we have developed a set of Python-based tools aimed at building initial conditions and analyzing simulation results, which takes inspiration from the REBOUND n-body code. Here we demonstrate our early results, and provide a roadmap for future development.


No comments here