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

Commit

Permalink
delete old dump file before creating a new one
Browse files Browse the repository at this point in the history
cmode = NF90_NETCDF4 doesn't delete the previously existing version of the file so you get a 'permission denied' error
  • Loading branch information
cwishard committed Sep 24, 2021
1 parent be30886 commit a2d4bdb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ module subroutine netcdf_initialize_output(self, param)
class(netcdf_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
! Internals
logical :: fileExists
integer(I4B) :: old_mode, nvar, varid, vartype
integer(I4B) :: old_mode, nvar, varid, vartype, old_unit
real(DP) :: dfill
real(SP) :: sfill

dfill = ieee_value(dfill, IEEE_QUIET_NAN)
sfill = ieee_value(sfill, IEEE_QUIET_NAN)

!! Create the new output file, deleting any previously existing output file of the same name
if (any(DUMP_NC_FILE == param%outfile)) then
open(file=param%outfile, unit=old_unit, status='OLD')
close(unit=old_unit, status='delete')
end if

call check( nf90_create(param%outfile, NF90_NETCDF4, self%ncid) )

! Define the NetCDF dimensions with particle name as the record dimension
Expand Down

0 comments on commit a2d4bdb

Please sign in to comment.