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 11509 for NEMO/branches/UKMO/NEMO_4.0_new_runoff_coupling/src/OCE/SBC/sbccpl.F90 – NEMO

Ignore:
Timestamp:
2019-09-06T18:07:34+02:00 (5 years ago)
Author:
dancopsey
Message:

Merge in all the 1D river runoff code as I comitted to the GO6 package branch (skipping anything to do with Antarctic and Greenland icesheet mass).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0_new_runoff_coupling/src/OCE/SBC/sbccpl.F90

    r10888 r11509  
    3636   USE eosbn2         !  
    3737   USE sbcrnf  , ONLY : l_rnfcpl 
     38   USE cpl_rnf_1d, ONLY: nn_cpl_river, cpl_rnf_1d_init, cpl_rnf_1d_to_2d   ! Variables used in 1D river outflow  
    3839   USE sbcisf  , ONLY : l_isfcpl 
    3940#if defined key_cice 
     
    116117   INTEGER, PARAMETER ::   jpr_tauwy  = 56   ! y component of the ocean stress from waves 
    117118   INTEGER, PARAMETER ::   jpr_ts_ice = 57   ! Sea ice surface temp 
    118  
    119    INTEGER, PARAMETER ::   jprcv      = 57   ! total number of fields received   
     119   INTEGER, PARAMETER ::   jpr_rnf_1d = 58   ! 1D river runoff  
     120 
     121   INTEGER, PARAMETER ::   jprcv      = 58   ! total number of fields received   
    120122 
    121123   INTEGER, PARAMETER ::   jps_fice   =  1   ! ice fraction sent to the atmosphere 
     
    345347 
    346348      ! default definitions of srcv 
    347       srcv(:)%laction = .FALSE.   ;   srcv(:)%clgrid = 'T'   ;   srcv(:)%nsgn = 1.   ;   srcv(:)%nct = 1 
     349      srcv(:)%laction = .FALSE 
     350      srcv(:)%clgrid = 'T' 
     351      srcv(:)%nsgn = 1 
     352      srcv(:)%nct = 1 
     353      srcv(:)%dimensions = 2 
    348354 
    349355      !                                                      ! ------------------------- ! 
     
    461467      !                                                      !     Runoffs & Calving     !    
    462468      !                                                      ! ------------------------- ! 
    463       srcv(jpr_rnf   )%clname = 'O_Runoff' 
    464       IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) THEN 
    465          srcv(jpr_rnf)%laction = .TRUE. 
     469      srcv(jpr_rnf_1d   )%clname = 'ORunff1D'  
     470      IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' .OR. TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN   
     471         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) srcv(jpr_rnf)%laction = .TRUE.  
     472         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN  
     473            srcv(jpr_rnf_1d)%laction = .TRUE.  
     474            srcv(jpr_rnf_1d)%dimensions = 1 ! 1D field passed through coupler  
     475         END IF 
    466476         l_rnfcpl              = .TRUE.                      ! -> no need to read runoffs in sbcrnf 
    467477         ln_rnf                = nn_components /= jp_iam_sas ! -> force to go through sbcrnf if not sas 
     
    743753       
    744754      ! default definitions of nsnd 
    745       ssnd(:)%laction = .FALSE.   ;   ssnd(:)%clgrid = 'T'   ;   ssnd(:)%nsgn = 1.  ; ssnd(:)%nct = 1 
     755      ssnd(:)%laction = .FALSE. 
     756      ssnd(:)%clgrid = 'T' 
     757      ssnd(:)%nsgn = 1 
     758      ssnd(:)%nct = 1 
     759      ssnd(:)%dimensions = 2 
    746760          
    747761      !                                                      ! ------------------------- ! 
     
    10221036         ENDIF 
    10231037      ENDIF 
     1038 
     1039      ! Initialise 1D river outflow scheme  
     1040      nn_cpl_river = 1  
     1041      IF ( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) CALL cpl_rnf_1d_init   ! Coupled runoff using 1D array 
     1042 
     1043      ! =================================================== ! 
     1044      ! Allocate all parts of frcv used for received fields ! 
     1045      ! =================================================== ! 
     1046      DO jn = 1, jprcv 
     1047 
     1048         IF ( srcv(jn)%laction ) THEN  
     1049            SELECT CASE( srcv(jn)%dimensions ) 
     1050            ! 
     1051            CASE( 0 )   ! Scalar field 
     1052               ALLOCATE( frcv(jn)%z3(1,1,1) ) 
     1053                
     1054            CASE( 1 )   ! 1D field 
     1055               ALLOCATE( frcv(jn)%z3(nn_cpl_river,1,1) ) 
     1056                
     1057            CASE DEFAULT  ! 2D (or pseudo 3D) field. 
     1058               ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
     1059                
     1060            END SELECT 
     1061         END IF 
     1062 
     1063      END DO 
     1064      ! Allocate taum part of frcv which is used even when not received as coupling field 
     1065      IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
     1066      ! Allocate w10m part of frcv which is used even when not received as coupling field 
     1067      IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
     1068      ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field 
     1069      IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
     1070      IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
     1071      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE. 
     1072      IF( k_ice /= 0 ) THEN 
     1073         IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
     1074         IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
     1075      END IF 
    10241076 
    10251077      ! 
     
    11181170      isec = ( kt - nit000 ) * NINT( rdt )                      ! date of exchanges 
    11191171      DO jn = 1, jprcv                                          ! received fields sent by the atmosphere 
    1120          IF( srcv(jn)%laction )   CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) ) 
     1172         IF( srcv(jn)%laction ) THEN   
     1173  
     1174            IF ( srcv(jn)%dimensions <= 1 ) THEN  
     1175               CALL cpl_rcv_1d( jn, isec, frcv(jn)%z3, SIZE(frcv(jn)%z3), nrcvinfo(jn) )  
     1176            ELSE  
     1177               CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) )  
     1178            END IF  
     1179  
     1180         END IF  
    11211181      END DO 
    11221182 
     
    13991459         !                                                        ! runoffs and calving (added in emp) 
    14001460         IF( srcv(jpr_rnf)%laction )     rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
     1461         IF( srcv(jpr_rnf_1d)%laction )   CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:)) 
    14011462         IF( srcv(jpr_cal)%laction )     zemp(:,:) = zemp(:,:) - frcv(jpr_cal)%z3(:,:,1) 
    14021463  
     
    16991760         rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
    17001761      ENDIF 
     1762      IF( srcv(jpr_rnf_1d)%laction )   CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:)) 
    17011763      IF( srcv(jpr_cal)%laction ) THEN   ! calving (put in emp_tot and emp_oce) 
    17021764         zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) 
     
    17391801         rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
    17401802      ENDIF 
     1803      IF( srcv(jpr_rnf_1d)%laction )   CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:)) 
    17411804      IF( srcv(jpr_cal)%laction ) THEN   ! calving (put in emp_tot) 
    17421805         zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) 
Note: See TracChangeset for help on using the changeset viewer.