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 2236 for branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY – NEMO

Ignore:
Timestamp:
2010-10-12T20:49:32+02:00 (14 years ago)
Author:
cetlod
Message:

First guess of NEMO_v3.3

Location:
branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdy_oce.F90

    • Property svn:executable deleted
    r1170 r2236  
    66   !! History :  1.0  !  2001-05  (J. Chanut, A. Sellar)  Original code 
    77   !!            3.0  !  2008-04  (NEMO team)  add in the reference version      
     8   !!            3.3  !  2010-09  (D. Storkey) add ice boundary conditions 
    89   !!---------------------------------------------------------------------- 
    910#if defined key_bdy  
     
    5455   !! Unstructured open boundary data variables 
    5556   !!---------------------------------------------------------------------- 
    56    INTEGER, DIMENSION(jpbgrd) ::   nblen                  !: Size of bdy data on a proc for each grid type 
    57    INTEGER, DIMENSION(jpbgrd) ::   nblenrim               !: Size of bdy data on a proc for first rim ind 
    58    INTEGER, DIMENSION(jpbgrd) ::   nblendta               !: Size of bdy data in file 
     57   INTEGER, DIMENSION(jpbgrd) ::   nblen    = 0           !: Size of bdy data on a proc for each grid type 
     58   INTEGER, DIMENSION(jpbgrd) ::   nblenrim = 0           !: Size of bdy data on a proc for first rim ind 
     59   INTEGER, DIMENSION(jpbgrd) ::   nblendta = 0           !: Size of bdy data in file 
    5960 
    6061   INTEGER, DIMENSION(jpbdim,jpbgrd) ::   nbi, nbj        !: i and j indices of bdy dta 
     
    7374   REAL(wp), DIMENSION(jpbdim) ::   sshtide               !: Tidal boundary array : SSH 
    7475   REAL(wp), DIMENSION(jpbdim) ::   utide, vtide          !: Tidal boundary array : U and V 
     76#if defined key_lim2 
     77   REAL(wp), DIMENSION(jpbdim) ::  & 
     78      frld_bdy, hicif_bdy,  & !: Now clim of ice leads fraction, ice   
     79      hsnif_bdy               !: thickness and snow thickness 
     80#endif 
    7581 
    7682#else 
     
    8490   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    8591   !! $Id$  
    86    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     92   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    8793   !!====================================================================== 
    8894END MODULE bdy_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdy_par.F90

    • Property svn:executable deleted
    r1146 r2236  
    66   !! History :  1.0  !  2005-01  (J. Chanut, A. Sellar)  Original code 
    77   !!            3.0  !  2008-04  (NEMO team)  add in the reference version 
     8   !!            3.3  !  2010-09  (D. Storkey and E. O'Dea) update for Shelf configurations 
    89   !!---------------------------------------------------------------------- 
    9 #if defined key_bdy 
     10#if defined   key_bdy 
    1011   !!---------------------------------------------------------------------- 
    1112   !!   'key_bdy' :                    Unstructured Open Boundary Condition 
     
    1516   PUBLIC 
    1617 
    17  
    18    LOGICAL, PUBLIC, PARAMETER ::   lk_bdy  = .TRUE.  !: Unstructured Ocean Boundary Condition flag 
    19    INTEGER, PUBLIC, PARAMETER ::   jpbdta  = 5000    !: Max length of bdy field in file 
    20    INTEGER, PUBLIC, PARAMETER ::   jpbdim  = 5000    !: Max length of bdy field on a processor 
    21    INTEGER, PUBLIC, PARAMETER ::   jpbtime = 1000    !: Max number of time dumps per file 
    22    INTEGER, PUBLIC, PARAMETER ::   jpbgrd  = 3       !: Number of horizontal grid types used  (T, u, v, f) 
     18   LOGICAL, PUBLIC, PARAMETER ::   lk_bdy  = .TRUE.   !: Unstructured Ocean Boundary Condition flag 
     19   INTEGER, PUBLIC, PARAMETER ::   jpbdta  = 20000    !: Max length of bdy field in file 
     20   INTEGER, PUBLIC, PARAMETER ::   jpbdim  = 20000    !: Max length of bdy field on a processor 
     21   INTEGER, PUBLIC, PARAMETER ::   jpbtime = 1000     !: Max number of time dumps per file 
     22   INTEGER, PUBLIC, PARAMETER ::   jpbgrd  = 6        !: Number of horizontal grid types used  (T, u, v, f) 
    2323#else 
    2424   !!---------------------------------------------------------------------- 
     
    2929 
    3030   !!---------------------------------------------------------------------- 
    31    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     31   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    3232   !! $Id$  
    33    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     33   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3434   !!====================================================================== 
    3535END MODULE bdy_par 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdydta.F90

    • Property svn:executable deleted
    r1715 r2236  
    88   !!             -   !  2007-07  (D. Storkey) add bdy_dta_bt 
    99   !!            3.0  !  2008-04  (NEMO team)  add in the reference version 
     10   !!            3.3  !  2010-09  (E.O'Dea) modifications for Shelf configurations  
     11   !!            3.3  !  2010-09  (D.Storkey) add ice boundary conditions 
    1012   !!---------------------------------------------------------------------- 
    1113#if defined key_bdy 
     
    1416   !!---------------------------------------------------------------------- 
    1517   !!   bdy_dta    : read u, v, t, s data along open boundaries 
    16    !!   bdy_dta_bt : read depth-mean velocities and elevation along open 
    17    !!                boundaries         
     18   !!   bdy_dta_bt : read depth-mean velocities and elevation along open boundaries         
    1819   !!---------------------------------------------------------------------- 
    1920   USE oce             ! ocean dynamics and tracers 
     
    2526   USE ioipsl 
    2627   USE in_out_manager  ! I/O logical units 
     28#if defined key_lim2 
     29   USE ice_2 
     30#endif 
    2731 
    2832   IMPLICIT NONE 
     
    3236   PUBLIC   bdy_dta_bt  
    3337 
    34    INTEGER ::   numbdyt, numbdyu, numbdyv                      !: logical units for T-, U-, & V-points data file, resp. 
    35    INTEGER ::   ntimes_bdy                                     !: exact number of time dumps in data files 
    36    INTEGER ::   nbdy_b, nbdy_a                                 !: record of bdy data file for before and after model time step 
    37    INTEGER ::   numbdyt_bt, numbdyu_bt, numbdyv_bt             !: logical unit for T-, U- & V-points data file, resp. 
    38    INTEGER ::   ntimes_bdy_bt                                  !: exact number of time dumps in data files 
    39    INTEGER ::   nbdy_b_bt, nbdy_a_bt                           !: record of bdy data file for before and after model time step 
    40  
    41    INTEGER, DIMENSION (jpbtime) ::   istep, istep_bt           !: time array in seconds in each data file 
    42  
    43    REAL(wp) ::  zoffset                                        !: time offset between time origin in file & start time of model run 
    44  
    45    REAL(wp), DIMENSION(jpbdim,jpk,2) ::   tbdydta, sbdydta     !: time interpolated values of T and S bdy data    
    46    REAL(wp), DIMENSION(jpbdim,jpk,2) ::   ubdydta, vbdydta     !: time interpolated values of U and V bdy data  
    47    REAL(wp), DIMENSION(jpbdim,2)     ::   ubtbdydta, vbtbdydta !: Arrays used for time interpolation of bdy data    
    48    REAL(wp), DIMENSION(jpbdim,2)     ::   sshbdydta            !: bdy data of ssh 
     38   INTEGER ::   numbdyt, numbdyu, numbdyv                      ! logical units for T-, U-, & V-points data file, resp. 
     39   INTEGER ::   ntimes_bdy                                     ! exact number of time dumps in data files 
     40   INTEGER ::   nbdy_b, nbdy_a                                 ! record of bdy data file for before and after time step 
     41   INTEGER ::   numbdyt_bt, numbdyu_bt, numbdyv_bt             ! logical unit for T-, U- & V-points data file, resp. 
     42   INTEGER ::   ntimes_bdy_bt                                  ! exact number of time dumps in data files 
     43   INTEGER ::   nbdy_b_bt, nbdy_a_bt                           ! record of bdy data file for before and after time step 
     44 
     45   INTEGER, DIMENSION (jpbtime) ::   istep, istep_bt           ! time array in seconds in each data file 
     46 
     47   REAL(wp) ::  zoffset                                        ! time offset between time origin in file & start time of model run 
     48 
     49   REAL(wp), DIMENSION(jpbdim,jpk,2) ::   tbdydta, sbdydta     ! time interpolated values of T and S bdy data    
     50   REAL(wp), DIMENSION(jpbdim,jpk,2) ::   ubdydta, vbdydta     ! time interpolated values of U and V bdy data  
     51   REAL(wp), DIMENSION(jpbdim,2)     ::   ubtbdydta, vbtbdydta ! Arrays used for time interpolation of bdy data    
     52   REAL(wp), DIMENSION(jpbdim,2)     ::   sshbdydta            ! bdy data of ssh 
     53 
     54#if defined key_lim2 
     55   REAL(wp), DIMENSION(jpbdim,2)     ::   frld_bdydta          ! } 
     56   REAL(wp), DIMENSION(jpbdim,2)     ::   hicif_bdydta         ! } Arrays used for time interp. of ice bdy data  
     57   REAL(wp), DIMENSION(jpbdim,2)     ::   hsnif_bdydta         ! } 
     58#endif 
    4959 
    5060   !!---------------------------------------------------------------------- 
    51    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     61   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    5262   !! $Id$  
    53    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     63   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5464   !!---------------------------------------------------------------------- 
    55  
    5665CONTAINS 
    5766 
     
    6776      !!                the file. If so read it in. Time interpolate. 
    6877      !!---------------------------------------------------------------------- 
    69       INTEGER, INTENT( in ) ::   kt                             ! ocean time-step index (for timesplitting option, otherwise zero) 
     78      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index (for timesplitting option, otherwise zero) 
    7079      !! 
    7180      CHARACTER(LEN=80), DIMENSION(3) ::   clfile               ! names of input files 
     
    7988      INTEGER ::   itimer, totime 
    8089      INTEGER ::   ii, ij                                       ! array addresses 
    81       INTEGER ::   ipi, ipj, ipk, inum                          ! temporary integers (NetCDF read) 
     90      INTEGER ::   ipi, ipj, ipk, inum                          ! local integers (NetCDF read) 
    8291      INTEGER ::   iyear0, imonth0, iday0 
    8392      INTEGER ::   ihours0, iminutes0, isec0 
     
    91100      !!--------------------------------------------------------------------------- 
    92101 
    93       IF( ln_bdy_dyn_frs .OR. ln_bdy_tra_frs ) THEN  ! If these are both false then this routine  
    94                                                      ! does nothing. 
     102 
     103      IF( ln_bdy_dyn_frs .OR. ln_bdy_tra_frs    & 
     104         &               .OR. ln_bdy_ice_frs ) THEN  ! If these are both false then this routine does nothing 
    95105 
    96106      ! -------------------- ! 
     
    102112      ! Some time variables for monthly climatological forcing: 
    103113      ! ******************************************************* 
    104  !!gm  here  use directely daymod variables 
     114 
     115!!gm  here  use directely daymod calendar variables 
    105116  
    106117      iman = INT( raamo )      ! Number of months in a year 
     
    121132         !                                             !-------------------! 
    122133         istep(:) = 0 
    123          nbdy_b    = 0 
    124          nbdy_a    = 0 
     134         nbdy_b   = 0 
     135         nbdy_a   = 0 
    125136 
    126137         ! Get time information from bdy data file 
     
    151162            igrd_start = 1 
    152163            igrd_end   = 3 
    153             IF(.NOT. ln_bdy_tra_frs .AND. .NOT. ln_bdy_ice_frs) THEN 
    154                ! No T-grid file. 
     164            IF(.NOT. ln_bdy_tra_frs .AND. .NOT. ln_bdy_ice_frs) THEN       ! No T-grid file. 
    155165               igrd_start = 2 
    156             ELSEIF ( .NOT. ln_bdy_dyn_frs ) THEN 
    157                ! No U-grid or V-grid file. 
     166            ELSEIF ( .NOT. ln_bdy_dyn_frs ) THEN                           ! No U-grid or V-grid file. 
    158167               igrd_end   = 1          
    159168            ENDIF 
     
    165174 
    166175               SELECT CASE( igrd ) 
    167                   CASE (1)  
    168                      numbdyt = inum 
    169                   CASE (2)  
    170                      numbdyu = inum 
    171                   CASE (3)  
    172                      numbdyv = inum 
     176                  CASE (1)   ;   numbdyt = inum 
     177                  CASE (2)   ;   numbdyu = inum 
     178                  CASE (3)   ;   numbdyv = inum 
    173179               END SELECT 
    174180 
     
    196202               IF(lwp) WRITE(numout,*) 'offset: ',zoffset 
    197203               IF(lwp) WRITE(numout,*) 'totime: ',totime 
    198                IF(lwp) WRITE(numout,*) 'zstepr: ',zstepr 
     204               IF(lwp) WRITE(numout,*) 'zstepr: ',zstepr(1:ntimes_bdy) 
    199205 
    200206               ! Check that there are not too many times in the file.  
     
    205211 
    206212               ! Check that time array increases: 
    207          
    208213               it = 1 
    209                DO WHILE( zstepr(it+1) > zstepr(it) .AND. it /= ntimes_bdy - 1 ) 
    210                  it = it + 1 
     214               DO WHILE( zstepr(it+1) > zstepr(it) .AND. it /= ntimes_bdy - 1 )  
     215                  it = it + 1 
    211216               END DO 
    212  
    213                IF( it.NE.ntimes_bdy-1 .AND. ntimes_bdy > 1 ) THEN 
     217               ! 
     218               IF( it /= ntimes_bdy-1 .AND. ntimes_bdy > 1 ) THEN 
    214219                     WRITE(ctmp1,*) 'Check file: ', clfile(igrd) 
    215220                     CALL ctl_stop( 'Time array in unstructured boundary data files',   & 
     
    227232               END IF 
    228233               ! 
    229                IF    ( igrd == 1 ) THEN 
    230                  ntimes_bdyt = ntimes_bdy 
    231                  zoffsett = zoffset 
    232                  istept(:) = INT( zstepr(:) + zoffset ) 
    233                ELSEIF(igrd == 2 ) THEN 
    234                  ntimes_bdyu = ntimes_bdy 
    235                  zoffsetu = zoffset 
    236                  istepu(:) = INT( zstepr(:) + zoffset ) 
    237                ELSEIF(igrd == 3 ) THEN 
    238                  ntimes_bdyv = ntimes_bdy 
    239                  zoffsetv = zoffset 
    240                  istepv(:) = INT( zstepr(:) + zoffset ) 
    241                ENDIF 
     234               SELECT CASE( igrd ) 
     235                  CASE (1) 
     236                    ntimes_bdyt = ntimes_bdy 
     237                    zoffsett = zoffset 
     238                    istept(:) = INT( zstepr(:) + zoffset ) 
     239                    numbdyt = inum 
     240                  CASE (2) 
     241                    ntimes_bdyu = ntimes_bdy 
     242                    zoffsetu = zoffset 
     243                    istepu(:) = INT( zstepr(:) + zoffset ) 
     244                    numbdyu = inum 
     245                  CASE (3) 
     246                    ntimes_bdyv = ntimes_bdy 
     247                    zoffsetv = zoffset 
     248                    istepv(:) = INT( zstepr(:) + zoffset ) 
     249                    numbdyv = inum 
     250               END SELECT 
    242251               ! 
    243252            END DO                                         ! end loop over T, U & V grid  
     
    259268            ENDIF 
    260269 
    261             IF( igrd_start == 1 ) THEN 
    262                istep(:) = istept(:) 
    263             ELSE 
    264                istep(:) = istepu(:) 
     270            IF( igrd_start == 1 ) THEN   ;   istep(:) = istept(:) 
     271            ELSE                         ;   istep(:) = istepu(:) 
    265272            ENDIF 
    266273 
     
    287294            it = 1 
    288295            DO WHILE( istep(it+1) <= 0 .AND. it <= ntimes_bdy - 1 ) 
    289               it = it + 1 
     296               it = it + 1 
    290297            END DO 
    291298            nbdy_b = it 
    292299            ! 
    293             WRITE(numout,*) 'Time offset is ',zoffset 
    294             WRITE(numout,*) 'First record to read is ',nbdy_b 
     300            IF(lwp) WRITE(numout,*) 'Time offset is ',zoffset 
     301            IF(lwp) WRITE(numout,*) 'First record to read is ',nbdy_b 
    295302 
    296303         ENDIF ! endif (nbdy_dta == 1) 
     
    300307         ! ***************************************************************** 
    301308 
    302          IF( nbdy_dta == 0) THEN      ! boundary data arrays are filled with initial conditions 
     309         IF( nbdy_dta == 0 ) THEN      ! boundary data arrays are filled with initial conditions 
    303310            ! 
    304311            IF (ln_bdy_tra_frs) THEN 
    305               igrd = 1            ! T-points data  
    306               DO ib = 1, nblen(igrd) 
    307                 ii = nbi(ib,igrd) 
    308                 ij = nbj(ib,igrd) 
    309                 DO ik = 1, jpkm1 
    310                   tbdy(ib,ik) = tn(ii, ij, ik) 
    311                   sbdy(ib,ik) = sn(ii, ij, ik) 
    312                 ENDDO 
    313               END DO 
     312               igrd = 1            ! T-points data  
     313               DO ib = 1, nblen(igrd) 
     314                  ii = nbi(ib,igrd) 
     315                  ij = nbj(ib,igrd) 
     316                  DO ik = 1, jpkm1 
     317                     tbdy(ib,ik) = tn(ii,ij,ik) 
     318                     sbdy(ib,ik) = sn(ii,ij,ik) 
     319                  END DO 
     320               END DO 
    314321            ENDIF 
    315322 
    316323            IF(ln_bdy_dyn_frs) THEN 
    317               igrd = 2            ! U-points data  
    318               DO ib = 1, nblen(igrd) 
    319                 ii = nbi(ib,igrd) 
    320                 ij = nbj(ib,igrd) 
    321                 DO ik = 1, jpkm1 
    322                   ubdy(ib,ik) = un(ii, ij, ik) 
    323                 ENDDO 
    324               END DO 
    325  
    326               igrd = 3            ! V-points data  
    327               DO ib = 1, nblen(igrd)             
    328                 ii = nbi(ib,igrd) 
    329                 ij = nbj(ib,igrd) 
    330                 DO ik = 1, jpkm1 
    331                   vbdy(ib,ik) = vn(ii, ij, ik) 
    332                 ENDDO 
    333               END DO 
     324               igrd = 2            ! U-points data  
     325               DO ib = 1, nblen(igrd) 
     326                  ii = nbi(ib,igrd) 
     327                  ij = nbj(ib,igrd) 
     328                  DO ik = 1, jpkm1 
     329                     ubdy(ib,ik) = un(ii, ij, ik) 
     330                  END DO 
     331               END DO 
     332               ! 
     333               igrd = 3            ! V-points data  
     334               DO ib = 1, nblen(igrd)             
     335                  ii = nbi(ib,igrd) 
     336                  ij = nbj(ib,igrd) 
     337                  DO ik = 1, jpkm1 
     338                     vbdy(ib,ik) = vn(ii, ij, ik) 
     339                  END DO 
     340               END DO 
    334341            ENDIF 
    335342            ! 
     343#if defined key_lim2 
     344            IF( ln_bdy_ice_frs ) THEN 
     345               igrd = 1            ! T-points data 
     346               DO ib = 1, nblen(igrd) 
     347                  frld_bdy (ib) =  frld(nbi(ib,igrd), nbj(ib,igrd)) 
     348                  hicif_bdy(ib) = hicif(nbi(ib,igrd), nbj(ib,igrd)) 
     349                  hsnif_bdy(ib) = hsnif(nbi(ib,igrd), nbj(ib,igrd)) 
     350               END DO 
     351            ENDIF 
     352#endif 
    336353         ELSEIF( nbdy_dta == 1 ) THEN    ! Set first record in the climatological case:    
    337354            ! 
     
    352369 
    353370            IF(ln_bdy_tra_frs) THEN 
     371               ! 
    354372               igrd = 1                                           ! Temperature 
    355373               IF( nblendta(igrd) <=  0 ) THEN  
     
    357375                  nblendta(igrd) = iom_file(numbdyt)%dimsz(1,idvar) 
    358376               ENDIF 
    359                WRITE(numout,*) 'Dim size for votemper is ', nblendta(igrd) 
     377               IF(lwp) WRITE(numout,*) 'Dim size for votemper is ', nblendta(igrd) 
    360378               ipi = nblendta(igrd) 
    361379               CALL iom_get ( numbdyt, jpdom_unknown, 'votemper', zdta(1:ipi,1:ipj,1:ipk), nbdy_a ) 
    362  
     380               ! 
    363381               DO ib = 1, nblen(igrd) 
    364382                  DO ik = 1, jpkm1 
     
    372390                  nblendta(igrd) = iom_file(numbdyt)%dimsz(1,idvar) 
    373391               ENDIF 
    374                WRITE(numout,*) 'Dim size for vosaline is ', nblendta(igrd) 
     392               IF(lwp) WRITE(numout,*) 'Dim size for vosaline is ', nblendta(igrd) 
    375393               ipi = nblendta(igrd) 
    376394               CALL iom_get ( numbdyt, jpdom_unknown, 'vosaline', zdta(1:ipi,1:ipj,1:ipk), nbdy_a ) 
    377  
     395               ! 
    378396               DO ib = 1, nblen(igrd) 
    379397                  DO ik = 1, jpkm1 
     
    383401            ENDIF  ! ln_bdy_tra_frs 
    384402  
    385             IF(ln_bdy_dyn_frs) THEN 
    386  
     403            IF( ln_bdy_dyn_frs ) THEN 
     404               ! 
    387405               igrd = 2                                           ! u-velocity 
    388406               IF ( nblendta(igrd) .le. 0 ) THEN  
     
    390408                 nblendta(igrd) = iom_file(numbdyu)%dimsz(1,idvar) 
    391409               ENDIF 
    392                WRITE(numout,*) 'Dim size for vozocrtx is ', nblendta(igrd) 
     410               IF(lwp) WRITE(numout,*) 'Dim size for vozocrtx is ', nblendta(igrd) 
    393411               ipi = nblendta(igrd) 
    394412               CALL iom_get ( numbdyu, jpdom_unknown,'vozocrtx',zdta(1:ipi,1:ipj,1:ipk),nbdy_a ) 
     
    404422                 nblendta(igrd) = iom_file(numbdyv)%dimsz(1,idvar) 
    405423               ENDIF 
    406                WRITE(numout,*) 'Dim size for vomecrty is ', nblendta(igrd) 
     424               IF(lwp) WRITE(numout,*) 'Dim size for vomecrty is ', nblendta(igrd) 
    407425               ipi = nblendta(igrd) 
    408426               CALL iom_get ( numbdyv, jpdom_unknown,'vomecrty',zdta(1:ipi,1:ipj,1:ipk),nbdy_a ) 
     
    414432            ENDIF ! ln_bdy_dyn_frs 
    415433 
    416  
    417             IF ((.NOT.ln_bdy_clim) .AND. (istep(1) > 0)) THEN 
    418                ! First data time is after start of run 
    419                ! Put first value in both time levels 
     434#if defined key_lim2 
     435            IF( ln_bdy_ice_frs ) THEN 
     436              ! 
     437              igrd=1                                              ! leads fraction 
     438              IF(lwp) WRITE(numout,*) 'Dim size for ildsconc is ',nblendta(igrd) 
     439              ipi=nblendta(igrd) 
     440              CALL iom_get ( numbdyt, jpdom_unknown,'ildsconc',zdta(1:ipi,:,1),nbdy_a ) 
     441              DO ib=1, nblen(igrd) 
     442                frld_bdydta(ib,2) =  zdta(nbmap(ib,igrd),1,1) 
     443              END DO 
     444              ! 
     445              igrd=1                                              ! ice thickness 
     446              IF(lwp) WRITE(numout,*) 'Dim size for iicethic is ',nblendta(igrd) 
     447              ipi=nblendta(igrd) 
     448              CALL iom_get ( numbdyt, jpdom_unknown,'iicethic',zdta(1:ipi,:,1),nbdy_a ) 
     449              DO ib=1, nblen(igrd) 
     450                hicif_bdydta(ib,2) =  zdta(nbmap(ib,igrd),1,1) 
     451              END DO 
     452              ! 
     453              igrd=1                                              ! snow thickness 
     454              IF(lwp) WRITE(numout,*) 'Dim size for isnowthi is ',nblendta(igrd) 
     455              ipi=nblendta(igrd) 
     456              CALL iom_get ( numbdyt, jpdom_unknown,'isnowthi',zdta(1:ipi,:,1),nbdy_a ) 
     457              DO ib=1, nblen(igrd) 
     458                hsnif_bdydta(ib,2) =  zdta(nbmap(ib,igrd),1,1) 
     459              END DO 
     460            ENDIF ! just if ln_bdy_ice_frs is set 
     461#endif 
     462 
     463            IF( .NOT.ln_bdy_clim .AND. istep(1) > 0 ) THEN     ! First data time is after start of run 
     464               nbdy_b = nbdy_a                                 ! Put first value in both time levels 
     465               IF( ln_bdy_tra_frs ) THEN 
     466                 tbdydta(:,:,1) = tbdydta(:,:,2) 
     467                 sbdydta(:,:,1) = sbdydta(:,:,2) 
     468               ENDIF 
     469               IF( ln_bdy_dyn_frs ) THEN 
     470                 ubdydta(:,:,1) = ubdydta(:,:,2) 
     471                 vbdydta(:,:,1) = vbdydta(:,:,2) 
     472               ENDIF 
     473#if defined key_lim2 
     474               IF( ln_bdy_ice_frs ) THEN 
     475                  frld_bdydta (:,1) =  frld_bdydta(:,2) 
     476                  hicif_bdydta(:,1) = hicif_bdydta(:,2) 
     477                  hsnif_bdydta(:,1) = hsnif_bdydta(:,2) 
     478               ENDIF 
     479#endif 
     480            END IF 
     481            ! 
     482         END IF   ! nbdy_dta == 0/1 
     483  
     484         ! In the case of constant boundary forcing fill bdy arrays once for all 
     485         IF( ln_bdy_clim .AND. ntimes_bdy == 1 ) THEN 
     486            IF( ln_bdy_tra_frs ) THEN 
     487               tbdy  (:,:) = tbdydta  (:,:,2) 
     488               sbdy  (:,:) = sbdydta  (:,:,2) 
     489            ENDIF 
     490            IF( ln_bdy_dyn_frs) THEN 
     491               ubdy  (:,:) = ubdydta  (:,:,2) 
     492               vbdy  (:,:) = vbdydta  (:,:,2) 
     493            ENDIF 
     494#if defined key_lim2 
     495            IF( ln_bdy_ice_frs ) THEN 
     496               frld_bdy (:) = frld_bdydta (:,2) 
     497               hicif_bdy(:) = hicif_bdydta(:,2) 
     498               hsnif_bdy(:) = hsnif_bdydta(:,2) 
     499            ENDIF 
     500#endif 
     501 
     502            IF( ln_bdy_tra_frs .OR. ln_bdy_ice_frs) CALL iom_close( numbdyt ) 
     503            IF( ln_bdy_dyn_frs                    ) CALL iom_close( numbdyu ) 
     504            IF( ln_bdy_dyn_frs                    ) CALL iom_close( numbdyv ) 
     505         END IF 
     506         ! 
     507      ENDIF                                            ! End if nit000 
     508 
     509 
     510      !                                                !---------------------! 
     511      IF( nbdy_dta == 1 .AND. ntimes_bdy > 1 ) THEN    !  at each time step  ! 
     512         !                                             !---------------------! 
     513         ! Read one more record if necessary 
     514         !********************************** 
     515 
     516         IF( ln_bdy_clim .AND. imois /= nbdy_b ) THEN      ! remember that nbdy_b=0 for kt=nit000 
     517            nbdy_b = imois 
     518            nbdy_a = imois + 1 
     519            nbdy_b = MOD( nbdy_b, iman )   ;   IF( nbdy_b == 0 ) nbdy_b = iman 
     520            nbdy_a = MOD( nbdy_a, iman )   ;   IF( nbdy_a == 0 ) nbdy_a = iman 
     521            lect=.true. 
     522         ELSEIF( .NOT.ln_bdy_clim .AND. itimer >= istep(nbdy_a) ) THEN 
     523 
     524            IF( nbdy_a < ntimes_bdy ) THEN 
     525               nbdy_b = nbdy_a 
     526               nbdy_a = nbdy_a + 1 
     527               lect  =.true. 
     528            ELSE 
     529               ! We have reached the end of the file 
     530               ! put the last data time into both time levels 
    420531               nbdy_b = nbdy_a 
    421532               IF(ln_bdy_tra_frs) THEN 
    422                  tbdydta(:,:,1) = tbdydta(:,:,2) 
    423                  sbdydta(:,:,1) = sbdydta(:,:,2) 
     533                  tbdydta(:,:,1) = tbdydta(:,:,2) 
     534                  sbdydta(:,:,1) = sbdydta(:,:,2) 
    424535               ENDIF 
    425536               IF(ln_bdy_dyn_frs) THEN 
    426                  ubdydta(:,:,1) = ubdydta(:,:,2) 
    427                  vbdydta(:,:,1) = vbdydta(:,:,2) 
    428                ENDIF 
    429             END IF 
    430  
    431          END IF ! nbdy_dta == 0/1 
    432   
    433          ! In the case of constant boundary forcing fill bdy arrays once for all 
    434          IF ((ln_bdy_clim).AND.(ntimes_bdy==1)) THEN 
    435             IF(ln_bdy_tra_frs) THEN 
    436               tbdy  (:,:) = tbdydta  (:,:,2) 
    437               sbdy  (:,:) = sbdydta  (:,:,2) 
    438             ENDIF 
    439             IF(ln_bdy_dyn_frs) THEN 
    440               ubdy  (:,:) = ubdydta  (:,:,2) 
    441               vbdy  (:,:) = vbdydta  (:,:,2) 
    442             ENDIF 
    443  
    444             IF(ln_bdy_tra_frs .or. ln_bdy_ice_frs) CALL iom_close( numbdyt ) 
    445             IF(ln_bdy_dyn_frs) CALL iom_close( numbdyu ) 
    446             IF(ln_bdy_dyn_frs) CALL iom_close( numbdyv ) 
    447          END IF 
    448  
    449       ENDIF                                            ! End if nit000 
    450  
    451  
    452       !                                                !---------------------! 
    453       !                                                !  at each time step  ! 
    454       !                                                !---------------------! 
    455  
    456       IF( nbdy_dta == 1 .AND. ntimes_bdy > 1 ) THEN  
    457          ! 
    458          ! Read one more record if necessary 
    459          !********************************** 
    460  
    461         IF( ln_bdy_clim .AND. imois /= nbdy_b ) THEN      ! remember that nbdy_b=0 for kt=nit000 
    462            nbdy_b = imois 
    463            nbdy_a = imois + 1 
    464            nbdy_b = MOD( nbdy_b, iman )   ;   IF( nbdy_b == 0 ) nbdy_b = iman 
    465            nbdy_a = MOD( nbdy_a, iman )   ;   IF( nbdy_a == 0 ) nbdy_a = iman 
    466            lect=.true. 
    467         ELSEIF( .NOT.ln_bdy_clim .AND. itimer >= istep(nbdy_a) ) THEN 
    468  
    469            IF ( nbdy_a < ntimes_bdy ) THEN 
    470               nbdy_b = nbdy_a 
    471               nbdy_a = nbdy_a + 1 
    472               lect  =.true. 
    473            ELSE 
    474               ! We have reached the end of the file 
    475               ! put the last data time into both time levels 
    476               nbdy_b = nbdy_a 
    477               IF(ln_bdy_tra_frs) THEN 
    478                 tbdydta(:,:,1) =  tbdydta(:,:,2) 
    479                 sbdydta(:,:,1) =  sbdydta(:,:,2) 
    480               ENDIF 
    481               IF(ln_bdy_dyn_frs) THEN 
    482                 ubdydta(:,:,1) =  ubdydta(:,:,2) 
    483                 vbdydta(:,:,1) =  vbdydta(:,:,2) 
    484               ENDIF 
     537                  ubdydta(:,:,1) =  ubdydta(:,:,2) 
     538                  vbdydta(:,:,1) =  vbdydta(:,:,2) 
     539               ENDIF 
     540#if defined key_lim2 
     541               IF(ln_bdy_ice_frs) THEN 
     542                  frld_bdydta (:,1) =  frld_bdydta (:,2) 
     543                  hicif_bdydta(:,1) =  hicif_bdydta(:,2) 
     544                  hsnif_bdydta(:,1) =  hsnif_bdydta(:,2) 
     545               ENDIF 
     546#endif 
    485547            END IF ! nbdy_a < ntimes_bdy 
    486  
     548            ! 
    487549        END IF 
    488550          
    489         IF( lect ) THEN 
    490            ! Swap arrays 
    491            IF(ln_bdy_tra_frs) THEN 
     551        IF( lect ) THEN           ! Swap arrays 
     552           IF( ln_bdy_tra_frs ) THEN 
    492553             tbdydta(:,:,1) =  tbdydta(:,:,2) 
    493554             sbdydta(:,:,1) =  sbdydta(:,:,2) 
    494555           ENDIF 
    495            IF(ln_bdy_dyn_frs) THEN 
     556           IF( ln_bdy_dyn_frs ) THEN 
    496557             ubdydta(:,:,1) =  ubdydta(:,:,2) 
    497558             vbdydta(:,:,1) =  vbdydta(:,:,2) 
    498559           ENDIF 
    499   
     560#if defined key_lim2 
     561           IF( ln_bdy_ice_frs ) THEN 
     562             frld_bdydta (:,1) =  frld_bdydta (:,2) 
     563             hicif_bdydta(:,1) =  hicif_bdydta(:,2) 
     564             hsnif_bdydta(:,1) =  hsnif_bdydta(:,2) 
     565           ENDIF 
     566#endif  
    500567           ! read another set 
    501568           ipj  = 1 
    502569           ipk  = jpk 
    503570 
    504            IF(ln_bdy_tra_frs) THEN 
     571           IF( ln_bdy_tra_frs ) THEN 
    505572              !  
    506573              igrd = 1                                   ! temperature 
     
    543610              END DO 
    544611           ENDIF ! ln_bdy_dyn_frs 
    545  
     612           ! 
     613#if defined key_lim2 
     614           IF(ln_bdy_ice_frs) THEN 
     615             ! 
     616             igrd = 1                                    ! ice concentration 
     617             ipi=nblendta(igrd) 
     618             CALL iom_get ( numbdyt, jpdom_unknown,'ildsconc',zdta(1:ipi,:,1),nbdy_a ) 
     619             DO ib=1, nblen(igrd) 
     620               frld_bdydta(ib,2) =  zdta( nbmap(ib,igrd), 1, 1 ) 
     621             END DO 
     622             ! 
     623             igrd=1                                      ! ice thickness 
     624             ipi=nblendta(igrd) 
     625             CALL iom_get ( numbdyt, jpdom_unknown,'iicethic',zdta(1:ipi,:,1),nbdy_a ) 
     626             DO ib=1, nblen(igrd) 
     627               hicif_bdydta(ib,2) =  zdta( nbmap(ib,igrd), 1, 1 ) 
     628             END DO 
     629             ! 
     630             igrd=1                                      ! snow thickness 
     631             ipi=nblendta(igrd) 
     632             CALL iom_get ( numbdyt, jpdom_unknown,'isnowthi',zdta(1:ipi,:,1),nbdy_a ) 
     633             DO ib=1, nblen(igrd) 
     634               hsnif_bdydta(ib,2) =  zdta( nbmap(ib,igrd), 1, 1 ) 
     635             END DO 
     636           ENDIF ! ln_bdy_ice_frs 
     637#endif 
    546638           ! 
    547639           IF(lwp) WRITE(numout,*) 'bdy_dta : first record file used nbdy_b ',nbdy_b 
     
    559651       ! ******************** 
    560652       !  
    561        IF( ln_bdy_clim ) THEN   ;   zxy = REAL( nday                  , wp ) / REAL( nmonth_len(nbdy_b), wp ) + 0.5 - i15 
    562        ELSE                     ;   zxy = REAL( istep(nbdy_b) - itimer, wp ) / REAL( istep(nbdy_b) - istep(nbdy_a), wp ) 
     653       IF( ln_bdy_clim ) THEN   ;   zxy = REAL( nday                   ) / REAL( nmonth_len(nbdy_b) ) + 0.5 - i15 
     654       ELSEIF( istep(nbdy_b) == istep(nbdy_a) ) THEN  
     655                                    zxy = 0.0_wp 
     656       ELSE                     ;   zxy = REAL( istep(nbdy_b) - itimer ) / REAL( istep(nbdy_b) - istep(nbdy_a) ) 
    563657       END IF 
    564658 
     
    589683          ENDIF 
    590684 
     685#if defined key_lim2 
     686          IF(ln_bdy_ice_frs) THEN 
     687            igrd=1 
     688            DO ib=1, nblen(igrd) 
     689               frld_bdy(ib) = zxy *  frld_bdydta(ib,2) + (1.-zxy) *  frld_bdydta(ib,1) 
     690              hicif_bdy(ib) = zxy * hicif_bdydta(ib,2) + (1.-zxy) * hicif_bdydta(ib,1) 
     691              hsnif_bdy(ib) = zxy * hsnif_bdydta(ib,2) + (1.-zxy) * hsnif_bdydta(ib,1) 
     692            END DO 
     693          ENDIF ! just if ln_bdy_ice_frs is true 
     694#endif 
     695 
    591696      END IF                       !end if ((nbdy_dta==1).AND.(ntimes_bdy>1)) 
    592697     
     
    602707      ! 
    603708      ENDIF ! ln_bdy_dyn_frs .OR. ln_bdy_tra_frs 
    604  
     709      ! 
    605710   END SUBROUTINE bdy_dta 
    606711 
    607712 
    608    SUBROUTINE bdy_dta_bt( kt, jit ) 
     713   SUBROUTINE bdy_dta_bt( kt, jit, icycl ) 
    609714      !!--------------------------------------------------------------------------- 
    610715      !!                      ***  SUBROUTINE bdy_dta_bt  *** 
     
    620725      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index 
    621726      INTEGER, INTENT( in ) ::   jit         ! barotropic time step index 
     727      INTEGER, INTENT( in ) ::   icycl       ! number of cycles need for final file close 
    622728      !                                      ! (for timesplitting option, otherwise zero) 
    623729      !! 
     
    639745      REAL(wp), DIMENSION(jpbtime)      ::   zstepr             ! REAL time array from data files 
    640746      REAL(wp), DIMENSION(jpbdta,1)     ::   zdta               ! temporary array for data fields 
    641       CHARACTER(LEN=80), DIMENSION(3)   ::   clfile 
     747      CHARACTER(LEN=80), DIMENSION(6)   ::   clfile 
    642748      CHARACTER(LEN=70 )                ::   clunits            ! units attribute of time coordinate 
    643749      !!--------------------------------------------------------------------------- 
     
    688794 
    689795      !                                                !-------------------! 
    690       IF( kt == nit000 ) THEN                          !  First call only  ! 
     796      IF( kt == nit000 .and. jit ==2 ) THEN            !  First call only  ! 
    691797         !                                             !-------------------! 
    692798         istep_bt(:) = 0 
     
    712818                                                     ! necessary time dumps in file are included 
    713819 
    714           clfile(1) = filbdy_data_bt_T 
    715           clfile(2) = filbdy_data_bt_U 
    716           clfile(3) = filbdy_data_bt_V 
    717  
    718           DO igrd = 1,3 
     820          clfile(4) = filbdy_data_bt_T 
     821          clfile(5) = filbdy_data_bt_U 
     822          clfile(6) = filbdy_data_bt_V 
     823 
     824          DO igrd = 4,6 
    719825 
    720826            CALL iom_open( clfile(igrd), inum ) 
    721             CALL iom_gettime( inum, zstepr, kntime=ntimes_bdy, cdunits=clunits )  
     827            CALL iom_gettime( inum, zstepr, kntime=ntimes_bdy_bt, cdunits=clunits )  
    722828 
    723829            SELECT CASE( igrd ) 
    724                CASE (1)  
    725                   numbdyt = inum 
    726                CASE (2)  
    727                   numbdyu = inum 
    728                CASE (3)  
    729                   numbdyv = inum 
     830               CASE (4)  
     831                  numbdyt_bt = inum 
     832               CASE (5)  
     833                  numbdyu_bt = inum 
     834               CASE (6)  
     835                  numbdyv_bt = inum 
    730836            END SELECT 
    731837 
     
    757863 
    758864            ! Check that time array increases (or interp will fail): 
    759             DO it = 2, ntimes_bdy 
     865            DO it = 2, ntimes_bdy_bt 
    760866               IF ( zstepr(it-1) >= zstepr(it) ) THEN 
    761867                  CALL ctl_stop('Time array in unstructured boundary data file', & 
     
    778884               ! The same applies to the last time level: see setting of lect below. 
    779885 
    780                IF ( ntimes_bdy == 1 ) CALL ctl_stop( & 
     886               IF ( ntimes_bdy_bt == 1 ) CALL ctl_stop( & 
    781887                    'There is only one time dump in data files', & 
    782888                    'Set ln_bdy_clim=.true. in namelist for constant bdy forcing.' ) 
    783889 
    784890               zinterval_s = zstepr(2) - zstepr(1) 
    785                zinterval_e = zstepr(ntimes_bdy) - zstepr(ntimes_bdy-1) 
    786  
    787                IF ( zstepr(1) - zinterval_s / 2.0 > 0 ) THEN              
    788                   IF(lwp) WRITE(numout,*) 'First bdy time relative to nit000:', zstepr(1) 
    789                   IF(lwp) WRITE(numout,*) 'Interval between first two times: ', zinterval_s 
    790                   CALL ctl_stop( 'First data time is after start of run', &  
    791                        'by more than half a meaning period', & 
    792                        'Check file: ' // TRIM(clfile(igrd)) ) 
     891               zinterval_e = zstepr(ntimes_bdy_bt) - zstepr(ntimes_bdy_bt-1) 
     892 
     893               IF( zstepr(1) + zoffset > 0 ) THEN 
     894                     WRITE(ctmp1,*) 'Check file: ', clfile(igrd) 
     895                     CALL ctl_stop( 'First time dump in bdy file is after model initial time', ctmp1 ) 
    793896               END IF 
    794  
    795                IF ( zstepr(ntimes_bdy) + zinterval_e / 2.0 < totime ) THEN 
    796                   IF(lwp) WRITE(numout,*) 'Last bdy time relative to nit000:', zstepr(ntimes_bdy) 
    797                   IF(lwp) WRITE(numout,*) 'Interval between last two times: ', zinterval_e 
    798                   CALL ctl_stop( 'Last data time is before end of run', &  
    799                        'by more than half a meaning period', & 
    800                        'Check file: ' // TRIM(clfile(igrd))  ) 
     897               IF( zstepr(ntimes_bdy_bt) + zoffset < totime ) THEN 
     898                     WRITE(ctmp1,*) 'Check file: ', clfile(igrd) 
     899                     CALL ctl_stop( 'Last time dump in bdy file is before model final time', ctmp1 ) 
    801900               END IF 
    802  
    803901            END IF ! .NOT. ln_bdy_clim 
    804902 
    805             IF ( igrd .EQ. 1) THEN 
     903            IF ( igrd .EQ. 4) THEN 
    806904              ntimes_bdyt = ntimes_bdy_bt 
    807905              zoffsett = zoffset 
    808906              istept(:) = INT( zstepr(:) + zoffset ) 
    809             ELSE IF (igrd .EQ. 2) THEN 
     907            ELSE IF (igrd .EQ. 5) THEN 
    810908              ntimes_bdyu = ntimes_bdy_bt 
    811909              zoffsetu = zoffset 
    812910              istepu(:) = INT( zstepr(:) + zoffset ) 
    813             ELSE IF (igrd .EQ. 3) THEN 
     911            ELSE IF (igrd .EQ. 6) THEN 
    814912              ntimes_bdyv = ntimes_bdy_bt 
    815913              zoffsetv = zoffset 
     
    865963          nbdy_b_bt = it 
    866964 
    867           WRITE(numout,*) 'Time offset is ',zoffset 
    868           WRITE(numout,*) 'First record to read is ',nbdy_b_bt 
     965          IF(lwp) WRITE(numout,*) 'Time offset is ',zoffset 
     966          IF(lwp) WRITE(numout,*) 'First record to read is ',nbdy_b_bt 
    869967 
    870968        ENDIF ! endif (nbdy_dta == 1) 
     
    875973        IF ( nbdy_dta == 0) THEN 
    876974          ! boundary data arrays are filled with initial conditions 
    877           igrd = 2            ! U-points data  
     975          igrd = 5            ! U-points data  
    878976          DO ib = 1, nblen(igrd)               
    879977            ubtbdy(ib) = un(nbi(ib,igrd), nbj(ib,igrd), 1) 
    880978          END DO 
    881979 
    882           igrd = 3            ! V-points data  
     980          igrd = 6            ! V-points data  
    883981          DO ib = 1, nblen(igrd)               
    884982            vbtbdy(ib) = vn(nbi(ib,igrd), nbj(ib,igrd), 1) 
    885983          END DO 
    886984 
    887           igrd = 1            ! T-points data  
     985          igrd = 4            ! T-points data  
    888986          DO ib = 1, nblen(igrd)               
    889987            sshbdy(ib) = sshn(nbi(ib,igrd), nbj(ib,igrd)) 
     
    9101008         ! Read first record: 
    9111009          ipj=1 
    912           igrd=1 
     1010          igrd=4 
    9131011          ipi=nblendta(igrd) 
    9141012 
    9151013          ! ssh 
    916           igrd=1 
     1014          igrd=4 
    9171015          IF ( nblendta(igrd) .le. 0 ) THEN  
    9181016            idvar = iom_varid( numbdyt_bt,'sossheig' ) 
     
    9291027  
    9301028          ! u-velocity 
    931           igrd=2 
     1029          igrd=5 
    9321030          IF ( nblendta(igrd) .le. 0 ) THEN  
    9331031            idvar = iom_varid( numbdyu_bt,'vobtcrtx' ) 
     
    9441042 
    9451043          ! v-velocity 
    946           igrd=3 
     1044          igrd=6 
    9471045          IF ( nblendta(igrd) .le. 0 ) THEN  
    9481046            idvar = iom_varid( numbdyv_bt,'vobtcrty' ) 
     
    10101108          ipj=1 
    10111109          ipk=jpk 
    1012           igrd=1 
     1110          igrd=4 
    10131111          ipi=nblendta(igrd) 
    10141112 
    10151113           
    10161114          ! ssh 
    1017           igrd=1 
     1115          igrd=4 
    10181116          ipi=nblendta(igrd) 
    10191117 
     
    10251123 
    10261124          ! u-velocity 
    1027           igrd=2 
     1125          igrd=5 
    10281126          ipi=nblendta(igrd) 
    10291127 
     
    10351133 
    10361134          ! v-velocity 
    1037           igrd=3 
     1135          igrd=6 
    10381136          ipi=nblendta(igrd) 
    10391137 
     
    10641162        END IF 
    10651163 
    1066           igrd=1 
     1164          igrd=4 
    10671165          DO ib=1, nblen(igrd) 
    10681166            sshbdy(ib) = zxy      * sshbdydta(ib,2) + & 
     
    10701168          END DO 
    10711169 
    1072           igrd=2 
     1170          igrd=5 
    10731171          DO ib=1, nblen(igrd) 
    10741172            ubtbdy(ib) = zxy      * ubtbdydta(ib,2) + & 
     
    10761174          END DO 
    10771175 
    1078           igrd=3 
     1176          igrd=6 
    10791177          DO ib=1, nblen(igrd) 
    10801178            vbtbdy(ib) = zxy      * vbtbdydta(ib,2) + & 
     
    10901188 
    10911189      ! Closing of the 3 files 
    1092       IF( kt == nitend ) THEN 
     1190      IF( kt == nitend   .and. jit == icycl ) THEN 
    10931191          CALL iom_close( numbdyt_bt ) 
    10941192          CALL iom_close( numbdyu_bt ) 
     
    11091207      WRITE(*,*) 'bdy_dta: You should not have seen this print! error?', kt 
    11101208   END SUBROUTINE bdy_dta 
    1111    SUBROUTINE bdy_dta_bt( kt, kit )      ! Empty routine 
     1209   SUBROUTINE bdy_dta_bt( kt, kit, icycle )      ! Empty routine 
    11121210      WRITE(*,*) 'bdy_dta: You should not have seen this print! error?', kt, kit 
    11131211   END SUBROUTINE bdy_dta_bt 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdydyn.F90

    • Property svn:executable deleted
    r1740 r2236  
    88   !!            3.0  !  2008-04  (NEMO team)  add in the reference version 
    99   !!            3.2  !  2008-04  (R. Benshila) consider velocity instead of transport  
     10   !!            3.3  !  2010-09  (E.O'Dea) modifications for Shelf configurations  
     11   !!            3.3  !  2010-09  (D.Storkey) add ice boundary conditions 
    1012   !!---------------------------------------------------------------------- 
    1113#if defined key_bdy  
     
    3436 
    3537   !!---------------------------------------------------------------------- 
    36    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     38   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    3739   !! $Id$  
    38    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3941   !!---------------------------------------------------------------------- 
    40  
    4142CONTAINS 
    4243 
     
    5455      INTEGER, INTENT( in ) ::   kt   ! Main time step counter 
    5556      !! 
    56       INTEGER  ::   ib, ik, igrd      ! dummy loop indices 
    57       INTEGER  ::   ii, ij            ! 2D addresses 
    58       REAL(wp) ::   zwgt              ! boundary weight 
     57      INTEGER  ::   jb, jk         ! dummy loop indices 
     58      INTEGER  ::   ii, ij, igrd   ! local integers 
     59      REAL(wp) ::   zwgt           ! boundary weight 
    5960      !!---------------------------------------------------------------------- 
    6061      ! 
    61       IF(ln_bdy_dyn_frs) THEN ! If this is false, then this routine does nothing.  
    62  
     62      IF(ln_bdy_dyn_frs) THEN       ! If this is false, then this routine does nothing.  
     63         ! 
    6364         IF( kt == nit000 ) THEN 
    6465            IF(lwp) WRITE(numout,*) 
     
    6869         ! 
    6970         igrd = 2                      ! Relaxation of zonal velocity 
    70          DO ib = 1, nblen(igrd) 
    71             DO ik = 1, jpkm1 
    72                ii = nbi(ib,igrd) 
    73                ij = nbj(ib,igrd) 
    74                zwgt = nbw(ib,igrd) 
    75                ua(ii,ij,ik) = ( ua(ii,ij,ik) * ( 1.- zwgt ) + ubdy(ib,ik) * zwgt ) * umask(ii,ij,ik) 
     71         DO jb = 1, nblen(igrd) 
     72            DO jk = 1, jpkm1 
     73               ii   = nbi(jb,igrd) 
     74               ij   = nbj(jb,igrd) 
     75               zwgt = nbw(jb,igrd) 
     76               ua(ii,ij,jk) = ( ua(ii,ij,jk) * ( 1.- zwgt ) + ubdy(jb,jk) * zwgt ) * umask(ii,ij,jk) 
    7677            END DO 
    7778         END DO 
    7879         ! 
    7980         igrd = 3                      ! Relaxation of meridional velocity 
    80          DO ib = 1, nblen(igrd) 
    81             DO ik = 1, jpkm1 
    82                ii = nbi(ib,igrd) 
    83                ij = nbj(ib,igrd) 
    84                zwgt = nbw(ib,igrd) 
    85                va(ii,ij,ik) = ( va(ii,ij,ik) * ( 1.- zwgt ) + vbdy(ib,ik) * zwgt ) * vmask(ii,ij,ik) 
     81         DO jb = 1, nblen(igrd) 
     82            DO jk = 1, jpkm1 
     83               ii   = nbi(jb,igrd) 
     84               ij   = nbj(jb,igrd) 
     85               zwgt = nbw(jb,igrd) 
     86               va(ii,ij,jk) = ( va(ii,ij,jk) * ( 1.- zwgt ) + vbdy(jb,jk) * zwgt ) * vmask(ii,ij,jk) 
    8687            END DO 
    8788         END DO  
    88          ! 
    89          CALL lbc_lnk( ua, 'U', -1. )   ! Boundary points should be updated 
    90          CALL lbc_lnk( va, 'V', -1. )   ! 
     89         CALL lbc_lnk( ua, 'U', -1. )   ;   CALL lbc_lnk( va, 'V', -1. )   ! Boundary points should be updated 
    9190         ! 
    9291      ENDIF ! ln_bdy_dyn_frs 
    93  
     92      ! 
    9493   END SUBROUTINE bdy_dyn_frs 
    9594 
    9695 
    97 #if defined key_dynspg_exp || defined key_dynspg_ts 
     96# if defined   key_dynspg_exp   ||   defined key_dynspg_ts 
     97   !!---------------------------------------------------------------------- 
     98   !!   'key_dynspg_exp'        OR              explicit sea surface height 
     99   !!   'key_dynspg_ts '                  split-explicit sea surface height 
     100   !!---------------------------------------------------------------------- 
     101    
    98102!! Option to use Flather with dynspg_flt not coded yet... 
     103 
    99104   SUBROUTINE bdy_dyn_fla( pssh ) 
    100105      !!---------------------------------------------------------------------- 
     
    119124      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pssh 
    120125 
    121       INTEGER  ::   ib, igrd                         ! dummy loop indices 
     126      INTEGER  ::   jb, igrd                         ! dummy loop indices 
    122127      INTEGER  ::   ii, ij, iim1, iip1, ijm1, ijp1   ! 2D addresses 
    123128      REAL(wp) ::   zcorr                            ! Flather correction 
     
    132137 
    133138         ! Fill temporary array with ssh data (here spgu): 
    134          igrd = 1 
     139         igrd = 4 
    135140         spgu(:,:) = 0.0 
    136          DO ib = 1, nblenrim(igrd) 
    137             ii = nbi(ib,igrd) 
    138             ij = nbj(ib,igrd) 
    139             IF( ln_bdy_dyn_fla ) spgu(ii, ij) = sshbdy(ib) 
    140             IF( ln_bdy_tides )   spgu(ii, ij) = spgu(ii, ij) + sshtide(ib) 
     141         DO jb = 1, nblenrim(igrd) 
     142            ii = nbi(jb,igrd) 
     143            ij = nbj(jb,igrd) 
     144            IF( ln_bdy_dyn_fla ) spgu(ii, ij) = sshbdy(jb) 
     145            IF( ln_bdy_tides )   spgu(ii, ij) = spgu(ii, ij) + sshtide(jb) 
    141146         END DO 
    142147         ! 
    143          igrd = 2      ! Flather bc on u-velocity;  
     148         igrd = 5      ! Flather bc on u-velocity;  
    144149         !             ! remember that flagu=-1 if normal velocity direction is outward 
    145150         !             ! I think we should rather use after ssh ? 
    146          DO ib = 1, nblenrim(igrd) 
    147             ii  = nbi(ib,igrd) 
    148             ij  = nbj(ib,igrd)  
    149             iim1 = ii + MAX( 0, INT( flagu(ib) ) )   ! T pts i-indice inside the boundary 
    150             iip1 = ii - MIN( 0, INT( flagu(ib) ) )   ! T pts i-indice outside the boundary  
     151         DO jb = 1, nblenrim(igrd) 
     152            ii  = nbi(jb,igrd) 
     153            ij  = nbj(jb,igrd)  
     154            iim1 = ii + MAX( 0, INT( flagu(jb) ) )   ! T pts i-indice inside the boundary 
     155            iip1 = ii - MIN( 0, INT( flagu(jb) ) )   ! T pts i-indice outside the boundary  
    151156            ! 
    152             zcorr = - flagu(ib) * SQRT( grav * hur_e(ii, ij) ) * ( pssh(iim1, ij) - spgu(iip1,ij) ) 
    153             zforc = ubtbdy(ib) + utide(ib) 
     157            zcorr = - flagu(jb) * SQRT( grav * hur_e(ii, ij) ) * ( pssh(iim1, ij) - spgu(iip1,ij) ) 
     158            zforc = ubtbdy(jb) + utide(jb) 
    154159            ua_e(ii,ij) = zforc + zcorr * umask(ii,ij,1)  
    155160         END DO 
    156161         ! 
    157          igrd = 3      ! Flather bc on v-velocity 
     162         igrd = 6      ! Flather bc on v-velocity 
    158163         !             ! remember that flagv=-1 if normal velocity direction is outward 
    159          DO ib = 1, nblenrim(igrd) 
    160             ii  = nbi(ib,igrd) 
    161             ij  = nbj(ib,igrd)  
    162             ijm1 = ij + MAX( 0, INT( flagv(ib) ) )   ! T pts j-indice inside the boundary 
    163             ijp1 = ij - MIN( 0, INT( flagv(ib) ) )   ! T pts j-indice outside the boundary  
     164         DO jb = 1, nblenrim(igrd) 
     165            ii  = nbi(jb,igrd) 
     166            ij  = nbj(jb,igrd)  
     167            ijm1 = ij + MAX( 0, INT( flagv(jb) ) )   ! T pts j-indice inside the boundary 
     168            ijp1 = ij - MIN( 0, INT( flagv(jb) ) )   ! T pts j-indice outside the boundary  
    164169            ! 
    165             zcorr = - flagv(ib) * SQRT( grav * hvr_e(ii, ij) ) * ( pssh(ii, ijm1) - spgu(ii,ijp1) ) 
    166             zforc = vbtbdy(ib) + vtide(ib) 
     170            zcorr = - flagv(jb) * SQRT( grav * hvr_e(ii, ij) ) * ( pssh(ii, ijm1) - spgu(ii,ijp1) ) 
     171            zforc = vbtbdy(jb) + vtide(jb) 
    167172            va_e(ii,ij) = zforc + zcorr * vmask(ii,ij,1) 
    168173         END DO 
     174         CALL lbc_lnk( ua_e, 'U', -1. )   ! Boundary points should be updated 
     175         CALL lbc_lnk( va_e, 'V', -1. )   ! 
    169176         ! 
    170177      ENDIF ! ln_bdy_dyn_fla .or. ln_bdy_tides 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdyini.F90

    • Property svn:executable deleted
    r1528 r2236  
    88   !!             -   !  2007-01  (D. Storkey) Tidal forcing 
    99   !!            3.0  !  2008-04  (NEMO team)  add in the reference version 
     10   !!            3.3  !  2010-09  (E.O'Dea) updates for Shelf configurations 
     11   !!            3.3  !  2010-09  (D.Storkey) add ice boundary conditions 
    1012   !!---------------------------------------------------------------------- 
    1113#if defined key_bdy 
     
    1719   USE oce             ! ocean dynamics and tracers variables 
    1820   USE dom_oce         ! ocean space and time domain 
     21   USE obc_par         ! ocean open boundary conditions 
    1922   USE bdy_oce         ! unstructured open boundary conditions 
    2023   USE bdytides        ! tides at open boundaries initialization (tide_init routine) 
     
    3033 
    3134   !!---------------------------------------------------------------------- 
    32    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     35   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    3336   !! $Id$  
    34    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    35    !!--------------------------------------------------------------------------------- 
    36  
     37   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
     38   !!---------------------------------------------------------------------- 
    3739CONTAINS 
    3840    
     
    4850      !! 
    4951      !! ** Input   :  bdy_init.nc, input file for unstructured open boundaries 
    50       !! 
    5152      !!----------------------------------------------------------------------       
    5253      INTEGER ::   ii, ij, ik, igrd, ib, ir   ! dummy loop indices 
     
    5455      INTEGER ::   ib_len, ibr_max 
    5556      INTEGER ::   iw, ie, is, in  
    56       INTEGER ::   inum                 ! temporary logical unit 
    57       INTEGER ::   id_dummy             ! temporary integers 
     57      INTEGER ::   inum                 ! local logical unit 
     58      INTEGER ::   id_dummy             ! local integers 
    5859      INTEGER ::   igrd_start, igrd_end ! start and end of loops on igrd 
    5960      INTEGER, DIMENSION (2)             ::   kdimsz 
     
    6364      REAL(wp) , DIMENSION(jpidta,jpjdta) ::   zmask           ! global domain mask 
    6465      REAL(wp) , DIMENSION(jpbdta,1)      ::   zdta            ! temporary array  
    65       CHARACTER(LEN=80),DIMENSION(3)      ::   clfile 
     66      CHARACTER(LEN=80),DIMENSION(6)      ::   clfile 
    6667      !! 
    6768      NAMELIST/nambdy/filbdy_mask, filbdy_data_T, filbdy_data_U, filbdy_data_V,          & 
     69         &            filbdy_data_bt_T, filbdy_data_bt_U, filbdy_data_bt_V,              & 
    6870         &            ln_bdy_tides, ln_bdy_clim, ln_bdy_vol, ln_bdy_mask,                & 
    69          &            ln_bdy_dyn_fla, ln_bdy_dyn_frs, ln_bdy_tra_frs,                    & 
    70          &            nbdy_dta   , nb_rimwidth  , volbdy 
     71         &            ln_bdy_dyn_fla, ln_bdy_dyn_frs, ln_bdy_tra_frs,ln_bdy_ice_frs,     & 
     72         &            nbdy_dta, nb_rimwidth, volbdy 
    7173      !!---------------------------------------------------------------------- 
    7274 
     
    7577      IF(lwp) WRITE(numout,*) '~~~~~~~~' 
    7678      ! 
    77       IF( jperio /= 0 ) CALL ctl_stop( 'Cyclic or symmetric,',   & 
    78            ' and unstructured open boundary condition are not compatible' ) 
    79  
    80 #if defined key_obc 
    81       CALL ctl_stop( 'Straight open boundaries,',   & 
    82            ' and unstructured open boundaries are not compatible' ) 
    83 #endif 
    84  
    85       ! Read namelist parameters 
     79      IF( jperio /= 0 )   CALL ctl_stop( 'Cyclic or symmetric,',   & 
     80         &                               ' and unstructured open boundary condition are not compatible' ) 
     81 
     82      IF( lk_obc      )   CALL ctl_stop( 'Straight open boundaries,',   & 
     83         &                               ' and unstructured open boundaries are not compatible' ) 
     84 
    8685      ! --------------------------- 
    87       REWIND( numnam ) 
     86      REWIND( numnam )                    ! Read namelist parameters 
    8887      READ  ( numnam, nambdy ) 
    8988 
    90       ! control prints 
     89      !                                   ! control prints 
    9190      IF(lwp) WRITE(numout,*) '         nambdy' 
    9291 
    93       ! Check nbdy_dta value 
     92      !                                         ! check type of data used (nbdy_dta value) 
    9493      IF(lwp) WRITE(numout,*) 'nbdy_dta =', nbdy_dta       
    95       IF(lwp) WRITE(numout,*) ' ' 
    96       SELECT CASE( nbdy_dta ) 
    97       CASE( 0 ) 
    98         IF(lwp) WRITE(numout,*) '         initial state used for bdy data'         
    99       CASE( 1 ) 
    100         IF(lwp) WRITE(numout,*) '         boundary data taken from file' 
    101       CASE DEFAULT 
    102         CALL ctl_stop( 'nbdy_dta must be 0 or 1' ) 
     94      IF(lwp) WRITE(numout,*) 
     95      SELECT CASE( nbdy_dta )                   !  
     96      CASE( 0 )      ;   IF(lwp) WRITE(numout,*) '      initial state used for bdy data'         
     97      CASE( 1 )      ;   IF(lwp) WRITE(numout,*) '      boundary data taken from file' 
     98      CASE DEFAULT   ;   CALL ctl_stop( 'nbdy_dta must be 0 or 1' ) 
    10399      END SELECT 
    104100 
    105       IF(lwp) WRITE(numout,*) ' ' 
     101      IF(lwp) WRITE(numout,*) 
    106102      IF(lwp) WRITE(numout,*) 'Boundary rim width for the FRS nb_rimwidth = ', nb_rimwidth 
    107103 
    108       IF(lwp) WRITE(numout,*) ' ' 
    109       IF(lwp) WRITE(numout,*) '         volbdy = ', volbdy 
    110  
    111       IF (ln_bdy_vol) THEN 
    112         SELECT CASE ( volbdy ) ! Check volbdy value 
    113         CASE( 1 ) 
    114           IF(lwp) WRITE(numout,*) '         The total volume will be constant' 
    115         CASE( 0 ) 
    116           IF(lwp) WRITE(numout,*) '         The total volume will vary according' 
    117           IF(lwp) WRITE(numout,*) '         to the surface E-P flux' 
    118         CASE DEFAULT 
    119           CALL ctl_stop( 'volbdy must be 0 or 1' ) 
    120         END SELECT 
     104      IF(lwp) WRITE(numout,*) 
     105      IF(lwp) WRITE(numout,*) '      volbdy = ', volbdy 
     106 
     107      IF( ln_bdy_vol ) THEN                     ! check volume conservation (volbdy value) 
     108         SELECT CASE ( volbdy ) 
     109         CASE( 1 )      ;   IF(lwp) WRITE(numout,*) '      The total volume will be constant' 
     110         CASE( 0 )      ;   IF(lwp) WRITE(numout,*) '      The total volume will vary according to the surface E-P flux' 
     111         CASE DEFAULT   ;   CALL ctl_stop( 'volbdy must be 0 or 1' ) 
     112         END SELECT 
     113         IF(lwp) WRITE(numout,*) 
    121114      ELSE 
    122         IF(lwp) WRITE(numout,*) 'No volume correction with unstructured open boundaries' 
    123         IF(lwp) WRITE(numout,*) ' ' 
    124       ENDIF 
    125  
    126       IF (ln_bdy_tides) THEN 
    127         IF(lwp) WRITE(numout,*) ' ' 
     115         IF(lwp) WRITE(numout,*) 'No volume correction with unstructured open boundaries' 
     116         IF(lwp) WRITE(numout,*) 
     117      ENDIF 
     118 
     119      IF( ln_bdy_tides ) THEN 
    128120        IF(lwp) WRITE(numout,*) 'Tidal harmonic forcing at unstructured open boundaries' 
    129         IF(lwp) WRITE(numout,*) ' ' 
    130       ENDIF 
    131  
    132       IF (ln_bdy_dyn_fla) THEN 
    133         IF(lwp) WRITE(numout,*) ' ' 
     121        IF(lwp) WRITE(numout,*) 
     122      ENDIF 
     123 
     124      IF( ln_bdy_dyn_fla ) THEN 
    134125        IF(lwp) WRITE(numout,*) 'Flather condition on U, V at unstructured open boundaries' 
    135         IF(lwp) WRITE(numout,*) ' ' 
    136       ENDIF 
    137  
    138       IF (ln_bdy_dyn_frs) THEN 
    139         IF(lwp) WRITE(numout,*) ' ' 
     126        IF(lwp) WRITE(numout,*) 
     127      ENDIF 
     128 
     129      IF( ln_bdy_dyn_frs ) THEN 
    140130        IF(lwp) WRITE(numout,*) 'FRS condition on U and V at unstructured open boundaries' 
    141         IF(lwp) WRITE(numout,*) ' ' 
    142       ENDIF 
    143  
    144       IF (ln_bdy_tra_frs) THEN 
    145         IF(lwp) WRITE(numout,*) ' ' 
     131        IF(lwp) WRITE(numout,*) 
     132      ENDIF 
     133 
     134      IF( ln_bdy_tra_frs ) THEN 
    146135        IF(lwp) WRITE(numout,*) 'FRS condition on T & S fields at unstructured open boundaries' 
    147         IF(lwp) WRITE(numout,*) ' ' 
    148       ENDIF 
    149  
    150       ! Read tides namelist  
    151       ! ------------------------ 
    152       IF( ln_bdy_tides )   CALL tide_init 
     136        IF(lwp) WRITE(numout,*) 
     137      ENDIF 
     138 
     139      IF( ln_bdy_ice_frs ) THEN 
     140        IF(lwp) WRITE(numout,*) 'FRS condition on ice fields at unstructured open boundaries' 
     141        IF(lwp) WRITE(numout,*) 
     142      ENDIF 
     143 
     144      IF( ln_bdy_tides )   CALL tide_init      ! Read tides namelist  
     145 
    153146 
    154147      ! Read arrays defining unstructured open boundaries 
     
    160153      !          = 0  elsewhere    
    161154  
    162       IF( cp_cfg == "eel" .AND. jp_cfg == 5 ) THEN 
     155      IF( cp_cfg == "eel" .AND. jp_cfg == 5 ) THEN          ! EEL configuration at 5km resolution 
    163156         zmask(         :                ,:) = 0.e0 
    164157         zmask(jpizoom+1:jpizoom+jpiglo-2,:) = 1.e0           
    165       ELSE IF ( ln_bdy_mask ) THEN 
     158      ELSE IF( ln_bdy_mask ) THEN 
    166159         CALL iom_open( filbdy_mask, inum ) 
    167160         CALL iom_get ( inum, jpdom_data, 'bdy_msk', zmask(:,:) ) 
     
    171164      ENDIF 
    172165 
    173       ! Save mask over local domain       
    174       DO ij = 1, nlcj 
     166      DO ij = 1, nlcj      ! Save mask over local domain       
    175167         DO ii = 1, nlci 
    176168            bdytmask(ii,ij) = zmask( mig(ii), mjg(ij) ) 
     
    187179         END DO 
    188180      END DO 
    189  
    190       ! Lateral boundary conditions 
    191       CALL lbc_lnk( bdyumask(:,:), 'U', 1. ) 
    192       CALL lbc_lnk( bdyvmask(:,:), 'V', 1. ) 
     181      CALL lbc_lnk( bdyumask(:,:), 'U', 1. )   ;   CALL lbc_lnk( bdyvmask(:,:), 'V', 1. )      ! Lateral boundary cond. 
     182 
    193183 
    194184      ! Read discrete distance and mapping indices 
     
    200190      IF( cp_cfg == "eel" .AND. jp_cfg == 5 ) THEN 
    201191         icount = 0 
    202          ! Define west boundary (from ii=2 to ii=1+nb_rimwidth): 
    203          DO ir = 1, nb_rimwidth          
     192         DO ir = 1, nb_rimwidth                  ! Define west boundary (from ii=2 to ii=1+nb_rimwidth): 
    204193            DO ij = 3, jpjglo-2 
    205                icount=icount+1 
     194               icount = icount + 1 
    206195               nbidta(icount,:) = ir + 1 + (jpizoom-1) 
    207                nbjdta(icount,:) = ij + (jpjzoom-1)  
     196               nbjdta(icount,:) = ij     + (jpjzoom-1)  
    208197               nbrdta(icount,:) = ir 
    209198            END DO 
    210199         END DO 
    211  
    212          ! Define east boundary (from ii=jpiglo-1 to ii=jpiglo-nb_rimwidth): 
    213          DO ir=1,nb_rimwidth          
     200         ! 
     201         DO ir = 1, nb_rimwidth                  ! Define east boundary (from ii=jpiglo-1 to ii=jpiglo-nb_rimwidth): 
    214202            DO ij=3,jpjglo-2 
    215                icount=icount+1 
     203               icount = icount + 1 
    216204               nbidta(icount,:) = jpiglo-ir + (jpizoom-1) 
    217205               nbidta(icount,2) = jpiglo-ir-1 + (jpizoom-1) ! special case for u points 
     
    220208            END DO 
    221209         END DO 
    222              
     210         !        
    223211      ELSE            ! Read indices and distances in unstructured boundary data files  
    224  
    225          IF( ln_bdy_tides ) THEN  
    226             ! Read tides input files for preference in case there are 
    227             ! no bdydata files.  
    228             clfile(1) = TRIM(filtide)//TRIM(tide_cpt(1))//'_grid_T.nc' 
    229             clfile(2) = TRIM(filtide)//TRIM(tide_cpt(1))//'_grid_U.nc' 
    230             clfile(3) = TRIM(filtide)//TRIM(tide_cpt(1))//'_grid_V.nc' 
    231          ELSE 
     212         ! 
     213         IF( ln_bdy_tides ) THEN             ! Read tides input files for preference in case there are no bdydata files 
     214            clfile(4) = TRIM(filtide)//TRIM(tide_cpt(1))//'_grid_T.nc' 
     215            clfile(5) = TRIM(filtide)//TRIM(tide_cpt(1))//'_grid_U.nc' 
     216            clfile(6) = TRIM(filtide)//TRIM(tide_cpt(1))//'_grid_V.nc' 
     217         ENDIF 
     218         IF( ln_bdy_dyn_fla .AND. .NOT. ln_bdy_tides ) THEN  
     219            clfile(4) = filbdy_data_bt_T 
     220            clfile(5) = filbdy_data_bt_U 
     221            clfile(6) = filbdy_data_bt_V 
     222         ENDIF 
     223 
     224         IF( ln_bdy_tra_frs ) THEN  
    232225            clfile(1) = filbdy_data_T 
     226            IF( .NOT. ln_bdy_dyn_frs ) THEN  
     227               clfile(2) = filbdy_data_T     ! Dummy read re read T file for sake of 6 files 
     228               clfile(3) = filbdy_data_T     ! 
     229            ENDIF 
     230         ENDIF           
     231         IF( ln_bdy_dyn_frs ) THEN  
     232            IF( .NOT. ln_bdy_tra_frs )   clfile(1) = filbdy_data_U      ! Dummy Read  
    233233            clfile(2) = filbdy_data_U 
    234             clfile(3) = filbdy_data_V 
    235          ENDIF           
    236  
    237          ! how many files are we to read in? 
    238          igrd_start = 1 
    239          igrd_end   = 3 
    240          IF(.NOT. ln_bdy_tides ) THEN 
    241             IF(.NOT. (ln_bdy_dyn_fla) .AND..NOT. (ln_bdy_tra_frs)) THEN 
    242                ! No T-grid file. 
    243                igrd_start = 2 
    244             ELSEIF ( .NOT. ln_bdy_dyn_frs .AND..NOT. ln_bdy_dyn_fla ) THEN 
    245                ! No U-grid or V-grid file. 
    246                igrd_end   = 1          
    247             ENDIF 
     234            clfile(3) = filbdy_data_V  
     235         ENDIF 
     236 
     237         !                                   ! how many files are we to read in? 
     238         IF(ln_bdy_tides .OR. ln_bdy_dyn_fla)   igrd_start = 4 
     239         ! 
     240         IF(ln_bdy_tra_frs    ) THEN   ;   igrd_start = 1 
     241         ELSEIF(ln_bdy_dyn_frs) THEN   ;   igrd_start = 2 
     242         ENDIF 
     243         ! 
     244         IF( ln_bdy_tra_frs   )   igrd_end = 1 
     245         ! 
     246         IF(ln_bdy_dyn_fla .OR. ln_bdy_tides) THEN   ;   igrd_end = 6 
     247         ELSEIF( ln_bdy_dyn_frs             ) THEN   ;   igrd_end = 3 
    248248         ENDIF 
    249249 
     
    251251            CALL iom_open( clfile(igrd), inum ) 
    252252            id_dummy = iom_varid( inum, 'nbidta', kdimsz=kdimsz )   
    253             WRITE(numout,*) 'kdimsz : ',kdimsz 
     253            IF(lwp) WRITE(numout,*) 'kdimsz : ',kdimsz 
    254254            ib_len = kdimsz(1) 
    255             IF( ib_len > jpbdta) CALL ctl_stop(          & 
    256                 'Boundary data array in file too long.', & 
    257                 'File :', TRIM(clfile(igrd)),            & 
    258                 'increase parameter jpbdta.' ) 
     255            IF( ib_len > jpbdta)   CALL ctl_stop(  'Boundary data array in file too long.',                  & 
     256                &                                  'File :', TRIM(clfile(igrd)),'increase parameter jpbdta.' ) 
    259257 
    260258            CALL iom_get( inum, jpdom_unknown, 'nbidta', zdta(1:ib_len,:) ) 
     
    264262            CALL iom_get( inum, jpdom_unknown, 'nbjdta', zdta(1:ib_len,:) ) 
    265263            DO ii = 1,ib_len 
    266               nbjdta(ii,igrd) = INT( zdta(ii,1) ) 
    267             END DO 
    268             CALL iom_get ( inum, jpdom_unknown, 'nbrdta', zdta(1:ib_len,:) ) 
     264               nbjdta(ii,igrd) = INT( zdta(ii,1) ) 
     265            END DO 
     266            CALL iom_get( inum, jpdom_unknown, 'nbrdta', zdta(1:ib_len,:) ) 
    269267            DO ii = 1,ib_len 
    270               nbrdta(ii,igrd) = INT( zdta(ii,1) ) 
     268               nbrdta(ii,igrd) = INT( zdta(ii,1) ) 
    271269            END DO 
    272270            CALL iom_close( inum ) 
    273271 
    274             ! Check that rimwidth in file is big enough: 
    275             ibr_max = MAXVAL( nbrdta(:,igrd) ) 
    276             IF(lwp) WRITE(numout,*) 
    277             IF(lwp) WRITE(numout,*) ' Maximum rimwidth in file is ', ibr_max 
    278             IF(lwp) WRITE(numout,*) ' nb_rimwidth from namelist is ', nb_rimwidth 
    279             IF (ibr_max < nb_rimwidth) CALL ctl_stop( & 
    280                 'nb_rimwidth is larger than maximum rimwidth in file' ) 
     272            IF( igrd < 4) THEN            ! Check that rimwidth in file is big enough for Frs case(barotropic is one): 
     273               ibr_max = MAXVAL( nbrdta(:,igrd) ) 
     274               IF(lwp) WRITE(numout,*) 
     275               IF(lwp) WRITE(numout,*) ' Maximum rimwidth in file is ', ibr_max 
     276               IF(lwp) WRITE(numout,*) ' nb_rimwidth from namelist is ', nb_rimwidth 
     277               IF (ibr_max < nb_rimwidth)   CALL ctl_stop( 'nb_rimwidth is larger than maximum rimwidth in file' ) 
     278            ENDIF !Check igrd < 4 
    281279            ! 
    282280         END DO 
     
    293291 
    294292      DO igrd = igrd_start, igrd_end 
    295         icount  = 0 
    296         icountr = 0 
    297         nblen(igrd) = 0 
    298         nblenrim(igrd) = 0 
    299         nblendta(igrd) = 0 
    300         DO ir=1, nb_rimwidth 
    301           DO ib = 1, jpbdta 
    302           ! check if point is in local domain and equals ir 
    303             IF(  nbidta(ib,igrd) >= iw .AND. nbidta(ib,igrd) <= ie .AND.   & 
    304                & nbjdta(ib,igrd) >= is .AND. nbjdta(ib,igrd) <= in .AND.   & 
    305                & nbrdta(ib,igrd) == ir  ) THEN 
    306                ! 
    307                icount = icount  + 1 
    308                ! 
    309                IF( ir == 1 )   icountr = icountr+1 
     293         icount  = 0 
     294         icountr = 0 
     295         nblen   (igrd) = 0 
     296         nblenrim(igrd) = 0 
     297         nblendta(igrd) = 0 
     298         DO ir=1, nb_rimwidth 
     299            DO ib = 1, jpbdta 
     300               ! check if point is in local domain and equals ir 
     301               IF(  nbidta(ib,igrd) >= iw .AND. nbidta(ib,igrd) <= ie .AND.   & 
     302                  & nbjdta(ib,igrd) >= is .AND. nbjdta(ib,igrd) <= in .AND.   & 
     303                  & nbrdta(ib,igrd) == ir  ) THEN 
     304                  ! 
     305                  icount = icount  + 1 
     306                  ! 
     307                  IF( ir == 1 )   icountr = icountr+1 
    310308                  IF (icount > jpbdim) THEN 
    311309                     IF(lwp) WRITE(numout,*) 'bdy_ini: jpbdim too small' 
     
    328326      DO igrd = igrd_start, igrd_end 
    329327         DO ib = 1, nblen(igrd) 
    330             ! tanh formulation 
    331             nbw(ib,igrd) = 1.- TANH( FLOAT( nbr(ib,igrd) - 1 ) *0.5 ) 
    332             ! quadratic 
    333 !           nbw(ib,igrd) = (FLOAT(nb_rimwidth+1-nbr(ib,igrd))/FLOAT(nb_rimwidth))**2 
    334             ! linear 
    335 !           nbw(ib,igrd) =  FLOAT(nb_rimwidth+1-nbr(ib,igrd))/FLOAT(nb_rimwidth) 
     328            nbw(ib,igrd) = 1.- TANH( FLOAT( nbr(ib,igrd) - 1 ) *0.5 )                     ! tanh formulation 
     329!           nbw(ib,igrd) = (FLOAT(nb_rimwidth+1-nbr(ib,igrd))/FLOAT(nb_rimwidth))**2      ! quadratic 
     330!           nbw(ib,igrd) =  FLOAT(nb_rimwidth+1-nbr(ib,igrd))/FLOAT(nb_rimwidth)          ! linear 
    336331         END DO 
    337332      END DO  
     
    384379 
    385380      ! Lateral boundary conditions 
    386       CALL lbc_lnk( fmask        , 'F', 1. ) 
    387       CALL lbc_lnk( bdytmask(:,:), 'T', 1. ) 
    388       CALL lbc_lnk( bdyumask(:,:), 'U', 1. ) 
    389       CALL lbc_lnk( bdyvmask(:,:), 'V', 1. ) 
     381      CALL lbc_lnk( fmask        , 'F', 1. )   ;   CALL lbc_lnk( bdytmask(:,:), 'T', 1. ) 
     382      CALL lbc_lnk( bdyumask(:,:), 'U', 1. )   ;   CALL lbc_lnk( bdyvmask(:,:), 'V', 1. ) 
    390383 
    391384      IF( ln_bdy_vol .OR. ln_bdy_dyn_fla ) THEN      ! Indices and directions of rim velocity components 
     
    437430      ! Compute total lateral surface for volume correction: 
    438431      ! ---------------------------------------------------- 
    439   
    440432      bdysurftot = 0.e0  
    441433      IF( ln_bdy_vol ) THEN   
     
    455447               &                    * tmask_i(nbi(ib,igrd),nbj(ib,igrd)+1) 
    456448         END DO 
    457  
     449         ! 
    458450         IF( lk_mpp )   CALL mpp_sum( bdysurftot )      ! sum over the global domain 
    459451      END IF    
     
    468460      ubtbdy(:) = 0.e0 
    469461      vbtbdy(:) = 0.e0 
     462#if defined key_lim2 
     463      frld_bdy(:) = 0.e0 
     464      hicif_bdy(:) = 0.e0 
     465      hsnif_bdy(:) = 0.e0 
     466#endif 
    470467 
    471468      ! Read in tidal constituents and adjust for model start time 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdytides.F90

    • Property svn:executable deleted
    r1715 r2236  
    77   !!            2.3  !  2008-01  (J.Holt)  Add date correction. Origins POLCOMS v6.3 2007 
    88   !!            3.0  !  2008-04  (NEMO team)  add in the reference version 
     9   !!            3.3  !  2010-09  (D.Storkey and E.O'Dea)  bug fixes 
    910   !!---------------------------------------------------------------------- 
    1011#if defined key_bdy 
     
    3132   USE bdy_par         ! Unstructured boundary parameters 
    3233   USE bdy_oce         ! ocean open boundary conditions 
     34   USE daymod          ! calendar 
    3335 
    3436   IMPLICIT NONE 
     
    3941   PUBLIC   tide_update   ! routine called in bdydyn 
    4042 
    41    LOGICAL, PUBLIC            ::   ln_tide_date            !: =T correct tide phases and amplitude for model start date 
    42  
    43    INTEGER, PARAMETER ::   jptides_max = 15      !: Max number of tidal contituents 
    44    INTEGER            ::   ntide                 !: Actual number of tidal constituents 
     43   LOGICAL, PUBLIC            ::   ln_tide_date          !: =T correct tide phases and amplitude for model start date 
     44   INTEGER, PUBLIC, PARAMETER ::   jptides_max = 15      !: Max number of tidal contituents 
     45   INTEGER, PUBLIC            ::   ntide                 !: Actual number of tidal constituents 
    4546 
    4647   CHARACTER(len=80), PUBLIC                         ::   filtide    !: Filename root for tidal input files 
    4748   CHARACTER(len= 4), PUBLIC, DIMENSION(jptides_max) ::   tide_cpt   !: Names of tidal components used. 
    4849 
    49    INTEGER , DIMENSION(jptides_max) ::   nindx        !: ??? 
    50    REAL(wp), DIMENSION(jptides_max) ::   tide_speed   !: Phase speed of tidal constituent (deg/hr) 
     50   INTEGER , PUBLIC, DIMENSION(jptides_max) ::   nindx        !: ??? 
     51   REAL(wp), PUBLIC, DIMENSION(jptides_max) ::   tide_speed   !: Phase speed of tidal constituent (deg/hr) 
    5152    
    52    REAL(wp), DIMENSION(jpbdim,jptides_max)  ::   ssh1, ssh2   !: Tidal constituents : SSH 
    53    REAL(wp), DIMENSION(jpbdim,jptides_max)  ::   u1  , u2     !: Tidal constituents : U 
    54    REAL(wp), DIMENSION(jpbdim,jptides_max)  ::   v1  , v2     !: Tidal constituents : V 
     53   REAL(wp), DIMENSION(jpbdim,jptides_max)  ::   ssh1, ssh2   ! Tidal constituents : SSH 
     54   REAL(wp), DIMENSION(jpbdim,jptides_max)  ::   u1  , u2     ! Tidal constituents : U 
     55   REAL(wp), DIMENSION(jpbdim,jptides_max)  ::   v1  , v2     ! Tidal constituents : V 
    5556    
    5657   !!---------------------------------------------------------------------- 
    57    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     58   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    5859   !! $Id$  
    59    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     60   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6061   !!---------------------------------------------------------------------- 
    61  
    6262CONTAINS 
    6363 
     
    8787      !                                               ! Count number of components specified 
    8888      ntide = jptides_max 
    89       itide = 1 
    90       DO WHILE( tide_cpt(itide) /= '' ) 
    91          ntide = itide 
    92          itide = itide + 1 
     89      DO itide = 1, jptides_max 
     90        IF( tide_cpt(itide) == '' ) THEN 
     91           ntide = itide-1 
     92           exit 
     93        ENDIF 
    9394      END DO 
     95 
    9496      !                                               ! find constituents in standard list 
    9597      DO itide = 1, ntide 
     
    145147      CHARACTER(len=80) :: clfile         ! full file name for tidal input file  
    146148      INTEGER ::   ipi, ipj, inum, idvar  ! temporary integers (netcdf read) 
    147       INTEGER, DIMENSION(3) :: lendta=0   ! length of data in the file (note may be different from nblendta!) 
     149      INTEGER, DIMENSION(6) :: lendta=0   ! length of data in the file (note may be different from nblendta!) 
    148150      REAL(wp) ::  z_arg, z_atde, z_btde, z1t, z2t            
    149151      REAL(wp), DIMENSION(jpbdta,1) ::   zdta   ! temporary array for data fields 
     
    161163         IF(lwp) WRITE(numout,*) 'Reading data from file ', clfile 
    162164         CALL iom_open( clfile, inum ) 
    163          igrd = 1 
     165         igrd = 4 
    164166         IF( nblendta(igrd) <= 0 ) THEN  
    165167            idvar = iom_varid( inum,'z1' ) 
     
    183185         IF(lwp) WRITE(numout,*) 'Reading data from file ', clfile 
    184186         CALL iom_open( clfile, inum ) 
    185          igrd = 2 
     187         igrd = 5 
    186188         IF( lendta(igrd) <= 0 ) THEN  
    187189            idvar = iom_varid( inum,'u1' ) 
     
    204206         if(lwp) write(numout,*) 'Reading data from file ', clfile 
    205207         CALL iom_open( clfile, inum ) 
    206          igrd = 3 
     208         igrd = 6 
    207209         IF( lendta(igrd) <= 0 ) THEN  
    208210            idvar = iom_varid( inum,'v1' ) 
     
    252254            ENDIF 
    253255            !                                         !  elevation          
    254             igrd = 1 
     256            igrd = 4 
    255257            DO ib = 1, nblenrim(igrd)                 
    256258               z1t = z_atde * ssh1(ib,itide) + z_btde * ssh2(ib,itide) 
     
    260262            END DO 
    261263            !                                         !  u        
    262             igrd = 2 
     264            igrd = 5 
    263265            DO ib = 1, nblenrim(igrd)                 
    264266               z1t = z_atde * u1(ib,itide) + z_btde * u2(ib,itide) 
     
    268270            END DO 
    269271            !                                         !  v        
    270             igrd = 3 
     272            igrd = 6 
    271273            DO ib = 1, nblenrim(igrd)                 
    272274               z1t = z_atde * v1(ib,itide) + z_btde * v2(ib,itide) 
     
    320322      ! 
    321323      DO itide = 1, ntide 
    322          igrd=1                              ! SSH on tracer grid. 
     324         igrd=4                              ! SSH on tracer grid. 
    323325         DO ib = 1, nblenrim(igrd) 
    324326            sshtide(ib) =sshtide(ib)+ ssh1(ib,itide)*z_cost(itide) + ssh2(ib,itide)*z_sist(itide) 
    325327            !    if(lwp) write(numout,*) 'z',ib,itide,sshtide(ib), ssh1(ib,itide),ssh2(ib,itide) 
    326328         END DO 
    327          igrd=2                              ! U grid 
     329         igrd=5                              ! U grid 
    328330         DO ib=1, nblenrim(igrd) 
    329331            utide(ib) = utide(ib)+ u1(ib,itide)*z_cost(itide) + u2(ib,itide)*z_sist(itide) 
    330332            !    if(lwp) write(numout,*) 'u',ib,itide,utide(ib), u1(ib,itide),u2(ib,itide) 
    331333         END DO 
    332          igrd=3                              ! V grid 
     334         igrd=6                              ! V grid 
    333335         DO ib=1, nblenrim(igrd) 
    334336            vtide(ib) = vtide(ib)+ v1(ib,itide)*z_cost(itide) + v2(ib,itide)*z_sist(itide) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdytra.F90

    • Property svn:executable deleted
    r1146 r2236  
    2525 
    2626   !!---------------------------------------------------------------------- 
    27    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     27   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    2828   !! $Id$  
    29    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     29   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3030   !!---------------------------------------------------------------------- 
    31  
    3231CONTAINS 
    3332 
     
    4847      !!---------------------------------------------------------------------- 
    4948      ! 
    50       IF(ln_bdy_tra_frs) THEN ! If this is false, then this routine does nothing.  
    51  
    52       IF( kt == nit000 ) THEN 
    53          IF(lwp) WRITE(numout,*) 
    54          IF(lwp) WRITE(numout,*) 'bdy_tra : Flow Relaxation Scheme for tracers' 
    55          IF(lwp) WRITE(numout,*) '~~~~~~~' 
    56       ENDIF 
     49      IF(ln_bdy_tra_frs) THEN       ! If this is false, then this routine does nothing.  
     50         ! 
     51         IF( kt == nit000 ) THEN 
     52            IF(lwp) WRITE(numout,*) 
     53            IF(lwp) WRITE(numout,*) 'bdy_tra : Flow Relaxation Scheme for tracers' 
     54            IF(lwp) WRITE(numout,*) '~~~~~~~' 
     55         ENDIF 
     56         ! 
     57         igrd = 1                       ! Everything is at T-points here 
     58         DO ib = 1, nblen(igrd) 
     59            DO ik = 1, jpkm1 
     60               ii = nbi(ib,igrd) 
     61               ij = nbj(ib,igrd) 
     62               zwgt = nbw(ib,igrd) 
     63               ta(ii,ij,ik) = ( ta(ii,ij,ik) * (1.-zwgt) + tbdy(ib,ik) * zwgt ) * tmask(ii,ij,ik)          
     64               sa(ii,ij,ik) = ( sa(ii,ij,ik) * (1.-zwgt) + sbdy(ib,ik) * zwgt ) * tmask(ii,ij,ik) 
     65            END DO 
     66         END DO  
     67         ! 
     68         CALL lbc_lnk( ta, 'T', 1. )   ; CALL lbc_lnk( sa, 'T', 1. )    ! Boundary points should be updated 
     69         ! 
     70      ENDIF ! ln_bdy_tra_frs 
    5771      ! 
    58       igrd = 1                       ! Everything is at T-points here 
    59       DO ib = 1, nblen(igrd) 
    60          DO ik = 1, jpkm1 
    61             ii = nbi(ib,igrd) 
    62             ij = nbj(ib,igrd) 
    63             zwgt = nbw(ib,igrd) 
    64             ta(ii,ij,ik) = ( ta(ii,ij,ik) * (1.-zwgt) + tbdy(ib,ik) * zwgt ) * tmask(ii,ij,ik)          
    65             sa(ii,ij,ik) = ( sa(ii,ij,ik) * (1.-zwgt) + sbdy(ib,ik) * zwgt ) * tmask(ii,ij,ik) 
    66         END DO 
    67       END DO  
    68       ! 
    69       CALL lbc_lnk( ta, 'T', 1. )   ! Boundary points should be updated 
    70       CALL lbc_lnk( sa, 'T', 1. )   ! 
    71       ! 
    72       ENDIF ! ln_bdy_tra_frs 
    73  
    7472   END SUBROUTINE bdy_tra 
    7573    
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/BDY/bdyvol.F90

    • Property svn:executable deleted
    r2000 r2236  
    1111#if   defined key_bdy   &&   defined key_dynspg_flt 
    1212   !!---------------------------------------------------------------------- 
    13    !!   'key_bdy'            and      unstructured open boundary conditions 
     13   !!   'key_bdy'            AND      unstructured open boundary conditions 
    1414   !!   'key_dynspg_flt'                              filtered free surface 
    1515   !!---------------------------------------------------------------------- 
     
    3030#  include "domzgr_substitute.h90" 
    3131   !!---------------------------------------------------------------------- 
    32    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     32   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    3333   !! $Id$  
    34    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     34   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3535   !!---------------------------------------------------------------------- 
    36  
    3736CONTAINS 
    3837 
     
    7372      INTEGER  ::   ji, jj, jk, jb, jgrd 
    7473      INTEGER  ::   ii, ij 
    75       REAL(wp) ::   zubtpecor, z_cflxemp, ztranst, zraur 
     74      REAL(wp) ::   zubtpecor, z_cflxemp, ztranst 
    7675      !!----------------------------------------------------------------------------- 
    7776 
     
    8483      ! Calculate the cumulate surface Flux z_cflxemp (m3/s) over all the domain 
    8584      ! ----------------------------------------------------------------------- 
    86       z_cflxemp = 0.e0 
    87       zraur = 1.e0 / rau0 
    88       z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:) ) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) * zraur )  
    89       IF( lk_mpp )   CALL mpp_sum( z_cflxemp )   ! sum over the global domain 
     85      z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:) ) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) ) / rau0 
     86      IF( lk_mpp )   CALL mpp_sum( z_cflxemp )     ! sum over the global domain 
    9087 
    91       ! Barotropic velocity through the unstructured open boundary 
    92       ! ---------------------------------------------------------- 
     88      ! Transport through the unstructured open boundary 
     89      ! ------------------------------------------------ 
    9390      zubtpecor = 0.e0 
    9491      jgrd = 2                               ! cumulate u component contribution first  
     
    112109      ! The normal velocity correction 
    113110      ! ------------------------------ 
    114       IF (volbdy==1) THEN   ;   zubtpecor = ( zubtpecor - z_cflxemp) / bdysurftot  
    115       ELSE                  ;   zubtpecor =   zubtpecor             / bdysurftot 
     111      IF( volbdy==1 ) THEN   ;   zubtpecor = ( zubtpecor - z_cflxemp) / bdysurftot  
     112      ELSE                   ;   zubtpecor =   zubtpecor             / bdysurftot 
    116113      END IF 
    117114 
     
    141138      ! Check the cumulated transport through unstructured OBC once barotropic velocities corrected 
    142139      ! ------------------------------------------------------ 
    143  
    144140      IF( lwp .AND. MOD( kt, nwrite ) == 0) THEN 
    145141         IF(lwp) WRITE(numout,*) 
Note: See TracChangeset for help on using the changeset viewer.