diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml new file mode 100644 index 000000000..656359398 --- /dev/null +++ b/.github/workflows/draft-pdf.yml @@ -0,0 +1,23 @@ +on: [push] + +jobs: + paper: + runs-on: ubuntu-latest + name: Paper Draft + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build draft PDF + uses: openjournals/openjournals-draft-action@master + with: + journal: joss + # This should be the path to the paper within your repo. + paper-path: paper/paper.md + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: paper + # This is the output path where Pandoc will write the compiled + # PDF. Note, this should be the same directory as the input + # paper.md + path: paper/paper.pdf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 19b8038d1..bf2213a81 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ swiftest_driver.sh !README.swifter dump* !**/.gitignore -!.github/workflows/build_wheels.yml +!.github/workflows/*.yml !setup.py !examples/** !swiftest/** diff --git a/cmake/Modules/SetSwiftestFlags.cmake b/cmake/Modules/SetSwiftestFlags.cmake index 470f5c210..d49f42245 100644 --- a/cmake/Modules/SetSwiftestFlags.cmake +++ b/cmake/Modules/SetSwiftestFlags.cmake @@ -564,8 +564,10 @@ IF (CMAKE_BUILD_TYPE STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE STREQUAL "PROFILE") ) # Tells the compiler to link to certain libraries in the Intel oneAPI Math Kernel Library (oneMKL). SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" - Fortran "-qmkl=cluster" # Intel - "-qmkl" # Intel + Fortran "-mkl=cluster" + "-mkl" + "-qmkl=cluster" + "-qmkl" ) # Enables additional interprocedural optimizations for a single file compilation SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" @@ -614,7 +616,7 @@ IF (COMPILER_OPTIONS STREQUAL "Intel") ELSE () # Some subroutines require more strict floating point operation optimizations for repeatability SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" - Fortran "-fp-module=precise" # Intel + Fortran "-fp-model=precise" # Intel ) SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" Fortran "-prec-div" # Intel diff --git a/paper/paper.bib b/paper/paper.bib index fddf9bdaf..4d7dc2c99 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -1,3 +1,69 @@ +@article{Chambers:1999, + title = {A hybrid symplectic integrator that permits close encounters between massive bodies}, + volume = {304}, + url = {http://adsabs.harvard.edu/cgi-bin/nph-data_query?bibcode=1999MNRAS.304..793C&link_type=ABSTRACT}, + doi = {10.1046/j.1365-8711.1999.02379.x}, + number = {4}, + author = {Chambers, J E}, + month = apr, + year = {1999}, + pages = {793--799}, +} + +@article{Duncan:1998, + title = {A {Multiple} {Time} {Step} {Symplectic} {Algorithm} for {Integrating} {Close} {Encounters}}, + volume = {116}, + url = {http://stacks.iop.org/1538-3881/116/i=4/a=2067}, + doi = {10.1086/300541}, + number = {4}, + journal = {The Astronomical Journal}, + author = {Duncan, Martin J and Levison, Harold F and Lee, Man Hoi}, + month = oct, + year = {1998}, + pages = {2067--2077}, +} + + +@article{Grimm:2022, + title = {{GENGA}. {II}. {GPU} {Planetary} {N}-body {Simulations} with {Non}-{Newtonian} {Forces} and {High} {Number} of {Particles}}, + volume = {932}, + issn = {0004-637X}, + url = {https://dx.doi.org/10.3847/1538-4357/ac6dd2}, + doi = {10.3847/1538-4357/ac6dd2}, + language = {en}, + number = {2}, + urldate = {2023-10-06}, + journal = {The Astrophysical Journal}, + author = {Grimm, Simon L. and Stadel, Joachim G. and Brasser, Ramon and Meier, Matthias M. M. and Mordasini, Christoph}, + month = jun, + year = {2022}, + pages = {124}, +} + + +@misc{kaufmann_swifter_nodate, + title = {Swifter}, + url = {https://www.boulder.swri.edu/swifter/}, + abstract = {The Swifter software package, written by David E. Kaufmann, is a completely redesigned and improved version of the Swift package of Hal Levison and Martin Duncan. Like Swift, Swifter is designed to integrate a set of mutually gravitationally interacting bodies together with a group of massless test particles that feel the gravitational influence of the massive bodies but do not affect each other or the massive bodies. In addition, the SyMBA integrator supports a second class of massive bodies whose masses are less than some user-specified value. These bodies gravitationally interact with the more massive bodies, but do not interact with each other. Seven integration techniques are included in the current beta release of Swifter:}, + urldate = {2023-10-06}, + journal = {Swifter — an improved solar system integration software package}, + author = {Kaufmann, David E.}, +} + +@article{Leinhardt:2012, + title = {Collisions between {Gravity}-dominated {Bodies}. {I}. {Outcome} {Regimes} and {Scaling} {Laws}}, + volume = {745}, + url = {http://stacks.iop.org/0004-637X/745/i=1/a=79}, + doi = {10.1088/0004-637X/745/1/79}, + number = {1}, + journal = {The Astrophysical Journal}, + author = {Leinhardt, Zoë M and Stewart, Sarah T}, + month = jan, + year = {2012}, + pages = {79}, +} + + @article{Levison:1994, Author = {{Levison}, H. and {Duncan}, M.}, Journal = {Icarus}, @@ -9,24 +75,120 @@ @article{Levison:1994 url = {https://www.sciencedirect.com/science/article/pii/S0019103584710396?via%3Dihub} } -@article{Duncan:1998, - Author = {{Duncan}, M., {Levison}, H., and {Lee}, M. H.}, - Journal = {The Astronomical Journal}, - Title = {{A Multiple Time Step Symplectic Algorithm for Integrating Close Encounters}}, - Year = 1998, - Month = oct, - Volume = 116, - DOI = {10.1086/300541}, - url = {https://iopscience.iop.org/article/10.1086/300541} + +@article{Levison:2000, + title = {Symplectically {Integrating} {Close} {Encounters} with the {Sun}}, + volume = {120}, + issn = {0004-6256}, + url = {http://dx.doi.org/10.1086/301553}, + doi = {10.1086/301553}, + number = {4}, + journal = {The Astronomical Journal}, + author = {Levison, Harold F. and Duncan, Martin J.}, + month = oct, + year = {2000}, + pages = {2117--2123}, } -@article{Leinhardt:2012, - Author = {{Leinhardt}, Z. and {Stewart}, S.}, - Journal = {The Astronomical Journal}, - Title = {{Collisions between Gravity-dominated Bodies. I. Outcome Regimes and Scaling Laws.}}, - Year = 2012, - Month = dec, - Volume = 745, - DOI = {10.1088/0004-637X/745/1/79}, - url = {https://iopscience.iop.org/article/10.1088/0004-637X/745/1/79} +@article{Moore:2011, + title = {{QYMSYM}: {A} {GPU}-accelerated hybrid symplectic integrator that permits close encounters}, + volume = {16}, + url = {http://adsabs.harvard.edu/cgi-bin/nph-data_query?bibcode=2011NewA...16..445M&link_type=ABSTRACT}, + doi = {10.1016/j.newast.2011.03.009}, + number = {7}, + journal = {New Astronomy}, + author = {Moore, Alexander and Quillen, Alice C}, + month = nov, + year = {2011}, + pages = {445--455}, +} + +@article{Rein:2012, + title = {{REBOUND}: an open-source multi-purpose {N}-body code for collisional dynamics}, + volume = {537}, + url = {http://www.aanda.org/10.1051/0004-6361/201118085}, + doi = {10.1051/0004-6361/201118085}, + journal = {Astronomy \& Astrophysics}, + author = {Rein, H and Liu, S F}, + month = jan, + year = {2012}, + pages = {A128}, +} + + +@article{Rein:2015, + title = {`whfast`': a fast and unbiased implementation of a symplectic {Wisdom}–{Holman} integrator for long-term gravitational simulations}, + volume = {452}, + issn = {0035-8711}, + shorttitle = {whfast}, + url = {https://doi.org/10.1093/mnras/stv1257}, + doi = {10.1093/mnras/stv1257}, + number = {1}, + urldate = {2023-10-06}, + journal = {Monthly Notices of the Royal Astronomical Society}, + author = {Rein, Hanno and Tamayo, Daniel}, + month = sep, + year = {2015}, + pages = {376--388}, +} + + +@article{Rein:2019, + title = {Hybrid symplectic integrators for planetary dynamics}, + volume = {485}, + issn = {0035-8711}, + url = {https://academic.oup.com/mnras/article/485/4/5490/5380811}, + doi = {10.1093/mnras/stz769}, + number = {4}, + journal = {Monthly Notices of the Royal Astronomical Society}, + author = {Rein, Hanno and Hernandez, David M. and Tamayo, Daniel and Brown, Garett and Eckels, Emily and Holmes, Emma and Lau, Michelle and Leblanc, Réjean and Silburt, Ari}, + month = jun, + year = {2019}, + pages = {5490--5497}, +} + +@misc{rein_welcome_nodate, + title = {Welcome to {REBOUND} - {REBOUND}}, + url = {https://rebound.readthedocs.io/en/latest/}, + urldate = {2023-10-06}, + journal = {Welcome to REBOUND - REBOUND}, + author = {Rein, Hanno}, +} + +@article{Saha:1994, + title = {Long-term planetary integration with individual time steps}, + volume = {108}, + url = {http://adsabs.harvard.edu/cgi-bin/nph-data_query?bibcode=1994AJ....108.1962S&link_type=ABSTRACT}, + doi = {10.1086/117210}, + journal = {The Astronomical Journal}, + author = {Saha, Prasenjit and Tremaine, Scott}, + month = nov, + year = {1994}, + pages = {1962--1969}, +} + +@article{Stewart:2012, + title = {Collisions between {Gravity}-dominated {Bodies}. {II}. {The} {Diversity} of {Impact} {Outcomes} during the {End} {Stage} of {Planet} {Formation}}, + volume = {751}, + url = {http://stacks.iop.org/0004-637X/751/i=1/a=32}, + doi = {10.1088/0004-637X/751/1/32}, + number = {1}, + journal = {The Astrophysical Journal}, + author = {Stewart, Sarah T and Leinhardt, Zoë M}, + month = jan, + year = {2012}, + pages = {32}, +} + + +@article{Wisdom:1991, + title = {Symplectic maps for the n-body problem}, + volume = {102}, + url = {http://adsabs.harvard.edu/cgi-bin/bib_query?1991AJ....102.1528W}, + doi = {10.1086/115978}, + journal = {The Astronomical Journal}, + author = {Wisdom, Jack and Holman, Matthew}, + month = oct, + year = {1991}, + pages = {1528--1538}, } diff --git a/paper/paper.md b/paper/paper.md index f5c8c6310..01345efe2 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -9,48 +9,76 @@ tags: - Planetary Systems authors: - name: Carlisle Wishard + affiliation: "1,4" orcid: 0009-0001-0733-3268 equal-contrib: true - corresponding: true - affiliation: 1 - - name: David Minton - equal-contrib: true - affiliation: 1 - name: Jennifer Pouplin - affiliation: "1" - - name: Jake Elliott + affiliation: "1,3" + - name: Jacob Elliott affiliation: "1" - name: Dana Singh + affiliation: "5" + - name: Kaustub Anand + affiliation: "1, 2" + - name: David Minton affiliation: "1" + orcid: 0000-0003-1656-9704 + equal-contrib: true + corresponding: true affiliations: - - name: Department of Earth, Atmospheric, and Planetary Sciences, Purdue University, USA - index: 1 -date: 05 April 2023 + - name: Department of Earth, Atmospheric, and Planetary Sciences, Purdue University, USA + index: 1 + - name: School of Aeronautics and Astronautics, Purdue University, USA + index: 2 + - name: Department of Physics and Astronomy, Purdue University, USA + index: 3 + - name: Evansville Museum of Arts, History & Science, USA + index: 4 + - name : SAIC, Princeton, NJ, USA + index: 5 + +date: 06 October 2023 bibliography: paper.bib --- # Summary - -The dynamical evolution of planetary systems is dominated by gravitational interactions between massive bodies. Determining the orbits of massive bodies over long time scales is the first step towards understanding the formation and evolution of planets, moons, asteroids, comets, and more. To model these systems, which often include hundreds or thousands of gravitationally interacting bodies, a numerical tool called an \textit{n}-body integrator is often employed. +`Swiftest` is a software package designed to model the long-term dynamics of system of bodies in orbit around a dominant central body, such a planetary system around a star, or a satellite system around a planet. The main body of the program is written in Modern Fortran, taking advantage of the object-oriented capabilities included with Fortran 2003 and the parallel capabilities included with Fortran 2008 and Fortran 2018. `Swiftest` also includes a Python package that allows the user to quickly generate input, run simulations, and process output from the simulations. `Swiftest` uses a NetCDF output file format which makes data analysis with the `Swiftest` Python package a streamlined and flexible process for the user. # Statement of Need +Building off a strong legacy, including its predecessors `Swifter` [@kaufmann_swifter_nodate] and `Swift` [@Levison:1994], `Swiftest` takes the next step in modeling the dynamics of planetary systems by improving the performance and ease of use of software, and by introducing a new collisional fragmentation model. Currently, `Swiftest` includes the four main symplectic integrators included in its predecessors: -`Swiftest` is a software package designed to model gravitationally dominated systems. The main body of the program is written in Modern Fortran, taking advantage of the object-oriented capabilities included with Fortran 2003 and the parallel capabilities included with Fortran 2008 and Fortran 2018. `Swiftest` also includes a Python package that allows the user to quickly generate input and process output from the main integrator. `Swiftest` uses a NetCDF output file format which makes data analysis with the `Swiftest` Python package a streamlined and flexible process for the user. +WHM + : Wisdom-Holman method. `WHM` is a symplectic integrator that is best suited for cases in which the orbiting bodies do not have close encounters with each other. For details see @Wisdom:1991. -Building off a strong legacy, including its predecessors `Swifter` [@Duncan:1998] and `Swift` [@Levison:1994], `Swiftest` takes the next step in modeling gravitationally dominated systems by including collisional fragmentation. Our collisional fragmentation algorithm, `Fraggle` (based on the work of @Leinhardt:2012), is designed to resolve collisions between massive bodies and generate collisional debris. `Swiftest` fully incorporates this debris into the gravitational system, evolving these new bodies along with pre-existing bodies. This allows for a more complete model of the orbital evolution of the system and the growth of massive bodies. +RMVS + : Regularized Mixed Variable Symplectic. `RMVS` is an extension of `WHM` that handles close approaches between test particles and massive bodies. For details, see @Levison:1994. -The combination of modern programming practices, flexible data processing tools, and the latest advances in the field of collisional dynamics make `Swiftest` the ideal tool for studying the formation of planetary systems, the growth of planetary moons, the evolution of asteroid families, and beyond. +HELIO + : Democratic Heliocentric method. This is a basic symplectic integrator that uses democratic heliocentric coordinates instead of the Jacobi coordinates used by `WHM`. Like `WHM` it is not suited for simulating close encoutners between orbiting bodies. For details, see @Duncan:1998. -# Performance +SyMBA + : Symplectic Massive Body Algorithm. This is an extension of `HELIO` that handles close approaches between massive bodies and any of the other objects in the simulation. It also includes semi-interacting massive bodies that can gravitationally influence fully massive bodies but not each other. This algorithm is described in the @Duncan:1998. See also @Levison:2000. + +All of the integrators that are currently implemented are based symplectic integrators, which are designed to model massive bodies (e.g. planets) or test particles (e.g. asteroids) in orbit of a single dominant central body (e.g. the Sun) for very long periods of times (e.g. Gy). The core components of `Swiftest` were inherited from the `Swift`/`Swifter` codebase, but have been somewhat modified for performance. The `Swift`-family of integerators are most comparable to other symplectic integrators, which are among the most popular numerical methods used to study the long-term dynamics of planetary systems. + +The `SyMBA` integrator included in `Swiftest` is most similar to the hybrid symplectic integrator `MERCURY6` [@Chambers:1999], the `MERCURIUS` integrator of `REBOUND` [@Rein:2012,@Rein:2015,@rein_welcome_nodate], and the GPU-enabled hybrid symplectic integrators such as `QYMSYM` [@Moore:2011] and `GENGA II` [@Grimm:2022], with some important distinctions. The hybrid symplectic integrators typically employ a symplectic method, such as the original WHM method in Jacobi coordinates or the modified method that uses the Democratic Heliocentric coordinates, only when bodies are far from each other relative to their gravitational spheres of influence (some multiple of a Hill's sphere). When bodies approach each other, the integration is smoothly switched to a non-symplectic method, such as Bulirsch-Stoer or IAS15. In contrast, `SyMBA` is a multi-step method that recursively subdivides the step size of bodies undergoing close approach with each other. +In addition `Swiftest` contains a number of signfigant enhancements relative to its predecessors: +- It includes a fully symplectic implementation of the post-Newtonian correction (General Relativity) as described in @Saha:1994. +- Output data is stored in NetCDF4 (HDF5) format, making data analysis, cross-platform compatibility, and portability far more robust than the flat binary file formats used by its predecessors. +- It makes use of CPU-based parallelization via OpenMP. It also makes use of SIMD instructions, but these are available only when compiled for target host machine rather than when installed from PyPI via pip. +- Simulations can be run by means of a standalone binary driver program, similar to its predecessors, or from a compiled Python module. Both the standalone driver and Python module link to the same compiled library, so they simulations run by either method are identical. +- It comes with an extensive set of Python scripts to help generate simulation initial conditions and post-process simulation results. +- It includes the `Fraggle` collisional fragmentation model that is used to generate collisional fragments on trajectories that conserve linear and angular momentum and lose the appropriate amount of collisional energy for inelastic collisions between massive bodies in `SyMBA` simulations. The collisional outcome is deterimined using standard methods based on the work of @Leinhardt:2012 and @Stewart:2012. + +# Performance Modeling the behavior of thousands of fully interacting bodies over long timescales is computationally expensive, with typical runs taking weeks or months to complete. The addition of collisional fragmentation can quickly generate hundreds or thousands of new bodies in a short time period, creating further computational challenges for traditional \textit{n}-body integrators. As a result, enhancing computational performance was a key aspect of the development of `Swiftest`. Here we show a comparison between the performance of `Swift`, `Swifter-OMP` (a parallel version of `Swifter`), and `Swiftest` on simulations with 1k, 2k, 8k, and 16k fully interacting bodies. The number of cores dedicated to each run is varied from 1 to 24 to test the parallel performance of each program. \autoref{fig:performance} shows the results of this performance test. We can see that `Swiftest` outperforms `Swifter-OMP` and `Swift` in each simulation set, even when run in serial. When run in parallel, `Swiftest` shows a significant performance boost when the number of bodies is increased. The improved performance of `Swiftest` compared to `Swifter-OMP` and `Swift` is a critical step forward in \textit{n}-body modeling, providing a powerful tool for modeling the dynamical evolution of planetary systems. -![Performance testing of `Swiftest` on systems of (a) 1k, (b) 2k, (c) 8k, and (d) 16k fully interacting massive bodies. All simulations were run using the \textit{SyMBA} integrator included in `Swift`, `Swifter-OMP`, and `Swiftest`. Speedup is measured relative to `Swift` (dashed), with an ideal 1:1 speedup relative to `Swiftest` in serial shown as an upper limit (dotted). The performance of `Swifter-OMP` is shown in green while the performance of `Swiftest` is shown in blue. All simulations were run on the Purdue University Rosen Center for Advanced Computing Brown Community Cluster. Brown contains 550 Dell compute nodes, with each node containing 2 12-core Intel Xeon Gold Sky Lake processors, resulting in 24 cores per node. Each node has 96 GB of memory. \label{fig:performance}](performance.png) +![Performance testing of `Swiftest` on systems of (a) 1k, (b) 2k, (c) 8k, and (d) 16k fully interacting massive bodies. All simulations were run using the \textit{SyMBA} integrator included in `Swift`, `Swifter-OMP` (and earlier attempt to parallelize `Swifter`), and `Swiftest`. Speedup is measured relative to `Swiftest` for 1 CPU (dashed), with an ideal 1:1 speedup shown as an upper limit (dotted). The performance of `Swifter-OMP` is shown in green while the performance of `Swiftest` is shown in blue. All simulations were run on the Purdue University Rosen Center for Advanced Computing Brown Community Cluster. Brown contains 550 Dell compute nodes, with each node containing 2 12-core Intel Xeon Gold Sky Lake processors, resulting in 24 cores per node. Each node has 96 GB of memory. \label{fig:performance}](performance.png) # Acknowledgements - `Swiftest` was developed at Purdue University and was funded under the NASA Emerging Worlds and Solar System Workings programs. Active development by the Purdue Swiftest Team is ongoing and contributions from the community are highly encouraged. # References diff --git a/paper/performance.png b/paper/performance.png index 7a425e840..7f95d781e 100644 Binary files a/paper/performance.png and b/paper/performance.png differ diff --git a/pyproject.toml b/pyproject.toml index 2789589fd..49902b667 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "swiftest" -version = "2023.10.1" +version = "2023.10.2" authors=[ {name = 'David A. Minton', email='daminton@purdue.edu'}, {name = 'Carlisle Wishard'}, diff --git a/src/globals/globals_module.f90 b/src/globals/globals_module.f90 index def76b400..d7d00e085 100644 --- a/src/globals/globals_module.f90 +++ b/src/globals/globals_module.f90 @@ -48,7 +48,7 @@ module globals integer(I4B), parameter :: UPPERCASE_OFFSET = iachar('A') - iachar('a') !! ASCII character set parameter for lower to upper !! conversion - offset between upper and lower - character(*), parameter :: VERSION = "2023.10.1" !! Swiftest version + character(*), parameter :: VERSION = "2023.10.2" !! Swiftest version !> Symbolic name for integrator types character(*), parameter :: UNKNOWN_INTEGRATOR = "UKNOWN INTEGRATOR" diff --git a/version.txt b/version.txt index ea516b56c..d0d0c6122 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2023.10.1 \ No newline at end of file +2023.10.2 \ No newline at end of file