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

Commit

Permalink
Refactored and rearranged some subroutine calls to maintain consisten…
Browse files Browse the repository at this point in the history
…cy and make it easier to find things
  • Loading branch information
daminton committed Jul 28, 2021
1 parent afcf1b9 commit 5588444
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions src/modules/rmvs_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module rmvs_classes
contains
private
!> Replace the abstract procedures with concrete ones
procedure, public :: initialize => rmvs_setup_system !! Performs RMVS-specific initilization steps, including generating the close encounter planetocentric structures
procedure, public :: initialize => rmvs_setup_initialize_system !! Performs RMVS-specific initilization steps, including generating the close encounter planetocentric structures
procedure, public :: step => rmvs_step_system !! Advance the RMVS nbody system forward in time by one step
end type rmvs_nbody_system

Expand Down Expand Up @@ -152,12 +152,12 @@ module subroutine rmvs_setup_pl(self,n)
integer, intent(in) :: n !! Number of test particles to allocate
end subroutine rmvs_setup_pl

module subroutine rmvs_setup_system(self, param)
module subroutine rmvs_setup_initialize_system(self, param)
use swiftest_classes, only : swiftest_parameters
implicit none
class(rmvs_nbody_system), intent(inout) :: self !! RMVS system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine rmvs_setup_system
end subroutine rmvs_setup_initialize_system

module subroutine rmvs_setup_tp(self,n)
implicit none
Expand Down
6 changes: 3 additions & 3 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ module symba_classes
class(symba_pl), allocatable :: pl_discards !! Discarded test particle data structure
contains
private
procedure, public :: initialize => symba_setup_system !! Performs SyMBA-specific initilization steps
procedure, public :: initialize => symba_setup_initialize_system !! Performs SyMBA-specific initilization steps
procedure, public :: step => symba_step_system !! Advance the SyMBA nbody system forward in time by one step
procedure, public :: interp => symba_step_interp_system !! Perform an interpolation step on the SymBA nbody system
procedure, public :: recursive_step => symba_step_recur_system !! Step interacting planets and active test particles ahead in democratic heliocentric coordinates at the current recursion level, if applicable, and descend to the next deeper level if necessary
Expand Down Expand Up @@ -332,12 +332,12 @@ module subroutine symba_setup_plplenc(self,n)
integer, intent(in) :: n !! Number of encounters to allocate space for
end subroutine symba_setup_plplenc

module subroutine symba_setup_system(self, param)
module subroutine symba_setup_initialize_system(self, param)
use swiftest_classes, only : swiftest_parameters
implicit none
class(symba_nbody_system), intent(inout) :: self !! SyMBA system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine symba_setup_system
end subroutine symba_setup_initialize_system

module subroutine symba_setup_tp(self,n)
implicit none
Expand Down
12 changes: 6 additions & 6 deletions src/modules/whm_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module whm_classes
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 :: set_ir3 => whm_util_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_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 Down Expand Up @@ -72,7 +72,7 @@ module whm_classes
contains
private
!> Replace the abstract procedures with concrete ones
procedure, public :: initialize => whm_setup_system !! Performs WHM-specific initilization steps, like calculating the Jacobi masses
procedure, public :: initialize => whm_setup_initialize_system !! Performs WHM-specific initilization steps, like calculating the Jacobi masses
procedure, public :: step => whm_step_system !! Advance the WHM nbody system forward in time by one step
end type whm_nbody_system

Expand Down Expand Up @@ -199,10 +199,10 @@ module subroutine whm_setup_pl(self,n)
integer(I4B), intent(in) :: n !! Number of test particles to allocate
end subroutine whm_setup_pl

module subroutine whm_setup_set_ir3j(self)
module subroutine whm_util_set_ir3j(self)
implicit none
class(whm_pl), intent(inout) :: self !! WHM massive body object
end subroutine whm_setup_set_ir3j
end subroutine whm_util_set_ir3j

module subroutine whm_util_set_mu_eta_pl(self, cb)
use swiftest_classes, only : swiftest_cb
Expand All @@ -211,12 +211,12 @@ module subroutine whm_util_set_mu_eta_pl(self, cb)
class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object
end subroutine whm_util_set_mu_eta_pl

module subroutine whm_setup_system(self, param)
module subroutine whm_setup_initialize_system(self, param)
use swiftest_classes, only : swiftest_parameters
implicit none
class(whm_nbody_system), intent(inout) :: self !! WHM nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine whm_setup_system
end subroutine whm_setup_initialize_system

!> Reads WHM test particle object in from file
module subroutine whm_setup_tp(self,n)
Expand Down
6 changes: 3 additions & 3 deletions src/rmvs/rmvs_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module subroutine rmvs_setup_pl(self,n)
return
end subroutine rmvs_setup_pl

module subroutine rmvs_setup_system(self, param)
module subroutine rmvs_setup_initialize_system(self, param)
!! author: David A. Minton
!!
!! Initialize an RMVS nbody system from files and sets up the planetocentric structures.
Expand All @@ -64,7 +64,7 @@ module subroutine rmvs_setup_system(self, param)
integer(I4B) :: i, j

! Call parent method
call whm_setup_system(self, param)
call whm_setup_initialize_system(self, param)

! Set up the pl-tp planetocentric encounter structures for pl and cb. The planetocentric tp structures are
! generated as necessary during close encounter steps.
Expand Down Expand Up @@ -116,7 +116,7 @@ module subroutine rmvs_setup_system(self, param)
end select
end select

end subroutine rmvs_setup_system
end subroutine rmvs_setup_initialize_system

module subroutine rmvs_setup_tp(self,n)
!! author: David A. Minton
Expand Down
6 changes: 3 additions & 3 deletions src/symba/symba_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module subroutine symba_setup_plplenc(self,n)
return
end subroutine symba_setup_plplenc

module subroutine symba_setup_system(self, param)
module subroutine symba_setup_initialize_system(self, param)
!! author: David A. Minton
!!
!! Initialize an SyMBA nbody system from files and sets up the planetocentric structures.
Expand All @@ -115,7 +115,7 @@ module subroutine symba_setup_system(self, param)

! Call parent method
associate(system => self)
call whm_setup_system(system, param)
call whm_setup_initialize_system(system, param)
call system%mergeadd_list%setup(1)
call system%mergesub_list%setup(1)
call system%pltpenc_list%setup(1)
Expand All @@ -131,7 +131,7 @@ module subroutine symba_setup_system(self, param)
end select
end associate
return
end subroutine symba_setup_system
end subroutine symba_setup_initialize_system

module subroutine symba_setup_tp(self,n)
!! author: David A. Minton
Expand Down
27 changes: 2 additions & 25 deletions src/whm/whm_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module subroutine whm_util_set_mu_eta_pl(self, cb)

end subroutine whm_util_set_mu_eta_pl

module subroutine whm_setup_system(self, param)
module subroutine whm_setup_initialize_system(self, param)
!! author: David A. Minton
!!
!! Initialize a WHM nbody system from files
Expand All @@ -91,29 +91,6 @@ module subroutine whm_setup_system(self, param)
call self%tp%v2pv(param)
end if

end subroutine whm_setup_system

module subroutine whm_setup_set_ir3j(self)
!! author: David A. Minton
!!
!! Sets the inverse Jacobi and heliocentric radii cubed (1/rj**3 and 1/rh**3)
implicit none
! Arguments
class(whm_pl), intent(inout) :: self !! WHM massive body object
! Internals
integer(I4B) :: i
real(DP) :: r2, ir

if (self%nbody > 0) then
do i = 1, self%nbody
r2 = dot_product(self%xh(:, i), self%xh(:, i))
ir = 1.0_DP / sqrt(r2)
self%ir3h(i) = ir / r2
r2 = dot_product(self%xj(:, i), self%xj(:, i))
ir = 1.0_DP / sqrt(r2)
self%ir3j(i) = ir / r2
end do
end if
end subroutine whm_setup_set_ir3j
end subroutine whm_setup_initialize_system

end submodule s_whm_setup
23 changes: 23 additions & 0 deletions src/whm/whm_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,27 @@ module subroutine whm_util_fill_pl(self, inserts, lfill_list)

end subroutine whm_util_fill_pl

module subroutine whm_util_set_ir3j(self)
!! author: David A. Minton
!!
!! Sets the inverse Jacobi and heliocentric radii cubed (1/rj**3 and 1/rh**3)
implicit none
! Arguments
class(whm_pl), intent(inout) :: self !! WHM massive body object
! Internals
integer(I4B) :: i
real(DP) :: r2, ir

if (self%nbody > 0) then
do i = 1, self%nbody
r2 = dot_product(self%xh(:, i), self%xh(:, i))
ir = 1.0_DP / sqrt(r2)
self%ir3h(i) = ir / r2
r2 = dot_product(self%xj(:, i), self%xj(:, i))
ir = 1.0_DP / sqrt(r2)
self%ir3j(i) = ir / r2
end do
end if
end subroutine whm_util_set_ir3j

end submodule s_whm_util

0 comments on commit 5588444

Please sign in to comment.