Skip to content

Commit

Permalink
get pointer file name root from ice_in namelist and append timestamp …
Browse files Browse the repository at this point in the history
…for cesm
  • Loading branch information
jedwards4b committed Oct 21, 2024
1 parent 6074f27 commit 1cf1268
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ subroutine init_restart_read(ice_ic)
! local variables

character(len=char_len_long) :: &
filename, filename0

filename, filename0, lpointer_file
integer (kind=int_kind) :: status

logical (kind=log_kind), save :: first_call = .true.
Expand All @@ -69,16 +69,18 @@ subroutine init_restart_read(ice_ic)
else
if (my_task == master_task) then
#ifdef CESMCOUPLED
write(pointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec
inquire(file=pointer_file, exist=file_exist)
if (.not. file_exist) pointer_file = 'rpointer.ice'//trim(inst_suffix)
write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
trim(pointer_file)//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec
inquire(file=lpointer_file, exist=file_exist)
if (.not. file_exist) lpointer_file = trim(pointer_file)//trim(inst_suffix)
#else
lpointer_file = pointer_file
#endif
open(nu_rst_pointer,file=pointer_file)
open(nu_rst_pointer,file=lpointer_file)
read(nu_rst_pointer,'(a)') filename0
filename = trim(filename0)
close(nu_rst_pointer)
write(nu_diag,*) 'Read ',pointer_file(1:lenstr(pointer_file))
write(nu_diag,*) 'Read ',lpointer_file(1:lenstr(pointer_file))
endif
call broadcast_scalar(filename, master_task)
endif
Expand Down Expand Up @@ -184,6 +186,7 @@ subroutine init_restart_write(filename_spec)
integer (kind=int_kind) :: nbtrcr

character(len=char_len_long) :: filename
character(len=char_len_long) :: lpointer_file

integer (kind=int_kind) :: &
dimid_ncat, dimid_nilyr, dimid_nslyr, dimid_naero
Expand Down Expand Up @@ -231,10 +234,12 @@ subroutine init_restart_write(filename_spec)
! write pointer (path/file)
if (my_task == master_task) then
#ifdef CESMCOUPLED
write(pointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec
write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') &
trim(pointer_file)//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec
#else
lpointer_file = pointer_file
#endif
open(nu_rst_pointer,file=pointer_file)
open(nu_rst_pointer,file=lpointer_file)
write(nu_rst_pointer,'(a)') filename
close(nu_rst_pointer)
endif
Expand Down

0 comments on commit 1cf1268

Please sign in to comment.