diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index d8a5e46d5..229e283d8 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -76,9 +76,6 @@ module swiftest_classes procedure, public :: writer => io_param_writer procedure, public :: dump => io_dump_param procedure, public :: read_from_file => io_read_param_in - !TODO: Figure out if user-defined derived-type io can be made to work properly - !generic :: read(FORMATTED) => param_reader - !generic :: write(FORMATTED) => param_writer end type swiftest_parameters !******************************************************************************************************************************** @@ -166,7 +163,7 @@ module swiftest_classes procedure, public :: accel_obl => obl_acc_body !! Compute the barycentric accelerations of bodies due to the oblateness of the central body procedure, public :: el2xv => orbel_el2xv_vec !! Convert orbital elements to position and velocity vectors procedure, public :: xv2el => orbel_xv2el_vec !! Convert position and velocity vectors to orbital elements - procedure, public :: set_ir3 => util_set_ir3h !! Sets the inverse heliocentric radius term (1/rh**3) + procedure, public :: set_ir3 => util_set_ir3h !! Sets the inverse heliocentric radius term (1/rh**3) procedure, public :: setup => setup_body !! A constructor that sets the number of bodies and allocates all allocatable arrays procedure, public :: accel_user => user_getacch_body !! Add user-supplied heliocentric accelerations to planets procedure, public :: fill => util_fill_body !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic) @@ -180,15 +177,15 @@ module swiftest_classes !> An abstract class for a generic collection of Swiftest massive bodies type, abstract, public, extends(swiftest_body) :: swiftest_pl !! Superclass that defines the generic elements of a Swiftest particle - real(DP), dimension(:), allocatable :: mass !! Body mass (units MU) - real(DP), dimension(:), allocatable :: Gmass !! Mass gravitational term G * mass (units GU * MU) - real(DP), dimension(:), allocatable :: rhill !! Body mass (units MU) - real(DP), dimension(:), allocatable :: radius !! Body radius (units DU) - real(DP), dimension(:), allocatable :: irij3 !! 1.0_DP / (rji2 * sqrt(rji2)) where rji2 is the square of the Euclidean distance - real(DP), dimension(:,:), allocatable :: xbeg !! Position at beginning of step - real(DP), dimension(:,:), allocatable :: xend !! Position at end of step - real(DP), dimension(:,:), allocatable :: vbeg !! Velocity at beginning of step - real(DP), dimension(:), allocatable :: density !! Body mass density - calculated internally (units MU / DU**3) + real(DP), dimension(:), allocatable :: mass !! Body mass (units MU) + real(DP), dimension(:), allocatable :: Gmass !! Mass gravitational term G * mass (units GU * MU) + real(DP), dimension(:), allocatable :: rhill !! Body mass (units MU) + real(DP), dimension(:), allocatable :: radius !! Body radius (units DU) + real(DP), dimension(:), allocatable :: irij3 !! 1.0_DP / (rji2 * sqrt(rji2)) where rji2 is the square of the Euclidean distance + real(DP), dimension(:,:), allocatable :: xbeg !! Position at beginning of step + real(DP), dimension(:,:), allocatable :: xend !! Position at end of step + real(DP), dimension(:,:), allocatable :: vbeg !! Velocity at beginning of step + real(DP), dimension(:), allocatable :: density !! Body mass density - calculated internally (units MU / DU**3) !! Note to developers: If you add components to this class, be sure to update methods and subroutines that traverse the !! component list, such as setup_pl and util_spill_pl contains @@ -200,8 +197,8 @@ module swiftest_classes procedure, public :: eucl_irij3 => eucl_irij3_plpl !! Parallelized single loop blocking for Euclidean distance matrix calcualtion procedure, public :: accel_obl => obl_acc_pl !! Compute the barycentric accelerations of bodies due to the oblateness of the central body procedure, public :: setup => setup_pl !! A base constructor that sets the number of bodies and allocates and initializes all arrays - procedure, public :: set_mu => util_set_mu_pl !! Method used to construct the vectorized form of the central body mass - procedure, public :: set_rhill => util_set_rhill !! Calculates the Hill's radii for each body + procedure, public :: set_mu => util_set_mu_pl !! Method used to construct the vectorized form of the central body mass + procedure, public :: set_rhill => util_set_rhill !! Calculates the Hill's radii for each body procedure, public :: h2b => util_coord_h2b_pl !! Convert massive bodies from heliocentric to barycentric coordinates (position and velocity) procedure, public :: b2h => util_coord_b2h_pl !! Convert massive bodies from barycentric to heliocentric coordinates (position and velocity) procedure, public :: fill => util_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic) @@ -215,10 +212,10 @@ module swiftest_classes !> An abstract class for a generic collection of Swiftest test particles type, abstract, public, extends(swiftest_body) :: swiftest_tp !! Superclass that defines the generic elements of a Swiftest test particle - integer(I4B), dimension(:), allocatable :: isperi !! Perihelion passage flag - real(DP), dimension(:), allocatable :: peri !! Perihelion distance - real(DP), dimension(:), allocatable :: atp !! Semimajor axis following perihelion passage - real(DP), dimension(:, :), allocatable :: irij3 !! 1.0_DP / (rji2 * sqrt(rji2)) where rji2 is the square of the Euclidean distance betwen each pl-tp + integer(I4B), dimension(:), allocatable :: isperi !! Perihelion passage flag + real(DP), dimension(:), allocatable :: peri !! Perihelion distance + real(DP), dimension(:), allocatable :: atp !! Semimajor axis following perihelion passage + real(DP), dimension(:, :), allocatable :: irij3 !! 1.0_DP / (rji2 * sqrt(rji2)) where rji2 is the square of the Euclidean distance betwen each pl-tp !! Note to developers: If you add components to this class, be sure to update methods and subroutines that traverse the !! component list, such as setup_tp and util_spill_tp contains @@ -227,9 +224,9 @@ module swiftest_classes ! These are concrete because they are the same implemenation for all integrators procedure, public :: discard => discard_tp !! Check to see if test particles should be discarded based on their positions relative to the massive bodies procedure, public :: eucl_index => eucl_dist_index_pltp !! Sets up the (i, j) -> k indexing used for the single-loop blocking Euclidean distance matrix - procedure, public :: accel_obl => obl_acc_tp !! Compute the barycentric accelerations of bodies due to the oblateness of the central body + procedure, public :: accel_obl => obl_acc_tp !! Compute the barycentric accelerations of bodies due to the oblateness of the central body procedure, public :: setup => setup_tp !! A base constructor that sets the number of bodies and - procedure, public :: set_mu => util_set_mu_tp !! Method used to construct the vectorized form of the central body mass + procedure, public :: set_mu => util_set_mu_tp !! Method used to construct the vectorized form of the central body mass procedure, public :: h2b => util_coord_h2b_tp !! Convert test particles from heliocentric to barycentric coordinates (position and velocity) procedure, public :: b2h => util_coord_b2h_tp !! Convert test particles from barycentric to heliocentric coordinates (position and velocity) procedure, public :: fill => util_fill_tp !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic) @@ -264,13 +261,13 @@ module swiftest_classes procedure(abstract_step_system), public, deferred :: step ! Concrete classes that are common to the basic integrator (only test particles considered for discard) - procedure, public :: discard => discard_system !! Perform a discard step on the system - procedure, public :: dump => io_dump_system !! Dump the state of the system to a file - procedure, public :: initialize => io_read_initialize_system !! Initialize the system from an input file - procedure, public :: read_frame => io_read_frame_system !! Append a frame of output data to file - procedure, public :: set_msys => util_set_msys !! Sets the value of msys from the masses of system bodies. - procedure, public :: write_discard => io_write_discard !! Append a frame of output data to file - procedure, public :: write_frame => io_write_frame_system !! Append a frame of output data to file + procedure, public :: discard => discard_system !! Perform a discard step on the system + procedure, public :: dump => io_dump_system !! Dump the state of the system to a file + procedure, public :: initialize => io_read_initialize_system !! Initialize the system from an input file + procedure, public :: read_frame => io_read_frame_system !! Append a frame of output data to file + procedure, public :: set_msys => util_set_msys !! Sets the value of msys from the masses of system bodies. + procedure, public :: write_discard => io_write_discard !! Append a frame of output data to file + procedure, public :: write_frame => io_write_frame_system !! Append a frame of output data to file end type swiftest_nbody_system abstract interface @@ -324,17 +321,17 @@ end subroutine abstract_step_body subroutine abstract_step_system(self, param, t, dt) import DP, swiftest_nbody_system, swiftest_parameters implicit none - class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters - real(DP), intent(in) :: t !! Simulation time - real(DP), intent(in) :: dt !! Current stepsize + class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters + real(DP), intent(in) :: t !! Simulation time + real(DP), intent(in) :: dt !! Current stepsize end subroutine abstract_step_system subroutine abstract_write_frame(self, iu, param) import DP, I4B, swiftest_base, swiftest_parameters - class(swiftest_base), intent(in) :: self !! Swiftest base object - integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + class(swiftest_base), intent(in) :: self !! Swiftest base object + integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to + class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine abstract_write_frame end interface @@ -348,8 +345,8 @@ end subroutine discard_pl module subroutine discard_system(self, param) implicit none - class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object + class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine discard_system module subroutine discard_tp(self, system, param) @@ -361,10 +358,10 @@ end subroutine discard_tp module pure elemental subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag) implicit none - real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body to drift - real(DP), intent(inout) :: px, py, pz, vx, vy, vz !! Position and velocity of body to drift - real(DP), intent(in) :: dt !! Step size - integer(I4B), intent(out) :: iflag !! iflag : error status flag for Danby drift (0 = OK, nonzero = ERROR) + real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body to drift + real(DP), intent(inout) :: px, py, pz, vx, vy, vz !! Position and velocity of body to drift + real(DP), intent(in) :: dt !! Step size + integer(I4B), intent(out) :: iflag !! iflag : error status flag for Danby drift (0 = OK, nonzero = ERROR) end subroutine drift_one module subroutine eucl_dist_index_plpl(self) @@ -374,26 +371,26 @@ module subroutine eucl_dist_index_plpl(self) module subroutine eucl_dist_index_pltp(self, pl) implicit none - class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object - class(swiftest_pl), intent(inout) :: pl !! Swiftest massive body object + class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object + class(swiftest_pl), intent(inout) :: pl !! Swiftest massive body object end subroutine module subroutine eucl_irij3_plpl(self) implicit none - class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object + class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object end subroutine eucl_irij3_plpl module subroutine io_dump_param(self, param_file_name) implicit none - class(swiftest_parameters),intent(in) :: self !! Output collection of parameters + class(swiftest_parameters),intent(in) :: self !! Output collection of parameters character(len=*), intent(in) :: param_file_name !! Parameter input file name (i.e. param.in) end subroutine io_dump_param module subroutine io_dump_swiftest(self, param, msg) implicit none - class(swiftest_base), intent(inout) :: self !! Swiftest base object + class(swiftest_base), intent(inout) :: self !! Swiftest base object class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters - character(*), optional, intent(in) :: msg !! Message to display with dump operation + character(*), optional, intent(in) :: msg !! Message to display with dump operation end subroutine io_dump_swiftest module subroutine io_dump_system(self, param, msg) @@ -432,25 +429,25 @@ end subroutine io_param_reader module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg) implicit none - class(swiftest_parameters), intent(in) :: self !! Collection of parameters - integer(I4B), intent(in) :: unit !! File unit number - character(len=*), intent(in) :: iotype !! Dummy argument passed to the input/output procedure contains the text from the char-literal-constant, prefixed with DT. - !! If you do not include a char-literal-constant, the iotype argument contains only DT. - integer(I4B), intent(in) :: v_list(:) !! Not used in this procedure - integer(I4B), intent(out) :: iostat !! IO status code - character(len=*), intent(inout) :: iomsg !! Message to pass if iostat /= 0 + class(swiftest_parameters), intent(in) :: self !! Collection of parameters + integer(I4B), intent(in) :: unit !! File unit number + character(len=*), intent(in) :: iotype !! Dummy argument passed to the input/output procedure contains the text from the char-literal-constant, prefixed with DT. + !! If you do not include a char-literal-constant, the iotype argument contains only DT. + integer(I4B), intent(in) :: v_list(:) !! Not used in this procedure + integer(I4B), intent(out) :: iostat !! IO status code + character(len=*), intent(inout) :: iomsg !! Message to pass if iostat /= 0 end subroutine io_param_writer module subroutine io_read_body_in(self, param) implicit none - class(swiftest_body), intent(inout) :: self !! Swiftest body object + class(swiftest_body), intent(inout) :: self !! Swiftest body object class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters end subroutine io_read_body_in module subroutine io_read_cb_in(self, param) implicit none - class(swiftest_cb), intent(inout) :: self - class(swiftest_parameters), intent(inout) :: param + class(swiftest_cb), intent(inout) :: self !! Swiftest central body object + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters end subroutine io_read_cb_in module subroutine io_read_param_in(self, param_file_name) diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index 05c2838b6..0faea9561 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -106,6 +106,7 @@ module symba_classes procedure, public :: read_frame => symba_io_read_frame_pl !! I/O routine for reading out a single frame of time-series data for a massive body procedure, public :: initialize => symba_io_read_pl_in !! I/O routine for reading in a massive body structure from file with SyMBA-specific parameters procedure, public :: write_frame => symba_io_write_frame_pl !! I/O routine for writing out a single frame of time-series data for a massive body + procedure, public :: setup => symba_setup_pl !! Constructor method - Allocates space for number of particle end type symba_pl !******************************************************************************************************************************** @@ -120,69 +121,49 @@ module symba_classes private procedure, public :: discard => symba_discard_tp !! process test particle discards procedure, public :: encounter_check => symba_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body + procedure, public :: setup => symba_setup_tp !! Constructor method - Allocates space for number of particle end type symba_tp - !******************************************************************************************************************************** - ! symba_plplenc class definitions and method interfaces - !******************************************************************************************************************************* - !> SyMBA class for tracking pl-pl close encounters in a step - type symba_plplenc - integer(I4B) :: nplplenc !! Total number of pl-pl encounters - logical, dimension(:), allocatable :: lvdotr !! relative vdotr flag - integer(I4B), dimension(:), allocatable :: status !! status of the interaction - integer(I4B), dimension(:), allocatable :: level !! encounter recursion level - integer(I4B), dimension(:), allocatable :: index1 !! position of the first planet in encounter - integer(I4B), dimension(:), allocatable :: index2 !! position of the second planet in encounter - integer(I4B), dimension(:), allocatable :: enc_child !! the child of the encounter - integer(I4B), dimension(:), allocatable :: enc_parent !! the child of the encounter - real(DP), dimension(:,:), allocatable :: xh1 !! the heliocentric position of parent 1 in encounter - real(DP), dimension(:,:), allocatable :: xh2 !! the heliocentric position of parent 2 in encounter - real(DP), dimension(:,:), allocatable :: vb1 !! the barycentric velocity of parent 1 in encounter - real(DP), dimension(:,:), allocatable :: vb2 !! the barycentric velocity of parent 2 in encounter - end type symba_plplenc - !******************************************************************************************************************************** ! symba_pltpenc class definitions and method interfaces !******************************************************************************************************************************* !> SyMBA class for tracking pl-tp close encounters in a step - type symba_pltpenc - integer(I4B) :: npltpenc !! Total number of pl-tp encounters - logical, dimension(:), allocatable :: lvdotr !! relative vdotr flag - integer(I4B), dimension(:), allocatable :: status !! status of the interaction - integer(I4B), dimension(:), allocatable :: level !! encounter recursion level - integer(I4B), dimension(:), allocatable :: indexpl !! position of the planet in encounter - integer(I4B), dimension(:), allocatable :: indextp !! position of the test particle in encounter + type, public :: symba_pltpenc + integer(I4B) :: nenc !! Total number of encounters + logical, dimension(:), allocatable :: lvdotr !! relative vdotr flag + integer(I4B), dimension(:), allocatable :: status !! status of the interaction + integer(I4B), dimension(:), allocatable :: level !! encounter recursion level + integer(I4B), dimension(:), allocatable :: index1 !! position of the planet in encounter + integer(I4B), dimension(:), allocatable :: index2 !! position of the test particle in encounter end type symba_pltpenc !******************************************************************************************************************************** - ! symba_merger class definitions and method interfaces + ! symba_plplenc class definitions and method interfaces !******************************************************************************************************************************* - !> SyMBA class for tracking pl-pl mergers in a step - type symba_merger - integer(I4B), dimension(:), allocatable :: id !! identifier - integer(I4B), dimension(:), allocatable :: index_ps !! position of the particle - integer(I4B), dimension(:), allocatable :: status !! status - integer(I4B), dimension(:), allocatable :: nadded !! number of resultant bodies from this collisional event aka number of fragments - real(DP), dimension(:,:), allocatable :: xb !! barycentric position - real(DP), dimension(:,:), allocatable :: vb !! barycentric velocity - real(DP), dimension(:), allocatable :: mass !! mass - real(DP), dimension(:), allocatable :: radius ! radius - real(DP), dimension(:,:), allocatable :: IP ! moment of intertia - real(DP), dimension(:,:), allocatable :: rot ! rotation - type(symba_particle_info), dimension(:), allocatable :: info - end type symba_merger + !> SyMBA class for tracking pl-pl close encounters in a step + type, public, extends(symba_pltpenc) :: symba_plplenc + real(DP), dimension(:,:), allocatable :: xh1 !! the heliocentric position of parent 1 in encounter + real(DP), dimension(:,:), allocatable :: xh2 !! the heliocentric position of parent 2 in encounter + real(DP), dimension(:,:), allocatable :: vb1 !! the barycentric velocity of parent 1 in encounter + real(DP), dimension(:,:), allocatable :: vb2 !! the barycentric velocity of parent 2 in encounter + end type symba_plplenc !******************************************************************************************************************************** ! symba_nbody_system class definitions and method interfaces !******************************************************************************************************************************** type, public, extends(helio_nbody_system) :: symba_nbody_system + class(symba_pl), allocatable :: mergeadd_list !! List of added bodies in mergers or collisions + class(symba_pl), allocatable :: mergesub_list !! List of subtracted bodies in mergers or collisions + class(symba_pltpenc), allocatable :: pltpenc_list !! List of massive body-test particle encounters in a single step + class(symba_plplenc), allocatable :: plplenc_list !! List of massive body-massive body encounters in a single step + class(symba_pl), allocatable :: pl_discards !! Discarded test particle data structure contains private - 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 :: initialize => symba_setup_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 end type symba_nbody_system - interface module subroutine symba_discard_pl(self, system, param) use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters @@ -322,6 +303,19 @@ module subroutine symba_io_write_frame_pl(self, iu, param) class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine symba_io_write_frame_pl + module subroutine symba_setup_pl(self,n) + implicit none + class(symba_pl), intent(inout) :: self !! SyMBA test particle object + integer(I4B), intent(in) :: n !! Number of massive bodies to allocate + end subroutine symba_setup_pl + + module subroutine symba_setup_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 + module subroutine symba_step_system(self, param, t, dt) use swiftest_classes, only : swiftest_parameters implicit none @@ -331,6 +325,12 @@ module subroutine symba_step_system(self, param, t, dt) real(DP), intent(in) :: dt !! Current stepsize end subroutine symba_step_system + module subroutine symba_setup_tp(self,n) + implicit none + class(symba_tp), intent(inout) :: self !! SyMBA test particle object + integer(I4B), intent(in) :: n !! Number of test particles to allocate + end subroutine symba_setup_tp + module subroutine symba_step_interp_system(self, param, t, dt) use swiftest_classes, only : swiftest_parameters implicit none diff --git a/src/rmvs/rmvs_setup.f90 b/src/rmvs/rmvs_setup.f90 index 4c0c27ff1..f26d6e42d 100644 --- a/src/rmvs/rmvs_setup.f90 +++ b/src/rmvs/rmvs_setup.f90 @@ -9,11 +9,10 @@ module subroutine rmvs_setup_pl(self,n) !! Equivalent in functionality to David E. Kaufmann's Swifter routine rmvs_setup.f90 implicit none ! Arguments - class(rmvs_pl), intent(inout) :: self !! RMVS test particle object - integer(I4B), intent(in) :: n !! Number of test particles to allocate + class(rmvs_pl), intent(inout) :: self !! RMVS test particle object + integer(I4B), intent(in) :: n !! Number of massive bodies to allocate ! Internals - integer(I4B) :: i,j - !type(swiftest_parameters) :: encounter_param + integer(I4B) :: i,j !> Call allocation method for parent class associate(pl => self) @@ -49,7 +48,7 @@ end subroutine rmvs_setup_pl module subroutine rmvs_setup_system(self, param) !! author: David A. Minton !! - !! nitialize an RMVS nbody system from files and sets up the planetocentric structures. + !! Initialize an RMVS nbody system from files and sets up the planetocentric structures. !! !! We currently rearrange the pl order to keep it consistent with the way Swifter does it !! In Swifter, the central body occupies the first position in the pl list, and during @@ -58,7 +57,7 @@ module subroutine rmvs_setup_system(self, param) !! to use during close encounters. implicit none ! Arguments - class(rmvs_nbody_system), intent(inout) :: self !! RMVS system object + class(rmvs_nbody_system), intent(inout) :: self !! RMVS system object class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters ! Internals integer(I4B) :: i, j @@ -126,8 +125,8 @@ module subroutine rmvs_setup_tp(self,n) !! Equivalent in functionality to David E. Kaufmann's Swifter routine whm_setup.f90 implicit none ! Arguments - class(rmvs_tp), intent(inout) :: self !! RMVS test particle object - integer, intent(in) :: n !! Number of test particles to allocate + class(rmvs_tp), intent(inout) :: self !! RMVS test particle object + integer, intent(in) :: n !! Number of test particles to allocate !> Call allocation method for parent class call whm_setup_tp(self, n) diff --git a/src/symba/symba_setup.f90 b/src/symba/symba_setup.f90 new file mode 100644 index 000000000..9c311f2d1 --- /dev/null +++ b/src/symba/symba_setup.f90 @@ -0,0 +1,73 @@ +submodule(symba_classes) s_symba_setup + use swiftest +contains + module subroutine symba_setup_pl(self,n) + !! author: David A. Minton + !! + !! Allocate SyMBA test particle structure + !! + !! Equivalent in functionality to David E. Kaufmann's Swifter routine symba_setup.f90 + implicit none + ! Arguments + class(symba_pl), intent(inout) :: self !! SyMBA test particle object + integer(I4B), intent(in) :: n !! Number of massive bodies to allocate + ! Internals + integer(I4B) :: i,j + + !> Call allocation method for parent class + associate(pl => self) + call helio_setup_pl(pl, n) + if (n <= 0) return + end associate + return + end subroutine symba_setup_pl + + module subroutine symba_setup_system(self, param) + !! author: David A. Minton + !! + !! Initialize an SyMBA nbody system from files and sets up the planetocentric structures. + !! + implicit none + ! Arguments + class(symba_nbody_system), intent(inout) :: self !! SyMBA system object + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters + ! Internals + integer(I4B) :: i, j + + ! Call parent method + call helio_setup_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. + select type(pl => self%pl) + class is(symba_pl) + select type(cb => self%cb) + class is (symba_cb) + select type (tp => self%tp) + class is (symba_tp) + + + end select + end select + end select + + end subroutine symba_setup_system + + module subroutine symba_setup_tp(self,n) + !! author: David A. Minton + !! + !! Allocate WHM test particle structure + !! + !! Equivalent in functionality to David E. Kaufmann's Swifter routine whm_setup.f90 + implicit none + ! Arguments + class(symba_tp), intent(inout) :: self !! SyMBA test particle object + integer, intent(in) :: n !! Number of test particles to allocate + + !> Call allocation method for parent class + call helio_setup_tp(self, n) + if (n <= 0) return + return + end subroutine symba_setup_tp + +end submodule s_symba_setup