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

Make datestamps in pointer filenames configurable #9

Merged
merged 3 commits into from
Jan 24, 2025
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
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
12 changes: 11 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,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
!----------------------------------------------------------------------------
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
dougiesquire marked this conversation as resolved.
Show resolved Hide resolved

character (len=char_len), public :: &
restart_format , & ! format of restart files 'nc'
restart_rearranger ! restart file rearranger, box or subset for pio
Expand Down