Skip to content

Commit

Permalink
Merge pull request #201 from nmizukami/cesm-coupling
Browse files Browse the repository at this point in the history
Adding netcdf sync
  • Loading branch information
nmizukami authored Aug 20, 2021
2 parents d78446e + 6fbbf12 commit 8af2b80
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions route/build/src/pio_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module pio_utils
public::end_def
public::openFile
public::closeFile
public::sync_file
public::write_netcdf ! write non-distributed data
public::write_pnetcdf ! write distributed data without record dimension
public::write_pnetcdf_recdim ! write distributed data at a specified index of record dimension
Expand Down Expand Up @@ -333,6 +334,24 @@ subroutine closeFile(pioFileDesc)

end subroutine closeFile

!-----------------------------------------------------------------------
subroutine sync_file(pioFileDesc, ierr, message)
! !DESCRIPTION:
! end definition of netcdf file
!
implicit none
! input
type(file_desc_t), intent(inout) :: pioFileDesc ! netcdf file id
! output
integer(i4b), intent(out) :: ierr ! error status
character(*), intent(out) :: message ! error message

ierr=0; message='sync_file/'

call PIO_syncfile(pioFileDesc)

end subroutine sync_file

!-----------------------------------------------------------------------
subroutine end_def(pioFileDesc, ierr, message)
! !DESCRIPTION:
Expand Down
3 changes: 3 additions & 0 deletions route/build/src/write_simoutput_pio.f90
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ SUBROUTINE output(ierr, message)
if(ierr/=0)then; message=trim(message)//trim(cmessage); return; endif
endif

call sync_file(pioFileDesc, ierr, cmessage)
if(ierr/=0)then; message=trim(message)//trim(cmessage); return; endif

END SUBROUTINE output


Expand Down

0 comments on commit 8af2b80

Please sign in to comment.