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

Commit

Permalink
Fixed bugs related to opening and closing NetCDF files
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jan 3, 2023
1 parent 140adce commit 71bb215
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ SET(FAST_MATH_FILES
${SRC}/swiftest/swiftest_driver.f90
)


set(SWIFTEST_src ${FAST_MATH_FILES} ${STRICT_MATH_FILES})

# Define the executable in terms of the source files
Expand Down
10 changes: 6 additions & 4 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2838,12 +2838,14 @@ module subroutine swiftest_io_write_discard(self, param)
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
! Internals

associate(pl => self%pl, npl => self%pl%nbody, pl_adds => self%pl_adds)

if (self%tp_discards%nbody > 0) call self%tp_discards%write_info(param%system_history%nc, param)
associate(pl => self%pl, npl => self%pl%nbody, pl_adds => self%pl_adds, nc => param%system_history%nc)

call nc%open(param)
if (self%tp_discards%nbody > 0) call self%tp_discards%write_info(nc, param)
if (self%pl_discards%nbody == 0) return

call self%pl_discards%write_info(param%system_history%nc, param)
call self%pl_discards%write_info(nc, param)
call nc%close()
end associate

return
Expand Down
6 changes: 4 additions & 2 deletions src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ module subroutine swiftest_util_rearray_pl(self, nbody_system, param)
class(encounter_list), allocatable :: plplenc_old
logical :: lencounter

associate(pl => self, tp => nbody_system%tp, pl_adds => nbody_system%pl_adds)
associate(pl => self, tp => nbody_system%tp, pl_adds => nbody_system%pl_adds, nc => param%system_history%nc)

npl = pl%nbody
nadd = pl_adds%nbody
Expand Down Expand Up @@ -1724,7 +1724,9 @@ module subroutine swiftest_util_rearray_pl(self, nbody_system, param)
end where
end if

call pl%write_info(param%system_history%nc, param)
call nc%open(param)
call pl%write_info(nc, param)
call nc%close()
deallocate(ldump_mask)

! Reindex the new list of bodies
Expand Down

0 comments on commit 71bb215

Please sign in to comment.