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

Commit

Permalink
Lots of small improvements to array handling during normal spill/appe…
Browse files Browse the repository at this point in the history
…nd/rearray operations in SyMBA
  • Loading branch information
daminton committed Aug 17, 2021
1 parent c8c805e commit 9bb5869
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
5 changes: 3 additions & 2 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,10 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci)
integer(I4B), value :: ireci !! input recursion level
end subroutine symba_step_recur_system

module subroutine symba_step_reset_system(self)
module subroutine symba_step_reset_system(self, param)
implicit none
class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object
class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object
class(symba_parameters), intent(in) :: param !! Current run configuration parameters with SyMBA additions
end subroutine symba_step_reset_system
end interface

Expand Down
32 changes: 18 additions & 14 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ module subroutine symba_step_system(self, param, t, dt)
! Internals
logical :: lencounter

call self%reset()
select type(pl => self%pl)
class is (symba_pl)
select type(tp => self%tp)
class is (symba_tp)
lencounter = pl%encounter_check(self, dt, 0) .or. tp%encounter_check(self, dt, 0)
if (lencounter) then
tp%lfirst = pl%lfirst
call self%interp(param, t, dt)
pl%lfirst = .true.
tp%lfirst = .true.
else
call helio_step_system(self, param, t, dt)
end if
select type(param)
class is (symba_parameters)
call self%reset(param)
lencounter = pl%encounter_check(self, dt, 0) .or. tp%encounter_check(self, dt, 0)
if (lencounter) then
tp%lfirst = pl%lfirst
call self%interp(param, t, dt)
pl%lfirst = .true.
tp%lfirst = .true.
else
call helio_step_system(self, param, t, dt)
end if
end select
end select
end select

Expand Down Expand Up @@ -212,7 +215,7 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci)
end subroutine symba_step_recur_system


module subroutine symba_step_reset_system(self)
module subroutine symba_step_reset_system(self, param)
!! author: David A. Minton
!!
!! Resets pl, tp,and encounter structures at the start of a new step
Expand All @@ -221,7 +224,8 @@ module subroutine symba_step_reset_system(self)
!! Adapted from Hal Levison's Swift routine symba5_step.f
implicit none
! Arguments
class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object
class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object
class(symba_parameters), intent(in) :: param !! Current run configuration parameters with SyMBA additions
! Internals
integer(I4B) :: i

Expand Down Expand Up @@ -254,8 +258,8 @@ module subroutine symba_step_reset_system(self)
system%pltpenc_list%nenc = 0
end if

call system%pl_adds%resize(0)
call system%pl_discards%resize(0)
call system%pl_adds%setup(0, param)
call system%pl_discards%setup(0, param)
end select
end select
end associate
Expand Down
4 changes: 3 additions & 1 deletion src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,10 @@ module subroutine symba_util_rearray_pl(self, system, param)
pl%lmtiny(:) = pl%Gmass(:) > param%GMTINY
pl%nplm = count(pl%lmtiny(:))

! Reindex the bodies and calculate the level 0 encounter list
! Reindex the new list ofbodies
call pl%eucl_index()

! Re-build the encounter list
lencounter = pl%encounter_check(system, param%dt, 0)
select type(tp => system%tp)
class is (symba_tp)
Expand Down
2 changes: 0 additions & 2 deletions src/util/util_append.f90
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ module subroutine util_append_pl(self, source, lsource_mask)

call util_append_body(self, source, lsource_mask)
end associate

call self%eucl_index()
class default
write(*,*) "Invalid object passed to the append method. Source must be of class swiftest_pl or its descendents"
call util_exit(FAILURE)
Expand Down

0 comments on commit 9bb5869

Please sign in to comment.