New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 9158 for branches/UKMO/dev_r5518_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_rnf.F90 – NEMO

Ignore:
Timestamp:
2017-12-21T18:16:12+01:00 (6 years ago)
Author:
dancopsey
Message:

Add code to calculate river outflow areas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_rnf.F90

    r9156 r9158  
    1414   USE in_out_manager  ! I/O units 
    1515   USE iom 
     16   USE wrk_nemo        ! Memory allocation 
     17   USE dom_oce         ! Domain sizes (for grid box area e1e2t) 
     18   USE cpl_oasis3      ! Coupling information (for n_rivers) 
    1619    
    1720   IMPLICIT NONE 
    1821   PRIVATE 
    1922    
     23   PUBLIC   cpl_rnf_init     ! routine called in nemo_init 
     24    
    2025   TYPE, PUBLIC ::   RIVERS_DATA     !: Storage for river outflow data 
    2126      INTEGER, POINTER, DIMENSION(:,:)    ::   river_number       !: River outflow number 
     27      REAL, POINTER, DIMENSION(:)         ::   river_area         ! 1D array listing areas of each river outflow (m2) 
    2228   END TYPE RIVERS_DATA 
    2329    
     
    3945      INTEGER                                   ::   ios                 ! Local integer output status for namelist read 
    4046      INTEGER                                   ::   inum 
    41       INTEGER                                   ::   ii, ij              !: Loop indices 
     47      INTEGER                                   ::   ii, jj              !: Loop indices 
    4248      INTEGER                                   ::   max_river 
    43       ! INTEGER, POINTER, DIMENSION(:,:)          ::   river_number        ! 2D array containing the river outflow numbers 
     49      REAL(wp), POINTER, DIMENSION(:,:)         ::   river_number        ! 2D array containing the river outflow numbers 
    4450       
    4551      NAMELIST/nam_cpl_rnf/file_riv_number 
     
    5056      IF(lwp) WRITE(numout,*) 
    5157      IF(lwp) WRITE(numout,*) 'cpl_rnf_init : initialization of river runoff coupling' 
    52       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~ 
     58      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' 
    5359       
    5460      REWIND(numnam_cfg) 
     
    6975      ! Assign space for river numbers 
    7076      ALLOCATE( rivers%river_number( jpi, jpj ) ) 
    71       ! CALL wrk_alloc( jpi, jpj, river_number ) 
     77      CALL wrk_alloc( jpi, jpj, river_number ) 
    7278       
    7379      ! Read the river numbers from netcdf file 
    7480      CALL iom_open (file_riv_number , inum ) 
    75       CALL iom_get  ( inum, jpdom_data, 'river_number', rivers%river_number(:,:) ) 
     81      CALL iom_get  ( inum, jpdom_data, 'river_number', river_number ) 
    7682      CALL iom_close( inum ) 
    7783       
    78       ! Print out the largest river number 
     84      ! Convert from a real array to an integer array 
    7985      max_river=0 
    8086      DO ii = 1, jpi 
    8187        DO jj = 1, jpj 
     88          rivers%river_number(ii,jj) = INT(river_number(ii,jj)) 
     89           
    8290          IF ( rivers%river_number(ii,jj) > max_river ) THEN 
    8391            max_river = rivers%river_number(ii,jj) 
     
    8593        END DO 
    8694      END DO 
     95       
     96      ! Print out the largest river number 
    8797      WRITE(numout,*) 'Maximum river number = ',max_river 
     98       
     99      ! Get the area of each river outflow 
     100      ALLOCATE( rivers%river_area( n_rivers ) ) 
     101      rivers%river_area(:) = 0.0 
     102      DO ii = 1, jpi 
     103        DO jj = 1, jpj 
     104          IF ( rivers%river_number(ii,jj) > 0 .AND. rivers%river_number(ii,jj) <= n_rivers ) THEN 
     105            rivers%river_area(rivers%river_number(ii,jj)) = rivers%river_area(rivers%river_number(ii,jj)) + e1e2t(ii,jj) 
     106          END IF 
     107        END IF 
     108      END IF 
     109       
     110      ! Use mpp_sum to add together river areas on other processors 
     111      CALL mpp_sum( rivers%river_area ) 
     112      WRITE(numout,*) 'Area of river number 1 is ',rivers%river_area(1) 
     113      WRITE(numout,*) 'Area of river number 10 is ',rivers%river_area(10) 
     114       
    88115       
    89116   END SUBROUTINE cpl_rnf_init 
Note: See TracChangeset for help on using the changeset viewer.