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

Commit

Permalink
Switched fragments and colliders to be allocatables so they get wiped…
Browse files Browse the repository at this point in the history
… out between collision resolves
  • Loading branch information
daminton committed Dec 9, 2022
1 parent fa3b7f3 commit df77b32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ module symba_classes
class(symba_plplenc), allocatable :: plplenc_list !! List of massive body-massive body encounters in a single step
class(symba_plplenc), allocatable :: plplcollision_list !! List of massive body-massive body collisions in a single step
integer(I4B) :: irec !! System recursion level
type(fraggle_colliders) :: colliders !! Fraggle colliders object
type(fraggle_fragments) :: fragments !! Fraggle fragmentation system object
class(fraggle_colliders), allocatable :: colliders !! Fraggle colliders object
class(fraggle_fragments), allocatable :: fragments !! Fraggle fragmentation system object
type(encounter_storage(nframes=:)), allocatable :: encounter_history !! Stores encounter history for later retrieval and saving to file
contains
procedure :: write_discard => symba_io_write_discard !! Write out information about discarded and merged planets and test particles in SyMBA
Expand Down
11 changes: 7 additions & 4 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -885,21 +885,23 @@ module subroutine symba_resolve_collision_fragmentations(self, system, param)
logical :: lgoodcollision
integer(I4B) :: i

associate(plplcollision_list => self, ncollisions => self%nenc, idx1 => self%index1, idx2 => self%index2, colliders => system%colliders, fragments => system%fragments, t => system%t)
associate(plplcollision_list => self, ncollisions => self%nenc, idx1 => self%index1, idx2 => self%index2, t => system%t)
select type(pl => system%pl)
class is (symba_pl)
select type (cb => system%cb)
class is (symba_cb)
do i = 1, ncollisions
allocate(fraggle_colliders :: system%colliders)
allocate(fraggle_fragments :: system%fragments)
idx_parent(1) = pl%kin(idx1(i))%parent
idx_parent(2) = pl%kin(idx2(i))%parent
lgoodcollision = symba_collision_consolidate_colliders(pl, cb, param, idx_parent, colliders)
lgoodcollision = symba_collision_consolidate_colliders(pl, cb, param, idx_parent, system%colliders)
if ((.not. lgoodcollision) .or. any(pl%status(idx_parent(:)) /= COLLISION)) cycle

call colliders%regime(fragments, system, param)
call system%colliders%regime(system%fragments, system, param)

if (param%lencounter_save) call system%collision_snap(param, t, "before")
select case (fragments%regime)
select case (system%fragments%regime)
case (COLLRESOLVE_REGIME_DISRUPTION, COLLRESOLVE_REGIME_SUPERCATASTROPHIC)
plplcollision_list%status(i) = symba_collision_casedisruption(system, param)
case (COLLRESOLVE_REGIME_HIT_AND_RUN)
Expand All @@ -911,6 +913,7 @@ module subroutine symba_resolve_collision_fragmentations(self, system, param)
call util_exit(FAILURE)
end select
if (param%lencounter_save) call system%collision_snap(param, t, "after")
deallocate(system%colliders,system%fragments)
end do
end select
end select
Expand Down

0 comments on commit df77b32

Please sign in to comment.