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

add timestamp to rpointer files #304

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Changes from 1 commit
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
22 changes: 16 additions & 6 deletions config_src/drivers/nuopc_cap/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
! (same as restartfile if single restart file)
character(len=*), parameter :: subname='(MOM_cap:InitializeAdvertise)'
character(len=32) :: calendar
character(len=17) :: timestamp
character(len=:), allocatable :: rpointer_filename
integer :: inst_index
logical :: i2o_per_cat
logical :: found=.false. ! rpointer inquiry
real(8) :: MPI_Wtime, timeiads
!--------------------------------

Expand Down Expand Up @@ -479,7 +481,14 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call get_component_instance(gcomp, inst_suffix, inst_index, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ensemble_manager_init(inst_suffix)
rpointer_filename = 'rpointer.ocn'//trim(inst_suffix)

write(timestamp,'(".",i4.4,"-",i2.2,"-",i2.2,"-",i5.5)'),year,month,day,hour*3600+minute*60+second
rpointer_filename = 'rpointer.ocn'//trim(inst_suffix)//timestamp
inquire(file=trim(rpointer_filename), exist=found)
! for backward compatibility
if (.not. found) then
rpointer_filename = 'rpointer.ocn'//trim(inst_suffix)
endif
#endif

! reset shr logging to my log file
Expand Down Expand Up @@ -1662,7 +1671,6 @@ subroutine ModelAdvance(gcomp, rc)
integer(ESMF_KIND_I8) :: n_interval, time_elapsed_sec
type(ESMF_Field) :: lfield
type(ESMF_StateItem_Flag) :: itemType
character(len=64) :: timestamp
type (ocean_public_type), pointer :: ocean_public => NULL()
type (ocean_state_type), pointer :: ocean_state => NULL()
type(ice_ocean_boundary_type), pointer :: Ice_ocean_boundary => NULL()
Expand All @@ -1688,6 +1696,7 @@ subroutine ModelAdvance(gcomp, rc)
character(len=*),parameter :: subname='(MOM_cap:ModelAdvance)'
character(len=8) :: suffix
character(len=:), allocatable :: rpointer_filename
character(len=17) :: timestamp
integer :: num_rest_files
real(8) :: MPI_Wtime, timers
logical :: write_restart
Expand Down Expand Up @@ -1877,10 +1886,12 @@ subroutine ModelAdvance(gcomp, rc)
call ESMF_VMGet(vm, localPet=localPet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

rpointer_filename = 'rpointer.ocn'//trim(inst_suffix)
write(timestamp,'(".",i4.4,"-",i2.2,"-",i2.2,"-",i5.5)'),year,month,day,hour*3600+minute*60+seconds

rpointer_filename = 'rpointer.ocn'//trim(inst_suffix)//timestamp

write(restartname,'(A,".mom6.r.",I4.4,"-",I2.2,"-",I2.2,"-",I5.5)') &
trim(casename), year, month, day, hour * 3600 + minute * 60 + seconds
write(restartname,'(A,".mom6.r.",A)') &
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug here - correction coming...

trim(casename), timestamp
call ESMF_LogWrite("MOM_cap: Writing restart : "//trim(restartname), ESMF_LOGMSG_INFO)
! write restart file(s)
call ocean_model_restart(ocean_state, restartname=restartname, num_rest_files=num_rest_files)
Expand Down Expand Up @@ -2202,7 +2213,6 @@ subroutine ocean_model_finalize(gcomp, rc)
type(ESMF_Time) :: currTime
type(ESMF_Alarm), allocatable :: alarmList(:)
integer :: alarmCount
character(len=64) :: timestamp
logical :: write_restart
character(len=*),parameter :: subname='(MOM_cap:ocean_model_finalize)'
real(8) :: MPI_Wtime, timefs
Expand Down
Loading