Skip to content

Commit 5eebca3

Browse files
committed
move GEOSroute_GridComp one level up
1 parent 566058d commit 5eebca3

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ esma_add_library(${this}
1111
SRCS GEOS_LdasGridComp.F90
1212
SUBCOMPONENTS ${alldirs}
1313
SUBDIRS LDAS_Shared
14-
DEPENDENCIES GEOSland_GridComp GEOSlandice_GridComp makebcs MAPL
14+
DEPENDENCIES GEOSland_GridComp GEOSlandice_GridComp GEOSroute_GridComp makebcs MAPL
1515
INCLUDES ${INC_ESMF})
1616

1717
esma_add_subdirectory(GEOSldas_App)

GEOS_LdasGridComp.F90

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module GEOS_LdasGridCompMod
1515
use GEOS_EnsGridCompMod, only: EnsSetServices => SetServices
1616
use GEOS_LandAssimGridCompMod, only: LandAssimSetServices => SetServices
1717
use GEOS_LandiceGridCompMod, only: LandiceSetServices => SetServices
18+
use GEOS_RouteGridCompMod, only: RouteSetServices => SetServices
1819

1920
use LDAS_TileCoordType, only: tile_coord_type , T_TILECOORD_STATE, TILECOORD_WRAP
2021
use LDAS_TileCoordType, only: grid_def_type, io_grid_def_type, operator (==)
@@ -51,6 +52,7 @@ module GEOS_LdasGridCompMod
5152
! All children
5253
integer,allocatable :: LAND(:)
5354
integer,allocatable :: LANDICE(:)
55+
integer,allocatable :: ROUTE(:)
5456
integer,allocatable :: LANDPERT(:)
5557
integer,allocatable :: METFORCE(:)
5658
integer :: ENSAVG, LANDASSIM
@@ -62,6 +64,7 @@ module GEOS_LdasGridCompMod
6264
logical :: ensemble_forcing ! switch between deterministic and ensemble forcing
6365
logical :: with_landice ! true if landice tiles requested by config
6466
logical :: with_land ! true if land tiles requested by config
67+
integer :: RUN_ROUTE ! 1 if run river-routine grid comp
6568

6669
contains
6770

@@ -147,6 +150,8 @@ subroutine SetServices(gc, rc)
147150
VERIFY_(STATUS)
148151
call MAPL_GetResource ( MAPL, ens_id_width, Label="ENS_ID_WIDTH:", DEFAULT=0, RC=STATUS)
149152
VERIFY_(STATUS)
153+
call MAPL_GetResource ( MAPL, RUN_ROUTE, Label="RUN_ROUTE:", DEFAULT=0, RC=STATUS)
154+
VERIFY_(STATUS)
150155
call MAPL_GetResource ( MAPL, FIRST_ENS_ID, Label="FIRST_ENS_ID:", DEFAULT=0, RC=STATUS)
151156
VERIFY_(STATUS)
152157
call MAPL_GetResource ( MAPL, ENS_FORCING_STR, Label="ENSEMBLE_FORCING:", DEFAULT="NO", RC=STATUS)
@@ -205,7 +210,10 @@ subroutine SetServices(gc, rc)
205210

206211
if (with_land) allocate(LAND( NUM_ENSEMBLE),LANDPERT(NUM_ENSEMBLE))
207212
if (with_landice) allocate(LANDICE(NUM_ENSEMBLE))
208-
213+
if (RUN_ROUTE == 1) then
214+
_ASSERT( with_land, "RUNOFF must be from the export of land_gridcomp for now.")
215+
allocate(ROUTE(NUM_ENSEMBLE))
216+
endif
209217
! ens_id_with = 2 + number of digits = total number of chars in ensid_string ("_eXXXX")
210218
!
211219
! Assert ens_id_width<=2+9 so number of digits remains single-digit and "I1" can be
@@ -253,6 +261,12 @@ subroutine SetServices(gc, rc)
253261
LANDICE(i) = MAPL_AddChild(gc, name=childname, ss=LandiceSetServices, rc=status)
254262
VERIFY_(status)
255263
endif
264+
265+
if (RUN_ROUTE == 1) then
266+
childname='ROUTE'//trim(ensid_string)
267+
ROUTE(i) = MAPL_AddChild(gc, name=childname, ss=RouteSetServices, rc=status)
268+
VERIFY_(status)
269+
endif
256270
enddo
257271

258272
if (with_land) then
@@ -302,6 +316,17 @@ subroutine SetServices(gc, rc)
302316
rc = status &
303317
)
304318
VERIFY_(status)
319+
320+
IF(RUN_ROUTE == 1) THEN
321+
call MAPL_AddConnectivity ( &
322+
GC ,&
323+
SHORT_NAME = (/'RUNOFF '/) ,& ! RUNOFF = total runoff = surface runoff + baseflow
324+
SRC_ID = LAND(I) ,&
325+
DST_ID = ROUTE(I) ,&
326+
RC=STATUS )
327+
VERIFY_(STATUS)
328+
ENDIF
329+
305330
enddo
306331

307332
if(land_assim .or. mwRTM) then
@@ -788,6 +813,13 @@ subroutine Initialize(gc, import, export, clock, rc)
788813
call MAPL_Set(CHILD_MAPL, LocStream=landice_locstream, rc=status)
789814
VERIFY_(status)
790815
endif
816+
817+
if (RUN_ROUTE == 1) then
818+
call MAPL_GetObjectFromGC(gcs(ROUTE(i)), CHILD_MAPL, rc=status)
819+
VERIFY_(status) ! CHILD = ens_avg
820+
call MAPL_Set(CHILD_MAPL, LocStream=land_locstream, rc=status)
821+
VERIFY_(status)
822+
endif
791823

792824
enddo
793825

@@ -1016,6 +1048,14 @@ subroutine Run(gc, import, export, clock, rc)
10161048
call MAPL_TimerOff(MAPL, gcnames(igc))
10171049
endif ! with_land_ice
10181050

1051+
if ( RUN_ROUTE == 1 ) then
1052+
igc = ROUTE(i)
1053+
call MAPL_TimerOn(MAPL, gcnames(igc))
1054+
call ESMF_GridCompRun(gcs(igc), importState=gim(igc), exportState=gex(igc), clock=clock, phase=1, userRC=status)
1055+
VERIFY_(status)
1056+
call MAPL_TimerOff(MAPL, gcnames(igc))
1057+
endif ! river-routine
1058+
10191059
if (with_land) then
10201060
! ApplyPrognPert - moved: now before calculating ensemble average that is picked up by land analysis and HISTORY; reichle 28 May 2020
10211061
igc = LANDPERT(i)

0 commit comments

Comments
 (0)