Skip to content

Conversation

@weiyuan-jiang
Copy link
Contributor

@weiyuan-jiang weiyuan-jiang commented Aug 14, 2025

Add river routing module for offline land modeling (GEOSldas). Replaces #1023


Left for future PRs:

  • Run routing module within the AGCM and coupled model (AOGCM).
  • Run only the routing module (but not Catchment) in GEOSldas.
  • Include landice tiles in routing (GEOSldas and GCM).

Related PRs:


Testing:

  • TBD

List of tasks that remain to be addressed (in no particular order):

  • Move Routing GC from Land GC to Surface GC (@weiyuan-jiang)
  • Make sure Routing works when GEOSldas is run in cube-sphere tile space (@weiyuan-jiang, @zyj8881357)
  • Add routing parameters into Route GC restart files (similar to, say, porosity in Catch restart) (@zyj8881357)
  • Clean up files in Utils/Raster/preproc/routing_model/ (@zyj8881357)
  • Remove GEOSroute_GridComp/offline/ and save files elsewhere (for reference when we address the option to run only the routing module but not Catchment in GEOSldas) (@zyj8881357)
  • Add files from bcs preprocessing (river_inputs.bc, cell_area.nc?) into shared bcs directory and update location of these inputs in make_bcs scripts (@biljanaorescanin, @zyj8881357)
  • What (if anything) is needed for river routing in Utils/mk_restart? (@weiyuan-jiang, @zyj8881357)

@YujiN, I am trying to bring back some codes in develop branch. The develop branch is not working as it is but I believe it would be more efficient. The runoff and the other variables are distributed as needed, which is way more efficient than allgatherV.

Yujin Zeng and others added 30 commits October 23, 2024 21:22
…t in GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOSroute_GridComp
@zyj8881357
Copy link

I have reviewed the branch and fixed several issues. It can now produce results that are nearly identical to those from my original branch (the remaining differences are likely due to numerical precision). In addition, I have updated the pre-processing script for the routing model so that it generates the files cellarea.nc and river_input.nc, which are used in make_bcs.

@gmao-rreichle gmao-rreichle changed the title refactoring river-routing Add river routing module Nov 19, 2025
@gmao-rreichle gmao-rreichle added enhancement New feature or request Contingent - DNA These changes are contingent on other PRs (DNA=do not approve) labels Dec 3, 2025
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

This PR is being prevented from merging because you have added one of our blocking labels: Contingent - DNA, Needs Lead Approval, Contingent -- Do Not Approve. You'll need to remove it before this PR can be merged.

@atrayano
Copy link
Contributor

atrayano commented Dec 3, 2025

I just discussed the pfaf_index with @tclune and I am ok with the change

Yujin Zeng and others added 3 commits December 4, 2025 14:21
@weiyuan-jiang
Copy link
Contributor Author

CI build fails because it requires GEOS-ESM/MAPL#4000

Copy link
Contributor

@gmao-rreichle gmao-rreichle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zyj8881357, see inline comments below.

REAL, INTENT(OUT), DIMENSION (NCAT) :: QSFLOW,QOUTFLOW

REAL, PARAMETER :: K_SIMPLE = 0.111902, K_RES_MAX = 0.8 ! m1_r2com_c1
REAL, PARAMETER :: CUR_AVG = 1.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these parameter constants are defined in multiple places. E.g., 'cur_avg' is defined in at least three different files. We need to find way to define these constants only once. This may require fine-tuning the CMakeLists.txt file such that a build does the Routing GridComp before it does the Utils/Raster stuff. Then we should be able to connect the constants via "use" statements.
Note that some of the parameter constants used in the routing model may also be defined in Catchment (e.g., the total number of Pfafstetter catchments). This may require some thought and reorganization of the constants across GridComps

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removing the linear model, only two parameters (ie, M and mm) are shared between the routing_model.F90 and the pre-processing package. I have modified the CMakeLists.txt of the pre-processing package to let it read the M and mm from the routing_model.F90.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The total number of Pfafstetter catchments is still defined in multiple places across the Routing code, and it's also defined in Land/Shared:

GEOSland_GridComp/Shared/catch_constants.f90:  INTEGER, PARAMETER, PUBLIC :: CATCH_N_PFAFS       = 291284   ! # of Pfafstetter hydrological catchments (global)
Utils/Raster/preproc/routing_model/constant.f90:  integer,parameter :: nc=291284          ! Total number of catchments
Utils/Raster/preproc/routing_model/get_Qr_clmt.f90:    integer, parameter :: nc = 291284            ! Total number of catchments
Utils/Raster/preproc/routing/routing_constant.f90:  integer,parameter :: nc         = 291284  ! number of catchments in land

Ultimately, we'll probably need a new total number of Pfafstetter catchments that includes both land and landice, and that number probably needs to be defined in Surface/Shared. For now, though, the multiple definitions of "nc" in the Routing code can be cleaned up.


implicit none

logical, parameter :: use_res = .True.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly does this logical turn on/off? The entire "reservoir" module? Or just a portion of it? Needs more explanation. Also, it may be better to make this a runtime config input via RUN_ROUTE. We could have something like:
RUN_ROUTE = 0 : no routing
RUN_ROUTE = 1 : hydro geometry routing without reservoir model
RUN_ROUTE = 2 : linear routing without reservoir model
RUN_ROUTE = 3 : hydro geometry routing with reservoir model
etc
This approach is flexible and extensible, and it puts the documentation into one place (GEOS_SurfaceGridComp.rc).

Copy link

@zyj8881357 zyj8881357 Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this. This will be addressed later when we finish the "Move Routing GC from Land GC to Surface GC".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't @weiyuan-jiang already complete "Move Routing GC from Land GC to Surface GC"? There was a commit to that effect, but the box in the task list wasn't checked. So not sure about the status of this..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just confirmed with @weiyuan-jiang that this is done

endif
call MAPL_CommsBcast(layout, tmp_real, n_pfaf_g, MAPL_Root, status)
allocate(route%areacat(n_pfaf_local), source = tmp_real(minCatch:maxCatch))
route%areacat=route%areacat*1.e6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The seem to be "hidden" unit changes for some of the parameter inputs. The parameters should probably be included in the restart file, so this section is likely to change. In any case, if the units of the parameters in the nc4 file are different from the units of the parameters as they are used in the calculations, it's best to be very explicit about it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will address this when moving the river parameters to restart file.

@zyj8881357
Copy link

zyj8881357 commented Dec 9, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch. Contingent - DNA These changes are contingent on other PRs (DNA=do not approve) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants