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

Commit

Permalink
Switched to a default public model, since that was effectively what w…
Browse files Browse the repository at this point in the history
…e were doing anyway, and this simplifies the code quite a bit
  • Loading branch information
daminton committed Jul 28, 2021
1 parent 5588444 commit 720f15e
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 224 deletions.
39 changes: 20 additions & 19 deletions src/modules/helio_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ module helio_classes
use swiftest_classes, only : swiftest_cb, swiftest_pl, swiftest_tp, swiftest_nbody_system
use whm_classes, only : whm_nbody_system
implicit none
public


!********************************************************************************************************************************
! helio_nbody_system class definitions and method interfaces
!********************************************************************************************************************************
type, public, extends(whm_nbody_system) :: helio_nbody_system
type, extends(whm_nbody_system) :: helio_nbody_system
contains
procedure, public :: step => helio_step_system !! Advance the Helio nbody system forward in time by one step
procedure :: step => helio_step_system !! Advance the Helio nbody system forward in time by one step
end type helio_nbody_system

!********************************************************************************************************************************
! helio_cb class definitions and method interfaces
!*******************************************************************************************************************************
!> Helio central body particle class
type, public, extends(swiftest_cb) :: helio_cb
type, extends(swiftest_cb) :: helio_cb
real(DP), dimension(NDIM) :: ptbeg !! negative barycentric velocity of the central body at the beginning of time step
real(DP), dimension(NDIM) :: ptend !! negative barycentric velocity of the central body at the end of time step
contains
Expand All @@ -32,31 +33,31 @@ module helio_classes
!*******************************************************************************************************************************

!! Helio massive body particle class
type, public, extends(swiftest_pl) :: helio_pl
type, extends(swiftest_pl) :: helio_pl
contains
procedure, public :: vh2vb => helio_coord_vh2vb_pl !! Convert massive bodies from heliocentric to barycentric coordinates (velocity only)
procedure, public :: vb2vh => helio_coord_vb2vh_pl !! Convert massive bodies from barycentric to heliocentric coordinates (velocity only)
procedure, public :: drift => helio_drift_pl !! Method for Danby drift in Democratic Heliocentric coordinates
procedure, public :: lindrift => helio_drift_linear_pl !! Method for linear drift of massive bodies due to barycentric momentum of Sun
procedure, public :: accel => helio_kick_getacch_pl !! Compute heliocentric accelerations of massive bodies
procedure, public :: kick => helio_kick_vb_pl !! Kicks the barycentric velocities
procedure, public :: step => helio_step_pl !! Steps the body forward one stepsize
procedure :: vh2vb => helio_coord_vh2vb_pl !! Convert massive bodies from heliocentric to barycentric coordinates (velocity only)
procedure :: vb2vh => helio_coord_vb2vh_pl !! Convert massive bodies from barycentric to heliocentric coordinates (velocity only)
procedure :: drift => helio_drift_pl !! Method for Danby drift in Democratic Heliocentric coordinates
procedure :: lindrift => helio_drift_linear_pl !! Method for linear drift of massive bodies due to barycentric momentum of Sun
procedure :: accel => helio_kick_getacch_pl !! Compute heliocentric accelerations of massive bodies
procedure :: kick => helio_kick_vb_pl !! Kicks the barycentric velocities
procedure :: step => helio_step_pl !! Steps the body forward one stepsize
end type helio_pl

!********************************************************************************************************************************
! helio_tp class definitions and method interfaces
!*******************************************************************************************************************************

!! Helio test particle class
type, public, extends(swiftest_tp) :: helio_tp
type, extends(swiftest_tp) :: helio_tp
contains
procedure, public :: vh2vb => helio_coord_vh2vb_tp !! Convert test particles from heliocentric to barycentric coordinates (velocity only)
procedure, public :: vb2vh => helio_coord_vb2vh_tp !! Convert test particles from barycentric to heliocentric coordinates (velocity only)
procedure, public :: lindrift => helio_drift_linear_tp !! Method for linear drift of massive bodies due to barycentric momentum of Sun
procedure, public :: drift => helio_drift_tp !! Method for Danby drift in Democratic Heliocentric coordinates
procedure, public :: accel => helio_kick_getacch_tp !! Compute heliocentric accelerations of massive bodies
procedure, public :: kick => helio_kick_vb_tp !! Kicks the barycentric velocities
procedure, public :: step => helio_step_tp !! Steps the body forward one stepsize
procedure :: vh2vb => helio_coord_vh2vb_tp !! Convert test particles from heliocentric to barycentric coordinates (velocity only)
procedure :: vb2vh => helio_coord_vb2vh_tp !! Convert test particles from barycentric to heliocentric coordinates (velocity only)
procedure :: lindrift => helio_drift_linear_tp !! Method for linear drift of massive bodies due to barycentric momentum of Sun
procedure :: drift => helio_drift_tp !! Method for Danby drift in Democratic Heliocentric coordinates
procedure :: accel => helio_kick_getacch_tp !! Compute heliocentric accelerations of massive bodies
procedure :: kick => helio_kick_vb_tp !! Kicks the barycentric velocities
procedure :: step => helio_step_tp !! Steps the body forward one stepsize
end type helio_tp

interface
Expand Down
57 changes: 27 additions & 30 deletions src/modules/rmvs_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ module rmvs_classes
use swiftest_globals
use whm_classes, only : whm_cb, whm_pl, whm_tp, whm_nbody_system
implicit none

public

integer(I4B), private, parameter :: NTENC = 10
integer(I4B), private, parameter :: NTPHENC = 3
integer(I4B), private, parameter :: NTPENC = NTENC * NTPHENC
real(DP), private, parameter :: RHSCALE = 3.5_DP
real(DP), private, parameter :: RHPSCALE = 1.0_DP
real(DP), private, parameter :: FACQDT = 2.0_DP
real(DP), private, parameter :: RHSCALE = 3.5_DP
real(DP), private, parameter :: RHPSCALE = 1.0_DP
real(DP), private, parameter :: FACQDT = 2.0_DP

!********************************************************************************************************************************
! rmvs_nbody_system class definitions and method interfaces
!********************************************************************************************************************************
type, public, extends(whm_nbody_system) :: rmvs_nbody_system
type, extends(whm_nbody_system) :: rmvs_nbody_system
!> In the RMVS integrator, only test particles are discarded
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
real(DP) :: rts !! fraction of Hill's sphere radius to use as radius of encounter region
real(DP), dimension(:,:), allocatable :: vbeg !! Planet velocities at beginning ot step
contains
private
!> Replace the abstract procedures with concrete ones
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
procedure :: initialize => rmvs_setup_initialize_system !! Performs RMVS-specific initilization steps, including generating the close encounter planetocentric structures
procedure :: step => rmvs_step_system !! Advance the RMVS nbody system forward in time by one step
end type rmvs_nbody_system

type, private :: rmvs_interp
Expand All @@ -41,7 +40,7 @@ module rmvs_classes
! rmvs_cb class definitions and method interfaces
!*******************************************************************************************************************************
!> RMVS central body particle class
type, public, extends(whm_cb) :: rmvs_cb
type, extends(whm_cb) :: rmvs_cb
type(rmvs_interp), dimension(:), allocatable :: outer !! interpolated heliocentric central body position for outer encounters
type(rmvs_interp), dimension(:), allocatable :: inner !! interpolated heliocentric central body position for inner encounters
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
Expand All @@ -52,7 +51,7 @@ module rmvs_classes
!*******************************************************************************************************************************

!! RMVS test particle class
type, public, extends(whm_tp) :: rmvs_tp
type, extends(whm_tp) :: rmvs_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 rmvs_setup_tp and rmvs_util_spill_tp
! encounter steps)
Expand All @@ -67,34 +66,32 @@ 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
private
procedure, public :: discard => rmvs_discard_tp !! Check to see if test particles should be discarded based on pericenter passage distances with respect to planets encountered
procedure, public :: encounter_check => rmvs_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body
procedure, public :: fill => rmvs_util_fill_tp !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure, public :: 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, public :: setup => rmvs_setup_tp !! Constructor method - Allocates space for number of particles
procedure, public :: 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 :: 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)
end type rmvs_tp

!********************************************************************************************************************************
! rmvs_pl class definitions and method interfaces
!*******************************************************************************************************************************

!> RMVS massive body particle class
type, public, extends(whm_pl) :: rmvs_pl
integer(I4B), dimension(:), allocatable :: nenc !! number of test particles encountering planet this full rmvs time step
integer(I4B), dimension(:), allocatable :: tpenc1P !! index of first test particle encountering planet
integer(I4B), dimension(:), allocatable :: plind ! Connects the planetocentric indices back to the heliocentric planet list
type(rmvs_interp), dimension(:), allocatable :: outer !! interpolated heliocentric central body position for outer encounters
type(rmvs_interp), dimension(:), allocatable :: inner !! interpolated heliocentric central body position for inner encounters
class(rmvs_nbody_system), dimension(:), allocatable :: planetocentric
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
type, extends(whm_pl) :: rmvs_pl
integer(I4B), dimension(:), allocatable :: nenc !! number of test particles encountering planet this full rmvs time step
integer(I4B), dimension(:), allocatable :: tpenc1P !! index of first test particle encountering planet
integer(I4B), dimension(:), allocatable :: plind !! Connects the planetocentric indices back to the heliocentric planet list
type(rmvs_interp), dimension(:), allocatable :: outer !! interpolated heliocentric central body position for outer encounters
type(rmvs_interp), dimension(:), allocatable :: inner !! interpolated heliocentric central body position for inner encounters
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
private
procedure, public :: fill => rmvs_util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure, public :: setup => rmvs_setup_pl !! Constructor method - Allocates space for number of particles
procedure, public :: spill => rmvs_util_spill_pl !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
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)
end type rmvs_pl

interface
Expand Down
Loading

0 comments on commit 720f15e

Please sign in to comment.