Skip to content

Commit

Permalink
Fixed the RUNOFF logic. In particular, the conditions for allocating and
Browse files Browse the repository at this point in the history
initialing RUNOFFTILE
  • Loading branch information
atrayano committed Dec 2, 2024
1 parent 3790723 commit fc85026
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6052,6 +6052,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
real, allocatable :: PRECSUM(:,:)
character(len=ESMF_MAXPATHLEN) :: SolCycFileName
logical :: PersistSolar
logical :: allocateRunoff

!=============================================================================

Expand Down Expand Up @@ -7366,12 +7367,19 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
call MKTILE(LWNDSRF ,LWNDSRFTILE ,NT,RC=STATUS); VERIFY_(STATUS)
call MKTILE(SWNDSRF ,SWNDSRFTILE ,NT,RC=STATUS); VERIFY_(STATUS)

allocateRunoff = .false.
if (associated(RUNOFF)) allocateRunoff = .true.

if (associated(SURF_INTERNAL_STATE%RoutingType) .or. DO_DATA_ATM4OCN) then ! routing file exists or we run DataAtm
allocate(DISCHARGETILE(NT),stat=STATUS); VERIFY_(STATUS)
DISCHARGETILE=MAPL_Undef
allocateRunoff = .true.
end if
if (allocateRunoff) then
allocate(RUNOFFTILE(NT),stat=STATUS); VERIFY_(STATUS)
RUNOFFTILE=MAPL_Undef
RUNOFFTILE = 0.0
end if

call MKTILE(RUNSURF ,RUNSURFTILE ,NT,RC=STATUS); VERIFY_(STATUS)
call MKTILE(BASEFLOW,BASEFLOWTILE,NT,RC=STATUS); VERIFY_(STATUS)
call MKTILE(ACCUM ,ACCUMTILE ,NT,RC=STATUS); VERIFY_(STATUS)
Expand Down Expand Up @@ -7514,8 +7522,6 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
! Cycle through all continental children (skip ocean),
! collecting RUNOFFTILE exports.

if (associated(RUNOFFTILE)) RUNOFFTILE = 0.0

do I = 1, NUM_CHILDREN
if (I == OCEAN) cycle
call DOTYPE(I,RC=STATUS)
Expand Down

0 comments on commit fc85026

Please sign in to comment.