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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jan 11, 2023
2 parents 93091a9 + db38bcf commit af2b8ff
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/Fragmentation/Fragmentation_Movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"hitandrun_disrupt" : [np.array([ 0.00, 6.28, 0.0]),
np.array([-1.45, -6.28, 0.0])],
"hitandrun_pure" : [np.array([ 0.00, 6.28, 0.0]),
np.array([-1.51, -6.28, 0.0])],
np.array([-1.52, -6.28, 0.0])],
"merge" : [np.array([ 0.00, 0.0, 0.0]),
np.array([ 0.01, -0.100005, 0.0])]
}
Expand Down
22 changes: 18 additions & 4 deletions src/collision/collision_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,24 @@ module subroutine collision_generate_bounce(self, nbody_system, param, t)
! Internals
integer(I4B) :: i,j,nimp
real(DP), dimension(NDIM) :: vcom, rnorm
logical, dimension(:), allocatable :: lmask

select type(nbody_system)
class is (swiftest_nbody_system)
select type (pl => nbody_system%pl)
class is (swiftest_pl)
associate(impactors => nbody_system%collider%impactors, fragments => nbody_system%collider%fragments)
allocate(lmask, mold=pl%lmask)
lmask(:) = .false.
lmask(impactors%id(:)) = .true.
select case (impactors%regime)
case (COLLRESOLVE_REGIME_DISRUPTION, COLLRESOLVE_REGIME_SUPERCATASTROPHIC)

! Manually save the before/after snapshots because this case doesn't use the mergeaddsub procedure
select type(before => self%before)
class is (swiftest_nbody_system)
allocate(before%pl, source=pl)
allocate(before%pl, mold=pl)
call pl%spill(before%pl, lmask, ldestructive=.false.)
end select

nimp = size(impactors%id(:))
Expand All @@ -78,7 +83,8 @@ module subroutine collision_generate_bounce(self, nbody_system, param, t)

select type(after => self%after)
class is (swiftest_nbody_system)
allocate(after%pl, source=pl)
allocate(after%pl, mold=pl)
call pl%spill(after%pl, lmask, ldestructive=.false.)
end select

case (COLLRESOLVE_REGIME_HIT_AND_RUN)
Expand Down Expand Up @@ -112,20 +118,27 @@ module subroutine collision_generate_hitandrun(self, nbody_system, param, t)
integer(I4B) :: status !! Status flag assigned to this outcome
! Internals
character(len=STRMAX) :: message
logical, dimension(:), allocatable :: lmask

select type(nbody_system)
class is (swiftest_nbody_system)
select type(pl => nbody_system%pl)
class is (swiftest_pl)
associate(impactors => self%impactors)

allocate(lmask, mold=pl%lmask)
lmask(:) = .false.
lmask(impactors%id(:)) = .true.

message = "Hit and run between"
call collision_io_collider_message(nbody_system%pl, impactors%id, message)
call swiftest_io_log_one_message(COLLISION_LOG_OUT, trim(adjustl(message)))

! Manually save the before/after snapshots because this case doesn't use the mergeaddsub procedure
select type(before => self%before)
class is (swiftest_nbody_system)
allocate(before%pl, source=pl)
allocate(before%pl, mold=pl)
call pl%spill(before%pl, lmask, ldestructive=.false.)
end select

status = HIT_AND_RUN_PURE
Expand All @@ -135,7 +148,8 @@ module subroutine collision_generate_hitandrun(self, nbody_system, param, t)

select type(after => self%after)
class is (swiftest_nbody_system)
allocate(after%pl, source=pl)
allocate(after%pl, mold=pl)
call pl%spill(after%pl, lmask, ldestructive=.false.)
end select

end associate
Expand Down

0 comments on commit af2b8ff

Please sign in to comment.