Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into debug
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 12, 2023
2 parents 002dfc3 + f32d1fb commit a6b99cd
Show file tree
Hide file tree
Showing 31 changed files with 4,140 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
!*.sh
!CMakeLists.txt
!*.cmake
!COPYING.txt
!CHANGELOG
!README.md
!README_figs/**
Expand Down
674 changes: 674 additions & 0 deletions COPYING.txt

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,25 +460,35 @@ This example walks through how to set up a standard solar system simulation. It
- Semi-Interacting Massive Bodies - Gravitationally affect and are affected by fully-interacting massive bodies, do not gravitationally affect and are not affected by other semi-interacting massive bodies.
- Test Particles - Gravitationally affected by fully-interacting massive bodies only.

To generate the initial conditions, run the Python script titled **initial_conditions.py**. To process the output file, run the script titled **output_reader.py**.
To generate the initial conditions, run the Python script titled **initial_conditions.py**. This script also runs Swiftest SyMBA, generating output. To process the output file, run the script titled **output_reader.py**.

**Chambers2013**

This example acts as a comparison to the work of [Chambers 2013](https://www.sciencedirect.com/science/article/pii/S0019103513000754?via%3Dihub). It can be found in the ```/swiftest/examples/Chambers2013``` directory. It is intended to be run using the SyMBA integrator.
This example acts as a comparison to the work of [Chambers 2013](https://www.sciencedirect.com/science/article/pii/S0019103513000754?via%3Dihub). It can be found in the ```/swiftest/examples/Chambers2013``` directory. It is intended to be run using the SyMBA integrator and highlights how to run Swiftest using and executable, as opposed to through a Python script. To generate the initial conditions, run **init_cond.py**. To run Swiftest with these intial conditions, type:

```
./swiftest_driver symba param.in
```

To process the output file, run the script titled **<span>scattermovie.py</span>**.

**Fragmentation**

This example highlights the functionality of the Fraggle algorithm. It can be found in the ```/swiftest/examples/Fragmentation``` directory. It is intended to be run using the SyMBA integrator. It contains three pre-built collisional test cases:

- A Head-On Disruptive Collision
- An Off-Axis Supercatastrophic Disruptive Collision
- A Head-On Disruptive Collision
- An Off-Axis Super-Catastrophic Disruptive Collision
- A Disruptive Hit and Run Collision

To generate a movide depicting the collision and results of each test case, run the Python script titled **Fragmentation_Movie.py**.
To generate a movie depicting the collision and results of each of the test cases, run the Python script titled **Fragmentation_Movie.py**.

**helio_gr_test**

This example demonstrates the functionality of general relativity in Swiftest HELIO. It can be found in the ```/swiftest/examples/helio_gr_test``` directory. It is intended to be run using the HELIO integrator. Because the SyMBA integrator is built upon the HELIO integrator, GR can also be used in SyMBA.
This example demonstrates the functionality of general relativity in Swiftest HELIO. It can be found in the ```/swiftest/examples/helio_gr_test``` directory. It is intended to be run using the HELIO integrator. Because the SyMBA integrator is built upon the HELIO integrator, GR is also available in SyMBA.

**Multibody_Fragmentation**

This example highlights the functionality of the Fraggle algorithm. It can be found in the ```/swiftest/examples/Mulitbody_Fragmentation``` directory. It is intended to be run using the SyMBA integrator. To generate a set of initial conditions, run the initial conditions using Swiftest, and generate a movie depicting the collisional result, run the Python script titled **Multibody_Movie.py**.

**solar_impact**

Expand All @@ -490,7 +500,7 @@ This set of examples acts as a comparison between Swiftest and its predecessor,

**whm_gr_test**

This example demonstrates the functionality of general relativity in Swiftest WHM. It can be found in the ```/swiftest/examples/whm_gr_test``` directory. It is intended to be run using the WHM integrator. Because the SyMBA integrator is built upon the HELIO integrator, which is in turn built upon the WHM integrator, GR can also be used in SyMBA.
This example demonstrates the functionality of general relativity in Swiftest WHM. It can be found in the ```/swiftest/examples/whm_gr_test``` directory. It is intended to be run using the WHM integrator. Because the SyMBA integrator is built upon the HELIO integrator, which is in turn built upon the WHM integrator, GR is also available in SyMBA.

---

Expand All @@ -516,14 +526,10 @@ This mass threshold is necessary to ensure that Swiftest SyMBA does not generate

**What are the limits of Swiftest SyMBA?**

While Swifest SyMBA is a powerful tool for modeling gravitational interactions between massive bodies, it does have its limits. While Swiftest SyMBA is capable of modeling systems containing thousands of massive bodies, the code does slow down significantly. For this reason, Swiftest SyMBA is best used for systems containing tens to hundreds of fully-interacting massive bodies. It is also best used for timescales on the order of a few hundred million years or less. While it is possible to model systems on a billion year timescale, the computational power required may be beyond what is available to the average user. In these cases, it is recommended that the user consider modeling with test particles instead of massive bodies. For systems that contain mainly test particles, with few to no close encounters between massive bodies, Swiftest RMVS is likely a more appropriate tool. An overview of the performance capabilities of Swiftest SyMBA is included in **Figure 3**.
While Swifest SyMBA is a powerful tool for modeling gravitational interactions between massive bodies, it does have its limits. While Swiftest SyMBA is capable of modeling systems containing thousands of massive bodies, the code does slow down significantly. For this reason, Swiftest SyMBA is best used for systems containing tens to hundreds of fully-interacting massive bodies. It is also best used for timescales on the order of a few hundred million years or less. While it is possible to model systems on a billion year timescale, the computational power required may be beyond what is available to the average user. In these cases, it is recommended that the user consider modeling with test particles instead of massive bodies. For systems that contain mainly test particles, with few to no close encounters between massive bodies, Swiftest RMVS is likely a more appropriate tool.

To get a sense of the scope of your desired simulation, it is recommended that you run your initial conditions and parameters for a just few steps. Make sure that you set ```ISTEP_OUT``` and ```DUMP_CADENCE``` to output only once the simulation is complete, not between steps. Because writing to the output files and memory takes a significant amount of computational time compared to integrating the step, we want to avoid counting writing time in our diagnostic information. The terminal output contains information about the total wall time and the wall time per integration step. To get a sense of how long your run will take to complete your desired ```tmax```, simply scale up the wall time per integration step to the number of steps necessary for ```tmax``` to be reached. Remember that writing to the output files will take a considerable amount of time. Adjust your intitial conditions and parameters accordingly.

|![Swiftest SyMBA Performance](README_figs/performance.png "Swiftest SyMBA Performance")|
|:--:|
|**Figure 3** - The wall time per integration step as a result of the number of CPUs used. The results for a system containing 10, 100, and 1000 fully-interacting massive bodies are shown in dark blue, medium blue, and teal, respectively. In red are the the optimum number of CPUs needed to achieve peek performance in each run. Parallelization in Swiftest SyMBA is still under development, so performance at higher numbers of CPUs is expected to improve.|

---

#### References
Expand Down
Binary file added README_figs/.DS_Store
Binary file not shown.
Binary file removed README_figs/performance.png
Binary file not shown.
Binary file removed README_figs/swifter_swiftest_comp.png
Binary file not shown.
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
!.gitignore
!Basic_Simulation
!Fragmentation
!Multibody_Fragmentation
!helio_gr_test
!whm_gr_test
!Chambers2013
Expand Down
13 changes: 8 additions & 5 deletions examples/Basic_Simulation/initial_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
Output
------
data.nc : A NetCDF file containing the simulation output.
collisions.log : An ASCII file containing the information of any collisional events that occured.
init_cond.nc : A NetCDF file containing the initial conditions for the simulation.
param.in : An ASCII file containing the parameters for the simulation.
swiftest.log : An ASCII file containing the information on the status of the simulation as it runs.
collisions.log : An ASCII file containing the information of any collisional events that occured.
collisions.nc : A NetCDF file containing the collision output.
data.nc : A NetCDF file containing the simulation output.
init_cond.nc : A NetCDF file containing the initial conditions for the simulation.
param.00...0.in : A series of parameter input files containing the parameters for the simulation at every output stage.
param.in : An ASCII file containing the inital parameters for the simulation.
param.restart.in : An ASCII file containing the parameters for the simulation at the last output.
swiftest.log : An ASCII file containing the information on the status of the simulation as it runs.
"""

import swiftest
Expand Down
2 changes: 1 addition & 1 deletion examples/Chambers2013/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Date : December 6, 2022
Included in the Chambers2013 example directory are the following files:

- README.txt : This file
- init_cond.py : A Python Script that generates and runs a set of initial conditions.
- init_cond.py : A Python Script that generates a set of initial conditions.
- scattermovie.py : A Python Script that processes data.nc and generates Chambers2013-aescatter.mp4 or Chambers2013-aiscatter.mp4

This example is intended to be run with Swiftest SyMBA. For details on how to generate, run, and analyze this example,
Expand Down
14 changes: 8 additions & 6 deletions examples/Chambers2013/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
Output
------
init_cond.nc : A NetCDF file containing the initial conditions for the simulation.
param.in : An ASCII file containing the parameters for the simulation.
"""
inital_conditions.png : A .png file depicting the simulation initial configuration.
init_cond.nc : A NetCDF file containing the initial conditions for the simulation.
param.in : An ASCII file containing the parameters for the simulation.
"""

import swiftest
import numpy as np
Expand All @@ -38,10 +39,11 @@
Ns = 140
Mb = 2.8e-7 * 14 / Nb
Ms = 2.8e-8 * 140 / Ns
dens = 3000.0 / (sim.MU2KG / sim.DU2M**3)
dens = 3000.0 * sim.KG2MU / sim.M2DU**3

mtiny = 1e-2 * Ms
mininum_fragment_mass = 1e-4 * Ms
minimum_fragment_mass = 1e-5 * Ms
nfrag_reduction = 10.0
rng = default_rng(seed=3031179)

runname = "Chambers (2013)"
Expand Down Expand Up @@ -127,7 +129,7 @@ def sample(r_inner, r_break, r_outer, slope1, slope2):
sim.add_solar_system_body(["Sun","Jupiter","Saturn","Uranus","Neptune"])
sim.add_body(name=nameb, a=avalb, e=evalb, inc=incvalb, capom=capomvalb, omega=omegavalb, capm=capmvalb, mass=Mvalb, radius=Rvalb, rot=rotvalb, Ip=Ipvalb)
sim.add_body(name=names, a=avals, e=evals, inc=incvals, capom=capomvals, omega=omegavals, capm=capmvals, mass=Mvals, radius=Rvals, rot=rotvals, Ip=Ipvals)
sim.set_parameter(mtiny=mtiny, minimum_fragment_mass=mininum_fragment_mass)
sim.set_parameter(mtiny=mtiny, minimum_fragment_mass=minimum_fragment_mass, nfrag_reduction=nfrag_reduction)

sim.set_parameter(tstop=3e8, dt=6.0875/365.25, istep_out=60000, dump_cadence=10)
sim.clean()
Expand Down
1 change: 0 additions & 1 deletion examples/Fragmentation/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*
!.gitignore
!Fragmentation_Movie.py
!Multibody_Movie.py
!swiftest_fragmentation.py
!README.txt
5 changes: 2 additions & 3 deletions examples/Fragmentation/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Included in the Fragmentation example directory are the following files:

- README.txt : This file
- swiftest_fragmentation.py : A Python Script that generates and runs three sets of initial conditions.
- Fragmentation_Movie.py : A Python Script that processes an out.nc file and generates a movie (.mp4) of a collisional event.
- Multibody_Movie.py : A Python Script that processes an out.nc file and generates a movie (.mp4) of a multi-body collisional event.
- Fragmentation_Movie.py : A Python Script that processes a data.nc file and generates a movie (.mp4) of a collisional event.

This example is intendedto be run with Swiftest SyMBA. For details on how to generate, run, and analyze this example, see the Swiftest User Manual.
This example is intended to be run with Swiftest SyMBA. For details on how to generate, run, and analyze this example, see the Swiftest User Manual.
4 changes: 4 additions & 0 deletions examples/Multibody_Fragmentation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!.gitignore
!Multibody_Movie.py
!README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@
"""

"""
Generates a movie of a multi-body fragmentation event from set of Swiftest output files.
Generates, runs, and processes a set of initial conditions for a multi-body super-catastrophic distruption collisional event.
All Swiftest output files are stored in the /supercatastrophic_multi subdirectory.
Inputs
_______
param.in : ASCII Swiftest parameter input file.
data.nc : A NetCDF file containing the simulation output.
None.
Returns
-------
fragmentation.mp4 : A .mp4 file of a fragmentation event.
supercatastrophic_multi.mp4 : A .mp4 file of a fragmentation event.
collisions.log : An ASCII file containing the information of any collisional events that occured.
collisions.nc : A NetCDF file containing the collision output.
data.nc : A NetCDF file containing the simulation output.
encounters.nc : A NetCDF file containing the encounters output.
init_cond.nc : A NetCDF file containing the initial conditions for the simulation.
param.00....in : A series of parameter input files containing the parameters for the simulation at every output stage.
param.in : An ASCII file containing the inital parameters for the simulation.
param.restart.in : An ASCII file containing the parameters for the simulation at the last output.
swiftest.log : An ASCII file containing the information on the status of the simulation as it runs.
"""

import swiftest
Expand Down
21 changes: 21 additions & 0 deletions examples/Multibody_Fragmentation/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright 2023 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh
This file is part of Swiftest.
Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Swiftest.
If not, see: https://www.gnu.org/licenses.

README.txt

Swiftest Example : Fragmentation
Author : David Minton and Carlisle Wishard
Date : December 6, 2022

Included in the Fragmentation example directory are the following files:

- README.txt : This file
- Multibody_Movie.py : A Python Script that generates, runs, and processes a multi-body collisional event.

This example is intended to be run with Swiftest SyMBA. For details on how to generate, run, and analyze this example, see the Swiftest User Manual.
2 changes: 1 addition & 1 deletion examples/Swifter_Swiftest/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*
!.gitignore
!8pl_0tp
!108_pl_50tp
!108pl_50tp
13 changes: 13 additions & 0 deletions examples/Swifter_Swiftest/108pl_50tp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*
!.gitignore
!cb.in
!param.swifter.in
!param.swiftest.in
!pl.swifter.in
!pl.swiftest.in
!README.txt
!swifter_start.in
!swifter_swiftest_comp.eps
!swifter_swiftest_comp.py
!tp.swifter.in
!tp.swiftest.in
32 changes: 32 additions & 0 deletions examples/Swifter_Swiftest/108pl_50tp/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Copyright 2023 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh
This file is part of Swiftest.
Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Swiftest.
If not, see: https://www.gnu.org/licenses.

README.txt

Swiftest Example : Swifter_Swiftest
Author : Carlisle A. Wishard
Date : August 15, 2022

Included in the Swifter_Swiftest/108pl_50tp example directory are the following files:

- README.txt : This file
- param.swifter.in : The Swifter parameter input file
- param.swiftest.in : The Swiftest parameter input file
- cb.in : The Swiftest central body input file
- pl.swifter.in : The Swifter massive body input file
- pl.swiftest.in : The Swiftest massive body input file
- tp.swifter.in : The Swifter test particle input file
- tp.swiftest.in : The Swiftest test particle input file
- swifter.dat : The Swifter output file in binary format
- swiftest.nc : The Swiftest output file in NetCDF format
- swifter_start.in : The Swifter file containing additional parameter information
- swifter_swiftest_comp.py : A Python Script that generates swifter_swiftest_comp.eps
- swifter_swifterst_comp.eps : A plot of the results of the Swifter run compared to the results of the Swiftest run, generated by swifter_swiftest_comp.py

This example is intended to be run with the SyMBA integrator for both Swifter and Swiftest. For details on how to generate, run, and analyze this example, see the Swiftest User Manual. To obtain a copy of Swifter, please see https://www.boulder.swri.edu/swifter/home.html.
16 changes: 16 additions & 0 deletions examples/Swifter_Swiftest/108pl_50tp/cb.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!! Copyright 2023 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh
!! This file is part of Swiftest.
!! Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
!! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
!! Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
!! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
!! You should have received a copy of the GNU General Public License along with Swiftest.
!! If not, see: https://www.gnu.org/licenses.

Sun
39.476926408897626
0.004650467260962157
4.7535806948127355e-12
-2.2473967953572827e-18
0.0 0.0 0.07
11.209306302144773 -38.759372036774764 82.25088158389266
Loading

0 comments on commit a6b99cd

Please sign in to comment.