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

Commit

Permalink
Merge branch 'OOPSymba' into OOPTides
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jul 28, 2021
2 parents d7abeb9 + bc943d3 commit 7e8baa4
Show file tree
Hide file tree
Showing 9 changed files with 459 additions and 258 deletions.
84 changes: 57 additions & 27 deletions src/modules/rmvs_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ module rmvs_classes
integer(I4B) :: ipleP !! index value of encountering planet
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
contains
procedure :: discard => rmvs_discard_tp !! Check to see if test particles should be discarded based on pericenter passage distances with respect to planets encountered
procedure :: encounter_check => rmvs_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body
procedure :: fill => rmvs_util_fill_tp !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure :: accel => rmvs_kick_getacch_tp !! Calculates either the standard or modified version of the acceleration depending if the
!! if the test particle is undergoing a close encounter or not
procedure :: setup => rmvs_setup_tp !! Constructor method - Allocates space for number of particles
procedure :: spill => rmvs_util_spill_tp !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
procedure :: discard => rmvs_discard_tp !! Check to see if test particles should be discarded based on pericenter passage distances with respect to planets encountered
procedure :: encounter_check => rmvs_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body
procedure :: accel => rmvs_kick_getacch_tp !! Calculates either the standard or modified version of the acceleration depending if the
!! if the test particle is undergoing a close encounter or not
procedure :: setup => rmvs_setup_tp !! Constructor method - Allocates space for number of particles
procedure :: fill => rmvs_util_fill_tp !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure :: sort => rmvs_util_sort_tp !! Sorts body arrays by a sortable componen
procedure :: rearrange => rmvs_util_sort_rearrange_tp !! Rearranges the order of array elements of body based on an input index array. Used in sorting methods
procedure :: spill => rmvs_util_spill_tp !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
end type rmvs_tp

!********************************************************************************************************************************
Expand All @@ -89,9 +91,11 @@ module rmvs_classes
class(rmvs_nbody_system), dimension(:), allocatable :: planetocentric !! Planetocentric version of the massive body objects (one for each massive body)
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
contains
procedure :: fill => rmvs_util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure :: setup => rmvs_setup_pl !! Constructor method - Allocates space for number of particles
procedure :: spill => rmvs_util_spill_pl !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
procedure :: setup => rmvs_setup_pl !! Constructor method - Allocates space for number of particles
procedure :: sort => rmvs_util_sort_pl !! Sorts body arrays by a sortable componen
procedure :: rearrange => rmvs_util_sort_rearrange_pl !! Rearranges the order of array elements of body based on an input index array. Used in sorting methods
procedure :: fill => rmvs_util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure :: spill => rmvs_util_spill_pl !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
end type rmvs_pl

interface
Expand All @@ -117,22 +121,6 @@ module function rmvs_encounter_check_tp(self, system, dt) result(lencounter)
logical :: lencounter !! Returns true if there is at least one close encounter
end function rmvs_encounter_check_tp

module subroutine rmvs_util_fill_pl(self, inserts, lfill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(rmvs_pl), intent(inout) :: self !! RMVS 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 rmvs_util_fill_pl

module subroutine rmvs_util_fill_tp(self, inserts, lfill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(rmvs_tp), intent(inout) :: self !! RMVS 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 rmvs_util_fill_tp

module subroutine rmvs_kick_getacch_tp(self, system, param, t, lbeg)
use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters
implicit none
Expand Down Expand Up @@ -162,10 +150,52 @@ module subroutine rmvs_setup_tp(self,n)
integer, intent(in) :: n !! Number of test particles to allocate
end subroutine rmvs_setup_tp

module subroutine rmvs_util_fill_pl(self, inserts, lfill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(rmvs_pl), intent(inout) :: self !! RMVS 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 rmvs_util_fill_pl

module subroutine rmvs_util_fill_tp(self, inserts, lfill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(rmvs_tp), intent(inout) :: self !! RMVS 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 rmvs_util_fill_tp

module subroutine rmvs_util_sort_pl(self, sortby, ascending)
implicit none
class(rmvs_pl), intent(inout) :: self !! RMVS massive body object
character(*), intent(in) :: sortby !! Sorting attribute
logical, intent(in) :: ascending !! Logical flag indicating whether or not the sorting should be in ascending or descending order
end subroutine rmvs_util_sort_pl

module subroutine rmvs_util_sort_tp(self, sortby, ascending)
implicit none
class(rmvs_tp), intent(inout) :: self !! RMVS test particle object
character(*), intent(in) :: sortby !! Sorting attribute
logical, intent(in) :: ascending !! Logical flag indicating whether or not the sorting should be in ascending or descending order
end subroutine rmvs_util_sort_tp

module subroutine rmvs_util_sort_rearrange_pl(self, ind)
implicit none
class(rmvs_pl), intent(inout) :: self !! RMVS massive body object
integer(I4B), dimension(:), intent(in) :: ind !! Index array used to restructure the body (should contain all 1:n index values in the desired order)
end subroutine rmvs_util_sort_rearrange_pl

module subroutine rmvs_util_sort_rearrange_tp(self, ind)
implicit none
class(rmvs_tp), intent(inout) :: self !! RMVS test particle object
integer(I4B), dimension(:), intent(in) :: ind !! Index array used to restructure the body (should contain all 1:n index values in the desired order)
end subroutine rmvs_util_sort_rearrange_tp

module subroutine rmvs_util_spill_pl(self, discards, lspill_list)
use swiftest_classes, only : swiftest_body
implicit none
class(rmvs_pl), intent(inout) :: self !! RMVS massive body object
class(rmvs_pl), intent(inout) :: self !! RMVS 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 rmvs_util_spill_pl
Expand Down
12 changes: 6 additions & 6 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ end subroutine symba_setup_pl

module subroutine symba_setup_pltpenc(self,n)
implicit none
class(symba_pltpenc), intent(inout) :: self !! Symba pl-tp encounter structure
class(symba_pltpenc), intent(inout) :: self !! SyMBA pl-tp encounter structure
integer, intent(in) :: n !! Number of encounters to allocate space for
end subroutine symba_setup_pltpenc

module subroutine symba_setup_plplenc(self,n)
implicit none
class(symba_plplenc), intent(inout) :: self !! Symba pl-tp encounter structure
class(symba_plplenc), intent(inout) :: self !! SyMBA pl-tp encounter structure
integer, intent(in) :: n !! Number of encounters to allocate space for
end subroutine symba_setup_plplenc

Expand Down Expand Up @@ -390,27 +390,27 @@ end subroutine symba_util_resize_pltpenc

module subroutine symba_util_sort_pl(self, sortby, ascending)
implicit none
class(symba_pl), intent(inout) :: self !! Symba massive body object
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
character(*), intent(in) :: sortby !! Sorting attribute
logical, intent(in) :: ascending !! Logical flag indicating whether or not the sorting should be in ascending or descending order
end subroutine symba_util_sort_pl

module subroutine symba_util_sort_tp(self, sortby, ascending)
implicit none
class(symba_tp), intent(inout) :: self !! Swiftest test particle object
class(symba_tp), intent(inout) :: self !! SyMBA test particle object
character(*), intent(in) :: sortby !! Sorting attribute
logical, intent(in) :: ascending !! Logical flag indicating whether or not the sorting should be in ascending or descending order
end subroutine symba_util_sort_tp

module subroutine symba_util_sort_rearrange_pl(self, ind)
implicit none
class(symba_pl), intent(inout) :: self !! Symba massive body object
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
integer(I4B), dimension(:), intent(in) :: ind !! Index array used to restructure the body (should contain all 1:n index values in the desired order)
end subroutine symba_util_sort_rearrange_pl

module subroutine symba_util_sort_rearrange_tp(self, ind)
implicit none
class(symba_tp), intent(inout) :: self !! Symba massive body object
class(symba_tp), intent(inout) :: self !! SyMBA massive body object
integer(I4B), dimension(:), intent(in) :: ind !! Index array used to restructure the body (should contain all 1:n index values in the desired order)
end subroutine symba_util_sort_rearrange_tp

Expand Down
43 changes: 29 additions & 14 deletions src/modules/whm_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,22 @@ module whm_classes
!! 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_util_spill_pl
contains
procedure :: h2j => whm_coord_h2j_pl !! Convert position and velcoity vectors from heliocentric to Jacobi coordinates
procedure :: j2h => whm_coord_j2h_pl !! Convert position and velcoity vectors from Jacobi to helliocentric coordinates
procedure :: vh2vj => whm_coord_vh2vj_pl !! Convert velocity vectors from heliocentric to Jacobi coordinates
procedure :: drift => whm_drift_pl !! Loop through massive bodies and call Danby drift routine to jacobi coordinates
procedure :: fill => whm_util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure :: accel => whm_kick_getacch_pl !! Compute heliocentric accelerations of massive bodies
procedure :: kick => whm_kick_vh_pl !! Kick heliocentric velocities of massive bodies
procedure :: accel_gr => whm_gr_kick_getacch_pl !! Acceleration term arising from the post-Newtonian correction
procedure :: gr_pos_kick => whm_gr_p4_pl !! Position kick due to p**4 term in the post-Newtonian correction
procedure :: setup => whm_setup_pl !! Constructor method - Allocates space for number of particles
procedure :: set_mu => whm_util_set_mu_eta_pl !! Sets the Jacobi mass value for all massive bodies.
procedure :: set_ir3 => whm_util_set_ir3j !! Sets both the heliocentric and jacobi inverse radius terms (1/rj**3 and 1/rh**3)
procedure :: step => whm_step_pl !! Steps the body forward one stepsize
procedure :: spill => whm_util_spill_pl !!"Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
procedure :: h2j => whm_coord_h2j_pl !! Convert position and velcoity vectors from heliocentric to Jacobi coordinates
procedure :: j2h => whm_coord_j2h_pl !! Convert position and velcoity vectors from Jacobi to helliocentric coordinates
procedure :: vh2vj => whm_coord_vh2vj_pl !! Convert velocity vectors from heliocentric to Jacobi coordinates
procedure :: drift => whm_drift_pl !! Loop through massive bodies and call Danby drift routine to jacobi coordinates
procedure :: fill => whm_util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure :: accel => whm_kick_getacch_pl !! Compute heliocentric accelerations of massive bodies
procedure :: kick => whm_kick_vh_pl !! Kick heliocentric velocities of massive bodies
procedure :: accel_gr => whm_gr_kick_getacch_pl !! Acceleration term arising from the post-Newtonian correction
procedure :: gr_pos_kick => whm_gr_p4_pl !! Position kick due to p**4 term in the post-Newtonian correction
procedure :: setup => whm_setup_pl !! Constructor method - Allocates space for number of particles
procedure :: set_mu => whm_util_set_mu_eta_pl !! Sets the Jacobi mass value for all massive bodies.
procedure :: set_ir3 => whm_util_set_ir3j !! Sets both the heliocentric and jacobi inverse radius terms (1/rj**3 and 1/rh**3)
procedure :: sort => whm_util_sort_pl !! Sort a WHM massive body object in-place.
procedure :: rearrange => whm_util_sort_rearrange_pl !! Rearranges the order of array elements of body based on an input index array. Used in sorting methods
procedure :: step => whm_step_pl !! Steps the body forward one stepsize
procedure :: 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 @@ -209,6 +211,19 @@ 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_util_sort_pl(self, sortby, ascending)
implicit none
class(whm_pl), intent(inout) :: self !! WHM massive body object
character(*), intent(in) :: sortby !! Sorting attribute
logical, intent(in) :: ascending !! Logical flag indicating whether or not the sorting should be in ascending or descending order
end subroutine whm_util_sort_pl

module subroutine whm_util_sort_rearrange_pl(self, ind)
implicit none
class(whm_pl), intent(inout) :: self !! WHM massive body object
integer(I4B), dimension(:), intent(in) :: ind !! Index array used to restructure the body (should contain all 1:n index values in the desired order)
end subroutine whm_util_sort_rearrange_pl

module subroutine whm_setup_initialize_system(self, param)
use swiftest_classes, only : swiftest_parameters
implicit none
Expand Down
Loading

0 comments on commit 7e8baa4

Please sign in to comment.