From a0d1a9261746e5faae9ed157f2f996703f230a8a Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 21 Oct 2024 07:43:09 -0600 Subject: [PATCH 1/6] response to review --- .../cicedyn/infrastructure/io/io_pio2/ice_restart.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 8ebca4b23..8c2342221 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -59,7 +59,9 @@ subroutine init_restart_read(ice_ic) integer (kind=int_kind) :: status logical (kind=log_kind), save :: first_call = .true. - logical :: exist +#ifdef CESMCOUPLED + logical :: file_exist +#endif character(len=*), parameter :: subname = '(init_restart_read)' if (present(ice_ic)) then @@ -69,8 +71,8 @@ subroutine init_restart_read(ice_ic) #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=exist) - if (.not. exist) pointer_file = 'rpointer.ice'//trim(inst_suffix) + inquire(file=pointer_file, file_exist=exist) + if (.not. file_exist) pointer_file = 'rpointer.ice'//trim(inst_suffix) #endif open(nu_rst_pointer,file=pointer_file) read(nu_rst_pointer,'(a)') filename0 From 6074f273513cd74270efd918da32e967da29bd96 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 21 Oct 2024 15:02:50 -0600 Subject: [PATCH 2/6] correct exist and file_exist --- cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 8c2342221..9fc5715ee 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -71,7 +71,7 @@ subroutine init_restart_read(ice_ic) #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, file_exist=exist) + inquire(file=pointer_file, exist=file_exist) if (.not. file_exist) pointer_file = 'rpointer.ice'//trim(inst_suffix) #endif open(nu_rst_pointer,file=pointer_file) From 1cf126869c1305e8858e8b59b84cd6a5b7677fbb Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 21 Oct 2024 17:15:39 -0600 Subject: [PATCH 3/6] get pointer file name root from ice_in namelist and append timestamp for cesm --- .../infrastructure/io/io_pio2/ice_restart.F90 | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 9fc5715ee..40c0ae010 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -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. @@ -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 @@ -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 @@ -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 From e0b59fcc5ed7de15b85c244576fe2175cfe0d6ba Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 24 Oct 2024 10:17:55 -0600 Subject: [PATCH 4/6] the pointer_file name is set in namelist, no need to modify here --- .../infrastructure/io/io_pio2/ice_restart.F90 | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 40c0ae010..f6735855b 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -54,7 +54,7 @@ subroutine init_restart_read(ice_ic) ! local variables character(len=char_len_long) :: & - filename, filename0, lpointer_file + filename, filename0 integer (kind=int_kind) :: status @@ -68,19 +68,11 @@ subroutine init_restart_read(ice_ic) filename = trim(ice_ic) else if (my_task == master_task) then -#ifdef CESMCOUPLED - 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=lpointer_file) + open(nu_rst_pointer,file=pointer_file) read(nu_rst_pointer,'(a)') filename0 filename = trim(filename0) close(nu_rst_pointer) - write(nu_diag,*) 'Read ',lpointer_file(1:lenstr(pointer_file)) + write(nu_diag,*) 'Read ',pointer_file(1:lenstr(pointer_file)) endif call broadcast_scalar(filename, master_task) endif From 66b4bbf90ae5dbf4670d3ae10c409d91dbd75946 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 24 Oct 2024 10:20:41 -0600 Subject: [PATCH 5/6] cleanup whitespace --- cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index f6735855b..4d5bbf6f3 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -55,13 +55,10 @@ subroutine init_restart_read(ice_ic) character(len=char_len_long) :: & filename, filename0 - + integer (kind=int_kind) :: status logical (kind=log_kind), save :: first_call = .true. -#ifdef CESMCOUPLED - logical :: file_exist -#endif character(len=*), parameter :: subname = '(init_restart_read)' if (present(ice_ic)) then From f7552bc273bfe40b566876f4fbb5856e0abd6a80 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 24 Oct 2024 10:48:22 -0600 Subject: [PATCH 6/6] need to use default cesm pointer name for write and not read from ice_in namelist --- cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 4d5bbf6f3..d659d89e6 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -224,7 +224,7 @@ subroutine init_restart_write(filename_spec) if (my_task == master_task) then #ifdef CESMCOUPLED 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 + 'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec #else lpointer_file = pointer_file #endif