Skip to content

Commit

Permalink
Merge pull request #105 from jedwards4b/rpointer_file_timestamps
Browse files Browse the repository at this point in the history
add timestamp to rpointer files
  • Loading branch information
ekluzek authored Dec 25, 2024
2 parents 39608ca + 6e1018f commit a246344
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 124 deletions.
37 changes: 37 additions & 0 deletions cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version= "1.0"?>

<expectedFails version="1.1">

<!-- Notes about the format of this file:
The required elements for a given failure are just:
<test name="...">
<phase name="...">
<status>...</status>
</phase>
</test>
There can be multiple phase blocks in a given test block.
In addition, a number of optional elements are allowed, which
currently are just for human consumption (not parsed by any
scripts):
- A phase block can contain an "issue" element, which gives the
issue number associated with this failure. (#123 refers to issue
#123 in the ESCOMP/ctsm repository. Issues in other repositories
should be specified as ORG/repo#123 - e.g., ESMCI/cime#123.)
- A phase block can contain a "comment" element, which gives any
sort of comment you desire.
-->

<test name="SMS_D_Ld5.f10_f10_mg37.I1850Clm60Sp.derecho_nvhpc.mosart-default">
<phase name="SHAREDLIB_BUILD">
<status>FAIL</status>
<issue>MOSART#109</issue>
</phase>
</test>

</expectedFails>
35 changes: 24 additions & 11 deletions docs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
===============================================================
Tag name: mosart1_1_05
Tag name: mosart1.1.06
Originator(s): jedwards4b
Date: Dec 24, 2024
One-line Summary: Add simulation timestamp to rpointer filenames

Add timestamps to rpointer files, initialize curr date from driver and compare
to what is in the restart files (instead of initializing from restart files).

Testing: standard testing (ekluzek)
izumi ---- OK (but problems with baseline compare)
derecho -- OK

===============================================================
Tag name: mosart1.1.05
Originator(s): slevis
Date: Nov 12, 2024
One-line Summary: Stop running 0th timestep
Expand All @@ -11,12 +24,12 @@ Relates to issue ESCOMP/CTSM#925 and PR ESCOMP/CTSM#2084.

Testing: standard testing
izumi -- OK
cheyenne -- OK
derecho -- OK

See https://github.com/ESCOMP/MOSART/pull/67 for more details

===============================================================
Tag name: mosart1_1_04
Tag name: mosart1.1.04
Originator(s): slevis
Date: Nov 11, 2024
One-line Summary: time now equals the middle of the time_bounds
Expand All @@ -28,12 +41,12 @@ Relates to issue #52 but does not separate instantaneous fields into separate hi

Testing: standard testing
izumi -- OK
cheyenne -- OK
derecho -- OK

See https://github.com/ESCOMP/MOSART/pull/106 for more details

===============================================================
Tag name: mosart1_1_03
Tag name: mosart1.1.03
Originator(s): ekluzek
Date: Nov 6, 2024
One-line Summary: Add more tests and merge in some other PRs
Expand All @@ -50,12 +63,12 @@ Resolves #107 change all mosart tests to clm60?

Testing: standard testing
izumi -- OK
cheyenne -- OK
derecho -- OK

See https://github.com/ESCOMP/MOSART/pull/70 for more details

===============================================================
Tag name: mosart1_1_02
Tag name: mosart1.1.02
Originator(s): mvertens
Date: Jun 21, 2024
One-line Summary: cism runoff will be now routed to ocn via mosart
Expand All @@ -73,12 +86,12 @@ Fixes #102

Testing: standard testing
izumi -- OK
cheyenne -- OK
derecho -- OK

See https://github.com/ESCOMP/MOSART/pull/94 for more details

===============================================================
Tag name: mosart1_1_01
Tag name: mosart1.1.01
Originator(s): mvertens
Date: Jun 06, 2024
One-line Summary: major mosart refactor including addition of new halo capability
Expand Down Expand Up @@ -121,7 +134,7 @@ Fixes #99 Add a new mosart_noresm testlist

Testing: standard testing
izumi -- OK
cheyenne -- OK
derecho -- OK

See https://github.com/ESCOMP/MOSART/pull/76 for more details

Expand Down Expand Up @@ -163,7 +176,7 @@ Issues resolved:

Testing: standard testing
izumi -- PASS
cheyenne -- PASS (following change answers but determined to be OK)
derecho -- PASS (following change answers but determined to be OK)
ERP_D.f10_f10_mg37.I1850Clm50Bgc.derecho_intel.mosart-qgrwlOpts
PEM_D.f10_f10_mg37.I1850Clm50Sp.derecho_intel.mosart-inplacethreshold
SMS_D.f10_f10_mg37.I1850Clm50Bgc.derecho_intel.mosart-decompOpts
Expand Down
59 changes: 31 additions & 28 deletions src/cpl/nuopc/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! local variables
type(ESMF_Mesh) :: Emesh
type(ESMF_VM) :: vm
type(ESMF_Time) :: currTime ! Current time
integer , allocatable :: gindex(:) ! global index space on my processor
integer :: lbnum ! input to memory diagnostic
character(CL) :: cvalue ! temporary
Expand Down Expand Up @@ -482,8 +483,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! - Adjust area estimation from DRT algorithm for those outlet grids
! - useful for grid-based representation only
! - need to compute areas where they are not defined in input file

call mosart_init1(rc)
call ESMF_ClockGet(clock, currTime=currtime, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

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

!--------------------------------
Expand Down Expand Up @@ -810,52 +813,52 @@ subroutine ModelSetRunClock(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_LogWrite(subname//'setting alarms for' // trim(name), ESMF_LOGMSG_INFO)

!----------------
! Restart alarm
!----------------
call NUOPC_CompAttributeGet(gcomp, name="restart_option", value=restart_option, rc=rc)
!------------------------------------------------------------------
! Stop alarm, set first in case needed for the restart alarm
!------------------------------------------------------------------
call NUOPC_CompAttributeGet(gcomp, name="stop_option", value=stop_option, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call NUOPC_CompAttributeGet(gcomp, name="restart_n", value=cvalue, rc=rc)
call NUOPC_CompAttributeGet(gcomp, name="stop_n", value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) restart_n
read(cvalue,*) stop_n

call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, rc=rc)
call NUOPC_CompAttributeGet(gcomp, name="stop_ymd", value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) restart_ymd
read(cvalue,*) stop_ymd

call alarmInit(mclock, restart_alarm, restart_option, &
opt_n = restart_n, &
opt_ymd = restart_ymd, &
call alarmInit(mclock, stop_alarm, stop_option, &
opt_n = stop_n, &
opt_ymd = stop_ymd, &
RefTime = mcurrTime, &
alarmname = 'alarm_restart', rc=rc)
alarmname = 'alarm_stop', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc)
call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!----------------
! Stop alarm
!----------------
call NUOPC_CompAttributeGet(gcomp, name="stop_option", value=stop_option, rc=rc)
!-------------------------------------------
! Restart alarm, set after the stop alarm
!-------------------------------------------
call NUOPC_CompAttributeGet(gcomp, name="restart_option", value=restart_option, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call NUOPC_CompAttributeGet(gcomp, name="stop_n", value=cvalue, rc=rc)
call NUOPC_CompAttributeGet(gcomp, name="restart_n", value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) stop_n
read(cvalue,*) restart_n

call NUOPC_CompAttributeGet(gcomp, name="stop_ymd", value=cvalue, rc=rc)
call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) stop_ymd
read(cvalue,*) restart_ymd

call alarmInit(mclock, stop_alarm, stop_option, &
opt_n = stop_n, &
opt_ymd = stop_ymd, &
call alarmInit(mclock, restart_alarm, restart_option, &
opt_n = restart_n, &
opt_ymd = restart_ymd, &
RefTime = mcurrTime, &
alarmname = 'alarm_stop', rc=rc)
alarmname = 'alarm_restart', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc)
call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

end if
Expand Down
15 changes: 4 additions & 11 deletions src/riverroute/mosart_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module mosart_driver
use perf_mod , only : t_startf, t_stopf
use nuopc_shr_methods , only : chkerr
use ESMF , only : ESMF_SUCCESS, ESMF_FieldGet, ESMF_FieldSMMStore, ESMF_FieldSMM, &
ESMF_TERMORDER_SRCSEQ, ESMF_Mesh
ESMF_TERMORDER_SRCSEQ, ESMF_Mesh, ESMF_Time
use mosart_io , only : ncd_pio_openfile, ncd_inqdid, ncd_inqdlen, ncd_pio_closefile, ncd_decomp_init, &
pio_subsystem
use pio , only : file_desc_t
Expand Down Expand Up @@ -217,12 +217,13 @@ end subroutine mosart_read_namelist

!-----------------------------------------------------------------------

subroutine mosart_init1(rc)
subroutine mosart_init1(currTime, rc)

!-------------------------------------------------
! Initialize mosart grid, mask, decomp
!
! Arguments
type(ESMF_Time), intent(in) :: currTime
integer, intent(out) :: rc
!
! Local variables
Expand All @@ -235,6 +236,7 @@ subroutine mosart_init1(rc)
!-------------------------------------------------

rc = ESMF_SUCCESS
call timemgr_init(dtime_in=coupling_period, curr_date_in=currTime)

!-------------------------------------------------------
! Obtain restart file if appropriate
Expand All @@ -244,15 +246,6 @@ subroutine mosart_init1(rc)
call mosart_rest_getfile( file=fnamer )
endif

!-------------------------------------------------------
! Initialize time manager
!-------------------------------------------------------
if (nsrest == nsrStartup) then
call timemgr_init(dtime_in=coupling_period)
else
call mosart_rest_timemanager(file=fnamer)
end if

!-------------------------------------------------------
! Write out tracers to stdout
!-------------------------------------------------------
Expand Down
49 changes: 32 additions & 17 deletions src/riverroute/mosart_restfile.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module mosart_restfile
use mosart_data, only : ctl, Trunoff
use mosart_histfile, only : mosart_hist_restart
use mosart_fileutils, only : getfil
use mosart_timemanager, only : timemgr_restart, get_nstep, get_curr_date
use mosart_timemanager, only : timemgr_restart, get_nstep, get_curr_date, get_prev_date
use mosart_io, only : ncd_pio_createfile, ncd_enddef, ncd_pio_openfile, ncd_pio_closefile, &
ncd_defdim, ncd_putatt, ncd_defvar, ncd_io, ncd_global, ncd_double, &
ncd_getdatetime
Expand Down Expand Up @@ -223,8 +223,9 @@ end subroutine mosart_rest_Getfile
!-----------------------------------------------------------------------

subroutine restFile_read_pfile( pnamer )

!-------------------------------------
use mpi, only : MPI_CHARACTER
use mosart_vars, only : mpicom_rof
!-------------------------------------
! Setup restart file and perform necessary consistency checks

! Arguments
Expand All @@ -234,6 +235,8 @@ subroutine restFile_read_pfile( pnamer )
integer :: nio ! restart unit
integer :: ier ! error return from fortran open
integer :: i ! index
integer :: yr, mon, day, tod
character(len=17) :: timestamp
character(len=CL) :: locfn ! Restart pointer file name
!-------------------------------------

Expand All @@ -244,21 +247,29 @@ subroutine restFile_read_pfile( pnamer )
! New history files are always created for branch runs.

if (mainproc) then
write(iulog,*) 'Reading restart pointer file....'
call get_curr_date(yr, mon, day, tod)
write(timestamp,'(".",i4.4,"-",i2.2,"-",i2.2,"-",i5.5)'),yr,mon,day,tod
locfn = './'// trim(rpntfil)//trim(inst_suffix)//timestamp

write(iulog,*) 'Reading restart pointer file: '//trim(locfn)
open (newunit=nio, file=trim(locfn), status='old', form='formatted', iostat=ier)
if (ier /= 0) then
locfn = './'// trim(rpntfil)//trim(inst_suffix)
open (newunit=nio, file=trim(locfn), status='old', form='formatted', iostat=ier)
if (ier /= 0) then
write(iulog,'(a,i8)')'(restFile_read_pfile): failed to open file '//trim(locfn)//' ierr=',ier
call shr_sys_abort()
end if
endif
read (nio,'(a256)') pnamer
close(nio)
endif
locfn = './'// trim(rpntfil)//trim(inst_suffix)
open (newunit=nio, file=trim(locfn), status='unknown', form='formatted', iostat=ier)
if (ier /= 0) then
write(iulog,'(a,i8)')'(restFile_read_pfile): failed to open file '//trim(locfn)//' ierr=',ier
call shr_sys_abort()
end if
read (nio,'(a256)') pnamer
close(nio)
if (mainproc) then
write(iulog,'(a)') 'Reading restart data.....'
call mpi_bcast (pnamer, CL, MPI_CHARACTER, 0, mpicom_rof, ier)
if(mainproc) then
write(iulog,'(a)') 'Reading restart data: ',trim(pnamer)
write(iulog,'(72a1)') ("-",i=1,60)
end if

end subroutine restFile_read_pfile

!-----------------------------------------------------------------------
Expand All @@ -275,18 +286,22 @@ subroutine restFile_write_pfile( fnamer )
integer :: nio ! restart pointer file unit number
integer :: ier ! error return from fortran open
character(len=CL) :: filename ! local file name
integer :: yr, mon, day, tod
character(len=17) :: timestamp
!-------------------------------------

if (mainproc) then
filename= './'// trim(rpntfil)//trim(inst_suffix)
call get_curr_date(yr, mon, day, tod)
write(timestamp,'(".",i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr, mon, day, tod
filename= './'// trim(rpntfil)//trim(inst_suffix)//timestamp
open (newunit=nio, file=trim(filename), status='unknown', form='formatted', iostat=ier)
if (ier /= 0) then
write(iulog,'(a,i8)')'(restFile_write_pfile): failed to open file '//trim(filename)//' ierr=',ier
call shr_sys_abort()
end if
write(nio,'(a)') fnamer
close(nio)
write(iulog,*)'Successfully wrote local restart pointer file'
write(iulog,*)'Successfully wrote local restart pointer file: '//trim(filename)
end if

end subroutine restFile_write_pfile
Expand Down
Loading

0 comments on commit a246344

Please sign in to comment.