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

Commit

Permalink
Reorganized io subroutines into alphabetical order like the other sub…
Browse files Browse the repository at this point in the history
…modules
  • Loading branch information
daminton committed Aug 4, 2021
1 parent cfedcd5 commit 5dee8d3
Show file tree
Hide file tree
Showing 7 changed files with 1,540 additions and 441 deletions.
1,208 changes: 1,142 additions & 66 deletions examples/symba_swifter_comparison/1pl_1pl_encounter/swiftest_vs_swifter.ipynb

Large diffs are not rendered by default.

732 changes: 366 additions & 366 deletions src/io/io.f90

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ end subroutine symba_util_peri_pl

module subroutine symba_util_rearray_pl(self, system, param)
implicit none
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
class(symba_nbody_system), intent(inout) :: system !! SyMBA nbody system object
class(symba_parameters), intent(in) :: param !! Current run configuration parameters with SyMBA additions
end subroutine symba_util_rearray_pl
end interface

Expand Down
2 changes: 1 addition & 1 deletion src/symba/symba_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ module subroutine symba_discard_pl(self, system, param)

if (any(pl%ldiscard(:))) then
call symba_discard_nonplpl_conservation(self, system, param)
!call pl%rearray(self, system, param)
call pl%rearray(system, param)
end if

end associate
Expand Down
2 changes: 2 additions & 0 deletions src/symba/symba_fragmentation.f90
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ module function symba_fragmentation_casemerge(system, param, family, x, v, mass,
ibiggest = maxloc(pl%Gmass(family(:)), dim=1)
plnew%id(1) = pl%id(family(ibiggest))
plnew%status(1) = ACTIVE
plnew%lcollision = .false.
plnew%ldiscard = .false.
plnew%xb(:,1) = xcom(:)
plnew%vb(:,1) = vcom(:)
plnew%xh(:,1) = xcom(:) - cb%xb(:)
Expand Down
30 changes: 25 additions & 5 deletions src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,37 @@ module subroutine symba_util_rearray_pl(self, system, param)
!! Clean up the massive body structures to remove discarded bodies and add new bodies
implicit none
! Arguments
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
class(symba_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(symba_parameters), intent(in) :: param !! Current run configuration parameters
! Internals
class(symba_pl), allocatable :: pl_discards !! The discarded body list.

associate(pl => self, mergeadd_list => system%mergeadd_list)
allocate(pl_discards, mold=pl)
! Remove the discards
call pl%spill(pl_discards, lspill_list=(pl%ldiscard(:) .or. pl%status(:) == INACTIVE), ldestructive=.true.)

! Add in any new bodies
call pl%append(mergeadd_list)

! If there are still bodies in the system, sort by mass in descending order and re-index
if (pl%nbody > 0) then
call pl%sort("mass", ascending=.false.)
pl%lmtiny(:) = pl%Gmass(:) > param%MTINY
pl%nplm = count(pl%lmtiny(:))
call pl%eucl_index()
end if

! First
! Destroy the discarded body list, since we already have what we need in the mergesub_list
call pl_discards%setup(0,param)
deallocate(pl_discards)
end associate

return
end subroutine symba_util_rearray_pl



module subroutine symba_util_resize_arr_info(arr, nnew)
!! author: David A. Minton
!!
Expand Down
1 change: 1 addition & 0 deletions src/util/util_spill.f90
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ module subroutine util_spill_body(self, discards, lspill_list, ldestructive)
call util_spill(keeps%name, discards%name, lspill_list, ldestructive)
call util_spill(keeps%status, discards%status, lspill_list, ldestructive)
call util_spill(keeps%lmask, discards%lmask, lspill_list, ldestructive)
call util_spill(keeps%ldiscard, discards%ldiscard, lspill_list, ldestructive)
call util_spill(keeps%mu, discards%mu, lspill_list, ldestructive)
call util_spill(keeps%xh, discards%xh, lspill_list, ldestructive)
call util_spill(keeps%vh, discards%vh, lspill_list, ldestructive)
Expand Down

0 comments on commit 5dee8d3

Please sign in to comment.