Skip to content

Commit

Permalink
add log message to stdout for restart_fh use
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Jan 12, 2024
1 parent 55661cc commit a69299a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions config_src/drivers/nuopc_cap/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,7 @@ subroutine ModelSetRunClock(gcomp, rc)
integer, intent(out) :: rc

! local variables
type(ESMF_VM) :: vm
type(ESMF_Clock) :: mclock, dclock
type(ESMF_Time) :: mcurrtime, dcurrtime
type(ESMF_Time) :: mstoptime, dstoptime
Expand All @@ -1827,13 +1828,15 @@ subroutine ModelSetRunClock(gcomp, rc)
character(len=256) :: restart_option ! Restart option units
integer :: restart_n ! Number until restart interval
integer :: restart_ymd ! Restart date (YYYYMMDD)
integer :: dt_cpl ! coupling timestep
type(ESMF_Alarm) :: restart_alarm
type(ESMF_Alarm) :: stop_alarm
logical :: isPresent, isSet
logical :: first_time = .true.
integer :: localPet
integer :: n, nfh
integer, allocatable :: restart_fh(:)
character(len=*),parameter :: subname='MOM_cap:(ModelSetRunClock) '
character(len=*),parameter :: subname='(MOM_cap:ModelSetRunClock) '
!--------------------------------

rc = ESMF_SUCCESS
Expand All @@ -1849,6 +1852,11 @@ subroutine ModelSetRunClock(gcomp, rc)
call ESMF_ClockGet(mclock, currTime=mcurrtime, timeStep=mtimestep, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call ESMF_GridCompGet(gcomp, vm=vm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMGet(vm, localPet=localPet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!--------------------------------
! check that the current time in the model and driver are the same
!--------------------------------
Expand Down Expand Up @@ -1976,6 +1984,9 @@ subroutine ModelSetRunClock(gcomp, rc)
call NUOPC_CompAttributeGet(gcomp, name='restart_fh', isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then

call ESMF_TimeIntervalGet(dtimestep, s=dt_cpl, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call NUOPC_CompAttributeGet(gcomp, name='restart_fh', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand All @@ -1990,10 +2001,15 @@ subroutine ModelSetRunClock(gcomp, rc)
call ESMF_TimeIntervalSet(fhInterval, h=restart_fh(n), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
restartFhTimes(n) = mcurrtime + fhInterval

call ESMF_TimePrint(restartFhTimes(n), options="string", preString="Restart_Fh at ", unit=timestr, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_LogWrite(subname//trim(timestr), ESMF_LOGMSG_INFO)
if (localPet == 0) then
if (mod(3600*restart_fh(n),dt_cpl) /= 0) then
write(stdout,'(A)')trim(subname)//trim(timestr)//' will not be written'
else
write(stdout,'(A)')trim(subname)//trim(timestr)//' will be written'
end if
end if
end do
deallocate(restart_fh)
end if
Expand Down

0 comments on commit a69299a

Please sign in to comment.