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

Commit

Permalink
Changed save lfirst variables to nbody_system class variables
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Aug 18, 2023
1 parent 77c21ae commit 150d464
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3190,9 +3190,9 @@ module subroutine swiftest_io_initialize_output_file_system(self, nc, param)
character(len=2*STRMAX) :: errmsg
logical :: fileExists

associate (pl => self%pl, tp => self%tp, npl => self%pl%nbody, ntp => self%tp%nbody)
associate (pl => self%pl, tp => self%tp, npl => self%pl%nbody, ntp => self%tp%nbody, lfirst => self%lfirst_io)
nc%file_name = param%outfile
if (self%lfirst) then
if (lfirst) then
inquire(file=param%outfile, exist=fileExists)
#ifdef COARRAY
if (this_image() /= 1) param%out_stat = 'APPEND'
Expand All @@ -3215,7 +3215,7 @@ module subroutine swiftest_io_initialize_output_file_system(self, nc, param)
call nc%initialize(param)
end select

self%lfirst = .false.
lfirst = .false.
end if

end associate
Expand Down
3 changes: 2 additions & 1 deletion src/swiftest/swiftest_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ module swiftest
logical :: lbeg !! True if this is the beginning of a step. This is used so that test particle steps can be calculated
!! separately from massive bodies. Massive body variables are saved at half steps, and passed to
!! the test particles
logical :: lfirst = .true. !! Flag to indicate that this is a new run
logical :: lfirst_io = .true. !! Flag to indicate that this is the first time to write to a file
logical :: lfirst_peri = .true. !! Flag to indicate that this is the first pericenter passage
contains
!> Each integrator will have its own version of the step
procedure(abstract_step_system), deferred :: step
Expand Down
3 changes: 2 additions & 1 deletion src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,8 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param)
write(*,*) 'Unkown integrator',param%integrator
call base_util_exit(FAILURE,param%display_unit)
end select
nbody_system%lfirst = .true.
nbody_system%lfirst_io = .true.
nbody_system%lfirst_peri = .true.

allocate(swiftest_particle_info :: nbody_system%cb%info)

Expand Down
7 changes: 3 additions & 4 deletions src/symba/symba_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,16 @@ subroutine symba_discard_peri_pl(pl, nbody_system, param)
class(swiftest_nbody_system), intent(inout) :: nbody_system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
! Internals
logical, save :: lfirst = .true.
logical :: lfirst_orig
integer(I4B) :: i
character(len=STRMAX) :: timestr, idstr, message


lfirst_orig = pl%lfirst
pl%lfirst = lfirst
if (lfirst) then
pl%lfirst = nbody_system%lfirst_peri
if (nbody_system%lfirst_peri) then
call pl%get_peri(nbody_system, param)
lfirst = .false.
nbody_system%lfirst_peri = .false.
else
call pl%get_peri(nbody_system, param)
do i = 1, pl%nbody
Expand Down
1 change: 0 additions & 1 deletion src/whm/whm_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module subroutine whm_step_pl(self, nbody_system, param, t, dt)
!!
!! Adapted from Hal Levison's Swift routine step_kdk_pl.f
!! Adapted from David E. Kaufmann's Swifter routine whm_step_pl.f90
!logical, save :: lfirst = .true.
implicit none
! Arguments
class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure
Expand Down

0 comments on commit 150d464

Please sign in to comment.