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 12580 for NEMO/branches/UKMO/NEMO_4.0.1_icesheet_and_river_coupling/src/OCE/SBC/sbccpl.F90 – NEMO

Ignore:
Timestamp:
2020-03-20T19:38:24+01:00 (4 years ago)
Author:
dancopsey
Message:

Add 1D river coupling code from changeset 10269 of GO6 package branch
branches/UKMO/dev_r5518_GO6_package

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0.1_icesheet_and_river_coupling/src/OCE/SBC/sbccpl.F90

    r12577 r12580  
    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 
     
    118119   INTEGER, PARAMETER ::   jpr_grnm   = 58   ! Greenland ice mass  
    119120   INTEGER, PARAMETER ::   jpr_antm   = 59   ! Antarctic ice mass  
    120  
    121    INTEGER, PARAMETER ::   jprcv      = 59   ! total number of fields received   
     121   INTEGER, PARAMETER ::   jpr_rnf_1d = 60            ! 1D river runoff  
     122 
     123   INTEGER, PARAMETER ::   jprcv      = 60   ! total number of fields received   
    122124 
    123125   INTEGER, PARAMETER ::   jps_fice   =  1   ! ice fraction sent to the atmosphere 
     
    361363 
    362364      ! default definitions of srcv 
    363       srcv(:)%laction = .FALSE.   ;   srcv(:)%clgrid = 'T'   ;   srcv(:)%nsgn = 1.   ;   srcv(:)%nct = 1 
     365      srcv(:)%laction = .FALSE.  
     366      srcv(:)%clgrid = 'T'  
     367      srcv(:)%nsgn = 1.  
     368      srcv(:)%nct = 1  
     369      srcv(:)%dimensions = 2  
    364370 
    365371      !                                                      ! ------------------------- ! 
     
    478484      !                                                      ! ------------------------- ! 
    479485      srcv(jpr_rnf   )%clname = 'O_Runoff' 
    480       IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) THEN 
    481          srcv(jpr_rnf)%laction = .TRUE. 
     486      srcv(jpr_rnf_1d   )%clname = 'ORunff1D'  
     487      IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' .OR. TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN   
     488         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) srcv(jpr_rnf)%laction = .TRUE.  
     489         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN  
     490            srcv(jpr_rnf_1d)%laction = .TRUE.  
     491            srcv(jpr_rnf_1d)%dimensions = 1 ! 1D field passed through coupler  
     492         END IF  
    482493         l_rnfcpl              = .TRUE.                      ! -> no need to read runoffs in sbcrnf 
    483494         ln_rnf                = nn_components /= jp_iam_sas ! -> force to go through sbcrnf if not sas 
     
    486497      ENDIF 
    487498      ! 
    488       srcv(jpr_cal)%clname = 'OCalving'   ;  IF( TRIM( sn_rcv_cal%cldes) == 'coupled' )   srcv(jpr_cal)%laction = .TRUE. 
    489       srcv(jpr_grnm  )%clname = 'OGrnmass'   ;   IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled' )   srcv(jpr_grnm)%laction = .TRUE.  
    490       srcv(jpr_antm  )%clname = 'OAntmass'   ;   IF( TRIM( sn_rcv_antm%cldes ) == 'coupled' )   srcv(jpr_antm)%laction = .TRUE.  
     499      srcv(jpr_cal   )%clname = 'OCalving'     
     500      IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' )   srcv(jpr_cal)%laction = .TRUE.       
     501  
     502      srcv(jpr_grnm  )%clname = 'OGrnmass'   
     503      IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled' .OR. TRIM( sn_rcv_grnm%cldes ) == 'coupled0d' ) srcv(jpr_grnm)%laction = .TRUE.          
     504      IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled0d' ) srcv(jpr_grnm  )%dimensions = 0 ! Scalar field  
     505        
     506      srcv(jpr_antm  )%clname = 'OAntmass'  
     507      IF( TRIM( sn_rcv_antm%cldes ) == 'coupled' .OR. TRIM( sn_rcv_antm%cldes ) == 'coupled0d' )  srcv(jpr_antm)%laction = .TRUE.  
     508      IF( TRIM( sn_rcv_antm%cldes ) == 'coupled0d' ) srcv(jpr_antm  )%dimensions = 0 ! Scalar field    
    491509      srcv(jpr_isf)%clname = 'OIcshelf'   ;  IF( TRIM( sn_rcv_isf%cldes) == 'coupled' )   srcv(jpr_isf)%laction = .TRUE. 
    492510      srcv(jpr_icb)%clname = 'OIceberg'   ;  IF( TRIM( sn_rcv_icb%cldes) == 'coupled' )   srcv(jpr_icb)%laction = .TRUE. 
     
    733751         ENDIF 
    734752      ENDIF 
    735        
    736       ! =================================================== ! 
    737       ! Allocate all parts of frcv used for received fields ! 
    738       ! =================================================== ! 
    739       DO jn = 1, jprcv 
    740          IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
    741       END DO 
    742       ! Allocate taum part of frcv which is used even when not received as coupling field 
    743       IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
    744       ! Allocate w10m part of frcv which is used even when not received as coupling field 
    745       IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
    746       ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field 
    747       IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
    748       IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
    749       ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE. 
    750       IF( k_ice /= 0 ) THEN 
    751          IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
    752          IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
    753       END IF 
    754753 
    755754      ! ================================ ! 
     
    761760       
    762761      ! default definitions of nsnd 
    763       ssnd(:)%laction = .FALSE.   ;   ssnd(:)%clgrid = 'T'   ;   ssnd(:)%nsgn = 1.  ; ssnd(:)%nct = 1 
     762      ssnd(:)%laction = .FALSE.  
     763      ssnd(:)%clgrid = 'T'  
     764      ssnd(:)%nsgn = 1.  
     765      ssnd(:)%nct = 1  
     766      ssnd(:)%dimensions = 2  
    764767          
    765768      !                                                      ! ------------------------- ! 
     
    10401043         ENDIF 
    10411044      ENDIF 
     1045 
     1046      ! Initialise 1D river outflow scheme  
     1047      nn_cpl_river = 1  
     1048      IF ( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) CALL cpl_rnf_1d_init   ! Coupled runoff using 1D array 
     1049       
     1050      ! =================================================== ! 
     1051      ! Allocate all parts of frcv used for received fields ! 
     1052      ! =================================================== ! 
     1053      DO jn = 1, jprcv 
     1054 
     1055         IF ( srcv(jn)%laction ) THEN  
     1056            SELECT CASE( srcv(jn)%dimensions ) 
     1057            ! 
     1058            CASE( 0 )   ! Scalar field 
     1059               ALLOCATE( frcv(jn)%z3(1,1,1) ) 
     1060                
     1061            CASE( 1 )   ! 1D field 
     1062               ALLOCATE( frcv(jn)%z3(nn_cpl_river,1,1) ) 
     1063                
     1064            CASE DEFAULT  ! 2D (or pseudo 3D) field. 
     1065               ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 
     1066                
     1067            END SELECT 
     1068         END IF 
     1069 
     1070      END DO 
     1071      ! Allocate taum part of frcv which is used even when not received as coupling field 
     1072      IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 
     1073      ! Allocate w10m part of frcv which is used even when not received as coupling field 
     1074      IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 
     1075      ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field 
     1076      IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 
     1077      IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 
     1078      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE. 
     1079      IF( k_ice /= 0 ) THEN 
     1080         IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 
     1081         IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 
     1082      END IF 
    10421083 
    10431084      ! 
     
    11621203      isec = ( kt - nit000 ) * NINT( rdt )                      ! date of exchanges 
    11631204      DO jn = 1, jprcv                                          ! received fields sent by the atmosphere 
    1164          IF( srcv(jn)%laction )   CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) ) 
     1205        IF( srcv(jn)%laction ) THEN   
     1206  
     1207          IF ( srcv(jn)%dimensions <= 1 ) THEN  
     1208            CALL cpl_rcv_1d( jn, isec, frcv(jn)%z3, SIZE(frcv(jn)%z3), nrcvinfo(jn) )  
     1209          ELSE  
     1210            CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) )  
     1211          END IF  
     1212 
     1213        END IF  
    11651214      END DO 
    11661215 
     
    18181867       
    18191868      ! --- Continental fluxes --- ! 
    1820       IF( srcv(jpr_rnf)%laction ) THEN   ! runoffs (included in emp later on) 
     1869      IF( srcv(jpr_rnf)%laction ) THEN   ! 2D runoffs (included in emp later on) 
    18211870         rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
     1871      ENDIF 
     1872      IF( srcv(jpr_rnf_1d)%laction ) THEN ! 1D runoff 
     1873         CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:)) 
    18221874      ENDIF 
    18231875      IF( srcv(jpr_cal)%laction ) THEN   ! calving (put in emp_tot and emp_oce) 
     
    18581910      zsnw(:,:) = picefr(:,:) 
    18591911      ! --- Continental fluxes --- ! 
    1860       IF( srcv(jpr_rnf)%laction ) THEN   ! runoffs (included in emp later on) 
     1912      IF( srcv(jpr_rnf)%laction ) THEN   ! 2D runoffs (included in emp later on) 
    18611913         rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
     1914      ENDIF 
     1915      IF( srcv(jpr_rnf_1d)%laction ) THEN  ! 1D runoff 
     1916         CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:))  
    18621917      ENDIF 
    18631918      IF( srcv(jpr_cal)%laction ) THEN   ! calving (put in emp_tot) 
Note: See TracChangeset for help on using the changeset viewer.