From 0aa83aca8df7ef0682dda8551754d188f9255060 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 30 Aug 2021 23:04:42 -0400 Subject: [PATCH] Fixed issue in which pure hit and run kinship relationships were not being reset, causing bodies to later accumulate children when the hit and run had aleady been resolved. This was inadverently causing bodies to be lost when they shouldn't have been. --- src/symba/symba_collision.f90 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/symba/symba_collision.f90 b/src/symba/symba_collision.f90 index 99ced73c5..7a2a38023 100644 --- a/src/symba/symba_collision.f90 +++ b/src/symba/symba_collision.f90 @@ -119,7 +119,7 @@ module function symba_collision_casehitandrun(system, param, family, x, v, mass, ! Result integer(I4B) :: status !! Status flag assigned to this outcome ! Internals - integer(I4B) :: i, nfrag, jproj, jtarg, idstart, ibiggest, nfamily + integer(I4B) :: i, j, nfrag, jproj, jtarg, idstart, ibiggest, nfamily real(DP) :: mtot, avg_dens real(DP), dimension(NDIM) :: xcom, vcom real(DP), dimension(2) :: vol @@ -201,6 +201,12 @@ module function symba_collision_casehitandrun(system, param, family, x, v, mass, pl%status(family(:)) = ACTIVE pl%ldiscard(family(:)) = .false. pl%lcollision(family(:)) = .false. + pl%kin(family(:))%parent = family(:) + pl%kin(family(:))%nchild = 0 + do j = 1, size(family(:)) + i = family(j) + if (allocated(pl%kin(i)%child)) deallocate(pl%kin(i)%child) + end do end select else status = HIT_AND_RUN_DISRUPT @@ -341,7 +347,7 @@ module function symba_collision_casesupercatastrophic(system, param, family, x, ! Result integer(I4B) :: status !! Status flag assigned to this outcome ! Internals - integer(I4B) :: i, nfrag, ibiggest, nfamily, nstart, nend + integer(I4B) :: i, j, nfrag, ibiggest, nfamily, nstart, nend real(DP) :: mtot, avg_dens, min_frag_mass real(DP), dimension(NDIM) :: xcom, vcom real(DP), dimension(2) :: vol @@ -408,6 +414,12 @@ module function symba_collision_casesupercatastrophic(system, param, family, x, pl%status(family(:)) = status pl%ldiscard(family(:)) = .false. pl%lcollision(family(:)) = .false. + pl%kin(family(:))%parent = family(:) + pl%kin(family(:))%nchild = 0 + do j = 1, size(family(:)) + i = family(j) + if (allocated(pl%kin(i)%child)) deallocate(pl%kin(i)%child) + end do end select else ! Populate the list of new bodies @@ -1066,8 +1078,7 @@ module subroutine symba_collision_resolve_fragmentations(self, system, param) idx_parent(1) = pl%kin(idx1(i))%parent idx_parent(2) = pl%kin(idx2(i))%parent lgoodcollision = symba_collision_consolidate_familes(pl, cb, param, idx_parent, family, x, v, mass, radius, L_spin, Ip) - if (.not. lgoodcollision) cycle - if (any(pl%status(idx_parent(:)) /= COLLISION)) cycle ! One of these two bodies has already been resolved + if ((.not. lgoodcollision) .or. any(pl%status(idx_parent(:)) /= COLLISION)) cycle ! Convert all quantities to SI units and determine which of the pair is the projectile vs. target before sending them ! to symba_regime