Posidonius is a N-body simulator inspired by Mercury-T (Bolmont et al. 2015), which is one of the most used open source tools by the community to simulate exoplanetary systems. Mercury-T is based on the N-body simulator Mercury with an added extension to account for tidal effects, general relativity, rotational flattening and the evolution of the central body. It calculates the evolution of the orbital distance, eccentricity and inclination of the planets, as well as their rotation (rotation period and obliquity) and it also computes the rotation of the central body (taking into account the contraction and/or stellar wind). The original Mercury is a customizable general-purpose N-body code written in Fortran 77, although there are forks re-written in Fortran 90 that were actually used to create Mercury-T.
Fortran (derived from Formula Translation) is an imperative programming language created by IBM in the 1950s and it is especially suited to scientific computing. The language has gone through several updates since its birth (where version names correlate with the year the update was released), adding support for structured programming (Fortran 77), modular and generic programming (Fortran 90), high performance capabilities (Fortran 95), object-oriented programming (Fortran 2003) and concurrent programming (Fortran 2008). Nevertheless, most of the scientific community keeps using Fortran 77/90 and it is common than available codes only work properly with specific compilers (e.g., the proprietary Intel Fortran/ifort Compiler, the deprecated g77 or the modern GNU Fortran/gfortran). Fortran (like the C language) provides to the developer a high level of control for managing the computer memory which can lead to errors and bugs. For instance, Mercury suffered a problem due to an array not being properly initialized, hence its elements may access random values which will affect the simulation results and the scientific conclusions.
Certain Fortran compilers offer validations such as checking for initialized variables or checking out-of-bound access for arrays, which can be enabled/disabled depending on the flags used to compile the code. These verifications, although useful, do not cover all possible problems derived from memory management and, in any case, they are not enforced by the language. Given the wide use of the language in the scientific community, the lack of software engineering training in certain disciplines such as astrophysics and the lack of memory management controls in the language, it can be convenient to look for alternative technologies. A possibility could be to use garbage collected languages such as Python or Java, which are already extensively used by the astronomy community (especially Python). But these solutions have an impact on execution times, and codes such as N-body simulators are computationally intense and they require fast solutions to be useful. It is for these specific cases that the new programming language Rust can be well fitted as exposed in Blanco-Cuaresma et al. 2017.
Posidonius improves and re-implements the tidal model used in Mercury-T using Rust as programming language, as well as the WHFAST integrator (Rein & Tamayo 2015) and the IAS15 integrator (Rein & Spiegel, 2015). The code ensures memory safety, reproducibility of numerical N-body experiments, it improves the spin integration compared to Mercury-T, it's more than six times faster, it conserves the total angular momentum of the system one order of magnitude better and the spin to rotational-fattening evolution five orders of magnitude better.
Rust ensures that the simulations are free from typical memory management errors but its learning curve can be steep, hence to help the user to define the initial condition of his/her scientific cases, Posidonius provides a Python package (a more user-friendly language and very popular in the astrophysical community).
This document describes the installation steps and a general overview of Posidonius.
NOTE Posidonius (c. 135 BCE - c. 51 BCE), was a Greek Stoic philosopher, politician, astronomer, geographer, historian and teacher native to Apamea (Syria). In Hispania, on the Atlantic coast near Cadiz, Posidonius could observe tides much higher than in his native Mediterranean. He wrote that daily tides are related to the Moon's orbit, while tidal heights vary with the cycles of the Moon (source: Wikipedia).