diff --git a/README.md b/README.md index 817ef2fd2..28eb73f2d 100644 --- a/README.md +++ b/README.md @@ -462,6 +462,10 @@ This example walks through how to set up a standard solar system simulation. It 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**. +**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. + **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: @@ -472,6 +476,22 @@ This example highlights the functionality of the Fraggle algorithm. It can be fo To generate a movide depicting the collision and results of each test case, 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. + +**solar_impact** + +This example demonstrates the conservation of angular momentum, energy, and mass during a collision between a massive body and the Sun, or central body. It can be found in the ```/swiftest/examples/solar_impact``` directory. It is intended to be run using the SyMBA integrator. + +**Swifter_Swiftest** + +This set of examples acts as a comparison between Swiftest and its predecessor, Swifter. Two unique simulations are included in this example, one with 8 massive bodies and 0 test particles, and one with 108 massive bodies and 50 test particles. These simulations can be found in the ```/swiftest/examples/Swifter_Swiftest/8pl_0tp``` and the ```/swiftest/examples/Swifter_Swiftest/108pl_50tp``` directories, respectively. They are intended to be run using the SyMBA integrator. For details on how to run a simulation using Swifter, please see the [Swifter website](https://www.boulder.swri.edu/swifter/). + +**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. + --- #### Simulation Parameter FAQs and Recommendations @@ -510,6 +530,7 @@ To get a sense of the scope of your desired simulation, it is recommended that y - Angeletti, M., Bonny, J. -M., and Koko, J. (2019). Parallel Euclidean distance matrix computation on big datasets. **HAL**. [HAL Id: hal-02047514](https://hal.archives-ouvertes.fr/hal-02047514) - Duncan, M. J., Levison, H. F., and Lee, M. H. (1998). A Multiple Time Step Symplectic Algorithm for Integrating Close Encounters. **The Astronomical Journal**, 116, 2067. [doi: 10.1086/300541](https://iopscience.iop.org/article/10.1086/300541) +- Chambers, J. E. (2013). Late-Stage Planetary Accretion Including Hit-and-Run Collisions and Fragmentation. **Icarus**, 224. [doi: 10.1016/j.icarus.2013.02.015](https://www.sciencedirect.com/science/article/pii/S0019103513000754?via%3Dihub) - Ericson, C. (2005) Real-Time Collision Detection. **Elsevier Inc.** [ISBN: 978-1-55860-732-3](https://www.sciencedirect.com/book/9781558607323/real-time-collision-detection) - Leinhardt, Z. M. and Stewart, S. T. (2012). Collisions between Gravity-dominated Bodies. I. Outcome Regimes and Scaling Laws. **The Astrophysical Journal**, 745, 79. [doi:10.1088/0004-637X/745/1/79](https://iopscience.iop.org/article/10.1088/0004-637X/745/1/79) - Levison, H. F. and Duncan, M. J. (1994). The Long-Term Behavior of Short-Period Comets. **Icarus**, 108, 18. [doi: 10.1006/icar.1994.1039](https://www.sciencedirect.com/science/article/pii/S0019103584710396?via%3Dihub) diff --git a/examples/helio_neptune_pluto/param.in b/examples/helio_neptune_pluto/param.in deleted file mode 100644 index 50736acc7..000000000 --- a/examples/helio_neptune_pluto/param.in +++ /dev/null @@ -1,42 +0,0 @@ -!! 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. - -! VERSION Swiftest parameter input from file param.in -T0 0.0 -TSTOP 100000.0 -DT 5.0 -ISTEP_OUT 20 -ISTEP_DUMP 20 -OUT_FORM XVEL -OUT_TYPE NETCDF_DOUBLE -OUT_STAT REPLACE -IN_TYPE NETCDF_DOUBLE -BIN_OUT bin.nc -CHK_QMIN 0.004650467260962157 -CHK_RMIN 0.004650467260962157 -CHK_RMAX 1000.0 -CHK_EJECT 1000.0 -CHK_QMIN_COORD HELIO -CHK_QMIN_RANGE 0.004650467260962157 1000.0 -MU2KG 1.988409870698051e+30 -TU2S 31557600.0 -DU2M 149597870700.0 -IN_FORM XV -NC_IN init_cond.nc -EXTRA_FORCE NO -BIG_DISCARD NO -CHK_CLOSE NO -RHILL_PRESENT NO -FRAGMENTATION NO -ROTATION NO -TIDES NO -ENERGY YES -GR NO -INTERACTION_LOOPS TRIANGULAR -ENCOUNTER_CHECK TRIANGULAR diff --git a/examples/symba_swifter_comparison/1pl_1pl_collision/param.swiftest.in b/examples/symba_swifter_comparison/1pl_1pl_collision/param.swiftest.in deleted file mode 100644 index aa2702302..000000000 --- a/examples/symba_swifter_comparison/1pl_1pl_collision/param.swiftest.in +++ /dev/null @@ -1,47 +0,0 @@ -!! 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. - -! VERSION Swiftest parameter input -T0 0.0 -TSTOP 1.0 -DT 0.005 -ISTEP_OUT 200000 -ISTEP_DUMP 200000 -OUT_FORM XVEL -OUT_TYPE NETCDF_DOUBLE -OUT_STAT REPLACE -IN_TYPE ASCII -PL_IN pl.swiftest.in -TP_IN tp.swiftest.in -CB_IN sun_MsunAUYR.in -BIN_OUT 1pl_1pl_enc.nc -CHK_QMIN -1.0 -CHK_RMIN -1.0 -CHK_RMAX 1000.0 -CHK_EJECT 1000.0 -CHK_QMIN_COORD HELIO -CHK_QMIN_RANGE -1.0 -1.0 -MU2KG 1.988409870698051e+30 -TU2S 31557600.0 -DU2M 149597870700.0 -IN_FORM EL -EXTRA_FORCE NO -PARTICLE_OUT 1pl_1pl_particle.dat -BIG_DISCARD NO -CHK_CLOSE YES -RHILL_PRESENT YES -FRAGMENTATION NO -ROTATION YES -TIDES NO -ENERGY YES -GR YES -INTERACTION_LOOPS TRIANGULAR -ENCOUNTER_CHECK TRIANGULAR -ENERGY_OUT 1pl_1pl_energy.dat -GMTINY 1e-26 diff --git a/examples/symba_swifter_comparison/1pl_1pl_collision/pl.swiftest.in b/examples/symba_swifter_comparison/1pl_1pl_collision/pl.swiftest.in deleted file mode 100644 index f0513d13d..000000000 --- a/examples/symba_swifter_comparison/1pl_1pl_collision/pl.swiftest.in +++ /dev/null @@ -1,22 +0,0 @@ -!! 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. - -2 -Mercury 6.553709809565314146e-06 0.0014751274547839194341 -1.6306381826061645943e-05 -0.38710350131956905 0.20558985105084426 7.0037441475892 -48.302109425370055 29.181335754822598 286.2251596331737 -0.4000000000000000222 0.4000000000000000222 0.4000000000000000222 -0.0 0.0 0.0 -Planet 6.553709809565314146e-26 3.1781030349897803e-10 -1.6306381826061643e-65 -0.38710350131956905 0.20558985105084426 7.0037441475892 -48.302119425370055 29.181335754822598 286.2251596331737 -0.4000000000000000222 0.4000000000000000222 0.4000000000000000222 -0.0 0.0 0.0 diff --git a/examples/symba_swifter_comparison/1pl_1pl_collision/sun_MsunAUYR.in b/examples/symba_swifter_comparison/1pl_1pl_collision/sun_MsunAUYR.in deleted file mode 100644 index 5e69f346c..000000000 --- a/examples/symba_swifter_comparison/1pl_1pl_collision/sun_MsunAUYR.in +++ /dev/null @@ -1,16 +0,0 @@ -!! 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 diff --git a/examples/symba_swifter_comparison/1pl_1pl_collision/tp.swiftest.in b/examples/symba_swifter_comparison/1pl_1pl_collision/tp.swiftest.in deleted file mode 100644 index 78a4f20a6..000000000 --- a/examples/symba_swifter_comparison/1pl_1pl_collision/tp.swiftest.in +++ /dev/null @@ -1,10 +0,0 @@ -!! 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. - -0 diff --git a/examples/symba_swifter_comparison/1pl_1tp_collision/param.swiftest.in b/examples/symba_swifter_comparison/1pl_1tp_collision/param.swiftest.in deleted file mode 100644 index b705f5c90..000000000 --- a/examples/symba_swifter_comparison/1pl_1tp_collision/param.swiftest.in +++ /dev/null @@ -1,47 +0,0 @@ -!! 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. - -! VERSION Swiftest parameter input -T0 0.0 -TSTOP 1.0 -DT 0.005 -ISTEP_OUT 1 -ISTEP_DUMP 1 -OUT_FORM XVEL -OUT_TYPE NETCDF_DOUBLE -OUT_STAT REPLACE -IN_TYPE ASCII -PL_IN pl.swiftest.in -TP_IN tp.swiftest.in -CB_IN sun_MsunAUYR.in -BIN_OUT 1pl_1tp_enc.nc -CHK_QMIN -1.0 -CHK_RMIN -1.0 -CHK_RMAX 1000.0 -CHK_EJECT 1000.0 -CHK_QMIN_COORD HELIO -CHK_QMIN_RANGE -1.0 -1.0 -MU2KG 1.988409870698051e+30 -TU2S 31557600.0 -DU2M 149597870700.0 -IN_FORM EL -EXTRA_FORCE NO -PARTICLE_OUT 1pl_1tp_particle.dat -BIG_DISCARD NO -CHK_CLOSE YES -RHILL_PRESENT YES -FRAGMENTATION NO -ROTATION YES -TIDES NO -ENERGY YES -GR YES -INTERACTION_LOOPS TRIANGULAR -ENCOUNTER_CHECK TRIANGULAR -ENERGY_OUT 1pl_1tp_energy.dat -GMTINY 3.6460981419534435e-08 diff --git a/examples/symba_swifter_comparison/1pl_1tp_collision/pl.swiftest.in b/examples/symba_swifter_comparison/1pl_1tp_collision/pl.swiftest.in deleted file mode 100644 index d148361af..000000000 --- a/examples/symba_swifter_comparison/1pl_1tp_collision/pl.swiftest.in +++ /dev/null @@ -1,16 +0,0 @@ -!! 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. - -1 -Mercury 6.553709809565314146e-06 0.0014751274547839194341 -1.6306381826061645943e-05 -0.38710350131956905 0.20558985105084426 7.0037441475892 -48.302109425370055 29.181335754822598 286.2251596331737 -0.4000000000000000222 0.4000000000000000222 0.4000000000000000222 -0.0 0.0 0.0 diff --git a/examples/symba_swifter_comparison/1pl_1tp_collision/sun_MsunAUYR.in b/examples/symba_swifter_comparison/1pl_1tp_collision/sun_MsunAUYR.in deleted file mode 100644 index 5e69f346c..000000000 --- a/examples/symba_swifter_comparison/1pl_1tp_collision/sun_MsunAUYR.in +++ /dev/null @@ -1,16 +0,0 @@ -!! 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 diff --git a/examples/symba_swifter_comparison/1pl_1tp_collision/tp.swiftest.in b/examples/symba_swifter_comparison/1pl_1tp_collision/tp.swiftest.in deleted file mode 100644 index e7d899da2..000000000 --- a/examples/symba_swifter_comparison/1pl_1tp_collision/tp.swiftest.in +++ /dev/null @@ -1,13 +0,0 @@ -!! 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. - -1 -Test_Particle -0.38710350131956905 0.20558985105084426 7.0037441475892 -48.402109425370054 29.181335754822598 286.2251596331737 diff --git a/examples/symba_swifter_comparison/8pl/cb.in b/examples/symba_swifter_comparison/8pl/cb.in deleted file mode 100644 index 64008ecae..000000000 --- a/examples/symba_swifter_comparison/8pl/cb.in +++ /dev/null @@ -1,14 +0,0 @@ -!! 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 -0.00029591220819207774 -0.004650467260962157 -0.0 -0.0 diff --git a/examples/symba_swifter_comparison/8pl/pl.in b/examples/symba_swifter_comparison/8pl/pl.in deleted file mode 100644 index 29d7ae207..000000000 --- a/examples/symba_swifter_comparison/8pl/pl.in +++ /dev/null @@ -1,42 +0,0 @@ -!! 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. - -8 -Mercury 4.9125474498983623693e-11 0.0014751322421091943544 -1.6306381826061645943e-05 -0.2386666776623860009 -0.35641151623302969043 -0.05101731016108843747 -0.017764175111075249797 0.017029962919661641163 -0.00023782836795535061019 -Venus 7.243452483873646905e-10 0.0067590994376241490576 -4.0453784346544178454e-05 -0.2990753407779592199 -0.6632100042621156266 -0.026360212624545961008 -0.018302016936885410342 0.008245710698089018728 -0.00094295400489744841174 -Earth 8.9970113821660187435e-10 0.010044890881522152024 -4.25875607065040958e-05 -1.0036256535410339463 -0.01896165200005213089 -2.8417417483764697977e-06 -4.5405883021213687997e-05 0.017136881726258899883 -8.2401921935443904624e-07 -Mars 9.549535102761465607e-11 0.0072464600218361159065 -2.265740805092889601e-05 --1.6269997788049339604 -0.21390234390978191126 0.03542716286161200212 -0.0023442654831218119778 -0.012678934386626589462 -0.00032322307543280830687 -Jupiter 2.825345908631354893e-07 0.35527050568877215555 -0.00046732617030490929307 -4.337786461883050393 -2.5177577989629078559 -0.08659310309181492138 -0.003701702275184468819 0.00688886526378316294 -0.000111430767468823893455 -Saturn 8.459715183006415395e-08 0.43766614553930262567 -0.00038925687730393611812 -6.5790524733447179884 -7.4503769195907869616 -0.13229534767175391008 -0.0038755970018745189258 0.0036872503470294919377 -0.00021829651897950920047 -Uranus 1.2920249163736673626e-08 0.4697430994852798912 -0.00016953449859497231466 -14.66889989083050061 13.203872414598899709 -0.14103421509241859111 --0.0026568764662203521107 0.0027468710922308441774 4.4479242436019731115e-05 -Neptune 1.5243589003230834323e-08 0.7815248400937813483 -0.000164587904124493665 -29.589962576161859431 -4.4071843471850522533 -0.591227914742734173 -0.00044593775398081260874 0.0031315328653865699346 -7.4667609066900140504e-05 diff --git a/examples/symba_swifter_comparison/8pl/tp.in b/examples/symba_swifter_comparison/8pl/tp.in deleted file mode 100644 index 78a4f20a6..000000000 --- a/examples/symba_swifter_comparison/8pl/tp.in +++ /dev/null @@ -1,10 +0,0 @@ -!! 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. - -0 diff --git a/src/collision/collision_resolve.f90 b/src/collision/collision_resolve.f90 index bc6bf302f..dc3d58a8d 100644 --- a/src/collision/collision_resolve.f90 +++ b/src/collision/collision_resolve.f90 @@ -142,7 +142,6 @@ module subroutine collision_resolve_consolidate_impactors(self, nbody_system, pa lflag = .true. ! Shift the impactors so that they are not overlapping - rlim = sum(impactors%radius(1:2)) vrel = impactors%vb(:,2) - impactors%vb(:,1) rrel = impactors%rb(:,2) - impactors%rb(:,1) diff --git a/src/fraggle/fraggle_generate.f90 b/src/fraggle/fraggle_generate.f90 index c91676621..0d6fa5078 100644 --- a/src/fraggle/fraggle_generate.f90 +++ b/src/fraggle/fraggle_generate.f90 @@ -26,7 +26,7 @@ module subroutine fraggle_generate(self, nbody_system, param, t) real(DP), intent(in) :: t !! Time of collision ! Internals integer(I4B) :: i, ibiggest, nfrag - real(DP), dimension(NDIM) :: L_residual, vbcom_orig, dvb + real(DP), dimension(NDIM) :: L_residual, vbcom_orig character(len=STRMAX) :: message logical :: lfailure @@ -37,10 +37,6 @@ module subroutine fraggle_generate(self, nbody_system, param, t) associate(impactors => self%impactors, status => self%status, maxid => nbody_system%maxid) ! Set the coordinate system of the impactors call impactors%set_coordinate_system() - - - vbcom_orig(:) = impactors%vbcom(:) - select case (impactors%regime) case (COLLRESOLVE_REGIME_HIT_AND_RUN) call self%hitandrun(nbody_system, param, t) @@ -78,10 +74,6 @@ module subroutine fraggle_generate(self, nbody_system, param, t) fragments%radius(1:2) = impactors%radius(1:2) fragments%rb(:,1:2) = impactors%rb(:,1:2) fragments%vb(:,1:2) = impactors%vb(:,1:2) - do concurrent(i = 1:2) - fragments%rc(:,i) = fragments%rb(:,i) - impactors%rbcom(:) - fragments%vc(:,i) = fragments%vb(:,i) - impactors%vbcom(:) - end do fragments%Ip(:,1:2) = impactors%Ip(:,1:2) fragments%rot(:,1:2) = impactors%rot(:,1:2) fragments%mtot = sum(fragments%mass(1:2)) @@ -89,19 +81,23 @@ module subroutine fraggle_generate(self, nbody_system, param, t) end if end if - ! Get the energy and momentum of the system before and after the collision - call self%get_energy_and_momentum(nbody_system, param, phase="before") - call self%get_energy_and_momentum(nbody_system, param, phase="after") - L_residual(:) = (self%L_total(:,2) - self%L_total(:,1)) associate (fragments => self%fragments) + ! Get the energy and momentum of the system before and after the collision + call self%get_energy_and_momentum(nbody_system, param, phase="before") nfrag = fragments%nbody + do concurrent(i = 1:2) + fragments%rc(:,i) = fragments%rb(:,i) - impactors%rbcom(:) + fragments%vc(:,i) = fragments%vb(:,i) - impactors%vbcom(:) + end do + call self%get_energy_and_momentum(nbody_system, param, phase="after") + L_residual(:) = (self%L_total(:,2) - self%L_total(:,1)) ! Put any residual angular momentum into orbital velocity + vbcom_orig = impactors%vbcom(:) call collision_util_velocity_torque(-L_residual(:), fragments%mtot, impactors%rbcom(:), impactors%vbcom(:)) - dvb(:) = impactors%vbcom(:) - vbcom_orig(:) - do concurrent(i = 1:nfrag) - fragments%vb(:,i) = fragments%vb(:,i) + dvb(:) + do i=1,nfrag + fragments%vb(:,i) = fragments%vc(:,i) + impactors%vbcom(:) end do select case(impactors%regime) @@ -325,8 +321,9 @@ module subroutine fraggle_generate_pos_vec(collider, nbody_system, param, lfailu ! The distance is chosen to be close to the original locations of the impactors ! but far enough apart to prevent a collisional cascade between fragments real(DP), parameter :: cloud_size_scale_factor = 3.0_DP ! Scale factor to apply to the size of the cloud relative to the distance from the impact point. - ! A larger value puts more space between fragments initially - + ! A larger value puts more space between fragments initially + real(DP) :: rbuffer ! Body radii are inflated by this scale factor to prevent secondary collisions + rbuffer = 1.1_DP associate(fragments => collider%fragments, impactors => collider%impactors, nfrag => collider%fragments%nbody, & pl => nbody_system%pl, tp => nbody_system%tp, npl => nbody_system%pl%nbody, ntp => nbody_system%tp%nbody) @@ -418,17 +415,18 @@ module subroutine fraggle_generate_pos_vec(collider, nbody_system, param, lfailu ! Check for overlaps between fragments do i = j + 1, nfrag dis = .mag.(fragments%rc(:,j) - fragments%rc(:,i)) - loverlap(i) = loverlap(i) .or. (dis <= (fragments%radius(i) + fragments%radius(j))) - loverlap(j) = loverlap(j) .or. (dis <= (fragments%radius(i) + fragments%radius(j))) + loverlap(i) = loverlap(i) .or. (dis <= rbuffer * (fragments%radius(i) + fragments%radius(j))) + loverlap(j) = loverlap(j) .or. (dis <= rbuffer * (fragments%radius(i) + fragments%radius(j))) end do ! Check for overlaps with existing bodies that are not involved in the collision do i = 1, npl if (any(impactors%id(:) == i)) cycle dis = .mag. (fragments%rc(:,j) - (pl%rb(:,i) / collider%dscale - impactors%rbcom(:))) - loverlap(j) = loverlap(j) .or. (dis <= (pl%radius(i) / collider%dscale + fragments%radius(j))) + loverlap(j) = loverlap(j) .or. (dis <= rbuffer * (pl%radius(i) / collider%dscale + fragments%radius(j))) end do end do rdistance = rdistance * collider%fail_scale + rbuffer = rbuffer * collider%fail_scale end do lfailure = any(loverlap(:)) @@ -631,11 +629,6 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu call fragments%set_coordinate_system() call collider_local%get_energy_and_momentum(nbody_system, param, phase="after") - ke_avail = 0.0_DP - do i = fragments%nbody, 1, -1 - ke_avail = ke_avail + 0.5_DP * fragments%mass(i) * max(fragments%vmag(i) - vesc,0.0_DP)**2 - end do - dE = collider_local%te(2) - collider_local%te(1) E_residual_last = E_residual E_residual = dE + impactors%Qloss @@ -661,6 +654,11 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu end if ! Remove a constant amount of velocity from the bodies so we don't shift the center of mass and screw up the momentum + ke_avail = 0.0_DP + do i = fragments%nbody, 1, -1 + ke_avail = ke_avail + 0.5_DP * fragments%mass(i) * max(fragments%vmag(i) - vesc,0.0_DP)**2 + end do + ke_remove = min(E_residual, ke_avail) fscale = sqrt((max(fragments%ke_orbit_tot - ke_remove, 0.0_DP))/fragments%ke_orbit_tot) fragments%vc(:,:) = fscale * fragments%vc(:,:)