From bab38bbfcb23733ad66c3cb9ed5277038eb5269f Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 15 Dec 2022 07:02:17 -0500 Subject: [PATCH] Fixed bug that prevented pure hit and runs from being recorded properly in the collision snapshot --- examples/Fragmentation/swiftest_fragmentation.py | 2 +- src/symba/symba_collision.f90 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/Fragmentation/swiftest_fragmentation.py b/examples/Fragmentation/swiftest_fragmentation.py index e5a518896..2f4685929 100644 --- a/examples/Fragmentation/swiftest_fragmentation.py +++ b/examples/Fragmentation/swiftest_fragmentation.py @@ -72,7 +72,7 @@ # Do the same as above for the hit and run case. sim_hitandrun = swiftest.Simulation(simdir="hitandrun", **run_arguments) sim_hitandrun.add_solar_system_body(["Sun"]) -sim_hitandrun.add_body(name="Target", rh=[1.0, -4.2e-05, 0.0], vh=[[0.0, 6.28, 0.0]], Gmass=1e-7, radius=7e-6, rot=[0.0, 0.0, 6.0e4]) +sim_hitandrun.add_body(name="Target", rh=[1.0, -4.2e-05, 0.0], vh=[0.0, 6.28, 0.0], Gmass=1e-7, radius=7e-6, rot=[0.0, 0.0, 6.0e4]) sim_hitandrun.add_body(name="Projectile", rh=[1.0, 4.2e-05, 0.0], vh=[-1.5, -6.28, 0.0], Gmass=7e-10, radius=3.25e-6, rot=[0.0, 0.0, 1.0e5]) sim_hitandrun.get_parameter() sim_hitandrun.run() diff --git a/src/symba/symba_collision.f90 b/src/symba/symba_collision.f90 index b5ed877c3..e9c619d02 100644 --- a/src/symba/symba_collision.f90 +++ b/src/symba/symba_collision.f90 @@ -150,6 +150,7 @@ module function symba_collision_casehitandrun(system, param, t) result(status) pl%ldiscard(colliders%idx(:)) = .false. pl%lcollision(colliders%idx(:)) = .false. end select + allocate(system%fragments%pl, source=system%colliders%pl) ! Be sure to save the pl so that snapshots still work else ibiggest = colliders%idx(maxloc(system%pl%Gmass(colliders%idx(:)), dim=1)) fragments%id(1) = system%pl%id(ibiggest)