From 328dc536585216680dceda82e906b7a9c49fcec1 Mon Sep 17 00:00:00 2001 From: Anthony <anthony.schrapffer@polytechnique.fr> Date: Mon, 16 Mar 2020 20:07:58 +0100 Subject: [PATCH] Linkup new case : when the minimum hierarchy of a basin is in two different grid points --- F90subroutines/routing_reg.f90 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/F90subroutines/routing_reg.f90 b/F90subroutines/routing_reg.f90 index 57b0d01..0fb1429 100644 --- a/F90subroutines/routing_reg.f90 +++ b/F90subroutines/routing_reg.f90 @@ -2291,13 +2291,20 @@ SUBROUTINE routing_reg_linkup(nbpt, neighbours, nwbas, basin_count, basin_area, dop = minhloc(basin_id(sp,sb),1) bop = minhloc(basin_id(sp,sb),2) IF ((dop < undef_int ) .AND. (dop .GT. 0) .AND. (bop < undef_int) .AND. (bop .GT. 0)) THEN - !basin_hierarchy(sp,sb) = basin_hierarchy(dop,bop) + CALL routing_updateflow(sp, sb, dop, bop, nbpt,nwbas, nbxmax*8, outflow_grid, outflow_basin, & & inflow_number, inflow_grid, inflow_basin) - found = 1 - WRITE(numout,*) "Lowest basin hierarchy in the neighbours grid points" - WRITE(numout,*) "hierarch of (sp,sb)", basin_hierarchy(sp,sb) - WRITE(numout,*) "Lowest basinid hierarch", basin_hierarchy(dop,bop) + ! It is possible that the lowest hierarchy is in two grid cells + ! In this case, if we have an error for this routing_updateflow + ! We go to next step and make it a coastal flow + IF (outflow_basin(sp, sb) < undef_int) THEN + found = 1 + WRITE(numout,*) "Lowest basin hierarchy in the neighbours grid points" + ELSE + WRITE(numout,*) "Lowest hierarchy may be in two different grid points" + END IF + WRITE(numout,*) "hierarch of (sp,sb)", basin_hierarchy(sp,sb) + WRITE(numout,*) "Lowest basinid hierarch", basin_hierarchy(dop,bop) END IF END IF END DO -- GitLab