Skip to content

Commit

Permalink
Bugfix: time arguments to ED's GDD incrementer had badness
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'ryan/rgknox/phenology/gdd0-accum'

Summary: Bill Sacks identified that the month, day and second
arguments are uninitialized in clm_driv when it calls ED's
accumulateAndExtract subroutine. See issue #23 for discussion.

This PR issues a call to retrieve the current time prior to calling
the accumulateAndExtract, and corrects inconsistent ordering of the
time variables in calling function and called function.

Fixes: #23

User interface changes?: No

Code review: Ryan Knox, Bill Sacks (identified original issue),
discussion with @bandre-ucar , @rosiealice and @xuchongang

Test suite: ed - yellowstone intel, pgi, gnu
Test baseline: 89b8709
Test namelist changes: None
Test answer changes: bit for bit
Test summary: pass except for f09 and f19 restarts, #14.
              Interestingly, no failures associated with #43.
  • Loading branch information
bandre-ucar committed Apr 8, 2016
2 parents 2cbe980 + abd34e4 commit 6429e6e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions biogeochem/EDPhenologyType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ end subroutine restart
subroutine accumulateAndExtract( this, bounds, &
t_ref2m_patch, &
gridcell, latdeg, &
day, month, secs )
month, day, secs )
!
! start formal argument list --
! group formal (dummy) arguments by use/similarity
Expand Down Expand Up @@ -131,7 +131,7 @@ subroutine accumulateAndExtract( this, bounds, &

! Accumulate and extract GDD0 for ED
do p = bounds%begp,bounds%endp

g = gridcell(p)

if (latdeg(g) >= 0._r8) then
Expand All @@ -143,8 +143,8 @@ subroutine accumulateAndExtract( this, bounds, &
! FIX(RF,032414) - is this accumulation a bug in the normal phenology code,
! as it means to count from november but ctually counts from january?
if ( month==m .and. day==calParams%firstDayOfMonth .and. secs==get_step_size() ) then
rbufslp(p) = accumResetVal ! reset ED_GDD
else
rbufslp(p) = accumResetVal ! reset ED_GDD0
else
rbufslp(p) = max(0._r8, min(this%checkRefVal, t_ref2m_patch(p)-SHR_CONST_TKFRZ)) &
* get_step_size()/SHR_CONST_CDAY
end if
Expand All @@ -165,6 +165,8 @@ subroutine accumulateAndExtract( this, bounds, &
call update_accum_field ( trim(this%accString), rbufslp, get_nstep() )
call extract_accum_field ( trim(this%accString), this%ED_GDD_patch, get_nstep() )

if (this%DEBUG) write(iulog,*) 'MM-DD-SSSS',month,'-',day,'-',secs
if (this%DEBUG) write(iulog,*) 'cd_status:',this%phen_cd_status_patch(:)
if (this%DEBUG) write(iulog,*) 'ED_GDD accumAndExtract ', this%ED_GDD_patch

deallocate(rbufslp)
Expand Down

0 comments on commit 6429e6e

Please sign in to comment.