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

Commit

Permalink
Fixed save variable issue that changed behavior because of the change…
Browse files Browse the repository at this point in the history
… to having the driver be a module instead of an independent executable.
  • Loading branch information
daminton committed Aug 18, 2023
1 parent 9d25897 commit dfb6254
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/swiftest/swiftest_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2358,17 +2358,17 @@ 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'
case default
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)

Expand Down

0 comments on commit dfb6254

Please sign in to comment.