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

Commit

Permalink
Adjusted chunking sizes with new netcdf parameter variables. Ignore r…
Browse files Browse the repository at this point in the history
…eading parameter.dat file in when in NetCDF input mode on restart.
  • Loading branch information
daminton committed Oct 14, 2021
1 parent dc3a9f9 commit 1a7d37a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 68 deletions.
10 changes: 8 additions & 2 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module subroutine io_dump_particle_info_base(self, param, idx)
return

667 continue
write(*,*) "Error reading central body file: " // trim(adjustl(errmsg))
write(*,*) "Error reading particle information file: " // trim(adjustl(errmsg))
call util_exit(FAILURE)
end subroutine io_dump_particle_info_base

Expand Down Expand Up @@ -286,6 +286,8 @@ module subroutine io_dump_system(self, param)
else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then
dump_param%outfile = trim(adjustl(DUMP_NC_FILE(idx)))
dump_param%in_type = NETCDF_DOUBLE_TYPE
dump_param%nciu%id_chunk = self%pl%nbody + self%tp%nbody
dump_param%nciu%time_chunk = 1
end if
dump_param%T0 = param%t
dump_param%ioutput = 0
Expand Down Expand Up @@ -1625,7 +1627,7 @@ module function io_read_frame_cb(self, iu, param) result(ierr)
return

667 continue
write(*,*) "Error reading central body file: " // trim(adjustl(errmsg))
write(*,*) "Error reading central body frame: " // trim(adjustl(errmsg))
call util_exit(FAILURE)
end function io_read_frame_cb

Expand Down Expand Up @@ -1796,6 +1798,8 @@ module subroutine io_read_particle_info_system(self, param)
character(STRMAX) :: errmsg
type(swiftest_particle_info), allocatable :: tmpinfo

if (.not.((param%out_type == REAL4_TYPE) .or. (param%out_type == REAL8_TYPE))) return ! This subroutine is only necessary for classic binary input files

open(unit = LUN, file = param%particle_out, status = 'OLD', form = 'UNFORMATTED', err = 667, iomsg = errmsg)

allocate(tmpinfo, mold=self%cb%info)
Expand Down Expand Up @@ -2109,6 +2113,8 @@ module subroutine io_write_frame_system(self, param)
end if
else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then

param%nciu%id_chunk = pl%nbody + tp%nbody
param%nciu%time_chunk = param%istep_out / param%istep_dump
if (lfirst) then
inquire(file=param%outfile, exist=fileExists)

Expand Down
2 changes: 2 additions & 0 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ module swiftest_classes
integer(I4B) :: discard_vhy_varid !! NetCDF ID for the heliocentric velocity of the body at the time of discard y variable
integer(I4B) :: discard_vhz_varid !! NetCDF ID for the heliocentric velocity of the body at the time of discard z variable
integer(I4B) :: discard_body_id_varid !! NetCDF ID for the id of the other body involved in the discard
integer(I4B) :: id_chunk !! Chunk size for the id dimension variables
integer(I4B) :: time_chunk !! Chunk size for the time dimension variables
contains
procedure :: close => netcdf_close !! Closes an open NetCDF file
procedure :: flush => netcdf_flush !! Flushes the current buffer to disk by closing and re-opening the file.
Expand Down
Loading

0 comments on commit 1a7d37a

Please sign in to comment.