-
Notifications
You must be signed in to change notification settings - Fork 9
River routing for GEOSldas #1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…t in GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOSroute_GridComp
New Updates:
|
enddo | ||
|
||
! Deactivate reservoirs if the use_res flag is set to False | ||
if(use_res == .False.) active_res = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(use_res == .False.) active_res = 0 | |
if(use_res .eqv. .False.) active_res = 0 |
GNU was tripping on this as, per Fortran, you have to use .eqv.
and .neqv.
to compare logicals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just fixed this. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zyj8881357 It looks like GNU is finding a couple more. Lines 1007 and 1057 in GEOS_RouteGridComp.F90
I also see similar in lines 66 and 250 in lake_mod.F90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those have been fixed. Thank you!
New Updates: The pre-processing package for the input data to routing model has been added. Related comments and documents were supplemented. |
…ent (GEOS_RouteGridComp.F90)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zyj8881357: I started reviewing the routing model PR. I added a couple of minor commits with some cleanup (just a start). More importantly, we'll need to address the comments below, most of which are quite major and will require substantial revisions in how the model is integrated in GEOS.
cc: @weiyuan-jiang @tclune @biljanaorescanin @rdkoster @amolod @lcandre2
@@ -31,7 +31,7 @@ module GEOS_LandGridCompMod | |||
use GEOS_CatchGridCompMod, only : CatchSetServices => SetServices | |||
use GEOS_CatchCNGridCompMod, only : CatchCNSetServices => SetServices | |||
use GEOS_IgniGridCompMod, only : IgniSetServices => SetServices | |||
! use GEOS_RouteGridCompMod, only : RouteSetServices => SetServices | |||
use GEOS_RouteGridCompMod, only : RouteSetServices => SetServices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not about this particular line, but rather about the placement of GEOS_RouteGridComp inside GEOS_LandGridComp. Ultimately, we will need to route runoff from the land and the landice tiles. To do that, I think we need to place GEOS_RouteGridComp one level up, within GEOS_SurfaceGridComp (that is, next to GEOS_LandGridComp). Making this change will likely require extensive re-wiring. I wonder if it's best to tackle this re-wiring first or delay the move until later.
integer, parameter :: N_CatG = 291284 | ||
|
||
integer, parameter :: upmax = 34 | ||
character(len=500) :: inputdir = "/discover/nobackup/yzeng3/data/river_input/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot hardwire a user-specific directory here. The inputs that come from this directory need to become part of the bcs datasets. See also comment below about adding parameters into routing restart files.
|
||
integer, parameter :: upmax = 34 | ||
character(len=500) :: inputdir = "/discover/nobackup/yzeng3/data/river_input/" | ||
logical, parameter :: use_res = .True. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that we want to hardwire using the reservoir model (if that's what this switch does)? It may be better to include config information in the "RUN_ROUTE" resource variable. E.g., RUN_ROUTE=1 could be the routing model without reservoirs, and RUN_ROUTE=2 could be the routing model with reservoirs
USE catch_constants, ONLY: & | ||
N_CatG => N_Pfaf_Catchs | ||
#endif | ||
use ROUTING_MODEL, ONLY: river_routing_lin, river_routing_hyd, ROUTE_DT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
river_routing_lin() is commented out below. Do we want to make this a runtime option? We could use RUN_ROUTE for this purpose. E.g., RUN_ROUTE=1 runs the hydraulic model, and RUN_ROUTE=2 runs the linear model. If we never want to run the linear model, it should be removed from the code.
|
||
! ----------------------------------------------------------- | ||
! RUN -- Run method for the route component | ||
! ----------------------------------------------------------- | ||
subroutine RUN1 (GC,IMPORT, EXPORT, CLOCK, RC ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why define an empty subroutine RUN1()? Do we need this for anything? If there's a call to RUN1(), it should be removed, then we can remove the empty subroutine.
|
||
! Read sub-catchment data | ||
allocate(nsub_global(N_CatG),subarea_global(nmax,N_CatG)) | ||
open(77,file=trim(inputdir)//"/Pfaf_nsub_"//trim(resname)//".txt",status="old",action="read"); read(77,*)nsub_global; close(77) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this and many subsequent read statements do, but my sense is that we need to include the routing model parameters in the routing model restart files. Then the "init" routine would not need tap into external files.
Normally, the process for land model parameters is as follows:
- Create parameter datasets that can be archived in the bcs_shared directory (along with all the other bcs files). This is accomplished by make_bcs (and may already be part of the present PR).
- Create a routing restart file that includes the routing model parameters. This interfaces with the "remap_restarts" package in the GEOS_Util repo.
- When the model is run (in GEOSldas or GEOSgcm), the routing model parameters are read in from the restart file.
if(mapl_am_I_root())print *, "init time is ", YY, "/", MM, "/", DD, " ", HH, ":", MMM, ":", SS | ||
allocate(wriver(ntiles),wstream(ntiles),wres(ntiles)) | ||
allocate(wriver_global(n_catg),wstream_global(n_catg),wres_global(n_catg)) | ||
open(77,file="../input/restart/river_storage_rs_"//trim(yr_s)//trim(mon_s)//trim(day_s)//".txt",status="old",action="read",iostat=status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not introduce custom, ASCII restart files for the routing model. Instead, we need to make sure the restarts are handled by MAPL and are netcdf-formatted.
if(mapl_am_I_root())then | ||
!open(88,file="../river/river_storage_"//trim(yr_s)//trim(mon_s)//trim(day_s)//".txt",action="write") | ||
!open(89,file="../river/stream_storage_"//trim(yr_s)//trim(mon_s)//trim(day_s)//".txt",action="write") | ||
open(90,file="../river/river_flow_"//trim(yr_s)//trim(mon_s)//trim(day_s)//".txt",action="write") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output from the routing model should be handled by MAPL HISTORY. We can't publish custom ASCII files with GEOS products.
@weiyuan-jiang : In a recent commit (85af5a7), I added a USE statement into GEOS_RouteGridComp.F90 that pulls a constant from: |
I think we need to add dependencies "GEOS_LandShared ESMF::ESMF" . catch_constant is from GEOS_LandShared and ESMF::ESMF is a new standard way. Just added |
f4d3c73
to
e367061
Compare
I am quite confused about the variable names. "N_catg" was used as global tile number before. Can it be changed to N_pfaf_g here? The "ntiles" here seem n_pfaf_local to me. ( correct me if I am wrong) |
if(it>0)then | ||
RUNOFF_ACT(i)=RUNOFF_ACT(i)+route%subarea(j,i)*runoff_global(it)/1000. | ||
endif | ||
if(it==0)exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit or cycle ?
call MPI_allgatherv ( & | ||
QOUT_CAT, route%scounts_cat(mype+1) ,MPI_REAL, & | ||
QOUTFLOW_GLOBAL, route%scounts_cat, route%rdispls_cat,MPI_REAL, & | ||
MPI_COMM_WORLD, mpierr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the MPI_COMM_WORLD should be replaced by the comm obtained from VM
|
||
VERIFY_(STATUS) | ||
route%nt_global = nt_global | ||
! Determine the resolution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use gridname to determine the resolution
! define minCatch, maxCatch | ||
|
||
allocate(ims(1:ndes)) | ||
! define catchment space for this processor | ||
call MAPL_DecomposeDim ( n_catg,ims,ndes ) ! ims(mype+1) gives the size of my partition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to to me the distribution of pfaf has nothing to do with the distribution of tiles. Is there any proximity that can be taken advantage of ?
Pull Request Overview
This pull request initiates the implementation of a river routing process within GEOS, starting with an offline model.
Current Implementation: Only the offline version of the river routing model is introduced at this stage.
All model code is located in the directory:
GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOSroute_GridComp
The model reads runoff data from the Catchment model outputs (variables RUNOFF and BASEFLOW, with type tavg24_2d_lnd_Nx) and generates daily river-related outputs for each catchment area.
For detailed information on configuring and running the offline model, please refer to readme.txt in the above directory.
Next Steps:
This is an initial implementation, and many aspects require further discussion with relevant members to plan the next steps.
Additionally, work is ongoing to develop a pre-processing package for creating input data for the routing model.