Skip to content

Commit 4891eb3

Browse files
anton-seaiceaekissdougiesquire
committed
Make datestamps in pointer filenames configurable (#9)
This adds support in cice for the addition of datestamps to the pointer filenames to be configured through the nuopc option restart_pointer_append_date . Co-authored-by: Andrew Kiss <31054815+aekiss@users.noreply.github.com> Co-authored-by: Dougie Squire <42455466+dougiesquire@users.noreply.github.com>
1 parent b63a5d7 commit 4891eb3

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,16 @@ subroutine init_restart_write(filename_spec)
224224

225225
! write pointer (path/file)
226226
if (my_task == master_task) then
227-
#ifdef CESMCOUPLED
228-
write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
229-
'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec
227+
#ifdef CESMCOUPLED
228+
lpointer_file = 'rpointer.ice'//trim(inst_suffix)
230229
#else
231230
lpointer_file = pointer_file
232231
#endif
232+
if (pointer_date) then
233+
! append date to pointer filename
234+
write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
235+
trim(lpointer_file)//'.',myear,'-',mmonth,'-',mday,'-',msec
236+
end if
233237
open(nu_rst_pointer,file=lpointer_file)
234238
write(nu_rst_pointer,'(a)') filename
235239
close(nu_rst_pointer)

cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ module ice_comp_nuopc
3030
use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long
3131
use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name
3232
use ice_fileunits , only : inst_suffix, release_all_fileunits, flush_fileunit
33-
use ice_restart_shared , only : runid, runtype, restart, use_restart_time, restart_dir, restart_file, restart_format, restart_chunksize
33+
use ice_restart_shared , only : runid, runtype, restart, use_restart_time, restart_dir, restart_file, &
34+
restart_format, restart_chunksize, pointer_date
3435
use ice_history , only : accum_hist
3536
use ice_history_shared , only : history_format, history_chunksize
3637
use ice_exit , only : abort_ice
@@ -329,6 +330,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
329330
if (trim(cvalue) .eq. '.true.') restart_eor = .true.
330331
endif
331332

333+
#ifdef CESMCOUPLED
334+
pointer_date = .true.
335+
#endif
336+
337+
! set CICE internal pointer_date variable based on nuopc settings
338+
! this appends a datestamp to the "rpointer" file
339+
call NUOPC_CompAttributeGet(gcomp, name="restart_pointer_append_date", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
340+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
341+
if (isPresent .and. isSet) pointer_date = (trim(cvalue) .eq. ".true.")
332342
!----------------------------------------------------------------------------
333343
! generate local mpi comm
334344
!----------------------------------------------------------------------------

cicecore/shared/ice_restart_shared.F90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ module ice_restart_shared
2525
character (len=char_len_long), public :: &
2626
pointer_file ! input pointer file for restarts
2727

28+
logical (kind=log_kind), public :: &
29+
pointer_date = .false. ! if true, append datestamp to pointer file
30+
2831
character (len=char_len), public :: &
2932
restart_format , & ! format of restart files 'nc'
3033
restart_rearranger ! restart file rearranger, box or subset for pio

0 commit comments

Comments
 (0)