From d6a7cda0c08c3caab2fcb29ff2e51fc852e7051d Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Mon, 19 Oct 2026 14:38:03 -0600 Subject: [PATCH] Start MPAS dycore clock at current date on restarts, and remove un-used code (issue #1721). Co-Authored-By: Claude Opus 5.5 --- doc/ChangeLog | 59 ++++++++++++++++++++++++++++++++++ src/dynamics/mpas/dyn_comp.F90 | 14 ++++---- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6c62c08714..7f708e1f25 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,64 @@ =============================================================== +Tag name: +Originator(s): nusbaume +Date: +One-line Summary: Start the MPAS dycore clock at the current date on restarts +Github PR URL: + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + + Fixes #1721: MPAS dycore timer resets for restart runs + + The MPAS dycore clock was always started at RUN_STARTDATE, so on + continue runs the MPAS time-step diagnostics in atm.log (and the MPAS + "xtime" field) were reset to the run start date. The MPAS clock now + starts at CAM's current date, which is the run start date for initial + runs and the restart date for continue and branch runs. + + This change was developed with AI assistance (Claude Code). + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: + +M src/dynamics/mpas/dyn_comp.F90 + - Set MPAS config_start_time from get_curr_date instead of get_start_date + - Set MPAS config_run_duration to 'none' so the MPAS clock stop time + comes from config_stop_time + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +derecho/intel/aux_cam: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: bit-for-bit unchanged (expected) + +=============================================================== + Tag name: cam6_4_213 Originator(s): peverwhee, billsacks Date: Oct 16, 2026 diff --git a/src/dynamics/mpas/dyn_comp.F90 b/src/dynamics/mpas/dyn_comp.F90 index c92d4a3573..101550a80c 100644 --- a/src/dynamics/mpas/dyn_comp.F90 +++ b/src/dynamics/mpas/dyn_comp.F90 @@ -28,7 +28,7 @@ module dyn_comp use pio, only: file_desc_t use cam_pio_utils, only: clean_iodesc_list -use time_manager, only: get_start_date, get_stop_date, get_run_duration, & +use time_manager, only: get_curr_date, get_stop_date, & timemgr_get_calendar_cf, get_step_size use cam_logfile, only: iulog @@ -273,7 +273,7 @@ subroutine dyn_readnl(NLFileName) ! Local variables integer, dimension(2) :: logUnits ! stdout and stderr for MPAS logging - integer :: yr, mon, day, tod, ndate, nday, nsec + integer :: yr, mon, day, tod, ndate character(len=*), parameter :: subname = 'dyn_comp:dyn_readnl' !---------------------------------------------------------------------------- @@ -285,8 +285,10 @@ subroutine dyn_readnl(NLFileName) ! read namelist call cam_mpas_namelist_read(NLFileName, domain_ptr % configs) - ! Set config_start_date, etc. (these will not appear in the dycore namelist) - call get_start_date(yr, mon, day, tod) + ! Set config_start_time, etc. (these will not appear in the dycore namelist) + ! The MPAS clock starts at CAM's current time, which is the run start date for + ! initial runs and the restart date for continuation and branch runs. + call get_curr_date(yr, mon, day, tod) ndate = yr*10000 + mon*100 + day call mpas_pool_add_config(domain_ptr % configs, 'config_start_time', date2yyyymmdd(ndate)//'_'//sec2hms(tod)) @@ -294,8 +296,8 @@ subroutine dyn_readnl(NLFileName) ndate = yr*10000 + mon*100 + day call mpas_pool_add_config(domain_ptr % configs, 'config_stop_time', date2yyyymmdd(ndate)//'_'//sec2hms(tod)) - call get_run_duration(nday, nsec) - call mpas_pool_add_config(domain_ptr % configs, 'config_run_duration', trim(int2str(nday))//'_'//sec2hms(nsec)) + ! Let the MPAS clock use config_stop_time to set its stop time. + call mpas_pool_add_config(domain_ptr % configs, 'config_run_duration', 'none') ! Although the following namelist options are not expected to be used by CAM-MPAS, the MPAS-A dycore ! references these options, and they therefore must be defined in the configs pool