Ignore:
Timestamp:
2022-02-24T11:04:47+01:00 (2 years ago)
Author:
josefine.ghattas
Message:

Correction to allow routing scheme to work on the south pole: Check if resoultion(ib,1)=0 and if so, calculate the area in a different way.
Solution done by Sebastien Nguyen. See ticket #811

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing.f90

    r6189 r7500  
    37083708             i = (index_g(ik)-(j-1)*iim_g) 
    37093709 
    3710              basinfrac(i,j) = basinfrac(i,j) + lbasin_area(ib,ij)/(resolution_g(ik,1)*resolution_g(ik,2)) 
     3710             IF ( resolution_g(ik,1) == 0 ) THEN 
     3711                basinfrac(i,j) = basinfrac(i,j) + lbasin_area(ib,ij)/(resolution_g(ik,2)*resolution_g(ik,2)*pi) 
     3712             ELSE 
     3713                basinfrac(i,j) = basinfrac(i,j) + lbasin_area(ib,ij)/(resolution_g(ik,1)*resolution_g(ik,2)) 
     3714             ENDIF 
    37113715             basinuparea(i,j) = MAX(basinuparea(i,j), lbasin_uparea(ib,ij)) 
    37123716             basincode(i,j) = lrivercode(ib,ij) 
     
    47084712       basin_bx(iloc, jloc) = NINT(max_basins + 1) 
    47094713       max_basins = max_basins + 1 
    4710        area_bx(iloc, jloc) = resolution(ib,1)*resolution(ib,2)*contfrac(ib) 
     4714       ! Check if we are at the poles : resolution(ib,1) = 0 
     4715       IF ( resolution(ib,1) == 0 ) THEN 
     4716          ! compute the pole cell area as the circle surface 
     4717          area_bx(iloc, jloc) = pi*resolution(ib,2)*resolution(ib,2)*contfrac(ib) 
     4718       ELSE 
     4719          area_bx(iloc, jloc) = resolution(ib,1)*resolution(ib,2)*contfrac(ib) 
     4720       ENDIF 
    47114721       topoind_bx(iloc, jloc) = min_topoind 
    47124722       hierarchy_bx(iloc, jloc) =  min_topoind 
     
    65196529       ! 
    65206530       totbasins = SUM(basin_area(ib,1:basin_count(ib))) 
    6521        contarea = resolution(ib,1)*resolution(ib,2)*contfrac(ib) 
     6531       ! Check if we are at the poles (resolution(ib,1) = 0 
     6532       IF ( resolution(ib,1) == 0 ) THEN 
     6533          ! Hack to approximate the pole cell area by a circle 
     6534          contarea = pi*resolution(ib,2)*resolution(ib,2)*contfrac(ib) 
     6535       ELSE 
     6536          contarea = resolution(ib,1)*resolution(ib,2)*contfrac(ib) 
     6537       ENDIF 
    65226538       ! 
    65236539       DO ij=1,basin_count(ib) 
     
    70347050    ! 
    70357051    floflo(:,:) = zero 
    7036     gridarea(:) = contfrac(:)*resolution(:,1)*resolution(:,2) 
     7052    ! if we are at the poles : resolution(:,1) = 0 
     7053    WHERE (resolution(:,1) == 0) 
     7054        ! compute grid area as the circle of radius resolution(:,2) 
     7055        gridarea(:) = contfrac(:)*pi*resolution(:,2)*resolution(:,2) 
     7056    ELSEWHERE 
     7057        gridarea(:) = contfrac(:)*resolution(:,1)*resolution(:,2) 
     7058    END WHERE 
    70377059    DO ib=1,nbpt 
    70387060       gridbasinarea(ib) = SUM(routing_area(ib,:)) 
     
    77617783    REAL(r_std)                                    :: area_irrig            !! Irrigated surface in the grid box (m^2) 
    77627784    REAL(r_std)                                    :: area_flood(ntype)     !! Flooded surface in the grid box (m^2) 
     7785    REAL(r_std)                                    :: resolution_1          !! temporary variable 
    77637786!!$    REAL(r_std)                                :: irrigmap(nbpt) 
    77647787!!$    REAL(r_std)                                :: floodmap(nbpt) 
     
    79587981       ! 
    79597982       IF ( init_irrig ) THEN 
    7960           irrigated(ib) = MIN(area_irrig, resolution(ib,1)*resolution(ib,2)*contfrac(ib)) 
     7983          ! if we are at the poles resolution(ib,1) = 0 
     7984          IF (resolution(ib,1) == 0) THEN 
     7985             ! use pi*resolution(ib,2) to get the disc area 
     7986             resolution_1 = pi*resolution(ib,2) 
     7987          ELSE 
     7988             resolution_1 = resolution(ib,1) 
     7989          END IF 
     7990          irrigated(ib) = MIN(area_irrig, resolution_1*resolution(ib,2)*contfrac(ib)) 
    79617991          IF ( irrigated(ib) < 0 ) THEN 
    79627992             WRITE(numout,*) 'We have a problem here : ', irrigated(ib)  
    7963              WRITE(numout,*) 'resolution :', resolution(ib,1), resolution(ib,2) 
     7993             WRITE(numout,*) 'resolution :', resolution_1, resolution(ib,2) 
    79647994             WRITE(numout,*) area_irrig 
    79657995             CALL ipslerr_p(3,'routing_irrigmap','Problem with irrigated...','','') 
     
    79758005       ! 
    79768006       IF ( init_flood ) THEN 
     8007          ! if we are at the poles resolution(ib,1) = 0 
     8008          IF (resolution(ib,1) == 0) THEN  
     8009             ! use pi*resolution(ib,2) to get the disc area 
     8010             resolution_1 = pi*resolution(ib,2) 
     8011          ELSE 
     8012             resolution_1 = resolution(ib,1) 
     8013          END IF 
    79778014          floodplains(ib) = MIN(area_flood(iflood)+area_flood(idam)+area_flood(isal), & 
    7978                & resolution(ib,1)*resolution(ib,2)*contfrac(ib)) 
     8015               & resolution_1*resolution(ib,2)*contfrac(ib)) 
    79798016          IF ( floodplains(ib) < 0 ) THEN 
    79808017             WRITE(numout,*) 'We have a problem here : ', floodplains(ib)  
    7981              WRITE(numout,*) 'resolution :', resolution(ib,1), resolution(ib,2) 
     8018             WRITE(numout,*) 'resolution :', resolution_1, resolution(ib,2) 
    79828019             WRITE(numout,*) area_flood 
    79838020             CALL ipslerr_p(3,'routing_irrigmap','Problem with floodplains..','','') 
     
    79928029       ! 
    79938030       IF ( init_swamp ) THEN 
    7994           swamp(ib) = MIN(area_flood(iswamp), resolution(ib,1)*resolution(ib,2)*contfrac(ib)) 
     8031          ! if we are at the poles resolution(ib,1) = 0 
     8032          IF (resolution(ib,1) == 0) THEN  
     8033             ! use pi*resolution(ib,2) to get the disc area  
     8034             resolution_1 = pi*resolution(ib,2) 
     8035          ELSE 
     8036             resolution_1 = resolution(ib,1) 
     8037          END IF 
     8038          swamp(ib) = MIN(area_flood(iswamp), resolution_1*resolution(ib,2)*contfrac(ib)) 
    79958039          IF ( swamp(ib) < 0 ) THEN 
    79968040             WRITE(numout,*) 'We have a problem here : ', swamp(ib)  
    7997              WRITE(numout,*) 'resolution :', resolution(ib,1), resolution(ib,2) 
     8041             WRITE(numout,*) 'resolution :', resolution_1, resolution(ib,2) 
    79988042             WRITE(numout,*) area_flood 
    79998043             CALL ipslerr_p(3,'routing_irrigmap','Problem with swamp...','','') 
Note: See TracChangeset for help on using the changeset viewer.