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

Commit

Permalink
Rewrote comments describing input parameters. Started process of addi…
Browse files Browse the repository at this point in the history
…ng system to the step method for bodies to make it more generalizable across all integrators. I'm doing this so that the system object always gets passed down, rather than pulling out individual components for each method
  • Loading branch information
daminton committed Jul 2, 2021
1 parent 0c30e50 commit c587459
Show file tree
Hide file tree
Showing 22 changed files with 125 additions and 115 deletions.
4 changes: 2 additions & 2 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ GPAR = -fopenmp -ftree-parallelize-loops=4
GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak
GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries

#FFLAGS = $(IDEBUG) $(HEAPARR)
FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(SIMDVEC) $(PAR)
FFLAGS = $(IDEBUG) $(HEAPARR)
#FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(SIMDVEC) $(PAR)
FORTRAN = ifort
#AR = xiar

Expand Down
6 changes: 3 additions & 3 deletions src/discard/discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module subroutine discard_system(self, param)
!! Adapted from Hal Levison's Swift routine discard.f
implicit none
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters

if (self%tp%nbody == 0) return
select type(self)
Expand Down Expand Up @@ -51,7 +51,7 @@ module subroutine discard_sun_tp(self, cb, param, t, msys)
! Arguments
class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object
class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object
class(swiftest_parameters), intent(in) :: param !! parameters parameters
class(swiftest_parameters), intent(in) :: param !! parameters
real(DP), intent(in) :: t !! Current simulation tim
real(DP), intent(in) :: msys !! Total system mass
! Internals
Expand Down Expand Up @@ -102,7 +102,7 @@ module subroutine discard_peri_tp(self, cb, pl, param, t, msys)
class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object
class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object
class(swiftest_pl), intent(inout) :: pl !! Swiftest massive body object
class(swiftest_parameters), intent(in) :: param !! parameters parameters
class(swiftest_parameters), intent(in) :: param !! parameters
real(DP), intent(in) :: t !! Current simulation tim
real(DP), intent(in) :: msys !! Total system mass
! Internals
Expand Down
4 changes: 2 additions & 2 deletions src/helio/helio_drift.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module subroutine helio_drift_pl(self, cb, param, dt)
! Arguments
class(helio_pl), intent(inout) :: self !! Helio test particle data structure
class(swiftest_cb), intent(inout) :: cb !! Helio central body particle data structuree
class(swiftest_parameters), intent(in) :: param !! Input collection of
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: dt !! Stepsize
! Internals
integer(I4B) :: i !! Loop counter
Expand Down Expand Up @@ -105,7 +105,7 @@ module subroutine helio_drift_tp(self, cb, param, dt)
! Arguments
class(helio_tp), intent(inout) :: self !! Helio test particle data structure
class(swiftest_cb), intent(inout) :: cb !! Helio central body particle data structuree
class(swiftest_parameters), intent(in) :: param !! Input collection of
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: dt !! Stepsize
! Internals
integer(I4B) :: i !! Loop counter
Expand Down
4 changes: 2 additions & 2 deletions src/helio/helio_getacch.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module subroutine helio_getacch_pl(self, cb, param, t)
! Arguments
class(helio_pl), intent(inout) :: self !! Helio massive body particle data structure
class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure
class(swiftest_parameters), intent(in) :: param !! Input collection of
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: t !! Current time
! Internals
logical, save :: lmalloc = .true.
Expand Down Expand Up @@ -48,7 +48,7 @@ module subroutine helio_getacch_tp(self, cb, pl, param, t, xh)
class(helio_tp), intent(inout) :: self !! Helio test particle data structure
class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree
class(whm_pl), intent(inout) :: pl !! WHM massive body particle data structure.
class(swiftest_parameters), intent(in) :: param !! Input collection of
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: t !! Current time
real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets
! Internals
Expand Down
7 changes: 4 additions & 3 deletions src/helio/helio_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module subroutine helio_step_system(self, param)
implicit none
! Arguments
class(helio_nbody_system), intent(inout) :: self !! Helio nbody system object
class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of on parameters

select type(cb => self%cb)
class is (helio_cb)
Expand Down Expand Up @@ -45,7 +45,7 @@ module subroutine helio_step_pl(self, cb, param, t, dt)
! Arguments
class(helio_pl), intent(inout) :: self !! WHM massive body particle data structure
class(swiftest_cb), intent(inout) :: cb !! Helio central body particle data structure
class(swiftest_parameters), intent(in) :: param !! Input collection of
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: t !! Current time
real(DP), intent(in) :: dt !! Stepsize
! Internals
Expand All @@ -63,6 +63,7 @@ module subroutine helio_step_pl(self, cb, param, t, dt)
call self%lindrift(cb, dth, ptbeg)
call self%getacch(cb, param, t)
call self%kickvb(dth)

call self%drift(cb, param, dt)
call self%getacch(cb, param, t + dt)
call self%kickvb(dth)
Expand All @@ -85,7 +86,7 @@ module subroutine helio_step_tp(self, cb, pl, param, t, dt)
class(helio_tp), intent(inout) :: self !! Helio test particle data structure
class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure
class(whm_pl), intent(inout) :: pl !! WHM massive body data structure
class(swiftest_parameters), intent(in) :: param !! Input collection of
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: t !! Current time
real(DP), intent(in) :: dt !! Stepsize
! Internals
Expand Down
30 changes: 15 additions & 15 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg)
!! Adapted from Martin Duncan's Swift routine io_init_param.f
implicit none
! Arguments
class(swiftest_parameters), intent(inout) :: self !! Collection of parameters parameters
class(swiftest_parameters), intent(inout) :: self !! Collection of parameters
integer, 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.
Expand Down Expand Up @@ -316,7 +316,7 @@ module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg)
!! Adapted from Martin Duncan's Swift routine io_dump_param.f
implicit none
! Arguments
class(swiftest_parameters),intent(in) :: self !! Collection of parameters parameters
class(swiftest_parameters),intent(in) :: self !! Collection of parameters
integer, 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.
Expand Down Expand Up @@ -405,7 +405,7 @@ module subroutine io_dump_param(self, param_file_name, t, dt)
!! Adapted from Martin Duncan's Swift routine io_dump_param.f
implicit none
! Arguments
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)
real(DP),intent(in) :: t !! Current simulation time
real(DP),intent(in) :: dt !! Step size
Expand Down Expand Up @@ -444,7 +444,7 @@ module subroutine io_dump_swiftest(self, param, t, dt, msg)
implicit none
! Arguments
class(swiftest_base), intent(inout) :: self !! Swiftest base object
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Stepsize
character(*), optional, intent(in) :: msg !! Message to display with dump operation
Expand Down Expand Up @@ -483,7 +483,7 @@ module subroutine io_dump_system(self, param, t, dt, msg)
implicit none
! Arguments
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Stepsize
character(*), optional, intent(in) :: msg !! Message to display with dump operation
Expand Down Expand Up @@ -636,7 +636,7 @@ module subroutine io_read_body_in(self, param)
implicit none
! Arguments
class(swiftest_body), intent(inout) :: self !! Swiftest particle object
class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters of parameters
! Internals
integer(I4B), parameter :: LUN = 7 !! Unit number of input file
integer(I4B) :: iu = LUN
Expand Down Expand Up @@ -776,7 +776,7 @@ module subroutine io_read_param_in(self, param_file_name)
!! Adapted from Martin Duncan's Swift routine io_init_param.f
implicit none
! Arguments
class(swiftest_parameters),intent(out) :: self !! Input collection of parameters parameters
class(swiftest_parameters),intent(out) :: self !! Current run configuration parameters of parameters
character(len=*), intent(in) :: param_file_name !! Parameter input file name (i.e. param.in)
! Internals
integer(I4B), parameter :: LUN = 7 !! Unit number of input file
Expand Down Expand Up @@ -870,7 +870,7 @@ module subroutine io_read_frame_body(self, iu, param, form, t, ierr)
! Arguments
class(swiftest_body), intent(inout) :: self !! Swiftest particle object
integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to
class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters of parameters
character(*), intent(in) :: form !! Input format code ("XV" or "EL")
real(DP), intent(out) :: t !! Simulation time
integer(I4B), intent(out) :: ierr !! Error code
Expand Down Expand Up @@ -932,7 +932,7 @@ module subroutine io_read_frame_cb(self, iu, param, form, t, ierr)
! Arguments
class(swiftest_cb), intent(inout) :: self !! Swiftest central body object
integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to
class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters of parameters
character(*), intent(in) :: form !! Input format code ("XV" or "EL")
real(DP), intent(out) :: t !! Simulation time
integer(I4B), intent(out) :: ierr !! Error cod
Expand Down Expand Up @@ -966,7 +966,7 @@ module subroutine io_read_frame_system(self, iu, param, form, t, ierr)
! Arguments
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to
class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters of parameters
character(*), intent(in) :: form !! Input format code ("XV" or "EL")
real(DP), intent(out) :: t !! Current simulation time
integer(I4B), intent(out) :: ierr !! Error code
Expand Down Expand Up @@ -1042,7 +1042,7 @@ module subroutine io_read_initialize_system(self, param)
implicit none
! Arguments
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters of parameters

call self%cb%initialize(param)
call self%pl%initialize(param)
Expand All @@ -1063,7 +1063,7 @@ module subroutine io_write_discard(self, param, discards)
implicit none
! Arguments
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters
class(swiftest_body), intent(inout) :: discards !! Swiftest discard object
! Internals
integer(I4B), parameter :: LUN = 40
Expand Down Expand Up @@ -1196,7 +1196,7 @@ module subroutine io_write_frame_body(self, iu, param, t, dt)
! Arguments
class(swiftest_body), intent(in) :: self !! Swiftest particle object
integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Step size

Expand Down Expand Up @@ -1252,7 +1252,7 @@ module subroutine io_write_frame_cb(self, iu, param, t, dt)
! Arguments
class(swiftest_cb), intent(in) :: self !! Swiftest central body object
integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Step size

Expand Down Expand Up @@ -1288,7 +1288,7 @@ module subroutine io_write_frame_system(self, iu, param, t, dt)
! Arguments
class(swiftest_nbody_system), intent(in) :: self !! Swiftest system object
integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to
class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Step size
! Internals
Expand Down
2 changes: 1 addition & 1 deletion src/main/swiftest_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ program swiftest_driver
class(swiftest_nbody_system), allocatable :: nbody_system !! Polymorphic object containing the nbody system to be integrated
type(swiftest_parameters) :: param
integer(I4B) :: integrator !! Integrator type code (see swiftest_globals for symbolic names)
character(len=:),allocatable :: param_file_name !! Name of the file containing user-defined parameters parameters
character(len=:),allocatable :: param_file_name !! Name of the file containing user-defined parameters
integer(I4B) :: ierr !! I/O error code
logical :: lfirst !! Flag indicating that this is the first time through the main loop
integer(I8B) :: iloop !! Loop counter
Expand Down
Loading

0 comments on commit c587459

Please sign in to comment.