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 2528 for trunk/NEMOGCM/NEMO/OPA_SRC/BDY – NEMO

Ignore:
Timestamp:
2010-12-27T18:33:53+01:00 (13 years ago)
Author:
rblod
Message:

Update NEMOGCM from branch nemo_v3_3_beta

Location:
trunk/NEMOGCM/NEMO/OPA_SRC/BDY
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90

    • Property svn:executable deleted
    r1170 r2528  
    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  
     
    2021   !! Namelist variables 
    2122   !!---------------------------------------------------------------------- 
    22    CHARACTER(len=80) ::   filbdy_mask        !: Name of unstruct. bdy mask file 
    23    CHARACTER(len=80) ::   filbdy_data_T      !: Name of unstruct. bdy data file at T points 
    24    CHARACTER(len=80) ::   filbdy_data_U      !: Name of unstruct. bdy data file at U points 
    25    CHARACTER(len=80) ::   filbdy_data_V      !: Name of unstruct. bdy data file at V points 
    26    CHARACTER(len=80) ::   filbdy_data_bt_T   !: Name of unstruct. bdy data file at T points for barotropic variables 
    27    CHARACTER(len=80) ::   filbdy_data_bt_U   !: Name of unstruct. bdy data file at U points for barotropic variables 
    28    CHARACTER(len=80) ::   filbdy_data_bt_V   !: Name of unstruct. bdy data file at V points for barotropic variables 
     23   CHARACTER(len=80) ::   cn_mask        !: Name of unstruct. bdy mask file 
     24   CHARACTER(len=80) ::   cn_dta_frs_T   !: Name of unstruct. bdy data file at T points for FRS conditions 
     25   CHARACTER(len=80) ::   cn_dta_frs_U   !: Name of unstruct. bdy data file at U points for FRS conditions 
     26   CHARACTER(len=80) ::   cn_dta_frs_V   !: Name of unstruct. bdy data file at V points for FRS conditions 
     27   CHARACTER(len=80) ::   cn_dta_fla_T   !: Name of unstruct. bdy data file at T points for Flather scheme 
     28   CHARACTER(len=80) ::   cn_dta_fla_U   !: Name of unstruct. bdy data file at U points for Flather scheme 
     29   CHARACTER(len=80) ::   cn_dta_fla_V   !: Name of unstruct. bdy data file at V points for Flather scheme 
    2930   ! 
    30    LOGICAL ::   ln_bdy_tides = .false.  !: =T apply tidal harmonic forcing along open boundaries 
    31    LOGICAL ::   ln_bdy_vol  = .false.   !: =T volume correction              
    32    LOGICAL ::   ln_bdy_mask = .false.   !: =T read bdymask from file 
    33    LOGICAL ::   ln_bdy_clim = .false.   !: if true, we assume that bdy data files contain  
     31   LOGICAL ::   ln_tides = .false.    !: =T apply tidal harmonic forcing along open boundaries 
     32   LOGICAL ::   ln_vol  = .false.     !: =T volume correction              
     33   LOGICAL ::   ln_mask = .false.     !: =T read bdymask from file 
     34   LOGICAL ::   ln_clim = .false.     !: if true, we assume that bdy data files contain  
    3435   !                                    !  1 time dump  (-->bdy forcing will be constant)  
    3536   !                                    !  or 12 months (-->bdy forcing will be cyclic)  
    36    LOGICAL ::   ln_bdy_dyn_fla  = .false. !: =T Flather boundary conditions on barotropic velocities 
    37    LOGICAL ::   ln_bdy_dyn_frs  = .false. !: =T FRS boundary conditions on velocities 
    38    LOGICAL ::   ln_bdy_tra_frs  = .false. !: =T FRS boundary conditions on tracers (T and S) 
    39    LOGICAL ::   ln_bdy_ice_frs  = .false. !: =T FRS boundary conditions on seaice (leads fraction, ice depth, snow depth) 
     37   LOGICAL ::   ln_dyn_fla  = .false. !: =T Flather boundary conditions on barotropic velocities 
     38   LOGICAL ::   ln_dyn_frs  = .false. !: =T FRS boundary conditions on velocities 
     39   LOGICAL ::   ln_tra_frs  = .false. !: =T FRS boundary conditions on tracers (T and S) 
     40   LOGICAL ::   ln_ice_frs  = .false. !: =T FRS boundary conditions on seaice (leads fraction, ice depth, snow depth) 
    4041   ! 
    41    INTEGER ::   nb_rimwidth = 7         !: boundary rim width 
    42    INTEGER ::   nbdy_dta    = 1          !: = 0 use the initial state as bdy dta or = 1 read it in a NetCDF file 
    43    INTEGER ::   volbdy      = 1         !: = 0 the total volume will have the variability of the surface Flux E-P  
     42   INTEGER ::   nn_rimwidth = 7         !: boundary rim width 
     43   INTEGER ::   nn_dtactl   = 1          !: = 0 use the initial state as bdy dta or = 1 read it in a NetCDF file 
     44   INTEGER ::   nn_volctl   = 1         !: = 0 the total volume will have the variability of the surface Flux E-P  
    4445   !                                    !  = 1 the volume will be constant during all the integration. 
    4546 
     
    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 
     
    7884   !!   Dummy module                NO Unstructured Open Boundary Condition 
    7985   !!---------------------------------------------------------------------- 
    80    LOGICAL ::   ln_bdy_tides = .false.  !: =T apply tidal harmonic forcing along open boundaries 
     86   LOGICAL ::   ln_tides = .false.  !: =T apply tidal harmonic forcing along open boundaries 
    8187#endif 
    8288 
    8389   !!---------------------------------------------------------------------- 
    84    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     90   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    8591   !! $Id$  
    86    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     92   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    8793   !!====================================================================== 
    8894END MODULE bdy_oce 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_par.F90

    • Property svn:executable deleted
    r1146 r2528  
    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/NEMO_CeCILL.txt) 
    3434   !!====================================================================== 
    3535END MODULE bdy_par 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90

    • Property svn:executable deleted
    r1715 r2528  
    66   !! History :  1.0  !  2005-01  (J. Chanut, A. Sellar)  Original code 
    77   !!             -   !  2007-01  (D. Storkey) Update to use IOM module 
    8    !!             -   !  2007-07  (D. Storkey) add bdy_dta_bt 
     8   !!             -   !  2007-07  (D. Storkey) add bdy_dta_fla 
    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 
     
    1315   !!   'key_bdy'                     Unstructured Open Boundary Conditions 
    1416   !!---------------------------------------------------------------------- 
    15    !!   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         
     17   !!   bdy_dta_frs    : read u, v, t, s data along open boundaries 
     18   !!   bdy_dta_fla : 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 
    2933   PRIVATE 
    3034 
    31    PUBLIC   bdy_dta      ! routines called by step.F90 
    32    PUBLIC   bdy_dta_bt  
    33  
    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 
     35   PUBLIC   bdy_dta_frs      ! routines called by step.F90 
     36   PUBLIC   bdy_dta_fla  
     37 
     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/NEMO_CeCILL.txt) 
    5464   !!---------------------------------------------------------------------- 
    55  
    5665CONTAINS 
    5766 
    58    SUBROUTINE bdy_dta( kt ) 
     67   SUBROUTINE bdy_dta_frs( kt ) 
    5968      !!---------------------------------------------------------------------- 
    60       !!                   ***  SUBROUTINE bdy_dta  *** 
     69      !!                   ***  SUBROUTINE bdy_dta_frs  *** 
    6170      !!                     
    6271      !! ** Purpose :   Read unstructured boundary data for FRS condition. 
     
    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_dyn_frs .OR. ln_tra_frs    & 
     104         &               .OR. ln_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 
     
    128139 
    129140         IF(lwp) WRITE(numout,*) 
    130          IF(lwp) WRITE(numout,*)    'bdy_dta : Initialize unstructured boundary data' 
     141         IF(lwp) WRITE(numout,*)    'bdy_dta_frs : Initialize unstructured boundary data' 
    131142         IF(lwp) WRITE(numout,*)    '~~~~~~~'  
    132143 
    133          IF     ( nbdy_dta == 0 ) THEN 
     144         IF     ( nn_dtactl == 0 ) THEN 
    134145            ! 
    135146            IF(lwp) WRITE(numout,*) '          Bdy data are taken from initial conditions' 
    136147            ! 
    137          ELSEIF (nbdy_dta == 1) THEN 
     148         ELSEIF (nn_dtactl == 1) THEN 
    138149            ! 
    139150            IF(lwp) WRITE(numout,*) '          Bdy data are read in netcdf files' 
     
    144155            !                                                 ! necessary time dumps in file are included 
    145156            ! 
    146             clfile(1) = filbdy_data_T 
    147             clfile(2) = filbdy_data_U 
    148             clfile(3) = filbdy_data_V 
     157            clfile(1) = cn_dta_frs_T 
     158            clfile(2) = cn_dta_frs_U 
     159            clfile(3) = cn_dta_frs_V 
    149160            !                                                   
    150161            ! how many files are we to read in? 
    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_tra_frs .AND. .NOT. ln_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_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 
    267274            ! Check number of time dumps:               
    268             IF( ntimes_bdy == 1 .AND. .NOT. ln_bdy_clim ) THEN 
     275            IF( ntimes_bdy == 1 .AND. .NOT. ln_clim ) THEN 
    269276              CALL ctl_stop( 'There is only one time dump in data files',   & 
    270                  &           'Choose ln_bdy_clim=.true. in namelist for constant bdy forcing.' ) 
     277                 &           'Choose ln_clim=.true. in namelist for constant bdy forcing.' ) 
    271278            ENDIF 
    272279 
    273             IF( ln_bdy_clim ) THEN 
     280            IF( ln_clim ) THEN 
    274281              IF( ntimes_bdy /= 1 .AND. ntimes_bdy /= 12 ) THEN 
    275                  CALL ctl_stop( 'For climatological boundary forcing (ln_bdy_clim=.true.),',   & 
     282                 CALL ctl_stop( 'For climatological boundary forcing (ln_clim=.true.),',   & 
    276283                    &           'bdy data files must contain 1 or 12 time dumps.' ) 
    277284              ELSEIF( ntimes_bdy ==  1 ) THEN 
     
    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 
    295  
    296          ENDIF ! endif (nbdy_dta == 1) 
    297  
    298  
    299          ! 1.2  Read first record in file if necessary (ie if nbdy_dta == 1) 
     300            IF(lwp) WRITE(numout,*) 'Time offset is ',zoffset 
     301            IF(lwp) WRITE(numout,*) 'First record to read is ',nbdy_b 
     302 
     303         ENDIF ! endif (nn_dtactl == 1) 
     304 
     305 
     306         ! 1.2  Read first record in file if necessary (ie if nn_dtactl == 1) 
    300307         ! ***************************************************************** 
    301308 
    302          IF( nbdy_dta == 0) THEN      ! boundary data arrays are filled with initial conditions 
     309         IF( nn_dtactl == 0 ) THEN      ! boundary data arrays are filled with initial conditions 
    303310            ! 
    304             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 
     311            IF (ln_tra_frs) THEN 
     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 
    316             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 
     323            IF(ln_dyn_frs) THEN 
     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            ! 
    336          ELSEIF( nbdy_dta == 1 ) THEN    ! Set first record in the climatological case:    
     343#if defined key_lim2 
     344            IF( ln_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 
     353         ELSEIF( nn_dtactl == 1 ) THEN    ! Set first record in the climatological case:    
    337354            ! 
    338             IF( ln_bdy_clim .AND. ntimes_bdy == 1 ) THEN 
     355            IF( ln_clim .AND. ntimes_bdy == 1 ) THEN 
    339356               nbdy_a = 1 
    340             ELSEIF( ln_bdy_clim .AND. ntimes_bdy == iman ) THEN 
     357            ELSEIF( ln_clim .AND. ntimes_bdy == iman ) THEN 
    341358               nbdy_b = 0 
    342359               nbdy_a = imois 
     
    351368            ipi  = nblendta(igrd) 
    352369 
    353             IF(ln_bdy_tra_frs) THEN 
     370            IF(ln_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 
     
    381399                  END DO 
    382400               END DO 
    383             ENDIF  ! ln_bdy_tra_frs 
     401            ENDIF  ! ln_tra_frs 
    384402  
    385             IF(ln_bdy_dyn_frs) THEN 
    386  
     403            IF( ln_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 ) 
     
    412430                  END DO 
    413431               END DO 
    414             ENDIF ! ln_bdy_dyn_frs 
    415  
    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 
    420                nbdy_b = nbdy_a 
    421                IF(ln_bdy_tra_frs) THEN 
     432            ENDIF ! ln_dyn_frs 
     433 
     434#if defined key_lim2 
     435            IF( ln_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_ice_frs is set 
     461#endif 
     462 
     463            IF( .NOT.ln_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_tra_frs ) THEN 
    422466                 tbdydta(:,:,1) = tbdydta(:,:,2) 
    423467                 sbdydta(:,:,1) = sbdydta(:,:,2) 
    424468               ENDIF 
    425                IF(ln_bdy_dyn_frs) THEN 
     469               IF( ln_dyn_frs ) THEN 
    426470                 ubdydta(:,:,1) = ubdydta(:,:,2) 
    427471                 vbdydta(:,:,1) = vbdydta(:,:,2) 
    428472               ENDIF 
     473#if defined key_lim2 
     474               IF( ln_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 
    429480            END IF 
    430  
    431          END IF ! nbdy_dta == 0/1 
     481            ! 
     482         END IF   ! nn_dtactl == 0/1 
    432483  
    433484         ! 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) 
     485         IF( ln_clim .AND. ntimes_bdy == 1 ) THEN 
     486            IF( ln_tra_frs ) THEN 
     487               tbdy  (:,:) = tbdydta  (:,:,2) 
     488               sbdy  (:,:) = sbdydta  (:,:,2) 
    438489            ENDIF 
    439             IF(ln_bdy_dyn_frs) THEN 
    440               ubdy  (:,:) = ubdydta  (:,:,2) 
    441               vbdy  (:,:) = vbdydta  (:,:,2) 
     490            IF( ln_dyn_frs) THEN 
     491               ubdy  (:,:) = ubdydta  (:,:,2) 
     492               vbdy  (:,:) = vbdydta  (:,:,2) 
    442493            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 ) 
     494#if defined key_lim2 
     495            IF( ln_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_tra_frs .OR. ln_ice_frs) CALL iom_close( numbdyt ) 
     503            IF( ln_dyn_frs                    ) CALL iom_close( numbdyu ) 
     504            IF( ln_dyn_frs                    ) CALL iom_close( numbdyv ) 
    447505         END IF 
    448  
     506         ! 
    449507      ENDIF                                            ! End if nit000 
    450508 
    451509 
    452510      !                                                !---------------------! 
    453       !                                                !  at each time step  ! 
    454       !                                                !---------------------! 
    455  
    456       IF( nbdy_dta == 1 .AND. ntimes_bdy > 1 ) THEN  
    457          ! 
     511      IF( nn_dtactl == 1 .AND. ntimes_bdy > 1 ) THEN    !  at each time step  ! 
     512         !                                             !---------------------! 
    458513         ! Read one more record if necessary 
    459514         !********************************** 
    460515 
    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 
     516         IF( ln_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_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 
     531               nbdy_b = nbdy_a 
     532               IF(ln_tra_frs) THEN 
     533                  tbdydta(:,:,1) =  tbdydta(:,:,2) 
     534                  sbdydta(:,:,1) =  sbdydta(:,:,2) 
     535               ENDIF 
     536               IF(ln_dyn_frs) THEN 
     537                  ubdydta(:,:,1) =  ubdydta(:,:,2) 
     538                  vbdydta(:,:,1) =  vbdydta(:,:,2) 
     539               ENDIF 
     540#if defined key_lim2 
     541               IF(ln_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_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_dyn_frs ) THEN 
    496557             ubdydta(:,:,1) =  ubdydta(:,:,2) 
    497558             vbdydta(:,:,1) =  vbdydta(:,:,2) 
    498559           ENDIF 
    499   
     560#if defined key_lim2 
     561           IF( ln_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_tra_frs ) THEN 
    505572              !  
    506573              igrd = 1                                   ! temperature 
     
    521588                 END DO 
    522589              END DO 
    523            ENDIF ! ln_bdy_tra_frs 
    524  
    525            IF(ln_bdy_dyn_frs) THEN 
     590           ENDIF ! ln_tra_frs 
     591 
     592           IF(ln_dyn_frs) THEN 
    526593              ! 
    527594              igrd = 2                                   ! u-velocity 
     
    542609                 END DO 
    543610              END DO 
    544            ENDIF ! ln_bdy_dyn_frs 
    545  
     611           ENDIF ! ln_dyn_frs 
    546612           ! 
    547            IF(lwp) WRITE(numout,*) 'bdy_dta : first record file used nbdy_b ',nbdy_b 
     613#if defined key_lim2 
     614           IF(ln_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_ice_frs 
     637#endif 
     638           ! 
     639           IF(lwp) WRITE(numout,*) 'bdy_dta_frs : first record file used nbdy_b ',nbdy_b 
    548640           IF(lwp) WRITE(numout,*) '~~~~~~~~  last  record file used nbdy_a ',nbdy_a 
    549            IF (.NOT.ln_bdy_clim) THEN 
     641           IF (.NOT.ln_clim) THEN 
    550642              IF(lwp) WRITE(numout,*) 'first  record time (s): ', istep(nbdy_b) 
    551643              IF(lwp) WRITE(numout,*) 'model time (s)        : ', itimer 
     
    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_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 
    565           IF(ln_bdy_tra_frs) THEN 
     659          IF(ln_tra_frs) THEN 
    566660             igrd = 1                                   ! temperature & salinity 
    567661             DO ib = 1, nblen(igrd) 
     
    573667          ENDIF 
    574668 
    575           IF(ln_bdy_dyn_frs) THEN 
     669          IF(ln_dyn_frs) THEN 
    576670             igrd = 2                                   ! u-velocity 
    577671             DO ib = 1, nblen(igrd) 
     
    589683          ENDIF 
    590684 
    591       END IF                       !end if ((nbdy_dta==1).AND.(ntimes_bdy>1)) 
     685#if defined key_lim2 
     686          IF(ln_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_ice_frs is true 
     694#endif 
     695 
     696      END IF                       !end if ((nn_dtactl==1).AND.(ntimes_bdy>1)) 
    592697     
    593698 
     
    596701      !                                                !---------------------! 
    597702      IF( kt == nitend ) THEN 
    598           IF(ln_bdy_tra_frs .or. ln_bdy_ice_frs) CALL iom_close( numbdyt )              ! Closing of the 3 files 
    599           IF(ln_bdy_dyn_frs) CALL iom_close( numbdyu ) 
    600           IF(ln_bdy_dyn_frs) CALL iom_close( numbdyv ) 
     703          IF(ln_tra_frs .or. ln_ice_frs) CALL iom_close( numbdyt )              ! Closing of the 3 files 
     704          IF(ln_dyn_frs) CALL iom_close( numbdyu ) 
     705          IF(ln_dyn_frs) CALL iom_close( numbdyv ) 
    601706      ENDIF 
    602707      ! 
    603       ENDIF ! ln_bdy_dyn_frs .OR. ln_bdy_tra_frs 
    604  
    605    END SUBROUTINE bdy_dta 
    606  
    607  
    608    SUBROUTINE bdy_dta_bt( kt, jit ) 
     708      ENDIF ! ln_dyn_frs .OR. ln_tra_frs 
     709      ! 
     710   END SUBROUTINE bdy_dta_frs 
     711 
     712 
     713   SUBROUTINE bdy_dta_fla( kt, jit, icycl ) 
    609714      !!--------------------------------------------------------------------------- 
    610       !!                      ***  SUBROUTINE bdy_dta_bt  *** 
     715      !!                      ***  SUBROUTINE bdy_dta_fla  *** 
    611716      !!                     
    612717      !! ** Purpose :   Read unstructured boundary data for Flather condition 
     
    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      !!--------------------------------------------------------------------------- 
    644750 
    645 !!gm   add here the same style as in bdy_dta 
    646 !!gm      clearly bdy_dta_bt and bdy_dta  can be combined...    
     751!!gm   add here the same style as in bdy_dta_frs 
     752!!gm      clearly bdy_dta_fla and bdy_dta_frs  can be combined...    
    647753!!gm      too many things duplicated in the read of data...   simplification can be done 
    648754 
     
    671777      itimer = itimer + jit*rdt/REAL(nn_baro,wp)      ! in non-climatological case 
    672778 
    673       IF ( ln_bdy_tides ) THEN 
     779      IF ( ln_tides ) THEN 
    674780 
    675781         ! -------------------------------------! 
     
    681787      ENDIF 
    682788 
    683       IF ( ln_bdy_dyn_fla ) THEN 
     789      IF ( ln_dyn_fla ) THEN 
    684790 
    685791         ! -------------------------------------! 
     
    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 
     
    698804 
    699805        IF(lwp) WRITE(numout,*) 
    700         IF(lwp) WRITE(numout,*)    'bdy_dta_bt :Initialize unstructured boundary data for barotropic variables.' 
     806        IF(lwp) WRITE(numout,*)    'bdy_dta_fla :Initialize unstructured boundary data for barotropic variables.' 
    701807        IF(lwp) WRITE(numout,*)    '~~~~~~~'  
    702808 
    703         IF( nbdy_dta == 0 ) THEN 
     809        IF( nn_dtactl == 0 ) THEN 
    704810          IF(lwp) WRITE(numout,*)  'Bdy data are taken from initial conditions' 
    705811 
    706         ELSEIF (nbdy_dta == 1) THEN 
     812        ELSEIF (nn_dtactl == 1) THEN 
    707813          IF(lwp) WRITE(numout,*)  'Bdy data are read in netcdf files' 
    708814 
     
    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) = cn_dta_fla_T 
     821          clfile(5) = cn_dta_fla_U 
     822          clfile(6) = cn_dta_fla_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', & 
     
    766872            END DO 
    767873 
    768             IF ( .NOT. ln_bdy_clim ) THEN 
     874            IF ( .NOT. ln_clim ) THEN 
    769875               ! Check that times in file span model run time: 
    770876 
     
    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', & 
    782                     'Set ln_bdy_clim=.true. in namelist for constant bdy forcing.' ) 
     888                    'Set ln_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  
    803             END IF ! .NOT. ln_bdy_clim 
    804  
    805             IF ( igrd .EQ. 1) THEN 
     901            END IF ! .NOT. ln_clim 
     902 
     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 
     
    840938 
    841939      ! Check number of time dumps:               
    842           IF (ln_bdy_clim) THEN 
     940          IF (ln_clim) THEN 
    843941            SELECT CASE ( ntimes_bdy_bt ) 
    844942            CASE( 1 ) 
     
    852950            CASE DEFAULT 
    853951              CALL ctl_stop( & 
    854                 'For climatological boundary forcing (ln_bdy_clim=.true.),',& 
     952                'For climatological boundary forcing (ln_clim=.true.),',& 
    855953                'bdy data files must contain 1 or 12 time dumps.' ) 
    856954            END SELECT 
     
    865963          nbdy_b_bt = it 
    866964 
    867           WRITE(numout,*) 'Time offset is ',zoffset 
    868           WRITE(numout,*) 'First record to read is ',nbdy_b_bt 
    869  
    870         ENDIF ! endif (nbdy_dta == 1) 
    871  
    872       ! 1.2  Read first record in file if necessary (ie if nbdy_dta == 1) 
     965          IF(lwp) WRITE(numout,*) 'Time offset is ',zoffset 
     966          IF(lwp) WRITE(numout,*) 'First record to read is ',nbdy_b_bt 
     967 
     968        ENDIF ! endif (nn_dtactl == 1) 
     969 
     970      ! 1.2  Read first record in file if necessary (ie if nn_dtactl == 1) 
    873971      ! ***************************************************************** 
    874972 
    875         IF ( nbdy_dta == 0) THEN 
     973        IF ( nn_dtactl == 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)) 
    890988          END DO 
    891989 
    892         ELSEIF (nbdy_dta == 1) THEN 
     990        ELSEIF (nn_dtactl == 1) THEN 
    893991  
    894992        ! Set first record in the climatological case:    
    895           IF ((ln_bdy_clim).AND.(ntimes_bdy_bt==1)) THEN 
     993          IF ((ln_clim).AND.(ntimes_bdy_bt==1)) THEN 
    896994            nbdy_a_bt = 1 
    897           ELSEIF ((ln_bdy_clim).AND.(ntimes_bdy_bt==iman)) THEN 
     995          ELSEIF ((ln_clim).AND.(ntimes_bdy_bt==iman)) THEN 
    898996            nbdy_b_bt = 0 
    899997            nbdy_a_bt = imois 
     
    9041002         ! Open Netcdf files: 
    9051003 
    906           CALL iom_open ( filbdy_data_bt_T, numbdyt_bt ) 
    907           CALL iom_open ( filbdy_data_bt_U, numbdyu_bt ) 
    908           CALL iom_open ( filbdy_data_bt_V, numbdyv_bt ) 
     1004          CALL iom_open ( cn_dta_fla_T, numbdyt_bt ) 
     1005          CALL iom_open ( cn_dta_fla_U, numbdyu_bt ) 
     1006          CALL iom_open ( cn_dta_fla_V, numbdyv_bt ) 
    9091007 
    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' ) 
     
    9611059  
    9621060        ! In the case of constant boundary forcing fill bdy arrays once for all 
    963         IF ((ln_bdy_clim).AND.(ntimes_bdy_bt==1)) THEN 
     1061        IF ((ln_clim).AND.(ntimes_bdy_bt==1)) THEN 
    9641062 
    9651063          ubtbdy  (:) = ubtbdydta  (:,2) 
     
    9791077      ! -------------------- ! 
    9801078 
    981       IF ((nbdy_dta==1).AND.(ntimes_bdy_bt>1)) THEN  
     1079      IF ((nn_dtactl==1).AND.(ntimes_bdy_bt>1)) THEN  
    9821080 
    9831081      ! 2.1 Read one more record if necessary 
    9841082      !************************************** 
    9851083 
    986         IF ( (ln_bdy_clim).AND.(imois/=nbdy_b_bt) ) THEN ! remember that nbdy_b_bt=0 for kt=nit000 
     1084        IF ( (ln_clim).AND.(imois/=nbdy_b_bt) ) THEN ! remember that nbdy_b_bt=0 for kt=nit000 
    9871085         nbdy_b_bt = imois 
    9881086         nbdy_a_bt = imois+1 
     
    9931091         lect=.true. 
    9941092 
    995         ELSEIF ((.NOT.ln_bdy_clim).AND.(itimer >= istep_bt(nbdy_a_bt))) THEN 
     1093        ELSEIF ((.NOT.ln_clim).AND.(itimer >= istep_bt(nbdy_a_bt))) THEN 
    9961094          nbdy_b_bt=nbdy_a_bt 
    9971095          nbdy_a_bt=nbdy_a_bt+1 
     
    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 
     
    10451143 
    10461144 
    1047          IF(lwp) WRITE(numout,*) 'bdy_dta : first record file used nbdy_b_bt ',nbdy_b_bt 
     1145         IF(lwp) WRITE(numout,*) 'bdy_dta_fla : first record file used nbdy_b_bt ',nbdy_b_bt 
    10481146         IF(lwp) WRITE(numout,*) '~~~~~~~~  last  record file used nbdy_a_bt ',nbdy_a_bt 
    1049          IF (.NOT.ln_bdy_clim) THEN 
     1147         IF (.NOT.ln_clim) THEN 
    10501148           IF(lwp) WRITE(numout,*) 'first  record time (s): ', istep_bt(nbdy_b_bt) 
    10511149           IF(lwp) WRITE(numout,*) 'model time (s)        : ', itimer 
     
    10581156      ! *************************** 
    10591157     
    1060         IF (ln_bdy_clim) THEN 
     1158        IF (ln_clim) THEN 
    10611159          zxy = REAL( nday, wp ) / REAL( nmonth_len(nbdy_b_bt), wp ) + 0.5 - i15 
    10621160        ELSE           
     
    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) + & 
     
    10831181 
    10841182 
    1085       END IF !end if ((nbdy_dta==1).AND.(ntimes_bdy_bt>1)) 
     1183      END IF !end if ((nn_dtactl==1).AND.(ntimes_bdy_bt>1)) 
    10861184     
    10871185      ! ------------------- ! 
     
    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 ) 
     
    10961194      ENDIF 
    10971195 
    1098       ENDIF ! ln_bdy_dyn_frs 
    1099  
    1100       END SUBROUTINE bdy_dta_bt 
     1196      ENDIF ! ln_dyn_frs 
     1197 
     1198      END SUBROUTINE bdy_dta_fla 
    11011199 
    11021200 
     
    11061204   !!---------------------------------------------------------------------- 
    11071205CONTAINS 
    1108    SUBROUTINE bdy_dta( kt )              ! Empty routine 
    1109       WRITE(*,*) 'bdy_dta: You should not have seen this print! error?', kt 
    1110    END SUBROUTINE bdy_dta 
    1111    SUBROUTINE bdy_dta_bt( kt, kit )      ! Empty routine 
    1112       WRITE(*,*) 'bdy_dta: You should not have seen this print! error?', kt, kit 
    1113    END SUBROUTINE bdy_dta_bt 
     1206   SUBROUTINE bdy_dta_frs( kt )              ! Empty routine 
     1207      WRITE(*,*) 'bdy_dta_frs: You should not have seen this print! error?', kt 
     1208   END SUBROUTINE bdy_dta_frs 
     1209   SUBROUTINE bdy_dta_fla( kt, kit, icycle )      ! Empty routine 
     1210      WRITE(*,*) 'bdy_dta_frs: You should not have seen this print! error?', kt, kit 
     1211   END SUBROUTINE bdy_dta_fla 
    11141212#endif 
    11151213 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90

    • Property svn:executable deleted
    r1740 r2528  
    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/NEMO_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_dyn_frs) THEN      ! If this is false, then this routine does nothing.  
     63         ! 
    6364         IF( kt == nit000 ) THEN 
    6465            IF(lwp) WRITE(numout,*) 
    65             IF(lwp) WRITE(numout,*) 'bdy_dyn : Flow Relaxation Scheme on momentum' 
     66            IF(lwp) WRITE(numout,*) 'bdy_dyn_frs : Flow Relaxation Scheme on momentum' 
    6667            IF(lwp) WRITE(numout,*) '~~~~~~~' 
    6768         ENDIF 
    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  
     89         CALL lbc_lnk( ua, 'U', -1. )   ;   CALL lbc_lnk( va, 'V', -1. )   ! Boundary points should be updated 
    8890         ! 
    89          CALL lbc_lnk( ua, 'U', -1. )   ! Boundary points should be updated 
    90          CALL lbc_lnk( va, 'V', -1. )   ! 
    91          ! 
    92       ENDIF ! ln_bdy_dyn_frs 
    93  
     91      ENDIF ! ln_dyn_frs 
     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      !!---------------------------------------------------------------------- 
     
    102107      !!              
    103108      !!              - Apply Flather boundary conditions on normal barotropic velocities  
    104       !!                (ln_bdy_dyn_fla=.true. or ln_bdy_tides=.true.) 
     109      !!                (ln_dyn_fla=.true. or ln_tides=.true.) 
    105110      !! 
    106111      !! ** WARNINGS about FLATHER implementation: 
     
    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 
     
    129134      ! ---------------------------------!  
    130135      
    131       IF(ln_bdy_dyn_fla .OR. ln_bdy_tides) THEN ! If these are both false, then this routine does nothing.  
     136      IF(ln_dyn_fla .OR. ln_tides) THEN ! If these are both false, then this routine does nothing.  
    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_dyn_fla ) spgu(ii, ij) = sshbdy(jb) 
     145            IF( ln_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         ! 
    170       ENDIF ! ln_bdy_dyn_fla .or. ln_bdy_tides 
     177      ENDIF ! ln_dyn_fla .or. ln_tides 
    171178      ! 
    172179   END SUBROUTINE bdy_dyn_fla 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90

    • Property svn:executable deleted
    r1528 r2528  
    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/NEMO_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      !! 
    67       NAMELIST/nambdy/filbdy_mask, filbdy_data_T, filbdy_data_U, filbdy_data_V,          & 
    68          &            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 
     68      NAMELIST/nambdy/cn_mask, cn_dta_frs_T, cn_dta_frs_U, cn_dta_frs_V,          & 
     69         &            cn_dta_fla_T, cn_dta_fla_U, cn_dta_fla_V,              & 
     70         &            ln_tides, ln_clim, ln_vol, ln_mask,                & 
     71         &            ln_dyn_fla, ln_dyn_frs, ln_tra_frs,ln_ice_frs,     & 
     72         &            nn_dtactl, nn_rimwidth, nn_volctl 
    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 
    94       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' ) 
     92      !                                         ! check type of data used (nn_dtactl value) 
     93      IF(lwp) WRITE(numout,*) 'nn_dtactl =', nn_dtactl       
     94      IF(lwp) WRITE(numout,*) 
     95      SELECT CASE( nn_dtactl )                   !  
     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( 'nn_dtactl must be 0 or 1' ) 
    10399      END SELECT 
    104100 
    105       IF(lwp) WRITE(numout,*) ' ' 
    106       IF(lwp) WRITE(numout,*) 'Boundary rim width for the FRS nb_rimwidth = ', nb_rimwidth 
    107  
    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 
     101      IF(lwp) WRITE(numout,*) 
     102      IF(lwp) WRITE(numout,*) 'Boundary rim width for the FRS nn_rimwidth = ', nn_rimwidth 
     103 
     104      IF(lwp) WRITE(numout,*) 
     105      IF(lwp) WRITE(numout,*) '      nn_volctl = ', nn_volctl 
     106 
     107      IF( ln_vol ) THEN                     ! check volume conservation (nn_volctl value) 
     108         SELECT CASE ( nn_volctl ) 
     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( 'nn_volctl 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_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_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_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_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_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_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 
    166          CALL iom_open( filbdy_mask, inum ) 
     158      ELSE IF( ln_mask ) THEN 
     159         CALL iom_open( cn_mask, inum ) 
    167160         CALL iom_get ( inum, jpdom_data, 'bdy_msk', zmask(:,:) ) 
    168161         CALL iom_close( inum ) 
     
    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, nn_rimwidth                  ! Define west boundary (from ii=2 to ii=1+nn_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, nn_rimwidth                  ! Define east boundary (from ii=jpiglo-1 to ii=jpiglo-nn_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 
    232             clfile(1) = filbdy_data_T 
    233             clfile(2) = filbdy_data_U 
    234             clfile(3) = filbdy_data_V 
     212         ! 
     213         IF( ln_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_dyn_fla .AND. .NOT. ln_tides ) THEN  
     219            clfile(4) = cn_dta_fla_T 
     220            clfile(5) = cn_dta_fla_U 
     221            clfile(6) = cn_dta_fla_V 
     222         ENDIF 
     223 
     224         IF( ln_tra_frs ) THEN  
     225            clfile(1) = cn_dta_frs_T 
     226            IF( .NOT. ln_dyn_frs ) THEN  
     227               clfile(2) = cn_dta_frs_T     ! Dummy read re read T file for sake of 6 files 
     228               clfile(3) = cn_dta_frs_T     ! 
     229            ENDIF 
    235230         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 
     231         IF( ln_dyn_frs ) THEN  
     232            IF( .NOT. ln_tra_frs )   clfile(1) = cn_dta_frs_U      ! Dummy Read  
     233            clfile(2) = cn_dta_frs_U 
     234            clfile(3) = cn_dta_frs_V  
     235         ENDIF 
     236 
     237         !                                   ! how many files are we to read in? 
     238         IF(ln_tides .OR. ln_dyn_fla)   igrd_start = 4 
     239         ! 
     240         IF(ln_tra_frs    ) THEN   ;   igrd_start = 1 
     241         ELSEIF(ln_dyn_frs) THEN   ;   igrd_start = 2 
     242         ENDIF 
     243         ! 
     244         IF( ln_tra_frs   )   igrd_end = 1 
     245         ! 
     246         IF(ln_dyn_fla .OR. ln_tides) THEN   ;   igrd_end = 6 
     247         ELSEIF( ln_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,*) ' nn_rimwidth from namelist is ', nn_rimwidth 
     277               IF (ibr_max < nn_rimwidth)   CALL ctl_stop( 'nn_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, nn_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(nn_rimwidth+1-nbr(ib,igrd))/FLOAT(nn_rimwidth))**2      ! quadratic 
     330!           nbw(ib,igrd) =  FLOAT(nn_rimwidth+1-nbr(ib,igrd))/FLOAT(nn_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. ) 
    390  
    391       IF( ln_bdy_vol .OR. ln_bdy_dyn_fla ) THEN      ! Indices and directions of rim velocity components 
     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. ) 
     383 
     384      IF( ln_vol .OR. ln_dyn_fla ) THEN      ! Indices and directions of rim velocity components 
    392385         ! 
    393386         !flagu = -1 : u component is normal to the dynamical boundary but its direction is outward 
     
    437430      ! Compute total lateral surface for volume correction: 
    438431      ! ---------------------------------------------------- 
    439   
    440432      bdysurftot = 0.e0  
    441       IF( ln_bdy_vol ) THEN   
     433      IF( ln_vol ) THEN   
    442434         igrd = 2      ! Lateral surface at U-points 
    443435         DO ib = 1, nblenrim(igrd) 
     
    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 
    472469      ! ---------------------------------------------------------- 
    473       IF( ln_bdy_tides )   CALL tide_data 
     470      IF( ln_tides )   CALL tide_data 
    474471      ! 
    475472   END SUBROUTINE bdy_init 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90

    • Property svn:executable deleted
    r1715 r2528  
    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/NEMO_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) 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90

    • Property svn:executable deleted
    r1146 r2528  
    1111   !!   'key_bdy'                     Unstructured Open Boundary Conditions 
    1212   !!---------------------------------------------------------------------- 
    13    !!   bdy_tra        : Relaxation of tracers on unstructured open boundaries 
     13   !!   bdy_tra_frs        : Relaxation of tracers on unstructured open boundaries 
    1414   !!---------------------------------------------------------------------- 
    1515   USE oce             ! ocean dynamics and tracers variables 
     
    2222   PRIVATE 
    2323 
    24    PUBLIC bdy_tra     ! routine called in tranxt.F90  
     24   PUBLIC bdy_tra_frs     ! routine called in tranxt.F90  
    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/NEMO_CeCILL.txt) 
    3030   !!---------------------------------------------------------------------- 
    31  
    3231CONTAINS 
    3332 
    34    SUBROUTINE bdy_tra( kt ) 
     33   SUBROUTINE bdy_tra_frs( kt ) 
    3534      !!---------------------------------------------------------------------- 
    36       !!                 ***  SUBROUTINE bdy_tra  *** 
     35      !!                 ***  SUBROUTINE bdy_tra_frs  *** 
    3736      !!                     
    3837      !! ** Purpose : Apply the Flow Relaxation Scheme for tracers in the   
     
    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_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_frs : 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_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  
    74    END SUBROUTINE bdy_tra 
     72   END SUBROUTINE bdy_tra_frs 
    7573    
    7674#else 
     
    7977   !!---------------------------------------------------------------------- 
    8078CONTAINS 
    81    SUBROUTINE bdy_tra(kt)      ! Empty routine 
    82       WRITE(*,*) 'bdy_tra: You should not have seen this print! error?', kt 
    83    END SUBROUTINE bdy_tra 
     79   SUBROUTINE bdy_tra_frs(kt)      ! Empty routine 
     80      WRITE(*,*) 'bdy_tra_frs: You should not have seen this print! error?', kt 
     81   END SUBROUTINE bdy_tra_frs 
    8482#endif 
    8583 
  • trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90

    • Property svn:executable deleted
    r1739 r2528  
    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/NEMO_CeCILL.txt) 
    3535   !!---------------------------------------------------------------------- 
    36  
    3736CONTAINS 
    3837 
     
    6261      !!            zero (z_cflxemp=0) to calculate the correction velocity. So 
    6362      !!            it will only balance the flux through open boundaries. 
    64       !!            (set volbdy to 0 in tne namelist for this option) 
     63      !!            (set nn_volctl to 0 in tne namelist for this option) 
    6564      !!         2/ The volume is constant even with E-P flux. In this case 
    6665      !!            the correction velocity must balance both the flux  
    6766      !!            through open boundaries and the ones through the free 
    6867      !!            surface.  
    69       !!            (set volbdy to 1 in tne namelist for this option) 
     68      !!            (set nn_volctl to 1 in tne namelist for this option) 
    7069      !!---------------------------------------------------------------------- 
    7170      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     
    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      !!----------------------------------------------------------------------------- 
     76 
     77      IF( ln_vol ) THEN 
    7778 
    7879      IF( kt == nit000 ) THEN  
     
    8485      ! Calculate the cumulate surface Flux z_cflxemp (m3/s) over all the domain 
    8586      ! ----------------------------------------------------------------------- 
    86       z_cflxemp = 0.e0 
    87       zraur = 1.e0 / rau0 
    88       z_cflxemp = SUM ( emp(:,:) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) * zraur ) 
    89       IF( lk_mpp )   CALL mpp_sum( z_cflxemp )   ! sum over the global domain 
     87      z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:) ) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) ) / rau0 
     88      IF( lk_mpp )   CALL mpp_sum( z_cflxemp )     ! sum over the global domain 
    9089 
    91       ! Barotropic velocity through the unstructured open boundary 
    92       ! ---------------------------------------------------------- 
     90      ! Transport through the unstructured open boundary 
     91      ! ------------------------------------------------ 
    9392      zubtpecor = 0.e0 
    9493      jgrd = 2                               ! cumulate u component contribution first  
     
    112111      ! The normal velocity correction 
    113112      ! ------------------------------ 
    114       IF (volbdy==1) THEN   ;   zubtpecor = ( zubtpecor - z_cflxemp) / bdysurftot  
    115       ELSE                  ;   zubtpecor =   zubtpecor             / bdysurftot 
     113      IF( nn_volctl==1 ) THEN   ;   zubtpecor = ( zubtpecor - z_cflxemp) / bdysurftot  
     114      ELSE                   ;   zubtpecor =   zubtpecor             / bdysurftot 
    116115      END IF 
    117116 
     
    141140      ! Check the cumulated transport through unstructured OBC once barotropic velocities corrected 
    142141      ! ------------------------------------------------------ 
    143  
    144142      IF( lwp .AND. MOD( kt, nwrite ) == 0) THEN 
    145143         IF(lwp) WRITE(numout,*) 
     
    152150      END IF  
    153151      ! 
     152      END IF ! ln_vol 
     153 
    154154   END SUBROUTINE bdy_vol 
    155155 
Note: See TracChangeset for help on using the changeset viewer.