Skip to content

Commit

Permalink
ESCOMP tag: cam6_3_151
Browse files Browse the repository at this point in the history
Merge pull request ESCOMP#1003 from brian-eaton/mavg

Fix for multiple monthly average history files.

ESCOMP commit: c97e39c
  • Loading branch information
brian-eaton authored and Steve Goldhaber committed Apr 22, 2024
1 parent 8442d8f commit 0f0599e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 5 deletions.
69 changes: 69 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,74 @@
===============================================================

Tag name: cam6_3_151
Originator(s): eaton
Date: Thu 21 Mar 2024
One-line Summary: Bugfix to allow multiple monthly avg history files
Github PR URL: https://github.com/ESCOMP/CAM/pull/1003

Purpose of changes (include the issue number and title text for each relevant GitHub issue):

#1000 - Output of more than 1 monthly average history file is broken.

. resolves #1000

Describe any changes made to build system: none

Describe any changes made to the namelist: none

List any changes to the defaults for the boundary datasets: none

Describe any substantial timing or memory changes: none

Code reviewed by: cacraigucar, peverwhee

List all files eliminated: none

List all files added and what they do: none

List all existing files that have been modified, and describe the changes:

src/control/cam_history.F90
. subroutine wshist
- add new local variables to store the year, month, and day components of
the time interval midpoint date.

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.

All tests have a MEMCOMP failure which we are ignoring.
Several tests have a TPUTCOMP failure which we are also ignoring.

derecho/intel/aux_cam:
ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 (Overall: FAIL) details:
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: FAIL) details:
SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details:
- pre-existing failures

izumi/nag/aux_cam:
DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details:
- pre-existing failure

izumi/gnu/aux_cam:
All PASS.

TESTING NOTE: None of our regression tests use multiple monthly output
files. The fix was tested in a low res FHS94 compset that specified
monthly output for h0, h1, h2, and h3. The 'T' field was output in each
file. A 1 month test was run and all files had identical output. This is
the same configuration that I used to debug the problem.

CAM tag used for the baseline comparison tests if different than previous
tag:

Summarize any changes to answers: BFB

===============================================================
===============================================================

Tag name: cam6_3_150
Originator(s): megandevlan, peverwhee
Date: Feb 23, 2024
Expand Down
13 changes: 8 additions & 5 deletions src/control/cam_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5516,6 +5516,7 @@ subroutine wshist (rgnht_in)
#endif

integer :: yr, mon, day ! year, month, and day components of a date
integer :: yr_mid, mon_mid, day_mid ! year, month, and day components of midpoint date
integer :: nstep ! current timestep number
integer :: ncdate(maxsplitfiles) ! current (or midpoint) date in integer format [yyyymmdd]
integer :: ncsec(maxsplitfiles) ! current (or midpoint) time of day [seconds]
Expand All @@ -5529,7 +5530,6 @@ subroutine wshist (rgnht_in)
logical :: prev ! Label file with previous date rather than current
logical :: duplicate ! Flag for duplicate file name
integer :: ierr
integer :: ncsec_temp
#if ( defined BFB_CAM_SCAM_IOP )
integer :: tsec ! day component of current time
integer :: dtime ! seconds component of current time
Expand Down Expand Up @@ -5583,17 +5583,20 @@ subroutine wshist (rgnht_in)
end if
end if
end if

time = ndcur + nscur/86400._r8
if (is_initfile(file_index=t)) then
tdata = time ! Inithist file is always instantanious data
else
tdata(1) = beg_time(t)
tdata(2) = time
end if

! Set midpoint date/datesec for accumulated file
call set_date_from_time_float((tdata(1) + tdata(2)) / 2._r8, yr, mon, day, ncsec_temp)
ncsec(accumulated_file_index) = ncsec_temp
ncdate(accumulated_file_index) = yr*10000 + mon*100 + day
call set_date_from_time_float((tdata(1) + tdata(2)) / 2._r8, &
yr_mid, mon_mid, day_mid, ncsec(accumulated_file_index) )
ncdate(accumulated_file_index) = yr_mid*10000 + mon_mid*100 + day_mid

if (hstwr(t) .or. (restart .and. rgnht(t))) then
if(masterproc) then
if(is_initfile(file_index=t)) then
Expand All @@ -5609,7 +5612,7 @@ subroutine wshist (rgnht_in)
if (f == instantaneous_file_index) then
write(iulog,200) nfils(t),'instantaneous',t,yr,mon,day,ncsec(f)
else
write(iulog,200) nfils(t),'accumulated',t,yr,mon,day,ncsec(f)
write(iulog,200) nfils(t),'accumulated',t,yr_mid,mon_mid,day_mid,ncsec(f)
end if
200 format('WSHIST: writing time sample ',i3,' to ', a, ' h-file ', &
i1,' DATE=',i4.4,'/',i2.2,'/',i2.2,' NCSEC=',i6)
Expand Down

0 comments on commit 0f0599e

Please sign in to comment.