diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 0f9070fef..5d0dee085 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -223,12 +223,16 @@ subroutine init_restart_write(filename_spec) ! write pointer (path/file) if (my_task == master_task) then -#ifdef CESMCOUPLED - write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & - 'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec +#ifdef CESMCOUPLED + lpointer_file = 'rpointer.ice'//trim(inst_suffix) #else lpointer_file = pointer_file #endif + if (pointer_date) then + ! append date to pointer filename + write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & + trim(lpointer_file)//'.',myear,'-',mmonth,'-',mday,'-',msec + end if open(nu_rst_pointer,file=lpointer_file) write(nu_rst_pointer,'(a)') filename close(nu_rst_pointer) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index 7da8245a3..11ff9178d 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -30,7 +30,8 @@ module ice_comp_nuopc use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name use ice_fileunits , only : inst_suffix, release_all_fileunits, flush_fileunit - use ice_restart_shared , only : runid, runtype, restart, use_restart_time, restart_dir, restart_file, restart_format, restart_chunksize + use ice_restart_shared , only : runid, runtype, restart, use_restart_time, restart_dir, restart_file, & + restart_format, restart_chunksize, pointer_date use ice_history , only : accum_hist use ice_history_shared , only : history_format, history_chunksize use ice_exit , only : abort_ice @@ -323,6 +324,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (trim(cvalue) .eq. '.true.') restart_eor = .true. endif +#ifdef CESMCOUPLED + pointer_date = .true. +#endif + + ! set CICE internal pointer_date variable based on nuopc settings + ! this appends a datestamp to the "rpointer" file + call NUOPC_CompAttributeGet(gcomp, name="restart_pointer_append_date", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) pointer_date = (trim(cvalue) .eq. ".true.") !---------------------------------------------------------------------------- ! generate local mpi comm !---------------------------------------------------------------------------- diff --git a/cicecore/shared/ice_restart_shared.F90 b/cicecore/shared/ice_restart_shared.F90 index c022d77ba..32d78e82f 100644 --- a/cicecore/shared/ice_restart_shared.F90 +++ b/cicecore/shared/ice_restart_shared.F90 @@ -25,6 +25,9 @@ module ice_restart_shared character (len=char_len_long), public :: & pointer_file ! input pointer file for restarts + logical (kind=log_kind), public :: & + pointer_date = .false. ! if true, append datestamp to pointer file + character (len=char_len), public :: & restart_format , & ! format of restart files 'nc' restart_rearranger ! restart file rearranger, box or subset for pio