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

Commit

Permalink
Refactored whm spill and fill methods as part of a util submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jul 24, 2021
1 parent 4f30c8e commit aa715db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/modules/whm_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ module whm_classes
real(DP), dimension(:), allocatable :: muj !! Jacobi mu: GMcb * eta(i) / eta(i - 1)
real(DP), dimension(:), allocatable :: ir3j !! Third term of heliocentric acceleration
!! Note to developers: If you add componenets to this class, be sure to update methods and subroutines that traverse the
!! component list, such as whm_setup_pl and whm_spill_pl
!! component list, such as whm_setup_pl and whm_util_spill_pl
contains
procedure, public :: h2j => whm_coord_h2j_pl !! Convert position and velcoity vectors from heliocentric to Jacobi coordinates
procedure, public :: j2h => whm_coord_j2h_pl !! Convert position and velcoity vectors from Jacobi to helliocentric coordinates
procedure, public :: vh2vj => whm_coord_vh2vj_pl !! Convert velocity vectors from heliocentric to Jacobi coordinates
procedure, public :: drift => whm_drift_pl !! Loop through massive bodies and call Danby drift routine to jacobi coordinates
procedure, public :: fill => whm_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure, public :: fill => whm_util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure, public :: accel => whm_getacch_pl !! Compute heliocentric accelerations of massive bodies
procedure, public :: accel_gr => whm_gr_getacch_pl !! Acceleration term arising from the post-Newtonian correction
procedure, public :: gr_pos_kick => whm_gr_p4_pl !! Position kick due to p**4 term in the post-Newtonian correction
procedure, public :: setup => whm_setup_pl !! Constructor method - Allocates space for number of particles
procedure, public :: set_mu => whm_util_set_mu_eta_pl !! Sets the Jacobi mass value for all massive bodies.
procedure, public :: set_ir3 => whm_setup_set_ir3j !! Sets both the heliocentric and jacobi inverse radius terms (1/rj**3 and 1/rh**3)
procedure, public :: step => whm_step_pl !! Steps the body forward one stepsize
procedure, public :: spill => whm_spill_pl !!"Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
procedure, public :: spill => whm_util_spill_pl !!"Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
end type whm_pl

!********************************************************************************************************************************
Expand All @@ -52,7 +52,7 @@ module whm_classes
!! WHM test particle class
type, public, extends(swiftest_tp) :: whm_tp
!! Note to developers: If you add componenets to this class, be sure to update methods and subroutines that traverse the
!! component list, such as whm_setup_tp and whm_spill_tp
!! component list, such as whm_setup_tp and whm_util_spill_tp
contains
private
procedure, public :: accel => whm_getacch_tp !! Compute heliocentric accelerations of test particles
Expand Down Expand Up @@ -106,13 +106,13 @@ module subroutine whm_drift_pl(self, system, param, dt, mask)
logical, dimension(:), intent(in) :: mask !! Logical mask of size self%nbody that determines which bodies to drift
end subroutine whm_drift_pl

module subroutine whm_fill_pl(self, inserts, lfill_list)
module subroutine whm_util_fill_pl(self, inserts, lfill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(whm_pl), intent(inout) :: self !! WHM massive body object
class(swiftest_body), intent(inout) :: inserts !! inserted object
logical, dimension(:), intent(in) :: lfill_list !! Logical array of bodies to merge into the keeps
end subroutine whm_fill_pl
end subroutine whm_util_fill_pl

!> Get heliocentric accelration of massive bodies
module subroutine whm_getacch_pl(self, system, param, t, lbeg)
Expand Down Expand Up @@ -219,13 +219,13 @@ module subroutine whm_step_tp(self, system, param, t, dt)
real(DP), intent(in) :: dt !! Stepsize
end subroutine whm_step_tp

module subroutine whm_spill_pl(self, discards, lspill_list)
module subroutine whm_util_spill_pl(self, discards, lspill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(whm_pl), intent(inout) :: self !! WHM massive body object
class(swiftest_body), intent(inout) :: discards !! Discarded object
logical, dimension(:), intent(in) :: lspill_list !! Logical array of bodies to spill into the discards
end subroutine whm_spill_pl
end subroutine whm_util_spill_pl

!> Steps the Swiftest nbody system forward in time one stepsize
module subroutine whm_step_system(self, param, t, dt)
Expand Down
4 changes: 2 additions & 2 deletions src/rmvs/rmvs_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module subroutine rmvs_util_spill_pl(self, discards, lspill_list)
if (count(.not.lspill_list(:)) > 0) then
keeps%nenc(:) = pack(keeps%nenc(:), .not. lspill_list(:))
end if
call whm_spill_pl(keeps, discards, lspill_list)
call whm_util_spill_pl(keeps, discards, lspill_list)
class default
write(*,*) 'Error! spill method called for incompatible return type on rmvs_pl'
end select
Expand Down Expand Up @@ -54,7 +54,7 @@ module subroutine rmvs_util_fill_pl(self, inserts, lfill_list)
keeps%nenc(:) = unpack(keeps%nenc(:), .not.lfill_list(:), keeps%nenc(:))
keeps%nenc(:) = unpack(inserts%nenc(:), lfill_list(:), keeps%nenc(:))

call whm_fill_pl(keeps, inserts, lfill_list)
call whm_util_fill_pl(keeps, inserts, lfill_list)
class default
write(*,*) 'Error! spill method called for incompatible return type on rmvs_pl'
end select
Expand Down
12 changes: 6 additions & 6 deletions src/whm/whm_spill_and_fill.f90 → src/whm/whm_util.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
submodule(whm_classes) s_whm_spill_and_fill
submodule(whm_classes) s_whm_util
use swiftest
contains
module subroutine whm_spill_pl(self, discards, lspill_list)
module subroutine whm_util_spill_pl(self, discards, lspill_list)
!! author: David A. Minton
!!
!! Move spilled (discarded) WHM test particle structure from active list to discard list
Expand Down Expand Up @@ -42,9 +42,9 @@ module subroutine whm_spill_pl(self, discards, lspill_list)

return

end subroutine whm_spill_pl
end subroutine whm_util_spill_pl

module subroutine whm_fill_pl(self, inserts, lfill_list)
module subroutine whm_util_fill_pl(self, inserts, lfill_list)
!! author: David A. Minton
!!
!! Insert new WHM test particle structure into an old one.
Expand Down Expand Up @@ -87,6 +87,6 @@ module subroutine whm_fill_pl(self, inserts, lfill_list)

return

end subroutine whm_fill_pl
end subroutine whm_util_fill_pl

end submodule s_whm_spill_and_fill
end submodule s_whm_util

0 comments on commit aa715db

Please sign in to comment.