Skip to content

Commit

Permalink
configurable option to remove datestamp from rpointer file
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Dec 20, 2024
1 parent 0d9e0d3 commit 00a9dd8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
10 changes: 7 additions & 3 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 13 additions & 1 deletion cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -323,6 +324,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (trim(cvalue) .eq. '.true.') restart_eor = .true.
endif

#ifdef CESMCOUPLED
! set CICE internal pointer_date variable based on nuopc settings
! this appends a datestamp to the "rpointer" file (by default this is on)
pointer_date = .true.
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) then
if (trim(cvalue) .eq. '.false.') pointer_date = .false.
endif
#endif

!----------------------------------------------------------------------------
! generate local mpi comm
!----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions cicecore/shared/ice_restart_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00a9dd8

Please sign in to comment.