Skip to content

Commit

Permalink
Merge branch 'jonbob/data-models/solar-zenith-angle-correction' into …
Browse files Browse the repository at this point in the history
…next (PR #4589)

Corrects the calculation of solar zenith angle, which was off by a timestep

The solar zenith angle calculation used by the data models was off by
one timestep. This issue was first reported by CESM in ESMCI Issue #3380
and subsequently fixed in ESCOMP PR #123. This PR implements that
solution in E3SM.

Fixes #4575

[non-BFB] for some configurations with data models
  • Loading branch information
jonbob committed Apr 27, 2022
2 parents 710db43 + 4b85412 commit 0b7c831
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion share/streams/shr_dmodel_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ subroutine shr_dmodel_readLBUB(stream,pio_subsystem,pio_iotype,pio_iodesc_r8, pi
rDateUB = real(mDateUB,R8) + real(mSecUB,R8)/spd
call t_stopf(trim(lstr)//'_setup')

if (rDateM < rDateLB .or. rDateM > rDateUB) then
if (rDateM < rDateLB .or. rDateM >= rDateUB) then
call t_startf(trim(lstr)//'_fbound')
if (my_task == master_task) then
! call shr_stream_findBounds(stream,mDate,mSec, &
Expand Down
18 changes: 5 additions & 13 deletions share/streams/shr_tInterp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -305,26 +305,18 @@ subroutine shr_tInterp_getAvgCosz(tavCosz,lonr,latr,ymd1,tod1,ymd2,tod2,eccen,mv
tod = tod1
do while( reday < reday2) ! mid-interval t-steps thru interval [LB,UB]

!--- get next cosz value for t-avg ---
call shr_tInterp_getCosz(cosz,lonr,latr,ymd,tod,eccen,mvelpp,lambm0,obliqr,calendar)
n = n + ldt
tavCosz = tavCosz + cosz*real(ldt,SHR_KIND_R8) ! add to partial sum

!--- advance to next time in [LB,UB] ---
ymd0 = ymd
tod0 = tod
reday0 = reday
call shr_cal_advDateInt(ldt,'seconds',ymd0,tod0,ymd,tod,calendar)
call shr_cal_timeSet(reday,ymd,tod,calendar)

if (reday > reday2) then
ymd = ymd2
tod = tod2
timeint = reday2-reday0
call ESMF_TimeIntervalGet(timeint,s_i8=dtsec)
ldt = dtsec
endif

!--- get next cosz value for t-avg ---
call shr_tInterp_getCosz(cosz,lonr,latr,ymd,tod,eccen,mvelpp,lambm0,obliqr,calendar)
n = n + ldt
tavCosz = tavCosz + cosz*real(ldt,SHR_KIND_R8) ! add to partial sum

end do
tavCosz = tavCosz/real(n,SHR_KIND_R8) ! form t-avg

Expand Down

0 comments on commit 0b7c831

Please sign in to comment.