Skip to content
Merged
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
15 changes: 15 additions & 0 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<hr>
# Tag name: mosart1.1.12
### Originator(s): slevis
### Date: Jul 31, 2025
### One-line Summary: Add write_restart_at_endofrun functionality to mosart same as in clm

Resolves issue https://github.com/ESCOMP/MOSART/issues/123

Testing: standard testing
izumi ---- PASS
derecho -- PASS

More details in the PRs:
https://github.com/ESCOMP/MOSART/pull/124

<hr>
# Tag name: mosart1.1.11
### Originator(s): jedwards
Expand Down
46 changes: 31 additions & 15 deletions src/cpl/nuopc/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ module rof_comp_nuopc
integer :: nthrds
integer , parameter :: debug = 1
character(*), parameter :: modName = "(rof_comp_nuopc)"

logical :: write_restart_at_endofrun = .false.
Comment thread
slevis-lmwg marked this conversation as resolved.

character(*), parameter :: u_FILE_u = &
__FILE__

Expand Down Expand Up @@ -420,6 +423,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
integer :: localPet
integer :: localPeCount
integer :: rofid ! component id for pio
logical :: isPresent ! If attribute is present
logical :: isSet ! If attribute is present and also set
character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) '
!---------------------------------------------------------------------------

Expand Down Expand Up @@ -487,7 +492,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! - need to compute areas where they are not defined in input file
call ESMF_ClockGet(clock, currTime=currtime, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return


call NUOPC_CompAttributeGet(gcomp, name="write_restart_at_endofrun", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
if (trim(cvalue) .eq. '.true.') write_restart_at_endofrun = .true.
Comment thread
slevis-lmwg marked this conversation as resolved.
else
call shr_sys_abort( subname//'ERROR:: write_restart_at_endofrun not isPresent or not isSet' )
end if

call mosart_init1(currtime, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down Expand Up @@ -635,35 +648,38 @@ subroutine ModelAdvance(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!--------------------------------
! Determine if time to write restart
! Determine if time to stop
Comment thread
slevis-lmwg marked this conversation as resolved.
!--------------------------------

call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc)
call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
if (ChkErr(rc,__LINE__,u_FILE_u)) return
rstwr = .true.
nlend = .true.
call ESMF_AlarmRingerOff( alarm, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
rstwr = .false.
nlend = .false.
endif

!--------------------------------
! Determine if time to stop
! Determine if time to write restart
!--------------------------------

call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
if (ChkErr(rc,__LINE__,u_FILE_u)) return
nlend = .true.
call ESMF_AlarmRingerOff( alarm, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
rstwr = .false.
if (nlend .and. write_restart_at_endofrun) then
rstwr = .true.
else
nlend = .false.
call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
if (ChkErr(rc,__LINE__,u_FILE_u)) return
rstwr = .true.
call ESMF_AlarmRingerOff( alarm, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
endif

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