Index: branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 10174)
+++ branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 10176)
@@ -28,4 +28,5 @@
 #endif
    USE par_oce                      ! ocean parameters
+   USE cpl_rnf_1d, ONLY: nn_cpl_river   ! Variables used in 1D river outflow
    USE dom_oce                      ! ocean space and time domain
    USE in_out_manager               ! I/O manager
@@ -39,4 +40,5 @@
    PUBLIC   cpl_snd
    PUBLIC   cpl_rcv
+   PUBLIC   cpl_rcv_1d
    PUBLIC   cpl_freq
    PUBLIC   cpl_finalize
@@ -88,4 +90,5 @@
       INTEGER               ::   nct       ! Number of categories in field
       INTEGER               ::   ncplmodel ! Maximum number of models to/from which this variable may be sent/received
+      INTEGER               ::   dimensions ! Number of dimensions of coupling field
    END TYPE FLD_CPL
 
@@ -150,4 +153,8 @@
       !
       INTEGER :: id_part
+      INTEGER :: id_part_0d     ! Partition for 0d fields
+      INTEGER :: id_part_rnf_1d ! Partition for 1d river outflow fields
+      INTEGER :: id_part_temp   ! Temperary partition used to choose either 0d or 1d partitions
+      INTEGER :: vector_length  ! Length of 0d or 1d variables (0d variables will have vector_length=1)
       INTEGER :: paral(5)       ! OASIS3 box partition
       INTEGER :: ishape(4)      ! Shape of arrays passed to PSMILe. 
@@ -222,4 +229,34 @@
       
       CALL oasis_def_partition ( id_part, paral, nerror, jpiglo*jpjglo)
+
+      ! A special partition is needed for 0D fields
+     
+      paral(1) = 0                                       ! serial partitioning
+      paral(2) = 0   
+      IF ( nproc == 0) THEN
+         paral(3) = 1                   ! Size of array to couple (scalar)
+      ELSE
+         paral(3) = 0                   ! Dummy size for PE's not involved
+      END IF
+      paral(4) = 0
+      paral(5) = 0
+	     
+      CALL oasis_def_partition ( id_part_0d, paral, nerror, 1 )
+
+      ! Another partition is needed for 1D river routing fields
+      
+      paral(1) = 0                                       ! serial partitioning
+      paral(2) = 0   
+      IF ( nproc == 0) THEN
+         paral(3) = nn_cpl_river                   ! Size of array to couple (vector)
+      ELSE
+         paral(3) = 0                   ! Dummy size for PE's not involved
+      END IF
+      paral(4) = 0
+      paral(5) = 0
+
+
+      CALL oasis_def_partition ( id_part_rnf_1d, paral, nerror, nn_cpl_river )
+ 
       !
       ! ... Announce send variables. 
@@ -306,11 +343,42 @@
 #endif
                   IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In
-
-                  ! ... Set the field dimension and bundle count
-                  var_nodims(1) = 2
-                  var_nodims(2) = 1 ! Modify this value to cater for bundled fields.    
-
-                  CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , var_nodims,   &
-                     &                OASIS_In           , ishape , OASIS_REAL, nerror )
+                  flush(numout)
+
+                  ! Define 0D (Greenland or Antarctic ice mass) or 1D (river outflow) coupling fields
+                  IF (srcv(ji)%dimensions <= 1) THEN
+                    var_nodims(1) = 1
+                    var_nodims(2) = 1 ! Modify this value to cater for bundled fields.  
+                    IF (nproc == 0) THEN                    
+                       
+                       IF (srcv(ji)%dimensions == 0) THEN
+                       
+                          ! If 0D then set temporary variables to 0D components
+                          id_part_temp = id_part_0d
+                          vector_length = 1
+                       ELSE
+                       
+                          ! If 1D then set temporary variables to river outflow components
+                          id_part_temp = id_part_rnf_1d
+                          vector_length = nn_cpl_river
+                          
+                       END IF
+                       
+                       CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part_temp   , var_nodims,   &
+	                                OASIS_In           , (/ 1, vector_length /) , OASIS_REAL, nerror )
+                    ELSE
+                       ! Dummy call to keep OASIS3-MCT happy. 
+                       CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part_0d   , var_nodims,   &
+	                                OASIS_In           , (/ 0, 0 /) , OASIS_REAL, nerror )
+                    END IF
+                  ELSE 
+                    ! It's a "normal" 2D (or pseudo 3D) coupling field. 
+                    ! ... Set the field dimension and bundle count
+                    var_nodims(1) = 2
+                    var_nodims(2) = 1 ! Modify this value to cater for bundled fields.     
+
+                    CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , var_nodims,   &
+                                         OASIS_In           , ishape , OASIS_REAL, nerror )
+                  ENDIF
+
                   IF ( nerror /= OASIS_Ok ) THEN
                      WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
@@ -412,5 +480,5 @@
                
                llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
-                  &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
+                &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
                
                IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
@@ -437,7 +505,7 @@
                      WRITE(numout,*) '****************'
                   ENDIF
-                  
+
                ENDIF
-               
+
             ENDIF
             
@@ -451,4 +519,106 @@
       !
    END SUBROUTINE cpl_rcv
+
+   SUBROUTINE cpl_rcv_1d( kid, kstep, pdata, nitems, kinfo )
+      !!---------------------------------------------------------------------
+      !!              ***  ROUTINE cpl_rcv_1d  ***
+      !!
+      !! ** Purpose : - A special version of cpl_rcv to deal exclusively with
+      !! receipt of 0D or 1D fields. 
+      !! The fields are recieved into a 1D array buffer which is simply a 
+      !! dynamically sized sized array (which may be of size 1)
+      !! of 0 dimensional fields. This allows us to pass miltiple 0D 
+      !! fields via a single put/get operation.  
+      !!----------------------------------------------------------------------
+      INTEGER , INTENT(in   ) ::   nitems      ! Number of 0D items to recieve 
+                                               ! during this get operation. i.e.
+                                               ! The size of the 1D array in which
+                                               ! 0D items are passed.   
+      INTEGER , INTENT(in   ) ::   kid         ! ID index of the incoming
+                                               ! data.  
+      INTEGER , INTENT(in   ) ::   kstep       ! ocean time-step in seconds
+      REAL(wp), INTENT(inout) ::   pdata(1:nitems) ! The original value(s),  
+                                                   ! unchanged if nothing is 
+                                                   ! received
+      INTEGER , INTENT(  out) ::   kinfo       ! OASIS3 info argument
+      !! 
+      REAL(wp) ::   recvfld(1:nitems)          ! Local receive field buffer
+      INTEGER  ::   jc,jm     ! local loop index
+      INTEGER  ::   ierr
+      LOGICAL  ::   llaction
+      INTEGER  ::   MPI_WORKING_PRECISION
+      INTEGER  ::   number_to_print 
+      !!--------------------------------------------------------------------
+      !
+      ! receive local data from OASIS3 on every process
+      !
+      kinfo = OASIS_idle
+      !
+      ! 0D and 1D fields won't have categories or any other form of "pseudo level" 
+      ! so we only cater for a single set of values and thus don't bother 
+      ! with a loop over the jc index 
+      jc = 1
+
+      DO jm = 1, srcv(kid)%ncplmodel
+
+         IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN
+
+            IF ( ( srcv(kid)%dimensions <= 1) .AND. (nproc == 0) ) THEN
+               ! Since there is no concept of data decomposition for zero 
+               ! dimension fields, they must only be exchanged through the master PE, 
+               ! unlike "normal" 2D field cases where every PE is involved. 
+
+               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, recvfld, kinfo )   
+               
+               llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
+                           kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
+               
+               IF ( ln_ctl ) WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , &
+                                     llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
+               
+               IF ( llaction ) THEN
+                  
+                  kinfo = OASIS_Rcv
+                  pdata(1:nitems) = recvfld(1:nitems) 
+                  
+                  IF ( ln_ctl ) THEN        
+                     number_to_print = 10
+                     IF ( nitems < number_to_print ) number_to_print = nitems
+                     WRITE(numout,*) '****************'
+                     WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname
+                     WRITE(numout,*) 'oasis_get: ivarid '  , srcv(kid)%nid(jc,jm)
+                     WRITE(numout,*) 'oasis_get:   kstep', kstep
+                     WRITE(numout,*) 'oasis_get:   info ', kinfo
+                     WRITE(numout,*) '     - Minimum Value is ', MINVAL(pdata(:))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:))
+                     WRITE(numout,*) '     - Start of data is ', pdata(1:number_to_print)
+                     WRITE(numout,*) '****************'
+                  ENDIF
+                  
+               ENDIF
+            ENDIF   
+          ENDIF
+            
+       ENDDO
+       
+       ! Set the precision that we want to broadcast using MPI_BCAST
+       SELECT CASE( wp )
+       CASE( sp ) 
+         MPI_WORKING_PRECISION = MPI_REAL                ! Single precision
+       CASE( dp )
+         MPI_WORKING_PRECISION = MPI_DOUBLE_PRECISION    ! Double precision
+       CASE default
+         CALL oasis_abort( ncomp_id, "cpl_rcv_1d", "Could not find precision for coupling 0d or 1d field" )
+       END SELECT
+
+       ! We have to broadcast (potentially) received values from PE 0 to all 
+       ! the others. If no new data has been received we're just 
+       ! broadcasting the existing values but there's no more efficient way 
+       ! to deal with that w/o NEMO adopting a UM-style test mechanism
+       ! to determine active put/get timesteps. 
+       CALL mpi_bcast( pdata, nitems, MPI_WORKING_PRECISION, localRoot, mpi_comm_opa, ierr )
+
+      !
+   END SUBROUTINE cpl_rcv_1d
 
 
Index: branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_rnf_1d.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_rnf_1d.F90	(revision 10176)
+++ branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_rnf_1d.F90	(revision 10176)
@@ -0,0 +1,175 @@
+MODULE cpl_rnf_1d
+   !!======================================================================
+   !!                       ***  MODULE  cpl_rnf_1d  ***
+   !! Ocean forcing:  River runoff passed from the atmosphere using
+   !!                 1D array. One value per river.
+   !!=====================================================================
+   !! History : ?.?  ! 2018-01 (D. Copsey) Initial setup
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   cpl_rnf_1d_init : runoffs initialisation
+   !!---------------------------------------------------------------------- 
+
+#if defined key_oasis3
+   USE mod_oasis                    ! OASIS3-MCT module
+#endif
+   USE timing          ! Timing
+   USE in_out_manager  ! I/O units
+   USE lib_mpp         ! MPP library
+   USE iom
+   USE wrk_nemo        ! Memory allocation
+   USE dom_oce         ! Domain sizes (for grid box area e1e2t)
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE lib_fortran,    ONLY: DDPDD
+   
+   IMPLICIT NONE
+   PRIVATE
+   
+   PUBLIC   cpl_rnf_1d_init     ! routine called in nemo_init
+   PUBLIC   cpl_rnf_1d_to_2d      ! routine called in sbccpl.F90
+   
+   TYPE, PUBLIC ::   RIVERS_DATA     !: Storage for river outflow data
+      INTEGER, POINTER, DIMENSION(:,:)    ::   river_number       !: River outflow number
+      REAL(wp), POINTER, DIMENSION(:)     ::   river_area         ! 1D array listing areas of each river outflow (m2)
+      COMPLEX(wp), POINTER, DIMENSION(:)  ::   river_area_c       ! Comlex version of river_area for use in bit reproducible sums (m2)
+   END TYPE RIVERS_DATA
+   
+   TYPE(RIVERS_DATA), PUBLIC, TARGET :: rivers  !: River data
+   
+   INTEGER, PUBLIC            :: nn_cpl_river   ! Maximum number of rivers being passed through the coupler
+   INTEGER, PUBLIC            :: runoff_id      ! OASIS coupling id used in oasis_get command
+   LOGICAL                    :: ln_print_river_info  ! Diagnostic prints of river coupling information
+   
+CONTAINS
+
+   SUBROUTINE cpl_rnf_1d_init
+      !!----------------------------------------------------------------------
+      !!                    ***  SUBROUTINE cpl_rnf_1d_init  ***
+      !!                     
+      !! ** Purpose : - Read in file for river outflow numbers.
+      !!                Calculate 2D area of river outflow points.
+      !!                Called from nemo_init (nemogcm.F90).
+      !!
+      !!----------------------------------------------------------------------
+      !! namelist variables
+      !!-------------------
+      CHARACTER(len=80)                         ::   file_riv_number             !: Filename for river numbers
+      INTEGER                                   ::   ios                 ! Local integer output status for namelist read
+      INTEGER                                   ::   inum
+      INTEGER                                   ::   ii, jj, rr          !: Loop indices
+      INTEGER                                   ::   max_river
+      REAL(wp), POINTER, DIMENSION(:,:)         ::   river_number        ! 2D array containing the river outflow numbers
+      
+      NAMELIST/nam_cpl_rnf_1d/file_riv_number, nn_cpl_river, ln_print_river_info
+      !!----------------------------------------------------------------------
+
+      IF( nn_timing == 1 ) CALL timing_start('cpl_rnf_1d_init')
+      
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'cpl_rnf_1d_init : initialization of river runoff coupling'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
+      
+      REWIND(numnam_cfg)
+      
+      ! Read the namelist
+      READ  ( numnam_ref, nam_cpl_rnf_1d, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_cpl_rnf_1d in reference namelist', lwp )
+      READ  ( numnam_cfg, nam_cpl_rnf_1d, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_cpl_rnf_1d in configuration namelist', lwp )
+      IF(lwm) WRITE ( numond, nam_cpl_rnf_1d )
+
+      !                                               ! Parameter control and print
+      IF(lwp) WRITE(numout,*) '  '
+      IF(lwp) WRITE(numout,*) '          Namelist nam_cpl_rnf_1d : Coupled runoff using 1D array'
+      IF(lwp) WRITE(numout,*) '             Input file that contains river numbers = ',file_riv_number
+      IF(lwp) WRITE(numout,*) '             Maximum number of rivers to couple = ',nn_cpl_river
+      IF(lwp) WRITE(numout,*) '             Print river information = ',ln_print_river_info
+      IF(lwp) WRITE(numout,*) ' '
+      
+      ! Assign space for river numbers
+      ALLOCATE( rivers%river_number( jpi, jpj ) )
+      CALL wrk_alloc( jpi, jpj, river_number )
+      
+      ! Read the river numbers from netcdf file
+      CALL iom_open (file_riv_number , inum )
+      CALL iom_get  ( inum, jpdom_data, 'river_number', river_number )
+      CALL iom_close( inum )
+      
+      ! Convert from a real array to an integer array
+      max_river=0
+      DO ii = 1, jpi
+        DO jj = 1, jpj
+          rivers%river_number(ii,jj) = INT(river_number(ii,jj))
+          IF ( rivers%river_number(ii,jj) > max_river ) THEN
+            max_river = rivers%river_number(ii,jj)
+          END IF
+        END DO
+      END DO
+      
+      ! Print out the largest river number
+      IF ( ln_print_river_info ) THEN
+         WRITE(numout,*) 'Maximum river number in input file = ',max_river
+      END IF
+      
+      ! Get the area of each river outflow
+      ALLOCATE( rivers%river_area( nn_cpl_river ) )
+      ALLOCATE( rivers%river_area_c( nn_cpl_river ) )
+      rivers%river_area_c(:) = CMPLX( 0.e0, 0.e0, wp )
+      DO ii = nldi, nlei      
+        DO jj = nldj, nlej
+          IF ( tmask_i(ii,jj) > 0.5 ) THEN  ! This makes sure we are not at a duplicated point (at north fold or east-west cyclic point)
+            IF ( rivers%river_number(ii,jj) > 0 .AND. rivers%river_number(ii,jj) <= nn_cpl_river ) THEN
+              ! Add the area of each grid box (e1e2t) into river_area_c using DDPDD which should maintain bit reproducibility (needs to be checked)
+              CALL DDPDD( CMPLX( e1e2t(ii,jj), 0.e0, wp ), rivers%river_area_c(rivers%river_number(ii,jj) ) )
+            END IF
+          END IF
+        END DO
+      END DO
+      
+      ! Use mpp_sum to add together river areas on other processors
+      CALL mpp_sum( rivers%river_area_c, nn_cpl_river )
+      
+      ! Convert from complex number to real
+      ! DO rr = 1, nn_cpl_river
+      !    rivers%river_area(rr) = rivers%river_area_c(rr)
+      ! END DO
+      rivers%river_area(:) = REAL(rivers%river_area_c(:),wp)
+      
+      IF ( ln_print_river_info ) THEN
+        WRITE(numout,*) 'Area of rivers 1 to 10 are ',rivers%river_area(1:10)
+      END IF
+      
+   END SUBROUTINE cpl_rnf_1d_init
+   
+   SUBROUTINE cpl_rnf_1d_to_2d( runoff_1d )
+   
+      !!----------------------------------------------------------------------
+      !!                    ***  SUBROUTINE cpl_rnf_1d_to_2d  ***
+      !!                     
+      !! ** Purpose : - Convert river outflow from 1D array (passed from the
+      !!                atmosphere) to the 2D NEMO runoff field.
+      !!                Called from sbc_cpl_ice_flx (sbccpl.F90).
+      !!
+      !!----------------------------------------------------------------------
+      
+      REAL                   , INTENT(in   ) ::   runoff_1d(nn_cpl_river)    ! River runoff. One value per river.
+      
+      INTEGER  ::   ii, jj                 ! Loop indices
+            
+      ! Convert the 1D total runoff per river to 2D runoff flux by
+      ! dividing by the area of each runoff zone.
+      DO ii = 1, jpi
+        DO jj = 1, jpj
+          IF ( rivers%river_number(ii,jj) > 0 .AND. rivers%river_number(ii,jj) <= nn_cpl_river ) THEN
+            rnf(ii,jj) = runoff_1d(rivers%river_number(ii,jj)) / rivers%river_area(rivers%river_number(ii,jj))
+          ELSE
+            rnf(ii,jj) = 0.0
+          END IF
+            
+        END DO
+      END DO
+
+   END SUBROUTINE cpl_rnf_1d_to_2d
+
+END MODULE cpl_rnf_1d
Index: branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 10174)
+++ branches/UKMO/dev_r5518_GO6_new_runoff_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 10176)
@@ -46,4 +46,5 @@
    USE eosbn2
    USE sbcrnf   , ONLY : l_rnfcpl
+   USE cpl_rnf_1d, ONLY: nn_cpl_river, cpl_rnf_1d_init, cpl_rnf_1d_to_2d   ! Variables used in 1D river outflow
 #if defined key_cpl_carbon_cycle
    USE p4zflx, ONLY : oce_co2
@@ -111,5 +112,6 @@
    INTEGER, PARAMETER ::   jpr_atm_pco2 = 46          ! Incoming atm CO2 flux
    INTEGER, PARAMETER ::   jpr_atm_dust = 47          ! Incoming atm aggregate dust 
-   INTEGER, PARAMETER ::   jprcv      = 47            ! total number of fields received
+   INTEGER, PARAMETER ::   jpr_rnf_1d = 48            ! 1D river runoff
+   INTEGER, PARAMETER ::   jprcv      = 48            ! total number of fields received
 
    INTEGER, PARAMETER ::   jps_fice   =  1            ! ice fraction sent to the atmosphere
@@ -175,4 +177,5 @@
    LOGICAL     ::   ln_usecplmask          !  use a coupling mask file to merge data received from several models
                                            !   -> file cplmask.nc with the float variable called cplmask (jpi,jpj,nn_cplmodel)
+
    TYPE ::   DYNARR     
       REAL(wp), POINTER, DIMENSION(:,:,:)    ::   z3   
@@ -253,4 +256,5 @@
       NAMELIST/namsbc_cpl/  sn_snd_bio_co2, sn_snd_bio_dms, sn_snd_bio_chloro,                        &
          &                  sn_rcv_atm_pco2, sn_rcv_atm_dust
+
 
       !!---------------------------------------------------------------------
@@ -324,4 +328,5 @@
          WRITE(numout,*)'  rn_antarctica_calving_fraction      = ', rn_antarctica_calving_fraction
          WRITE(numout,*)'  rn_iceshelf_fluxes_tolerance        = ', rn_iceshelf_fluxes_tolerance
+
       ENDIF
 
@@ -339,5 +344,5 @@
 
       ! default definitions of srcv
-      srcv(:)%laction = .FALSE.   ;   srcv(:)%clgrid = 'T'   ;   srcv(:)%nsgn = 1.   ;   srcv(:)%nct = 1
+      srcv(:)%laction = .FALSE.   ;   srcv(:)%clgrid = 'T'   ;   srcv(:)%nsgn = 1.   ;   srcv(:)%nct = 1 ; srcv(:)%dimensions = 2
 
       !                                                      ! ------------------------- !
@@ -460,6 +465,11 @@
       !                                                      ! ------------------------- !
       srcv(jpr_rnf   )%clname = 'O_Runoff'
-      IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) THEN
-         srcv(jpr_rnf)%laction = .TRUE.
+      srcv(jpr_rnf_1d   )%clname = 'runoffo'
+      IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' .OR. TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN 
+         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) srcv(jpr_rnf)%laction = .TRUE.
+         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN
+            srcv(jpr_rnf_1d)%laction = .TRUE.
+            srcv(jpr_rnf_1d)%dimensions = 1 ! 1D field passed through coupler
+         END IF
          l_rnfcpl              = .TRUE.                      ! -> no need to read runoffs in sbcrnf
          ln_rnf                = nn_components /= jp_iam_sas ! -> force to go through sbcrnf if not sas
@@ -468,7 +478,15 @@
       ENDIF
       !
-      srcv(jpr_cal   )%clname = 'OCalving'   ;   IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' )   srcv(jpr_cal)%laction = .TRUE.
-      srcv(jpr_grnm  )%clname = 'OGrnmass'   ;   IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled' )   srcv(jpr_grnm)%laction = .TRUE.
-      srcv(jpr_antm  )%clname = 'OAntmass'   ;   IF( TRIM( sn_rcv_antm%cldes ) == 'coupled' )   srcv(jpr_antm)%laction = .TRUE.
+      srcv(jpr_cal   )%clname = 'OCalving'   
+      IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' )   srcv(jpr_cal)%laction = .TRUE.     
+
+      srcv(jpr_grnm  )%clname = 'OGrnmass' 
+      IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled' .OR. TRIM( sn_rcv_grnm%cldes ) == 'coupled0d' ) srcv(jpr_grnm)%laction = .TRUE.        
+      IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled0d' ) srcv(jpr_grnm  )%dimensions = 0 ! Scalar field
+      
+      srcv(jpr_antm  )%clname = 'OAntmass'
+      IF( TRIM( sn_rcv_antm%cldes ) == 'coupled' .OR. TRIM( sn_rcv_antm%cldes ) == 'coupled0d' )  srcv(jpr_antm)%laction = .TRUE.
+      IF( TRIM( sn_rcv_antm%cldes ) == 'coupled0d' ) srcv(jpr_antm  )%dimensions = 0 ! Scalar field   
+      
 
 
@@ -657,23 +675,4 @@
          ENDIF
       ENDIF
-      
-      ! =================================================== !
-      ! Allocate all parts of frcv used for received fields !
-      ! =================================================== !
-      DO jn = 1, jprcv
-         IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) )
-      END DO
-      ! Allocate taum part of frcv which is used even when not received as coupling field
-      IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) )
-      ! Allocate w10m part of frcv which is used even when not received as coupling field
-      IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) )
-      ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field
-      IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) )
-      IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) )
-      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE.
-      IF( k_ice /= 0 ) THEN
-         IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) )
-         IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) )
-      END IF
 
       ! ================================ !
@@ -685,5 +684,5 @@
       
       ! default definitions of nsnd
-      ssnd(:)%laction = .FALSE.   ;   ssnd(:)%clgrid = 'T'   ;   ssnd(:)%nsgn = 1.  ; ssnd(:)%nct = 1
+      ssnd(:)%laction = .FALSE.   ;   ssnd(:)%clgrid = 'T'   ;   ssnd(:)%nsgn = 1.  ; ssnd(:)%nct = 1 ; ssnd(:)%dimensions = 2
          
       !                                                      ! ------------------------- !
@@ -942,4 +941,42 @@
          ENDIF
       ENDIF
+      
+      ! Initialise 1D river outflow scheme 
+      nn_cpl_river = 1 
+      IF ( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) CALL cpl_rnf_1d_init   ! Coupled runoff using 1D array
+
+      ! =================================================== !
+      ! Allocate all parts of frcv used for received fields !
+      ! =================================================== !
+      DO jn = 1, jprcv
+
+         IF ( srcv(jn)%laction ) THEN 
+            SELECT CASE( srcv(jn)%dimensions )
+            !
+            CASE( 0 )   ! Scalar field
+               ALLOCATE( frcv(jn)%z3(1,1,1) )
+               
+            CASE( 1 )   ! 1D field
+               ALLOCATE( frcv(jn)%z3(nn_cpl_river,1,1) )
+               
+            CASE DEFAULT  ! 2D (or pseudo 3D) field.
+               ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) )
+               
+            END SELECT
+         END IF
+
+      END DO
+      ! Allocate taum part of frcv which is used even when not received as coupling field
+      IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) )
+      ! Allocate w10m part of frcv which is used even when not received as coupling field
+      IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) )
+      ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field
+      IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) )
+      IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) )
+      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE.
+      IF( k_ice /= 0 ) THEN
+         IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) )
+         IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) )
+      END IF
 
       !
@@ -1073,7 +1110,14 @@
       isec = ( kt - nit000 ) * NINT( rdttra(1) )                ! date of exchanges
       DO jn = 1, jprcv                                          ! received fields sent by the atmosphere
-         IF( srcv(jn)%laction )   CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) )
+         IF( srcv(jn)%laction ) THEN 
+
+            IF ( srcv(jn)%dimensions <= 1 ) THEN
+               CALL cpl_rcv_1d( jn, isec, frcv(jn)%z3, SIZE(frcv(jn)%z3), nrcvinfo(jn) )
+            ELSE
+               CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) )
+            END IF
+
+         END IF
       END DO
-
       !                                                      ! ========================= !
       IF( srcv(jpr_otx1)%laction ) THEN                      !  ocean stress components  !
@@ -1378,10 +1422,20 @@
 
       IF( srcv(jpr_grnm)%laction .AND. nn_coupled_iceshelf_fluxes == 1 ) THEN
-         greenland_icesheet_mass_array(:,:) = frcv(jpr_grnm)%z3(:,:,1)
-         ! take average over ocean points of input array to avoid cumulative error over time
-         ! The following must be bit reproducible over different PE decompositions
-         zgreenland_icesheet_mass_in = glob_sum( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) )
-
-         zgreenland_icesheet_mass_in = zgreenland_icesheet_mass_in / zmask_sum
+         
+         IF( srcv(jpr_grnm)%dimensions == 0 ) THEN
+      
+           ! This is a zero dimensional, single value field. 
+           zgreenland_icesheet_mass_in =  frcv(jpr_grnm)%z3(1,1,1)
+           
+         ELSE
+         
+           greenland_icesheet_mass_array(:,:) = frcv(jpr_grnm)%z3(:,:,1) 
+           ! take average over ocean points of input array to avoid cumulative error over time 
+           ! The following must be bit reproducible over different PE decompositions 
+           zgreenland_icesheet_mass_in = glob_sum( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) )  
+           zgreenland_icesheet_mass_in = zgreenland_icesheet_mass_in / zmask_sum 
+           
+         END IF
+
          greenland_icesheet_timelapsed = greenland_icesheet_timelapsed + rdt         
 
@@ -1415,10 +1469,20 @@
       !                                                        ! land ice masses : Antarctica
       IF( srcv(jpr_antm)%laction .AND. nn_coupled_iceshelf_fluxes == 1 ) THEN
-         antarctica_icesheet_mass_array(:,:) = frcv(jpr_antm)%z3(:,:,1)
-         ! take average over ocean points of input array to avoid cumulative error from rounding errors over time
-         ! The following must be bit reproducible over different PE decompositions
-         zantarctica_icesheet_mass_in = glob_sum( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) )
-
-         zantarctica_icesheet_mass_in = zantarctica_icesheet_mass_in / zmask_sum
+      
+         IF( srcv(jpr_antm)%dimensions == 0 ) THEN
+         
+           ! This is a zero dimensional, single value field. 
+           zantarctica_icesheet_mass_in = frcv(jpr_antm)%z3(1,1,1)
+           
+         ELSE
+         
+           antarctica_icesheet_mass_array(:,:) = frcv(jpr_antm)%z3(:,:,1) 
+           ! take average over ocean points of input array to avoid cumulative error from rounding errors over time 
+           ! The following must be bit reproducible over different PE decompositions 
+           zantarctica_icesheet_mass_in = glob_sum( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) )  
+           zantarctica_icesheet_mass_in = zantarctica_icesheet_mass_in / zmask_sum 
+           
+         END IF
+
          antarctica_icesheet_timelapsed = antarctica_icesheet_timelapsed + rdt         
 
@@ -1821,4 +1885,5 @@
       ! --- runoffs (included in emp later on) --- !
       IF( srcv(jpr_rnf)%laction )   rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1)
+      IF( srcv(jpr_rnf_1d)%laction )   CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:))
 
       ! --- calving (put in emp_tot and emp_oce) --- !
@@ -1858,4 +1923,5 @@
       ! runoffs and calving (put in emp_tot)
       IF( srcv(jpr_rnf)%laction )   rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1)
+      IF( srcv(jpr_rnf_1d)%laction )   CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:))
       IF( iom_use('hflx_rnf_cea') )   &
          CALL iom_put( 'hflx_rnf_cea' , rnf(:,:) * zcptn(:,:) )
