Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pio_finalize calls for CICE history and restart files #995

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,12 @@ subroutine ice_write_hist (ns)
write(nu_diag,*) 'Finished writing ',trim(ncfile)
endif

!-----------------------------------------------------------------
! clean up PIO
!-----------------------------------------------------------------

call ice_pio_finalize()

first_call = .false.

end subroutine ice_write_hist
Expand Down
22 changes: 22 additions & 0 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module ice_pio

public ice_pio_init
public ice_pio_initdecomp
public ice_pio_finalize
public ice_pio_check

#ifdef CESMCOUPLED
Expand Down Expand Up @@ -529,6 +530,27 @@ subroutine ice_pio_initdecomp_4d (ndim3, ndim4, iodesc, precision)
end subroutine ice_pio_initdecomp_4d


!================================================================================

! PIO Finalize

subroutine ice_pio_finalize()

integer(kind=int_kind) :: status
character(len=*), parameter :: subname = '(ice_pio_finalize)'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#ifndef CESMCOUPLED

This is handled elsewhere for CESMCOUPLED

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I've updated the implementation.

status = PIO_NOERR
#ifndef CESMCOUPLED
call pio_seterrorhandling(ice_pio_subsystem, PIO_RETURN_ERROR)
call pio_finalize(ice_pio_subsystem,status)
call ice_pio_check( status, subname//' ERROR: Failed to finalize ', &
file=__FILE__,line=__LINE__)
! do not call this, ice_pio_subsystem does not exist anymore
! call pio_seterrorhandling(ice_pio_subsystem, PIO_INTERNAL_ERROR)
#endif

end subroutine ice_pio_finalize

!================================================================================

! PIO Error handling
Expand Down
1 change: 1 addition & 0 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ subroutine final_restart()
call PIO_freeDecomp(File,iodesc2d)
call PIO_freeDecomp(File,iodesc3d_ncat)
call pio_closefile(File)
call ice_pio_finalize()

if (my_task == master_task) then
write(nu_diag,'(a,i8,4x,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
Expand Down
8 changes: 8 additions & 0 deletions configuration/scripts/options/set_nml.histhrly
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
histfreq = 'm','h','x','x','x'
histfreq_n = 1,1,1,1,1
histfreq_base = 'zero','zero','zero','zero','zero'
write_ic = .true.
f_aice = 'mh'
f_hi = 'hm'
f_hs = 'mh'
f_Tsfc = 'mh'
3 changes: 3 additions & 0 deletions configuration/scripts/tests/io_suite.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Test Grid PEs Sets BFB-compare
smoke gx3 32x1 run1year,histhrly,ionetcdf,iocdf2,short
smoke gx3 32x1 run1year,histhrly,iopio2,iocdf5,short

# some iobinary configurations fail due to bathymetry netcdf file requirement, remove them
# iobinary cannot work with JRA55 because netcdf is turned off
restart gx3 8x4 gx3ncarbulk,debug,histall,iobinary,precision8
Expand Down
Loading