From aa3e810729bdd5d69cb40c7a7529eaf86c32aa86 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 2 Aug 2021 19:08:49 -0400 Subject: [PATCH] Removed the mergesub_list call from inside the symba step --- src/symba/symba_collision.f90 | 5 ----- src/symba/symba_discard.f90 | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/symba/symba_collision.f90 b/src/symba/symba_collision.f90 index ed2e1e0a1..2614a486a 100644 --- a/src/symba/symba_collision.f90 +++ b/src/symba/symba_collision.f90 @@ -63,15 +63,10 @@ module subroutine symba_collision_check_plplenc(self, system, param, t, dt, irec ! Check to see if either of these bodies has been involved with a collision before, and if so, make this a collisional family if (pl%lcollision(ind1(k)) .or. pl%lcollision(ind2(k))) call pl%make_family([ind1(k),ind2(k)]) - ! Add any of the bodies that have *not* previously been involved in a collision to the subtraction list - lmask(:) = .false. - lmask(ind1(k)) = .not.pl%lcollision(ind1(k)) - lmask(ind2(k)) = .not.pl%lcollision(ind2(k)) ! Set the collision flag for these to bodies to true in case they become involved in another collision later in the step pl%lcollision([ind1(k), ind2(k)]) = .true. pl%lcollision([ind1(k), ind2(k)]) = .true. pl%status([ind1(k), ind2(k)]) = COLLISION - call system%mergesub_list%append(pl, lmask) end do end if diff --git a/src/symba/symba_discard.f90 b/src/symba/symba_discard.f90 index 9a90d7ea1..f9066fdc6 100644 --- a/src/symba/symba_discard.f90 +++ b/src/symba/symba_discard.f90 @@ -37,7 +37,10 @@ end subroutine symba_discard_pl subroutine symba_discard_cb_pl(pl, system, param) !! author: David A. Minton !! - !! Check to see if planets should be discarded based on their positions relative to the central body + !! Check to see if planets should be discarded based on their positions relative to the central body. + !! If a body gets flagged here when it has also been previously flagged for a collision with another massive body, + !! its collisional status will be revoked. Discards due to colliding with or escaping the central body take precedence + !! over pl-pl collisions !! !! Adapted from David E. Kaufmann's Swifter routine: symba_discard_cb.f90 !! Adapted from Hal Levison's Swift routine discard_massive5.f @@ -60,10 +63,12 @@ subroutine symba_discard_cb_pl(pl, system, param) rh2 = dot_product(pl%xh(:,i), pl%xh(:,i)) if ((param%rmax >= 0.0_DP) .and. (rh2 > rmax2)) then pl%ldiscard(i) = .true. + pl%lcollision(i) = .false. pl%status(i) = DISCARDED_RMAX write(*, *) "Massive body ", pl%id(i), " too far from the central body at t = ", param%t else if ((param%rmin >= 0.0_DP) .and. (rh2 < rmin2)) then pl%ldiscard(i) = .true. + pl%lcollision(i) = .false. pl%status(i) = DISCARDED_RMIN write(*, *) "Massive body ", pl%id(i), " too close to the central body at t = ", param%t else if (param%rmaxu >= 0.0_DP) then @@ -72,6 +77,7 @@ subroutine symba_discard_cb_pl(pl, system, param) energy = 0.5_DP * vb2 - system%msys / sqrt(rb2) if ((energy > 0.0_DP) .and. (rb2 > rmaxu2)) then pl%ldiscard(i) = .true. + pl%lcollision(i) = .false. pl%status(i) = DISCARDED_RMAXU write(*, *) "Massive body ", pl%id(i), " is unbound and too far from barycenter at t = ", param%t end if