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

Flexible restart write times (restart_fh) #125

Merged
merged 2 commits into from
Dec 11, 2024
Merged
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
16 changes: 16 additions & 0 deletions mediator/med_phases_restart_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module med_phases_restart_mod
use med_phases_prep_glc_mod , only : FBocnAccum2glc_o, ocnAccum2glc_cnt
use med_phases_prep_rof_mod , only : FBlndAccum2rof_l, lndAccum2rof_cnt
use pio , only : file_desc_t
#ifndef CESMCOUPLED
use shr_is_restart_fh_mod, only : init_is_restart_fh, is_restart_fh, is_restart_fh_type
#endif
implicit none
private

Expand All @@ -23,6 +26,9 @@ module med_phases_restart_mod
private :: med_phases_restart_alarm_init

logical :: write_restart_at_endofrun = .false.
#ifndef CESMCOUPLED
type(is_restart_fh_type) :: restartfh_info ! For flexible restarts in UFS
#endif
logical :: whead(2) = (/.true. , .false./)
logical :: wdata(2) = (/.false., .true. /)

Expand Down Expand Up @@ -115,6 +121,10 @@ subroutine med_phases_restart_alarm_init(gcomp, rc)
write(logunit,*)
end if

#ifndef CESMCOUPLED
call init_is_restart_fh(mcurrtime, timestep_length,maintask, restartfh_info)
#endif

end subroutine med_phases_restart_alarm_init

!===============================================================================
Expand Down Expand Up @@ -178,6 +188,7 @@ subroutine med_phases_restart_write(gcomp, rc)
real(R8) :: tbnds(2) ! CF1.0 time bounds
logical :: isPresent
logical :: first_time = .true.
logical :: write_restartfh
character(len=*), parameter :: subname='(med_phases_restart_write)'
!---------------------------------------

Expand Down Expand Up @@ -244,6 +255,11 @@ subroutine med_phases_restart_write(gcomp, rc)
endif
endif

#ifndef CESMCOUPLED
call is_restart_fh(clock, restartfh_info, write_restartfh)
if (write_restartfh) alarmIsOn = .true.
#endif

if (alarmIsOn) then
call ESMF_ClockGet(clock, currtime=currtime, starttime=starttime, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down