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) #1320

Open
wants to merge 3 commits into
base: dev/ufs-weather-model
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions model/src/cmake/src_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ set(nuopc_mesh_cap_src
wav_wrapper_mod.F90
wav_pio_mod.F90
wav_restart_mod.F90
#restart_fh
${PROJECT_SOURCE_DIR}/../CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90
)

set(esmf_multi_cap_src
Expand Down
15 changes: 14 additions & 1 deletion model/src/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module wav_comp_nuopc
use wmmdatmd , only : nmpscr
use w3updtmd , only : w3uini
use w3adatmd , only : flcold, fliwnd
use shr_is_restart_fh_mod , only : init_is_restart_fh, is_restart_fh, is_restart_fh_type
#endif
use constants , only : is_esmf_component

Expand Down Expand Up @@ -89,6 +90,7 @@ module wav_comp_nuopc
logical :: cesmcoupled = .true. !< logical to indicate CESM use case
#else
logical :: cesmcoupled = .false. !< logical to indicate non-CESM use case
type(is_restart_fh_type) :: restartfh_info ! For flexible restarts in UFS
#endif
integer, allocatable :: tend(:,:) !< the ending time of ModelAdvance when
!! run with multigrid=true
Expand Down Expand Up @@ -1126,6 +1128,7 @@ subroutine ModelAdvance(gcomp, rc)
type(ESMF_Time) :: currTime, nextTime, startTime, stopTime
integer :: yy,mm,dd,hh,ss
integer :: imod
logical :: write_restartfh
!integer :: shrlogunit ! original log unit and level
character(ESMF_MAXSTR) :: msgString
character(len=*),parameter :: subname = '(wav_comp_nuopc:ModelAdvance) '
Expand Down Expand Up @@ -1219,6 +1222,10 @@ subroutine ModelAdvance(gcomp, rc)
else
rstwr = .false.
endif
#ifndef W3_CESMCOUPLED
call is_restart_fh(clock, restartfh_info, write_restartfh)
if (write_restartfh) rstwr = .true.
#endif

! Determine if time to write ww3 history files
call ESMF_ClockGetAlarm(clock, alarmname='alarm_history', alarm=alarm, rc=rc)
Expand Down Expand Up @@ -1295,7 +1302,7 @@ subroutine ModelSetRunClock(gcomp, rc)
integer :: history_ymd ! History date (YYYYMMDD)
type(ESMF_ALARM) :: history_alarm
character(len=128) :: name
integer :: alarmcount
integer :: alarmcount, dt_cpl
character(len=*),parameter :: subname=trim(modName)//':(ModelSetRunClock) '

!-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1363,6 +1370,12 @@ subroutine ModelSetRunClock(gcomp, rc)

call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
#ifndef W3_CESMCOUPLED
call ESMF_TimeIntervalGet( dtimestep, s=dt_cpl, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call init_is_restart_fh(mcurrTime, dt_cpl, root_task, restartfh_info)
#endif

end if

!----------------
Expand Down
Loading