From dfb6254a921c42eabc47eda9996c471dc7da75de Mon Sep 17 00:00:00 2001 From: David Minton Date: Thu, 17 Aug 2023 20:23:23 -0400 Subject: [PATCH] Fixed save variable issue that changed behavior because of the change to having the driver be a module instead of an independent executable. --- src/swiftest/swiftest_io.f90 | 8 ++++---- src/swiftest/swiftest_module.f90 | 1 + src/swiftest/swiftest_util.f90 | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/swiftest/swiftest_io.f90 b/src/swiftest/swiftest_io.f90 index 48a9563a6..b22e892dd 100644 --- a/src/swiftest/swiftest_io.f90 +++ b/src/swiftest/swiftest_io.f90 @@ -3186,13 +3186,13 @@ module subroutine swiftest_io_initialize_output_file_system(self, nc, param) class(swiftest_netcdf_parameters), intent(inout) :: nc !! Parameters used to identify a particular NetCDF dataset class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters ! Internals - logical, save :: lfirst = .true. !! Flag to determine if this is the first call of this method - character(len=2*STRMAX) :: errmsg + + character(len=2*STRMAX) :: errmsg logical :: fileExists associate (pl => self%pl, tp => self%tp, npl => self%pl%nbody, ntp => self%tp%nbody) nc%file_name = param%outfile - if (lfirst) then + if (self%lfirst) then inquire(file=param%outfile, exist=fileExists) #ifdef COARRAY if (this_image() /= 1) param%out_stat = 'APPEND' @@ -3215,7 +3215,7 @@ module subroutine swiftest_io_initialize_output_file_system(self, nc, param) call nc%initialize(param) end select - lfirst = .false. + self%lfirst = .false. end if end associate diff --git a/src/swiftest/swiftest_module.f90 b/src/swiftest/swiftest_module.f90 index f3f282123..27cbbbddf 100644 --- a/src/swiftest/swiftest_module.f90 +++ b/src/swiftest/swiftest_module.f90 @@ -395,6 +395,7 @@ 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 contains !> Each integrator will have its own version of the step procedure(abstract_step_system), deferred :: step diff --git a/src/swiftest/swiftest_util.f90 b/src/swiftest/swiftest_util.f90 index c390be826..7dc5761fc 100644 --- a/src/swiftest/swiftest_util.f90 +++ b/src/swiftest/swiftest_util.f90 @@ -2358,10 +2358,9 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param) allocate(symba_pl :: nbody_system%pl_adds) allocate(symba_pl :: nbody_system%pl_discards) - allocate(symba_list_pltp :: nbody_system%pltp_encounter) - allocate(symba_list_plpl :: nbody_system%plpl_encounter) + allocate(symba_list_pltp :: nbody_system%pltp_encounter) + allocate(symba_list_plpl :: nbody_system%plpl_encounter) allocate(collision_list_plpl :: nbody_system%plpl_collision) - end select case (INT_RINGMOONS) write(*,*) 'RINGMOONS-SyMBA integrator not yet enabled' @@ -2369,6 +2368,7 @@ 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. allocate(swiftest_particle_info :: nbody_system%cb%info)