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

Commit

Permalink
Fixed issue in which pure hit and run kinship relationships were not …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
daminton committed Aug 31, 2021
1 parent f563225 commit 0aa83ac
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0aa83ac

Please sign in to comment.