Skip to content

Commit f4d3c73

Browse files
Yujin ZengYujin Zeng
authored andcommitted
RIVFLOW on model grid for standard output added
1 parent 2c7cc04 commit f4d3c73

File tree

3 files changed

+74
-19
lines changed

3 files changed

+74
-19
lines changed

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOS_SurfaceGridComp.F90

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,15 @@ subroutine SetServices ( GC, RC )
17191719
RC=STATUS )
17201720
VERIFY_(STATUS)
17211721

1722+
call MAPL_AddExportSpec(GC, &
1723+
LONG_NAME = 'river_water_flux' ,&
1724+
UNITS = 'kg m-2 s-1' ,&
1725+
SHORT_NAME = 'RIVFLOW' ,&
1726+
DIMS = MAPL_DimsHorzOnly ,&
1727+
VLOCATION = MAPL_VLocationNone ,&
1728+
RC=STATUS )
1729+
VERIFY_(STATUS)
1730+
17221731
call MAPL_AddExportSpec(GC, &
17231732
SHORT_NAME = 'EVLAND', &
17241733
LONG_NAME = 'total_evapotranspiration_land', &
@@ -5541,6 +5550,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
55415550
real, pointer, dimension(:,:) :: RUNOFF => NULL()
55425551
real, pointer, dimension(:,:) :: DISCHARGE => NULL()
55435552
real, pointer, dimension(:,:) :: RUNSURF => NULL()
5553+
real, pointer, dimension(:,:) :: RIVFLOW => NULL()
55445554
real, pointer, dimension(:,:) :: BASEFLOW => NULL()
55455555
real, pointer, dimension(:,:) :: ACCUM => NULL()
55465556
real, pointer, dimension(:,:) :: SMELT => NULL()
@@ -5858,6 +5868,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
58585868
real, pointer, dimension(:) :: SWNDSRFTILE => NULL()
58595869
real, pointer, dimension(:) :: RUNOFFTILE => NULL()
58605870
real, pointer, dimension(:) :: RUNSURFTILE => NULL()
5871+
real, pointer, dimension(:) :: RIVFLOWTILE => NULL()
58615872
real, pointer, dimension(:) :: DISCHARGETILE => NULL()
58625873
real, pointer, dimension(:) :: BASEFLOWTILE => NULL()
58635874
real, pointer, dimension(:) :: ACCUMTILE => NULL()
@@ -6747,6 +6758,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
67476758
call MAPL_GetPointer(EXPORT , RUNOFF , 'RUNOFF' , RC=STATUS); VERIFY_(STATUS)
67486759
call MAPL_GetPointer(EXPORT , DISCHARGE,'DISCHARGE',RC=STATUS); VERIFY_(STATUS)
67496760
call MAPL_GetPointer(EXPORT , RUNSURF , 'RUNSURF', RC=STATUS); VERIFY_(STATUS)
6761+
call MAPL_GetPointer(EXPORT , RIVFLOW , 'RIVFLOW', RC=STATUS); VERIFY_(STATUS)
67506762
call MAPL_GetPointer(EXPORT , BASEFLOW, 'BASEFLOW', RC=STATUS); VERIFY_(STATUS)
67516763
call MAPL_GetPointer(EXPORT , ACCUM , 'ACCUM' , RC=STATUS); VERIFY_(STATUS)
67526764
call MAPL_GetPointer(EXPORT , SMELT , 'SMELT' , RC=STATUS); VERIFY_(STATUS)
@@ -7381,6 +7393,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
73817393
end if
73827394

73837395
call MKTILE(RUNSURF ,RUNSURFTILE ,NT,RC=STATUS); VERIFY_(STATUS)
7396+
call MKTILE(RIVFLOW ,RIVFLOWTILE ,NT,RC=STATUS); VERIFY_(STATUS)
73847397
call MKTILE(BASEFLOW,BASEFLOWTILE,NT,RC=STATUS); VERIFY_(STATUS)
73857398
call MKTILE(ACCUM ,ACCUMTILE ,NT,RC=STATUS); VERIFY_(STATUS)
73867399
call MKTILE(SMELT ,SMELTTILE ,NT,RC=STATUS); VERIFY_(STATUS)
@@ -8156,6 +8169,10 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
81568169
call MAPL_LocStreamTransform( LOCSTREAM, RUNSURF, RUNSURFTILE, RC=STATUS)
81578170
VERIFY_(STATUS)
81588171
endif
8172+
if(associated( RIVFLOW)) then
8173+
call MAPL_LocStreamTransform( LOCSTREAM, RIVFLOW, RIVFLOWTILE, RC=STATUS)
8174+
VERIFY_(STATUS)
8175+
endif
81598176
if(associated( BASEFLOW)) then
81608177
call MAPL_LocStreamTransform( LOCSTREAM, BASEFLOW, BASEFLOWTILE, RC=STATUS)
81618178
VERIFY_(STATUS)
@@ -8951,6 +8968,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
89518968
if(associated(RUNOFFTILE )) deallocate(RUNOFFTILE )
89528969
if(associated(DISCHARGETILE))deallocate(DISCHARGETILE)
89538970
if(associated(RUNSURFTILE )) deallocate(RUNSURFTILE )
8971+
if(associated(RIVFLOWTILE )) deallocate(RIVFLOWTILE )
89548972
if(associated(BASEFLOWTILE)) deallocate(BASEFLOWTILE)
89558973
if(associated(ACCUMTILE )) deallocate(ACCUMTILE )
89568974
if(associated(SMELTTILE )) deallocate(SMELTTILE )
@@ -9242,6 +9260,8 @@ subroutine DOTYPE(type,RC)
92429260
VERIFY_(STATUS)
92439261
call MAPL_GetPointer(GEX(type), dum, 'RUNSURF' , ALLOC=associated(RUNSURFTILE ), notFoundOK=.true., RC=STATUS)
92449262
VERIFY_(STATUS)
9263+
call MAPL_GetPointer(GEX(type), dum, 'RIVFLOW' , ALLOC=associated(RIVFLOWTILE ), notFoundOK=.true., RC=STATUS)
9264+
VERIFY_(STATUS)
92459265
call MAPL_GetPointer(GEX(type), dum, 'BASEFLOW', ALLOC=associated(BASEFLOWTILE), notFoundOK=.true., RC=STATUS)
92469266
VERIFY_(STATUS)
92479267
call MAPL_GetPointer(GEX(type), dum, 'ACCUM' , ALLOC=associated(ACCUMTILE ), notFoundOK=.true., RC=STATUS)
@@ -9839,6 +9859,10 @@ subroutine DOTYPE(type,RC)
98399859
call FILLOUT_TILE(GEX(type), 'RUNSURF',RUNSURFTILE,XFORM, RC=STATUS)
98409860
VERIFY_(STATUS)
98419861
end if
9862+
if(associated(RIVFLOWTILE)) then
9863+
call FILLOUT_TILE(GEX(type), 'RIVFLOW',RIVFLOWTILE,XFORM, RC=STATUS)
9864+
VERIFY_(STATUS)
9865+
end if
98429866
if(associated(BASEFLOWTILE)) then
98439867
call FILLOUT_TILE(GEX(type), 'BASEFLOW',BASEFLOWTILE,XFORM, RC=STATUS)
98449868
VERIFY_(STATUS)

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOS_LandGridComp.F90

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,12 @@ subroutine SetServices ( GC, RC )
436436
SHORT_NAME = 'RUNOFF', &
437437
CHILD_ID = CATCH(1), &
438438
RC=STATUS )
439-
VERIFY_(STATUS)
439+
VERIFY_(STATUS)
440+
call MAPL_AddExportSpec ( GC, &
441+
SHORT_NAME = 'RIVFLOW', &
442+
CHILD_ID = ROUTE(1), &
443+
RC=STATUS )
444+
VERIFY_(STATUS)
440445
call MAPL_AddExportSpec ( GC, &
441446
SHORT_NAME = 'EVPINT', &
442447
CHILD_ID = CATCH(1), &
@@ -1055,7 +1060,9 @@ subroutine SetServices ( GC, RC )
10551060
call MAPL_AddExportSpec ( GC, SHORT_NAME = 'SHOUT' , CHILD_ID = CATCHCN(1), RC=STATUS )
10561061
VERIFY_(STATUS)
10571062
call MAPL_AddExportSpec ( GC, SHORT_NAME = 'RUNOFF' , CHILD_ID = CATCHCN(1), RC=STATUS )
1058-
VERIFY_(STATUS)
1063+
VERIFY_(STATUS)
1064+
call MAPL_AddExportSpec ( GC, SHORT_NAME = 'RIVFLOW' , CHILD_ID = ROUTE(1), RC=STATUS )
1065+
VERIFY_(STATUS)
10591066
call MAPL_AddExportSpec ( GC, SHORT_NAME = 'EVPINT' , CHILD_ID = CATCHCN(1), RC=STATUS )
10601067
VERIFY_(STATUS)
10611068
call MAPL_AddExportSpec ( GC, SHORT_NAME = 'EVPSOI' , CHILD_ID = CATCHCN(1), RC=STATUS )

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOSroute_GridComp/GEOS_RouteGridComp.F90

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ module GEOS_RouteGridCompMod
105105
real, pointer :: K(:) => NULL()
106106
real, pointer :: Kstr(:) => NULL()
107107

108+
real, pointer :: flow_riv(:) => NULL()
109+
108110
end type T_RROUTE_STATE
109111

110112

@@ -252,6 +254,15 @@ subroutine SetServices ( GC, RC )
252254
RC=STATUS )
253255
VERIFY_(STATUS)
254256

257+
call MAPL_AddExportSpec(GC, &
258+
LONG_NAME = 'river_water_flux' ,&
259+
UNITS = 'kg m-2 s-1' ,&
260+
SHORT_NAME = 'RIVFLOW' ,&
261+
DIMS = MAPL_DimsTileOnly ,&
262+
VLOCATION = MAPL_VLocationNone ,&
263+
RC=STATUS )
264+
VERIFY_(STATUS)
265+
255266
!EOS
256267

257268
call MAPL_TimerAdd(GC, name="-RRM" ,RC=STATUS)
@@ -646,6 +657,10 @@ subroutine INITIALIZE (GC,IMPORT, EXPORT, CLOCK, RC )
646657
route%qsflow_acc=0.
647658
route%reservoir%qres_acc=0.
648659

660+
!for output on model grid
661+
allocate(route%flow_riv(nt_local))
662+
route%flow_riv=0.
663+
649664
!Read input specially for geometry hydraulic (not required by linear model)
650665
allocate(buff_global(n_catg),route%lstr(ntiles))
651666
open(77,file=trim(inputdir)//"/Pfaf_lstr_PR.txt",status="old",action="read");read(77,*)buff_global;close(77)
@@ -772,9 +787,13 @@ subroutine RUN2 (GC,IMPORT, EXPORT, CLOCK, RC )
772787
real, dimension(:), pointer :: LRIVERMOUTH
773788
real, dimension(:), pointer :: ORIVERMOUTH
774789

790+
775791
! -----------------------------------------------------
776792
! EXPORT pointers
777-
! -----------------------------------------------------
793+
! -----------------------------------------------------
794+
795+
real, dimension(:), pointer :: RIVFLOW
796+
778797

779798
real, dimension(:), pointer :: QSFLOW
780799
real, dimension(:), pointer :: QINFLOW
@@ -847,6 +866,8 @@ subroutine RUN2 (GC,IMPORT, EXPORT, CLOCK, RC )
847866
! Get my internal MAPL_Generic state
848867
! -----------------------------------------------------------
849868

869+
call MAPL_GetPointer(EXPORT,RIVFLOW, 'RIVFLOW' ,ALLOC=.true.,RC=STATUS); VERIFY_(STATUS)
870+
850871
call MAPL_GetObjectFromGC(GC, MAPL, STATUS)
851872
VERIFY_(STATUS)
852873
call MAPL_Get(MAPL, HEARTBEAT = HEARTBEAT, RC=STATUS)
@@ -871,6 +892,7 @@ subroutine RUN2 (GC,IMPORT, EXPORT, CLOCK, RC )
871892
runoff_save => route%runoff_save
872893
nt_local = route%nt_local
873894
res => route%reservoir
895+
flow_riv => route%flow_riv
874896

875897
! get the field from IMPORT
876898
call ESMF_StateGet(IMPORT, 'RUNOFF', field=runoff_src, RC=STATUS)
@@ -982,6 +1004,19 @@ subroutine RUN2 (GC,IMPORT, EXPORT, CLOCK, RC )
9821004
enddo
9831005
enddo
9841006

1007+
flow_riv=0.
1008+
do i=1,nt_local
1009+
do j=1,nmaxt
1010+
it=route%subit(j,i)
1011+
if(it>0)then
1012+
if(route%catarea_global(it)>0.)then
1013+
flow_riv(i)=flow_riv(i)+route%subareat(j,i)*(QOUTFLOW_GLOBAL(it)/route%catarea_global(it)*1.e3) !kg m-2 s-1
1014+
endif
1015+
endif
1016+
if(it==0)exit
1017+
enddo
1018+
enddo
1019+
9851020
! Check balance if needed
9861021
!call check_balance(route,ntiles,nt_local,runoff_save,WRIVER_ACT,WSTREAM_ACT,WTOT_BEFORE,RUNOFF_ACT,QINFLOW_LOCAL,QOUT_CAT,FirstTime,yr_s,mon_s)
9871022

@@ -1021,22 +1056,6 @@ subroutine RUN2 (GC,IMPORT, EXPORT, CLOCK, RC )
10211056
route%qoutflow_acc, route%scounts_cat(mype+1) ,MPI_REAL, &
10221057
qoutflow_global, route%scounts_cat, route%rdispls_cat,MPI_REAL, &
10231058
MPI_COMM_WORLD, mpierr)
1024-
1025-
allocate(flow_riv(nt_local))
1026-
flow_riv=0.
1027-
do i=1,nt_local
1028-
do j=1,nmaxt
1029-
it=route%subit(j,i)
1030-
if(it>0)then
1031-
if(route%catarea_global(it)>0.)then
1032-
flow_riv(i)=flow_riv(i)+route%subareat(j,i)*(qoutflow_global(it)/route%catarea_global(it)*1.e3)
1033-
endif
1034-
endif
1035-
if(it==0)exit
1036-
enddo
1037-
enddo
1038-
deallocate(flow_riv)
1039-
10401059
!call MPI_allgatherv ( &
10411060
! route%qsflow_acc, route%scounts_cat(mype+1) ,MPI_REAL, &
10421061
! qsflow_global, route%scounts_cat, route%rdispls_cat,MPI_REAL, &
@@ -1140,7 +1159,12 @@ subroutine RUN2 (GC,IMPORT, EXPORT, CLOCK, RC )
11401159

11411160
endif RUN_MODEL
11421161

1162+
RIVFLOW = flow_riv
1163+
11431164
runoff_save => NULL()
1165+
res => NULL()
1166+
flow_riv => NULL()
1167+
11441168

11451169
! All done
11461170
! --------

0 commit comments

Comments
 (0)