From dc26b947afbd122d09200d78665e17ed1d21b389 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Wed, 11 Jan 2023 16:45:59 -0500 Subject: [PATCH 1/2] Adjusted Fragmentation Movie to make pure hit and runs pure again --- examples/Fragmentation/Fragmentation_Movie.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Fragmentation/Fragmentation_Movie.py b/examples/Fragmentation/Fragmentation_Movie.py index d2b5f79e8..7ed83247b 100644 --- a/examples/Fragmentation/Fragmentation_Movie.py +++ b/examples/Fragmentation/Fragmentation_Movie.py @@ -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])] } From db38bcfb173c0089d1b3c406e5cab5f450b576d3 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Wed, 11 Jan 2023 16:57:23 -0500 Subject: [PATCH 2/2] Fixed issue where pure hit and runs and the bounce model was storing the entire pl object into the before/after storage objects instead of just the bodies involved in the collision. --- src/collision/collision_generate.f90 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/collision/collision_generate.f90 b/src/collision/collision_generate.f90 index 288c00ebd..414cff13f 100644 --- a/src/collision/collision_generate.f90 +++ b/src/collision/collision_generate.f90 @@ -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(:)) @@ -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) @@ -112,12 +118,18 @@ 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))) @@ -125,7 +137,8 @@ module subroutine collision_generate_hitandrun(self, nbody_system, param, t) ! 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 @@ -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