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

Commit

Permalink
Fixed the discard routine so that it is not constantly opening and cl…
Browse files Browse the repository at this point in the history
…osing the NetCDF file every single step, but instead only when there is a discard to record.
  • Loading branch information
daminton committed Jan 4, 2023
1 parent d745a16 commit 583e8ca
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/swiftest/swiftest_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ module subroutine swiftest_discard_system(self, param)
call tp%discard(nbody_system, param)
ltp_discards = (tp_discards%nbody > 0)
end if
call nc%open(param)
if (ltp_discards) call tp_discards%write_info(param%system_history%nc, param)
if (lpl_discards) call pl_discards%write_info(param%system_history%nc, param)
if (lpl_discards .and. param%lenergy) call self%conservation_report(param, lterminal=.false.)
call nc%close()
if (lpl_check) call pl_discards%setup(0,param)
if (ltp_check) call tp_discards%setup(0,param)

if (ltp_discards.or.lpl_discards) then
call nc%open(param)
if (lpl_discards) then
call pl_discards%write_info(param%system_history%nc, param)
if (param%lenergy) call self%conservation_report(param, lterminal=.false.)
call pl_discards%setup(0,param)
end if
if (ltp_discards) then
call tp_discards%write_info(param%system_history%nc, param)
call tp_discards%setup(0,param)
end if
call nc%close()
end if

end associate

Expand Down

0 comments on commit 583e8ca

Please sign in to comment.