@@ -6052,6 +6052,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
60526052 real , allocatable :: PRECSUM(:,:)
60536053 character (len= ESMF_MAXPATHLEN) :: SolCycFileName
60546054 logical :: PersistSolar
6055+ logical :: allocateRunoff
60556056
60566057! =============================================================================
60576058
@@ -7366,12 +7367,19 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
73667367 call MKTILE(LWNDSRF ,LWNDSRFTILE ,NT,RC= STATUS); VERIFY_(STATUS)
73677368 call MKTILE(SWNDSRF ,SWNDSRFTILE ,NT,RC= STATUS); VERIFY_(STATUS)
73687369
7370+ allocateRunoff = .false.
7371+ if (associated (RUNOFF)) allocateRunoff = .true.
7372+
73697373 if (associated (SURF_INTERNAL_STATE% RoutingType) .or. DO_DATA_ATM4OCN) then ! routing file exists or we run DataAtm
73707374 allocate (DISCHARGETILE(NT),stat= STATUS); VERIFY_(STATUS)
73717375 DISCHARGETILE= MAPL_Undef
7376+ allocateRunoff = .true.
7377+ end if
7378+ if (allocateRunoff) then
73727379 allocate (RUNOFFTILE(NT),stat= STATUS); VERIFY_(STATUS)
7373- RUNOFFTILE= MAPL_Undef
7380+ RUNOFFTILE = 0.0
73747381 end if
7382+
73757383 call MKTILE(RUNSURF ,RUNSURFTILE ,NT,RC= STATUS); VERIFY_(STATUS)
73767384 call MKTILE(BASEFLOW,BASEFLOWTILE,NT,RC= STATUS); VERIFY_(STATUS)
73777385 call MKTILE(ACCUM ,ACCUMTILE ,NT,RC= STATUS); VERIFY_(STATUS)
@@ -7514,8 +7522,6 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
75147522! Cycle through all continental children (skip ocean),
75157523! collecting RUNOFFTILE exports.
75167524
7517- if (associated (RUNOFFTILE)) RUNOFFTILE = 0.0
7518-
75197525 do I = 1 , NUM_CHILDREN
75207526 if (I == OCEAN) cycle
75217527 call DOTYPE(I,RC= STATUS)
0 commit comments