New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2236 – NEMO

Changeset 2236


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

First guess of NEMO_v3.3

Location:
branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC
Files:
3 deleted
144 edited
8 copied

Legend:

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

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

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

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

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

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

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

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

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

    r2104 r2236  
    3939   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4040   !! $Id$ 
    41    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     41   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4242   !!---------------------------------------------------------------------- 
    4343 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DIA/diafwb.F90

    r2000 r2236  
    4040   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    4141   !! $Id$ 
    42    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4343   !!---------------------------------------------------------------------- 
    4444 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DIA/diagap.F90

    r1715 r2236  
    4747   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4848   !! $Id$  
    49    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     49   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5050   !!---------------------------------------------------------------------- 
    5151 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DIA/diahth.F90

    r1585 r2236  
    4444   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4545   !! $Id$  
    46    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     46   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4747   !!---------------------------------------------------------------------- 
    4848 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DIA/diaptr.F90

    r1970 r2236  
    102102   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    103103   !! $Id$  
    104    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     104   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    105105   !!---------------------------------------------------------------------- 
    106106 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DIA/diawri.F90

    r2000 r2236  
    3030   USE limwri_2  
    3131#endif 
     32   USE dtatem 
     33   USE dtasal 
     34 
    3235   IMPLICIT NONE 
    3336   PRIVATE 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/closea.F90

    r2000 r2236  
    4646   !!  OPA 9.0 , LOCEAN-IPSL (2006)  
    4747   !! $Id$ 
    48    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     48   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4949   !!---------------------------------------------------------------------- 
    5050 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/daymod.F90

    r2200 r2236  
    4545   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4646   !! $Id$ 
    47    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     47   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4848   !!---------------------------------------------------------------------- 
    4949 
     
    6767      !!              - nmonth_len, nyear_len, nmonth_half, nmonth_end through day_mth 
    6868      !!---------------------------------------------------------------------- 
     69      INTEGER :: inbday, irest 
     70      REAL(wp) :: zjul 
     71      !!---------------------------------------------------------------------- 
    6972 
    7073      ! all calendar staff is based on the fact that MOD( rday, rdttra(1) ) == 0 
     
    105108      ! day since january 1st 
    106109      nday_year = nday + SUM( nmonth_len(1:nmonth - 1) ) 
    107        
     110 
     111      !compute number of days between last monday and today       
     112      IF( nn_leapy==1 )THEN 
     113         CALL ymds2ju( 1900, 01, 01, 0.0, zjul )  ! compute julian day value of 01.01.1900 (monday) 
     114         inbday = INT(fjulday) - NINT(zjul)       ! compute nb day between  01.01.1900 and current day fjulday  
     115         irest = MOD(inbday,7)                    ! compute nb day between last monday and current day fjulday  
     116         IF(irest==0 )irest = 7  
     117      ENDIF 
     118 
    108119      ! number of seconds since the beginning of current year/month at the middle of the time-step 
    109120      nsec_year  = nday_year * nsecd - ndt05   ! 1 time step before the middle of the first time step 
    110121      nsec_month = nday      * nsecd - ndt05   ! because day will be called at the beginning of step 
    111122      nsec_day   =             nsecd - ndt05 
     123      nsec_week  = 0 
     124      IF( nn_leapy==1 ) nsec_week  = irest     * nsecd - ndt05 
    112125 
    113126      ! control print 
    114127      IF(lwp) WRITE(numout,'(a,i6,a,i2,a,i2,a,i6)')' ==============>> 1/2 time step before the start of the run DATE Y/M/D = ',   & 
    115            &                   nyear, '/', nmonth, '/', nday, '  nsec_day:', nsec_day 
     128           &                   nyear, '/', nmonth, '/', nday, '  nsec_day:', nsec_day, '  nsec_week:', nsec_week 
    116129 
    117130      ! Up to now, calendar parameters are related to the end of previous run (nit000-1) 
     
    200213      nsec_year  = nsec_year  + ndt  
    201214      nsec_month = nsec_month + ndt                  
     215      IF( nn_leapy==1 ) nsec_week  = nsec_week  + ndt 
    202216      nsec_day   = nsec_day   + ndt                 
    203217      adatrj  = adatrj  + rdttra(1) / rday 
     
    228242         ndastp = nyear * 10000 + nmonth * 100 + nday   ! NEW date 
    229243         ! 
     244         !compute first day of the year in julian days 
     245         CALL ymds2ju( nyear, 01, 01, 0.0, fjulstartyear ) 
     246         ! 
    230247         IF(lwp) WRITE(numout,'(a,i8,a,i4.4,a,i2.2,a,i2.2,a,i3.3)') '======>> time-step =', kt,   & 
    231248              &   '      New day, DATE Y/M/D = ', nyear, '/', nmonth, '/', nday, '      nday_year = ', nday_year 
    232249         IF(lwp) WRITE(numout,'(a,i8,a,i7,a,i5)') '         nsec_year = ', nsec_year,   & 
    233               &   '   nsec_month = ', nsec_month, '   nsec_day = ', nsec_day 
    234       ENDIF 
     250              &   '   nsec_month = ', nsec_month, '   nsec_day = ', nsec_day, '   nsec_week = ', nsec_week 
     251      ENDIF 
     252 
     253      IF( nsec_week .GT. 7*86400 ) nsec_week = ndt05 
    235254       
    236255      IF(ln_ctl) THEN 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/dom_oce.F90

    r2148 r2236  
    99   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    1010   !! $Id$  
    11    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     11   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    1212   !!---------------------------------------------------------------------- 
    1313   USE par_oce      ! ocean parameters 
     
    197197   !! calendar variables 
    198198   !! --------------------------------------------------------------------- 
    199    INTEGER , PUBLIC ::   nyear       !: current year 
    200    INTEGER , PUBLIC ::   nmonth      !: current month 
    201    INTEGER , PUBLIC ::   nday        !: current day of the month 
    202    INTEGER , PUBLIC ::   ndastp      !: time step date in yyyymmdd format 
    203    INTEGER , PUBLIC ::   nday_year   !: current day counted from jan 1st of the current year 
    204    INTEGER , PUBLIC ::   nsec_year   !: current time step counted in second since 00h jan 1st of the current year 
    205    INTEGER , PUBLIC ::   nsec_month  !: current time step counted in second since 00h 1st day of the current month 
    206    INTEGER , PUBLIC ::   nsec_day    !: current time step counted in second since 00h of the current day 
    207    REAL(wp), PUBLIC ::   fjulday     !: julian day  
    208    REAL(wp), PUBLIC ::   adatrj      !: number of elapsed days since the begining of the whole simulation 
    209    !                                 !: (cumulative duration of previous runs that may have used different time-step size) 
     199   INTEGER , PUBLIC ::   nyear         !: current year 
     200   INTEGER , PUBLIC ::   nmonth        !: current month 
     201   INTEGER , PUBLIC ::   nday          !: current day of the month 
     202   INTEGER , PUBLIC ::   ndastp        !: time step date in yyyymmdd format 
     203   INTEGER , PUBLIC ::   nday_year     !: current day counted from jan 1st of the current year 
     204   INTEGER , PUBLIC ::   nsec_year     !: current time step counted in second since 00h jan 1st of the current year 
     205   INTEGER , PUBLIC ::   nsec_month    !: current time step counted in second since 00h 1st day of the current month 
     206   INTEGER , PUBLIC ::   nsec_week     !: current time step counted in second since 00h of last monday 
     207   INTEGER , PUBLIC ::   nsec_day      !: current time step counted in second since 00h of the current day 
     208   REAL(wp), PUBLIC ::   fjulday       !: current julian day  
     209   REAL(wp), PUBLIC ::   fjulstartyear !: first day of the current year in julian days 
     210   REAL(wp), PUBLIC ::   adatrj        !: number of elapsed days since the begining of the whole simulation 
     211   !                                   !: (cumulative duration of previous runs that may have used different time-step size) 
    210212   INTEGER , PUBLIC, DIMENSION(0: 1) ::   nyear_len     !: length in days of the previous/current year 
    211213   INTEGER , PUBLIC, DIMENSION(0:13) ::   nmonth_len    !: length in days of the months of the current year 
     
    230232   LOGICAL, PUBLIC, PARAMETER ::   lk_agrif = .FALSE.   !: agrif flag 
    231233 
     234   !!---------------------------------------------------------------------- 
     235   !! mpp reproducibility 
     236   !!---------------------------------------------------------------------- 
     237#if defined key_mpp_rep1 || defined key_mpp_re2 
     238   LOGICAL, PUBLIC, PARAMETER ::   lk_mpp_rep = .TRUE.    !: agrif flag 
     239#else 
     240   LOGICAL, PUBLIC, PARAMETER ::   lk_mpp_rep = .FALSE.   !: agrif flag 
     241#endif 
     242 
    232243CONTAINS 
    233244   LOGICAL FUNCTION Agrif_Root() 
     
    239250   END FUNCTION Agrif_CFixed 
    240251#endif 
    241  
    242252   !!====================================================================== 
    243253END MODULE dom_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domain.F90

    r1976 r2236  
    4343   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4444   !! $Id$ 
    45    !! Software is governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     45   !! Software is governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4646   !!------------------------------------------------------------------------- 
    4747 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domcfg.F90

    r1566 r2236  
    2424   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    2525   !! $Id$  
    26    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     26   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    2727   !!---------------------------------------------------------------------- 
    2828 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domhgr.F90

    r1953 r2236  
    4040   !!   OPA 9.0 , LOCEAN-IPSL (2005)  
    4141   !! $Id$  
    42    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4343   !!---------------------------------------------------------------------- 
    4444 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/dommsk.F90

    r1707 r2236  
    4444   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    4545   !! $Id$  
    46    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     46   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4747   !!---------------------------------------------------------------------- 
    4848 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domngb.F90

    r1725 r2236  
    2121   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2008)  
    2222   !! $Id$  
    23    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     23   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    2424   !!---------------------------------------------------------------------- 
    2525 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domstp.F90

    r1152 r2236  
    2929   !!   OPA 9.0 , LOCEAN-IPSL (2005)  
    3030   !! $Id$  
    31    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     31   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3232   !!---------------------------------------------------------------------- 
    3333 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domvvl.F90

    r2148 r2236  
    3838   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3939   !! $Id$ 
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4141   !!---------------------------------------------------------------------- 
    4242 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domzgr.F90

    r1694 r2236  
    3434   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    3535   USE closea          ! closed seas 
    36    USE c1d             ! 1D configuration 
    3736 
    3837   IMPLICIT NONE 
     
    5958   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    6059   !! $Id$ 
    61    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     60   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6261   !!---------------------------------------------------------------------- 
    6362 
     
    482481      !                                               ! =============== ! 
    483482 
    484       !                                               ! =================== ! 
    485       IF( .NOT. lk_c1d )   CALL zgr_bat_ctl           !   Bathymetry check  ! 
    486       !                                               ! =================== ! 
     483#if ! defined key_c1d 
     484      !                          ! =================== ! 
     485      CALL zgr_bat_ctl           !   Bathymetry check  ! 
     486      !                          ! =================== ! 
     487#endif 
    487488   END SUBROUTINE zgr_bat 
    488489 
     
    984985      !                                               ! =============== ! 
    985986 
    986       !                                               ! =================== ! 
    987       IF( .NOT. lk_c1d )   CALL zgr_bat_ctl           !   Bathymetry check  ! 
    988       !                                               ! =================== ! 
     987#if ! defined key_c1d 
     988      !                          ! =================== ! 
     989      CALL zgr_bat_ctl           !   Bathymetry check  ! 
     990      !                          ! =================== ! 
     991#endif 
    989992   END SUBROUTINE zgr_zps 
    990993 
     
    14761479      !                                               ! =========== 
    14771480 
    1478       !                                               ! =================== ! 
    1479       IF( .NOT. lk_c1d )   CALL zgr_bat_ctl           !   Bathymetry check  ! 
    1480       !                                               ! =================== ! 
     1481#if ! defined key_c1d 
     1482      !                          ! =================== ! 
     1483      CALL zgr_bat_ctl           !   Bathymetry check  ! 
     1484      !                          ! =================== ! 
     1485#endif 
    14811486 
    14821487      !                                               ! ============= 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/domzgr_substitute.h90

    r2148 r2236  
    108108   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    109109   !! $Id$ 
    110    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     110   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    111111   !!---------------------------------------------------------------------- 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/phycst.F90

    r2224 r2236  
    8383   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    8484   !! $Id$  
    85    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     85   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    8686   !!---------------------------------------------------------------------- 
    8787    
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DTA/dtasal.F90

    r2104 r2236  
    6363      !!   9.0  !  02-06  (G. Madec)  F90: Free form and module  
    6464      !!---------------------------------------------------------------------- 
    65       
    66       !! * Arguments 
    6765      INTEGER, INTENT(in) ::   kt             ! ocean time step 
    6866       
    69       !! * Local declarations 
    7067      INTEGER ::   ji, jj, jk, jl, jkk            ! dummy loop indicies 
    7168      INTEGER ::   ik, ierror                     ! temporary integers 
     
    7471#endif 
    7572      REAL(wp)::   zl 
     73       
    7674#if defined key_orca_lev10 
    7775      INTEGER ::   ikr, ikw, ikt, jjk  
     
    109107             CALL ctl_stop( 'dta_sal: unable to allocate sf_sal structure' )   ;   RETURN 
    110108         ENDIF 
    111 #if defined key_orca_lev10 
    112          ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpkdta  ) ) 
    113          ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpkdta,2) ) 
     109 
     110#if defined key_orca_lev10 
     111                                ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpkdta)   ) 
     112         IF( sn_sal%ln_tint )   ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpkdta,2) ) 
    114113#else 
    115          ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpk  ) ) 
    116          ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpk,2) ) 
    117 #endif 
    118  
     114                                ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpk)   ) 
     115         IF( sn_sal%ln_tint )   ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpk,2) ) 
     116#endif 
    119117         ! fill sf_sal with sn_sal and control print 
    120118         CALL fld_fill( sf_sal, (/ sn_sal /), cn_dir, 'dta_sal', 'Salinity data', 'namdta_sal' ) 
     
    122120      ENDIF 
    123121      
    124       
    125122      ! 2. Read monthly file 
    126123      ! ------------------- 
     
    128125      CALL fld_read( kt, 1, sf_sal ) 
    129126 
    130       IF( lwp .AND. kt==nn_it000 ) THEN 
     127      IF( lwp .AND. kt == nit000 ) THEN 
    131128         WRITE(numout,*) 
    132129         WRITE(numout,*) ' read Levitus salinity ok' 
     
    247244      ENDIF 
    248245         
    249       IF( lwp .AND. kt==nn_it000 ) THEN 
     246      IF( lwp .AND. kt == nit000 ) THEN 
    250247         WRITE(numout,*)' salinity Levitus ' 
    251248         WRITE(numout,*) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DTA/dtatem.F90

    r2104 r2236  
    6969      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module 
    7070      !!---------------------------------------------------------------------- 
    71       !! * Arguments 
    7271      INTEGER, INTENT( in ) ::   kt     ! ocean time-step 
    7372 
    74       !! * Local declarations 
    7573      INTEGER ::   ji, jj, jk, jl, jkk            ! dummy loop indicies 
    7674      INTEGER ::   ik, ierror                     ! temporary integers 
     
    102100         sn_tem = FLD_N( 'temperature',  -1.  ,  'votemper',  .false.   , .true.  ,  'yearly'  , ''       , ''         ) 
    103101 
    104          REWIND( numnam )            ! ... read in namlist namdta_tem  
     102         REWIND( numnam )         ! ... read in namlist namdta_tem  
    105103         READ( numnam, namdta_tem )  
    106104 
    107          IF(lwp) THEN                ! control print 
     105         IF(lwp) THEN              ! control print 
    108106            WRITE(numout,*) 
    109107            WRITE(numout,*) 'dta_tem : Temperature Climatology ' 
     
    116114 
    117115#if defined key_orca_lev10 
    118          ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpkdta  ) ) 
    119          ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpkdta,2) ) 
     116                                ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpkdta)  ) 
     117         IF( sn_tem%ln_tint )   ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpkdta,2) ) 
    120118#else 
    121          ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpk  ) ) 
    122          ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpk,2) ) 
     119                                ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpk)  ) 
     120         IF( sn_tem%ln_tint )   ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpk,2) ) 
    123121#endif 
    124122         ! fill sf_tem with sn_tem and control print 
    125123         CALL fld_fill( sf_tem, (/ sn_tem /), cn_dir, 'dta_tem', 'Temperature data', 'namdta_tem' ) 
    126124         linit_tem = .TRUE. 
    127  
     125         ! 
    128126      ENDIF 
    129127       
     
    133131      CALL fld_read( kt, 1, sf_tem ) 
    134132        
    135       IF( lwp .AND. kt==nn_it000 )THEN  
     133      IF( lwp .AND. kt == nit000 )THEN  
    136134         WRITE(numout,*) 
    137135         WRITE(numout,*) ' read Levitus temperature ok' 
     
    141139#if defined key_tradmp 
    142140      IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN 
    143              
    144141         !                                        ! ======================= 
    145142         !                                        !  ORCA_R2 configuration 
     
    236233         END DO 
    237234             
    238          IF( lwp .AND. kt==nn_it000 )THEN 
     235         IF( lwp .AND. kt == nit000 )THEN 
    239236            WRITE(numout,*) 
    240237            WRITE(numout,*) ' Levitus temperature data interpolated to s-coordinate' 
     
    260257   ENDIF 
    261258          
    262    IF( lwp .AND. kt==nn_it000 ) THEN 
     259   IF( lwp .AND. kt == nit000 ) THEN 
    263260      WRITE(numout,*) ' temperature Levitus ' 
    264261      WRITE(numout,*) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/divcur.F90

    r2148 r2236  
    1414   USE in_out_manager  ! I/O manager 
    1515   USE obc_oce         ! ocean lateral open boundary condition 
    16    USE bdy_oce         ! Unstructured open boundaries variables 
    1716   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
     17   USE sbcrnf         ! river runoff  
     18   USE sbc_oce, ONLY : ln_rnf   ! surface boundary condition: ocean 
    1819 
    1920   IMPLICIT NONE 
     
    7980      !!   9.0  !  03-08  (G. Madec)  merged of cur and div, free form, F90 
    8081      !!        !  05-01  (J. Chanut, A. Sellar) unstructured open boundaries 
     82      !! NEMO 3.3  !  2010-09  (D.Storkey and E.O'Dea) bug fixes for BDY module 
    8183      !!---------------------------------------------------------------------- 
    8284      !! * Arguments 
     
    132134            IF( lp_obc_south )   hdivn(nis0  :nis1  ,njs0  :njs1  ,jk) = 0.e0      ! south 
    133135         ENDIF 
    134 #endif          
    135 #if defined key_bdy 
    136          ! unstructured open boundaries (div must be zero behind the open boundary) 
    137          DO jj = 1, jpj 
    138             DO ji = 1, jpi 
    139                hdivn(ji,jj,jk)=hdivn(ji,jj,jk)*bdytmask(ji,jj) 
    140             END DO 
    141          END DO 
    142136#endif          
    143137         IF( .NOT. AGRIF_Root() ) THEN 
     
    245239      END DO                                           !   End of slab 
    246240      !                                                ! =============== 
     241 
     242      IF( ln_rnf )  CALL sbc_rnf_div( hdivn )          ! runoffs (update hdivn field) 
    247243       
    248244      ! 4. Lateral boundary conditions on hdivn and rotn 
     
    346342         ENDIF 
    347343#endif          
    348 #if defined key_bdy 
    349          ! unstructured open boundaries (div must be zero behind the open boundary) 
    350          DO jj = 1, jpj 
    351            DO ji = 1, jpi 
    352              hdivn(ji,jj,jk)=hdivn(ji,jj,jk)*bdytmask(ji,jj) 
    353            END DO 
    354          END DO 
    355 #endif         
    356344         IF( .NOT. AGRIF_Root() ) THEN 
    357345            IF ((nbondi ==  1).OR.(nbondi == 2)) hdivn(nlci-1 , :     ,jk) = 0.e0      ! east 
     
    374362      END DO                                           !   End of slab 
    375363      !                                                ! =============== 
    376        
     364 
     365      IF( ln_rnf )  CALL sbc_rnf_div( hdivn )          ! runoffs (update hdivn field) 
     366 
    377367      ! 4. Lateral boundary conditions on hdivn and rotn 
    378368      ! ---------------------------------=======---====== 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynadv.F90

    • Property svn:executable deleted
    r2104 r2236  
    3838   !! NEMO/OPA 3,3 , LOCEAN-IPSL (2010)  
    3939   !! $Id$ 
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4141   !!---------------------------------------------------------------------- 
    4242 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynadv_cen2.F90

    • Property svn:executable deleted
    r1566 r2236  
    3131   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    3232   !! $Id$ 
    33    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     33   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    3434   !!---------------------------------------------------------------------- 
    3535 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynadv_ubs.F90

    • Property svn:executable deleted
    r1566 r2236  
    3636   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    3737   !! $Id$ 
    38    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     38   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    3939   !!---------------------------------------------------------------------- 
    4040 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynbfr.F90

    r1719 r2236  
    3232   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3333   !! $Id: dynzdf.F90 1152 2008-06-26 14:11:13Z rblod $ 
    34    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     34   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3535   !!---------------------------------------------------------------------- 
    3636 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynhpg.F90

    r2104 r2236  
    6363   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    6464   !! $Id$ 
    65    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     65   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6666   !!---------------------------------------------------------------------- 
    6767 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynkeg.F90

    r1152 r2236  
    2929   !!   OPA 9.0 , LOCEAN-IPSL (2005)  
    3030   !! $Id$  
    31    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     31   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3232   !!---------------------------------------------------------------------- 
    3333 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynldf.F90

    • Property svn:executable deleted
    r2104 r2236  
    3333   PUBLIC   dyn_ldf_init  ! called by opa  module  
    3434 
    35    INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_dynldf_... namlist logicals) 
     35   INTEGER ::   nldf = -2   ! type of lateral diffusion used defined from ln_dynldf_... namlist logicals) 
    3636 
    3737   !! * Substitutions 
     
    4141   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4242   !! $Id$ 
    43    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     43   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4444   !!---------------------------------------------------------------------- 
    4545 
     
    6868      CASE ( 2 )    ;   CALL dyn_ldf_bilap  ( kt )      ! iso-level bilaplacian 
    6969      CASE ( 3 )    ;   CALL dyn_ldf_bilapg ( kt )      ! s-coord. horizontal bilaplacian 
     70      CASE ( 4 )                                        ! iso-level laplacian + bilaplacian 
     71         CALL dyn_ldf_lap    ( kt ) 
     72         CALL dyn_ldf_bilap  ( kt ) 
     73      CASE ( 5 )                                        ! rotated laplacian + bilaplacian (s-coord) 
     74         CALL dyn_ldf_iso    ( kt ) 
     75         CALL dyn_ldf_bilapg ( kt ) 
    7076      ! 
    7177      CASE ( -1 )                                       ! esopa: test all possibility with control print 
     
    8288                        CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf3 - Ua: ', mask1=umask,   & 
    8389            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' ) 
     90      ! 
     91      CASE ( -2 )                                       ! neither laplacian nor bilaplacian schemes used 
     92         IF( kt == nit000 ) THEN 
     93            IF(lwp) WRITE(numout,*) 
     94            IF(lwp) WRITE(numout,*) 'dyn_ldf : no lateral diffusion on momentum setup' 
     95            IF(lwp) WRITE(numout,*) '~~~~~~~ ' 
     96         ENDIF 
    8497      END SELECT 
    8598 
     
    123136      IF( ln_dynldf_lap   )   ioptio = ioptio + 1 
    124137      IF( ln_dynldf_bilap )   ioptio = ioptio + 1 
    125       IF( ioptio /= 1 ) CALL ctl_stop( '          use ONE of the 2 lap/bilap operator type on dynamics' ) 
     138      IF( ioptio <  1 ) CALL ctl_warn( '          neither laplacian nor bilaplacian operator set for dynamics' ) 
    126139      ioptio = 0 
    127140      IF( ln_dynldf_level )   ioptio = ioptio + 1 
     
    143156            IF ( ln_dynldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    144157         ENDIF 
    145          IF ( ln_sco ) THEN             ! z-coordinate 
     158         IF ( ln_sco ) THEN             ! s-coordinate 
    146159            IF ( ln_dynldf_level )   nldf = 0      ! iso-level  (no rotation) 
    147160            IF ( ln_dynldf_hor   )   nldf = 1      ! horizontal (   rotation) 
     
    161174            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    162175         ENDIF 
    163          IF ( ln_sco ) THEN             ! z-coordinate 
     176         IF ( ln_sco ) THEN             ! s-coordinate 
    164177            IF ( ln_dynldf_level )   nldf = 2      ! iso-level  (no rotation) 
    165178            IF ( ln_dynldf_hor   )   nldf = 3      ! horizontal (   rotation) 
     
    168181      ENDIF 
    169182       
     183      IF( ln_dynldf_lap .AND. ln_dynldf_bilap ) THEN  ! mixed laplacian and bilaplacian operators 
     184         IF ( ln_zco ) THEN                ! z-coordinate 
     185            IF ( ln_dynldf_level )   nldf = 4      ! iso-level  (no rotation) 
     186            IF ( ln_dynldf_hor   )   nldf = 4      ! horizontal (no rotation) 
     187            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
     188         ENDIF 
     189         IF ( ln_zps ) THEN             ! z-coordinate 
     190            IF ( ln_dynldf_level )   ierr = 1      ! iso-level not allowed  
     191            IF ( ln_dynldf_hor   )   nldf = 4      ! horizontal (no rotation) 
     192            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
     193         ENDIF 
     194         IF ( ln_sco ) THEN             ! s-coordinate 
     195            IF ( ln_dynldf_level )   nldf = 4      ! iso-level  (no rotation) 
     196            IF ( ln_dynldf_hor   )   nldf = 5      ! horizontal (   rotation) 
     197            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
     198         ENDIF 
     199      ENDIF 
     200 
    170201      IF( lk_esopa )                 nldf = -1     ! esopa test 
    171202 
     
    178209      IF(lwp) THEN 
    179210         WRITE(numout,*) 
     211         IF( nldf == -2 )   WRITE(numout,*) '              neither laplacian nor bilaplacian schemes used' 
    180212         IF( nldf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used' 
    181213         IF( nldf ==  0 )   WRITE(numout,*) '              laplacian operator' 
    182          IF( nldf ==  1 )   WRITE(numout,*) '              Rotated laplacian operator' 
     214         IF( nldf ==  1 )   WRITE(numout,*) '              rotated laplacian operator' 
    183215         IF( nldf ==  2 )   WRITE(numout,*) '              bilaplacian operator' 
    184          IF( nldf ==  3 )   WRITE(numout,*) '              Rotated bilaplacian' 
     216         IF( nldf ==  3 )   WRITE(numout,*) '              rotated bilaplacian' 
     217         IF( nldf ==  4 )   WRITE(numout,*) '              laplacian and bilaplacian operators' 
     218         IF( nldf ==  5 )   WRITE(numout,*) '              rotated laplacian and bilaplacian operators' 
    185219      ENDIF 
    186220      ! 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynldf_iso.F90

    r1156 r2236  
    3838   !!   OPA 9.0 , LOCEAN-IPSL (2005)  
    3939   !! $Id$ 
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4141   !!---------------------------------------------------------------------- 
    4242 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynnxt.F90

    r2148 r2236  
    1515   !!            2.3  !  2007-07  (D. Storkey) Calls to BDY routines.  
    1616   !!            3.2  !  2009-06  (G. Madec, R.Benshila)  re-introduce the vvl option 
     17   !!            3.3  !  2010-09  (D. Storkey, E.O'Dea) Bug fix for BDY module 
    1718   !!------------------------------------------------------------------------- 
    1819   
     
    3435   USE bdydta          ! unstructured open boundary conditions 
    3536   USE bdydyn          ! unstructured open boundary conditions 
    36    USE agrif_opa_update 
    37    USE agrif_opa_interp 
    3837   USE in_out_manager  ! I/O manager 
    3938   USE lbclnk          ! lateral boundary condition (or mpp link) 
    4039   USE prtctl          ! Print control 
     40#if defined key_agrif 
     41   USE agrif_opa_update 
     42   USE agrif_opa_interp 
     43#endif 
    4144 
    4245   IMPLICIT NONE 
     
    5053   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    5154   !! $Id$  
    52    !! Software is governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     55   !! Software is governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    5356   !!------------------------------------------------------------------------- 
    5457 
     
    171174# elif defined key_bdy  
    172175      !                                !* BDY open boundaries 
    173       !RB all this part should be in a specific routine 
    174176      IF( lk_dynspg_exp .OR. lk_dynspg_ts ) THEN       ! except for filtered option 
    175          ! 
    176177         CALL bdy_dyn_frs( kt ) 
    177          ! 
    178          IF( ln_bdy_dyn_fla ) THEN 
    179             ua_e(:,:) = 0.e0 
    180             va_e(:,:) = 0.e0 
    181             ! Set these variables for use in bdy_dyn_fla 
    182             hur_e(:,:) = hur(:,:) 
    183             hvr_e(:,:) = hvr(:,:) 
    184             DO jk = 1, jpkm1   !! Vertically integrated momentum trends 
    185                ua_e(:,:) = ua_e(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk) 
    186                va_e(:,:) = va_e(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk) 
    187             END DO 
    188             ua_e(:,:) = ua_e(:,:) * hur(:,:) 
    189             va_e(:,:) = va_e(:,:) * hvr(:,:) 
    190             DO jk = 1 , jpkm1 
    191                ua(:,:,jk) = ua(:,:,jk) - ua_e(:,:) 
    192                va(:,:,jk) = va(:,:,jk) - va_e(:,:) 
    193             END DO 
    194             CALL bdy_dta_bt( kt+1, 0) 
    195             CALL bdy_dyn_fla( sshn_b ) 
    196             CALL lbc_lnk( ua_e, 'U', -1. )   ! Boundary points should be updated 
    197             CALL lbc_lnk( va_e, 'V', -1. )   ! 
    198             DO jk = 1 , jpkm1 
    199                ua(:,:,jk) = ( ua(:,:,jk) + ua_e(:,:) ) * umask(:,:,jk) 
    200                va(:,:,jk) = ( va(:,:,jk) + va_e(:,:) ) * vmask(:,:,jk) 
    201             END DO 
    202          ENDIF 
    203          ! 
    204178      ENDIF 
    205179# endif 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg.F90

    • Property svn:executable deleted
    r2027 r2236  
    3838   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    3939   !! $Id$  
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4141   !!---------------------------------------------------------------------- 
    4242 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_exp.F90

    • Property svn:executable deleted
    r1505 r2236  
    4040   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4141   !! $Id$ 
    42    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4343   !!---------------------------------------------------------------------- 
    4444 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90

    • Property svn:executable deleted
    r2000 r2236  
    4444   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    4545   USE prtctl          ! Print control 
    46    USE agrif_opa_interp 
    4746   USE iom 
    4847   USE restart         ! only for lrst_oce 
    4948   USE lib_fortran 
     49#if defined key_agrif 
     50   USE agrif_opa_interp 
     51#endif 
    5052 
    5153   IMPLICIT NONE 
     
    6163   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    6264   !! $Id$ 
    63    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     65   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    6466   !!---------------------------------------------------------------------- 
    6567 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_oce.F90

    r1566 r2236  
    4444   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    4545   !! $Id$  
    46    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     46   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4747   !!====================================================================== 
    4848END MODULE dynspg_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_ts.F90

    • Property svn:executable deleted
    r2200 r2236  
    77   !!              -   ! 2008-01  (R. Benshila)  change averaging method 
    88   !!             3.2  ! 2009-07  (R. Benshila, G. Madec) Complete revisit associated to vvl reactivation 
     9   !!             3.3  ! 2010-09  (D. Storkey, E. O'Dea) update for BDY for Shelf configurations 
    910  !!--------------------------------------------------------------------- 
    1011#if defined key_dynspg_ts   ||   defined key_esopa 
     
    5859   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    5960   !! $Id$ 
    60    !! Software is governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     61   !! Software is governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    6162   !!------------------------------------------------------------------------- 
    6263 
     
    352353         !                                                !  ------------------ 
    353354         IF( lk_obc                     )   CALL obc_dta_bt( kt, jn   ) 
    354          IF( lk_bdy  .OR.  ln_bdy_tides )   CALL bdy_dta_bt( kt, jn+1 ) 
     355         IF( lk_bdy  .OR.  ln_bdy_tides )   CALL bdy_dta_bt( kt, jn+1, icycle ) 
    355356 
    356357         !                                                !* after ssh_e 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynvor.F90

    r2104 r2236  
    5757   !! NEMO/OPA 3,3 , LOCEAN-IPSL (2010)  
    5858   !! $Id$ 
    59    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     59   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6060   !!---------------------------------------------------------------------- 
    6161 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynzad.F90

    r1146 r2236  
    3333   !!   OPA 9.0 , LOCEAN-IPSL (2005)  
    3434   !! $Id$ 
    35    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     35   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3636   !!---------------------------------------------------------------------- 
    3737 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynzdf.F90

    r2104 r2236  
    4141   !! NEMO/OPA 3,3 , LOCEAN-IPSL (2010)  
    4242   !! $Id$ 
    43    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     43   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4444   !!---------------------------------------------------------------------- 
    4545 
     
    104104      USE zdftke_old 
    105105      USE zdftke 
     106      USE zdfgls 
    106107      USE zdfkpp 
    107108      !!---------------------------------------------------------------------- 
     
    113114      ! 
    114115      ! Force implicit schemes 
    115       IF( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfkpp )   nzdf = 1   ! TKE or KPP physics 
    116       IF( ln_dynldf_iso                               )   nzdf = 1   ! iso-neutral lateral physics 
    117       IF( ln_dynldf_hor .AND. ln_sco                  )   nzdf = 1   ! horizontal lateral physics in s-coordinate 
     116      IF( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp )   nzdf = 1   ! TKE, GLS or KPP physics 
     117      IF( ln_dynldf_iso                                              )   nzdf = 1   ! iso-neutral lateral physics 
     118      IF( ln_dynldf_hor .AND. ln_sco                                 )   nzdf = 1   ! horizontal lateral physics in s-coordinate 
    118119      ! 
    119120      IF( lk_esopa )    nzdf = -1                   ! Esopa key: All schemes used 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynzdf_exp.F90

    r2148 r2236  
    3232   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    3333   !! $Id$ 
    34    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     34   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3535   !!---------------------------------------------------------------------- 
    3636 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynzdf_imp.F90

    r2148 r2236  
    2020   USE phycst          ! physical constants 
    2121   USE in_out_manager  ! I/O manager 
     22#if defined key_zdfgls 
     23   USE zdfbfr, ONLY : bfrua, bfrva, wbotu, wbotv ! bottom stresses 
     24   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
     25#endif 
    2226 
    2327   IMPLICIT NONE 
     
    6569      REAL(wp) ::   zzwi, zzws, zrhs       ! temporary scalars 
    6670      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwi        ! 3D workspace 
     71#if defined key_zdfgls 
     72      INTEGER :: ikbu, ikbv, ikbum1, ikbvm1 
     73      REAL(wp) :: zcbcu, zcbcv 
     74#endif 
    6775      !!---------------------------------------------------------------------- 
    6876 
     
    155163         END DO 
    156164      END DO 
    157       ! 
    158       DO jk = 1, jpkm1        !==  Normalization to obtain the general momentum trend ua  == 
     165 
     166#if defined key_zdfgls 
     167      ! Save bottom stress for next time step 
     168      DO jj = 2, jpjm1 
     169         DO ji = fs_2, fs_jpim1   ! vector opt. 
     170            ikbu   = MIN( mbathy(ji+1,jj  ), mbathy(ji,jj) ) 
     171            ikbum1 = MAX( ikbu-1, 1 ) 
     172            wbotu(ji,jj) = bfrua(ji,jj) * ua(ji,jj,ikbum1) * umask(ji,jj,ikbum1) 
     173         END DO 
     174      END DO 
     175      CALL lbc_lnk( wbotu(:,:), 'U', -1. ) 
     176#endif 
     177 
     178      ! Normalization to obtain the general momentum trend ua 
     179      DO jk = 1, jpkm1 
    159180         DO jj = 2, jpjm1    
    160181            DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    243264         END DO 
    244265      END DO 
    245       ! 
    246       DO jk = 1, jpkm1     !==  Normalization to obtain the general momentum trend va  == 
     266 
     267#if defined key_zdfgls 
     268      ! Save bottom stress for next time step 
     269      DO jj = 2, jpjm1 
     270         DO ji = fs_2, fs_jpim1   ! vector opt. 
     271            ikbv   = MIN( mbathy(ji,jj+1), mbathy(ji,jj) ) 
     272            ikbvm1 = MAX( ikbv-1, 1 ) 
     273            wbotv(ji,jj) = bfrva(ji,jj) * va(ji,jj,ikbvm1) * vmask(ji,jj,ikbvm1) 
     274         END DO 
     275      END DO 
     276      CALL lbc_lnk( wbotv(:,:), 'V', -1. ) 
     277#endif 
     278 
     279      ! Normalization to obtain the general momentum trend va 
     280      DO jk = 1, jpkm1 
    247281         DO jj = 2, jpjm1    
    248282            DO ji = fs_2, fs_jpim1   ! vector opt. 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/sshwzv.F90

    r2148 r2236  
    66   !! History :  3.1  !  2009-02  (G. Madec, M. Leclair)  Original code 
    77   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  modified LF-RA  
     8   !!             -   !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface 
     9   !!             -   !  2010-09  (D.Storkey and E.O'Dea) bug fixes for BDY module 
    810   !!---------------------------------------------------------------------- 
    911 
     
    2628   USE obc_par         ! open boundary cond. parameter 
    2729   USE obc_oce 
     30   USE bdy_oce 
    2831   USE diaar5, ONLY :   lk_diaar5 
    2932   USE iom 
    30    USE sbcrnf, ONLY : rnf_dep, rnf_mod_dep  ! River runoff 
     33   USE sbcrnf, ONLY  : h_rnf, nk_rnf  ! River runoff  
     34#if defined key_asminc    
     35   USE asminc          ! Assimilation increment 
     36#endif 
    3137 
    3238   IMPLICIT NONE 
     
    4248   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4349   !! $Id$ 
    44    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     50   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4551   !!---------------------------------------------------------------------- 
    4652 
     
    138144         hur(:,:) = umask(:,:,1) / ( hu(:,:) + 1.e0 - umask(:,:,1) ) 
    139145         hvr(:,:) = vmask(:,:,1) / ( hv(:,:) + 1.e0 - vmask(:,:,1) ) 
    140          ! 
     146         !  
    141147      ENDIF 
    142148      ! 
     
    168174      ENDIF 
    169175#endif 
     176#if defined key_bdy 
     177      ssha(:,:) = ssha(:,:) * bdytmask(:,:) 
     178      CALL lbc_lnk( ssha, 'T', 1. )  
     179#endif 
     180 
    170181      !                                                ! Sea Surface Height at u-,v- and f-points (vvl case only) 
    171182      IF( lk_vvl ) THEN                                ! (required only in key_vvl case) 
     
    184195         CALL lbc_lnk( sshv_a, 'V', 1. ) 
    185196      ENDIF 
     197! Include the IAU weighted SSH increment 
     198#if defined key_asminc 
     199      IF( ( lk_asminc ).AND.( ln_sshinc ).AND.( ln_asmiau ) ) THEN 
     200         CALL ssh_asm_inc( kt ) 
     201         ssha(:,:) = ssha(:,:) + z2dt * ssh_iau(:,:) 
     202      ENDIF 
     203#endif 
     204 
    186205      !                                           !------------------------------! 
    187206      !                                           !     Now Vertical Velocity    ! 
     
    193212            &                      - (  fse3t_a(:,:,jk) - fse3t_b(:,:,jk) )    & 
    194213            &                         * tmask(:,:,jk) * z1_2dt 
     214#if defined key_bdy 
     215         wn(:,:,jk) = wn(:,:,jk) * bdytmask(:,:) 
     216#endif 
    195217      END DO 
    196218 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/FLO/flo_oce.F90

    r1601 r2236  
    5151   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    5252   !! $Id$  
    53    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     53   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5454   !!====================================================================== 
    5555END MODULE flo_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/FLO/floats.F90

    r2104 r2236  
    3030   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3131   !! $Id$  
    32    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     32   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3333   !!---------------------------------------------------------------------- 
    3434 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/FLO/flowri.F90

    r1715 r2236  
    3434   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3535   !! $Id$  
    36    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     36   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3737   !!---------------------------------------------------------------------- 
    3838 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/in_out_manager.F90

    r1976 r2236  
    110110   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    111111   !! $Id$ 
    112    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     112   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    113113   !!---------------------------------------------------------------------- 
    114114 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom.F90

    r1953 r2236  
    7070   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
    7171   !! $Id$ 
    72    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     72   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7373   !!---------------------------------------------------------------------- 
    7474 
     
    800800            IF( iom_file(kiomid)%ndims(idvar) == 1 ) THEN 
    801801               IF( iom_file(kiomid)%luld(idvar) ) THEN 
    802                   IF( iom_file(kiomid)%dimsz(1,idvar) == size(ptime) ) THEN 
     802                  IF( iom_file(kiomid)%dimsz(1,idvar) <= size(ptime) ) THEN 
    803803                     SELECT CASE (iom_file(kiomid)%iolib) 
    804804                     CASE (jpioipsl )   ;   CALL iom_ioipsl_gettime( kiomid, idvar, ptime, cdunits, cdcalendar ) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_def.F90

    r1359 r2236  
    1010   !! OPA 9.0 , LOCEAN-IPSL (2006)  
    1111   !! $Id$  
    12    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     12   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    1313   !!--------------------------------------------------------------------------------- 
    1414 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_ioipsl.F90

    r2200 r2236  
    3737   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
    3838   !! $Id$ 
    39    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     39   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4040   !!---------------------------------------------------------------------- 
    4141 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_nf90.F90

    r2200 r2236  
    3838   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
    3939   !! $Id$ 
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4141   !!---------------------------------------------------------------------- 
    4242 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_rstdimg.F90

    r1488 r2236  
    3737   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
    3838   !! $Id$ 
    39    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     39   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4040   !!---------------------------------------------------------------------- 
    4141 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/restart.F90

    r2148 r2236  
    2121   USE in_out_manager  ! I/O manager 
    2222   USE iom             ! I/O module 
    23    USE c1d             ! re-initialization of u-v mask for the 1D configuration 
    2423   USE zpshde          ! partial step: hor. derivative (zps_hde routine) 
    2524   USE eosbn2          ! equation of state            (eos bn2 routine) 
     
    2928   USE domvvl          ! variable volume 
    3029   USE traswp          ! swap from 4D T-S to 3D T & S and vice versa 
     30#if defined key_zdfgls 
     31   USE zdfbfr, ONLY : wbotu, wbotv ! bottom stresses 
     32   USE zdf_oce 
     33#endif 
    3134 
    3235   IMPLICIT NONE 
     
    4649   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4750   !! $Id$ 
    48    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     51   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4952   !!---------------------------------------------------------------------- 
    5053 
     
    142145#endif 
    143146 
     147#if defined key_zdfgls 
     148      ! Save bottom stresses 
     149      CALL iom_rstput( kt, nitrst, numrow, 'wbotu' , wbotu ) 
     150      CALL iom_rstput( kt, nitrst, numrow, 'wbotv' , wbotv ) 
     151#endif 
     152 
    144153      IF( kt == nitrst ) THEN 
    145154         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn.F90

    • Property svn:executable deleted
    r1954 r2236  
    3838   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3939   !! $Id$  
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4141   !!---------------------------------------------------------------------- 
    4242 
     
    6767      NAMELIST/namdyn_ldf/ ln_dynldf_lap  , ln_dynldf_bilap,                  & 
    6868         &                 ln_dynldf_level, ln_dynldf_hor  , ln_dynldf_iso,   & 
    69          &                 rn_ahm_0       , rn_ahmb_0      , rn_ahm_0_blp 
     69         &                 rn_ahm_0_lap   , rn_ahmb_0      , rn_ahm_0_blp 
    7070      !!---------------------------------------------------------------------- 
    7171 
     
    8383         WRITE(numout,*) '      horizontal (geopotential)               ln_dynldf_hor   = ', ln_dynldf_hor 
    8484         WRITE(numout,*) '      iso-neutral                             ln_dynldf_iso   = ', ln_dynldf_iso 
    85          WRITE(numout,*) '      horizontal laplacian eddy viscosity     rn_ahm_0        = ', rn_ahm_0 
     85         WRITE(numout,*) '      horizontal laplacian eddy viscosity     rn_ahm_0_lap    = ', rn_ahm_0_lap 
    8686         WRITE(numout,*) '      background viscosity                    rn_ahmb_0       = ', rn_ahmb_0 
    87          WRITE(numout,*) '      horizontal bilaplacian eddy viscosity   rn_ahm_0        = ', rn_ahm_0 
    88  
    89       ENDIF 
    90  
    91       ahm0     = rn_ahm_0                  ! OLD namelist variables defined from DOCTOR namelist variables 
     87         WRITE(numout,*) '      horizontal bilaplacian eddy viscosity   rn_ahm_0_blp    = ', rn_ahm_0_blp 
     88      ENDIF 
     89 
     90      ahm0     = rn_ahm_0_lap              ! OLD namelist variables defined from DOCTOR namelist variables 
    9291      ahmb0    = rn_ahmb_0 
    9392      ahm0_blp = rn_ahm_0_blp 
     
    120119      IF( ln_dynldf_bilap ) THEN 
    121120         IF(lwp) WRITE(numout,*) '   biharmonic momentum diffusion' 
    122          IF( ahm0_blp == 0.0 ) ahm0_blp = ahm0       ! Old namelist method: bilap specified with ahm0 
    123121         IF( .NOT. ln_dynldf_lap ) ahm0 = ahm0_blp   ! Allow spatially varying coefs, which use ahm0 as input 
    124122         IF( ahm0_blp > 0 .AND. .NOT. lk_esopa )   CALL ctl_stop( 'The horizontal viscosity coef. ahm0 must be negative' ) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_c1d.h90

    r2200 r2236  
    2929      !! * Local variables 
    3030      INTEGER  ::   jk   ! dummy loop indice 
    31       REAL(wp) ::    zdam,  zwam,  zm00,  zm01,  zmhf,  zmhs 
     31      REAL(wp) ::   zdam,  zwam,  zm00,  zm01,  zmhf,  zmhs 
    3232      REAL(wp) ::   zdam2, zwam2, zm200, zm201, zmh2f, zmh2s 
    3333      REAL(wp) ::   zahmf, zahms 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_c2d.h90

    • Property svn:executable deleted
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_c3d.h90

    • Property svn:executable deleted
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_oce.F90

    r1954 r2236  
    1717   LOGICAL , PUBLIC ::   ln_dynldf_hor   = .TRUE.      !: horizontal (geopotential) direction 
    1818   LOGICAL , PUBLIC ::   ln_dynldf_iso   = .FALSE.     !: iso-neutral direction 
    19    REAL(wp), PUBLIC ::   rn_ahm_0        = 40000._wp   !: lateral laplacian eddy viscosity (m2/s) 
     19   REAL(wp), PUBLIC ::   rn_ahm_0_lap    = 40000._wp   !: lateral laplacian eddy viscosity (m2/s) 
    2020   REAL(wp), PUBLIC ::   rn_ahmb_0       =     0._wp   !: lateral laplacian background eddy viscosity (m2/s) 
    2121   REAL(wp), PUBLIC ::   rn_ahm_0_blp    =     0._wp   !: lateral bilaplacian eddy viscosity (m4/s) 
    22  
    23    REAL(wp), PUBLIC ::   ahm0, ahmb0, ahm0_blp       ! OLD namelist names 
     22   REAL(wp), PUBLIC ::   ahm0, ahmb0, ahm0_blp         ! OLD namelist names 
    2423 
    2524#if defined key_dynldf_c3d 
     
    3635   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3736   !! $Id$  
    38    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     37   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3938   !!====================================================================== 
    4039END MODULE ldfdyn_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfslp.F90

    r2104 r2236  
    2424   USE phycst          ! physical constants 
    2525   USE zdfmxl          ! mixed layer depth 
     26   USE eosbn2 
    2627   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2728   USE in_out_manager  ! I/O manager 
     
    3334   PUBLIC   ldf_slp         ! routine called by step.F90 
    3435   PUBLIC   ldf_slp_init    ! routine called by opa.F90 
     36   PUBLIC ldf_slp_grif   !              " 
    3537 
    3638   LOGICAL , PUBLIC, PARAMETER              ::   lk_ldfslp = .TRUE.   !: slopes flag 
    3739   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   uslp, wslpi          !: i_slope at U- and W-points 
    3840   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   vslp, wslpj          !: j-slope at V- and W-points 
     41   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   wslp2                !: wslp**2 from Griffies quarter cells 
     42   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   alpha, beta          !: alpha,beta at T points 
     43   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   tfw,sfw,ftu,fsu,ftv,fsv,ftud,fsud,ftvd,fsvd 
     44   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   psix_eiv 
     45   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   psiy_eiv 
    3946    
    4047   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   omlmask           ! mask of the surface mixed layer at T-pt 
     
    4451   !! * Substitutions 
    4552#  include "domzgr_substitute.h90" 
     53#  include "ldftra_substitute.h90" 
     54#  include "ldfeiv_substitute.h90" 
    4655#  include "vectopt_loop_substitute.h90" 
    4756   !!---------------------------------------------------------------------- 
    4857   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4958   !! $Id$ 
    50    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     59   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5160   !!---------------------------------------------------------------------- 
    5261 
     
    304313      END DO 
    305314          
    306  
    307315      ! III.  Specific grid points      
    308316      ! ===========================  
     
    339347      ! 
    340348   END SUBROUTINE ldf_slp 
     349 
     350   SUBROUTINE ldf_slp_grif ( kt ) 
     351     !!---------------------------------------------------------------------- 
     352     !!                 ***  ROUTINE ldf_slp_grif  *** 
     353     !! 
     354     !! ** Purpose :   Compute the squared slopes of neutral surfaces (slope 
     355     !!      of iso-pycnal surfaces referenced locally) ('key_traldfiso') 
     356     !!      at W-points using the Griffies quarter-cells.  Also calculates 
     357     !!      alpha and beta at T-points for use in the Griffies isopycnal 
     358     !!      scheme. 
     359     !! 
     360     !! ** Method  :   The slope in the i-direction is computed at U- and 
     361     !!      W-points (uslp, wslpi) and the slope in the j-direction is 
     362     !!      computed at V- and W-points (vslp, wslpj). 
     363     !! 
     364     !! ** Action : - alpha, beta 
     365     !!               wslp2 squared slope of neutral surfaces at w-points. 
     366     !! 
     367     !! History : 
     368     !!   9.0  !  06-10  (C. Harris)  New subroutine 
     369     !!---------------------------------------------------------------------- 
     370     !! * Modules used 
     371     USE oce            , zdit  => ua,  &  ! use ua as workspace 
     372          zdis  => va,  &  ! use va as workspace 
     373          zdjt  => ta,  &  ! use ta as workspace 
     374          zdjs  => sa      ! use sa as workspace 
     375     !! * Arguments 
     376     INTEGER, INTENT( in ) ::   kt         ! ocean time-step index 
     377 
     378     !! * Local declarations 
     379     INTEGER  ::   ji, jj, jk, ip, jp, kp  ! dummy loop indices 
     380     INTEGER  ::   iku, ikv                ! temporary integer 
     381     REAL(wp) ::   & 
     382          zt, zs, zh, zt2, zsp5, zp1t1,   &  ! temporary scalars 
     383          zdenr, zrhotmp, zdndt, zdddt,   &  !     "        " 
     384          zdnds, zddds, znum, zden,       &  !     "        " 
     385          zslope, za_sxe, zslopec, zdsloper,&  !     "        " 
     386          zfact, zepsln, zatempw,zatempu,zatempv, &   !     "        " 
     387          ze1ur,ze2vr,ze3wr,zdxt,zdxs,zdyt,zdys,zdzt,zdzs,zvolf,& 
     388          zr_slpmax,zdxrho,zdyrho,zabs_dzrho 
     389     REAL(wp), DIMENSION(jpi,jpj,jpk,0:1,0:1) ::   & 
     390          zsx,zsy 
     391     REAL(wp), DIMENSION(jpi,jpj,0:1,0:1) ::   & 
     392          zsx_ml_base,zsy_ml_base 
     393     REAL(wp), DIMENSION(jpi,jpj,jpk) ::   & 
     394          zdkt,zdks 
     395     REAL(wp), DIMENSION(jpi,jpj) ::   & 
     396          zr_ml_basew 
     397     !!---------------------------------------------------------------------- 
     398 
     399     ! 0. Local constant initialization 
     400     ! -------------------------------- 
     401     zr_slpmax = 1.0_wp/slpmax 
     402 
     403     ! zslopec=0.004 
     404     ! zdsloper=1000.0 
     405     zepsln=1e-25 
     406 
     407     SELECT CASE ( nn_eos ) 
     408 
     409     CASE ( 0 )               ! Jackett and McDougall (1994) formulation 
     410 
     411        !                                                ! =============== 
     412        DO jk = 1, jpk                                   ! Horizontal slab 
     413           !                                             ! =============== 
     414           DO jj = 1, jpjm1 
     415              DO ji = 1, fs_jpim1 
     416                 zt = tb(ji,jj,jk)          ! potential temperature 
     417                 zs = sb(ji,jj,jk) - 35.0   ! salinity anomaly (s-35) 
     418                 zh = fsdept(ji,jj,jk)      ! depth in meters 
     419 
     420                 beta(ji,jj,jk) = ( ( -0.415613e-09 * zt + 0.555579e-07 ) * zt      & 
     421                      &                            - 0.301985e-05 ) * zt      & 
     422                      &   + 0.785567e-03                                      & 
     423                      &   + (     0.515032e-08 * zs                           & 
     424                      &         + 0.788212e-08 * zt - 0.356603e-06 ) * zs     & 
     425                      &   +(  (   0.121551e-17 * zh                           & 
     426                      &         - 0.602281e-15 * zs                           & 
     427                      &         - 0.175379e-14 * zt + 0.176621e-12 ) * zh     & 
     428                      &                             + 0.408195e-10   * zs     & 
     429                      &     + ( - 0.213127e-11 * zt + 0.192867e-09 ) * zt     & 
     430                      &                             - 0.121555e-07 ) * zh 
     431 
     432                 alpha(ji,jj,jk) = - beta(ji,jj,jk) *                       & 
     433                      &     (((( - 0.255019e-07 * zt + 0.298357e-05 ) * zt   & 
     434                      &                               - 0.203814e-03 ) * zt   & 
     435                      &                               + 0.170907e-01 ) * zt   & 
     436                      &   + 0.665157e-01                                      & 
     437                      &   +     ( - 0.678662e-05 * zs                         & 
     438                      &           - 0.846960e-04 * zt + 0.378110e-02 ) * zs   & 
     439                      &   +   ( ( - 0.302285e-13 * zh                         & 
     440                      &           - 0.251520e-11 * zs                         & 
     441                      &           + 0.512857e-12 * zt * zt           ) * zh   & 
     442                      &           - 0.164759e-06 * zs                         & 
     443                      &        +(   0.791325e-08 * zt - 0.933746e-06 ) * zt   & 
     444                      &                               + 0.380374e-04 ) * zh) 
     445 
     446              ENDDO 
     447           ENDDO 
     448        ENDDO 
     449 
     450     CASE ( 1 ) 
     451 
     452        alpha(:,:,:)=-rn_alpha 
     453        beta(:,:,:)=0.0 
     454 
     455     CASE ( 2 ) 
     456 
     457        alpha(:,:,:)=-rn_alpha 
     458        beta (:,:,:)=rn_beta 
     459 
     460     CASE ( 3 ) 
     461 
     462        DO jk =1, jpk 
     463           DO jj = 1, jpjm1 
     464              DO ji = 1, fs_jpim1 
     465                 zt = tb(ji,jj,jk) 
     466                 zs = sb(ji,jj,jk) 
     467                 zh = fsdept(ji,jj,jk) 
     468                 zt2 = zt**2 
     469                 zsp5 = sqrt(ABS(zs)) 
     470                 zp1t1=zh*zt 
     471                 znum=9.99843699e+02+zt*(7.35212840e+00+zt*(-5.45928211e-02+3.98476704e-04*zt)) & 
     472                      +zs*(2.96938239e+00-7.23268813e-03*zt+2.12382341e-03*zs)  & 
     473                      +zh*(1.04004591e-02+1.03970529e-07*zt2+5.18761880e-06*zs+ & 
     474                      zh*(-3.24041825e-08-1.23869360e-11*zt2)) 
     475                 zden=1.00000000e+00+zt*(7.28606739e-03+zt*(-4.60835542e-05+zt*(3.68390573e-07+zt*1.80809186e-10))) & 
     476                      +zs*(2.14691708e-03+zt*(-9.27062484e-06-1.78343643e-10*zt2)+zsp5*(4.76534122e-06+1.63410736e-09*zt2)) & 
     477                      + zh*(5.30848875e-06+zh*zt*(-3.03175128e-16*zt2-1.27934137e-17*zh)) 
     478                 zdenr=1.0/zden 
     479                 zrhotmp=znum*zdenr 
     480                 zdndt=7.35212840e+00+zt*(-1.091856422e-01+1.195430112e-03*zt)-7.23268813e-03*zs & 
     481                      +zp1t1*(2.07941058e-07-2.4773872e-11*zh) 
     482                 zdddt=7.28606739e-03+zt*(-9.21671084e-05+zt*(1.105171719e-06+7.23236744e-10*zt))  & 
     483                      +zs*(-9.27062484e-06+zt*(-5.35030929e-10*zt+3.26821472e-09*zsp5))  & 
     484                      +zh*zh*(-9.09525384e-16*zt2-1.27934137e-17*zh) 
     485                 zdnds=2.96938239e+00-7.23268813e-03*zt+2*2.12382341e-03*zs+5.18761880e-06*zh 
     486                 zddds=2.14691708e-03+zt*(-9.27062484e-06-1.78343643e-10*zt2)+zsp5*(7.14801183e-06+2.45116104e-09*zt2) 
     487                 alpha(ji,jj,jk)=(zdndt-zrhotmp*zdddt)*zdenr 
     488                 beta(ji,jj,jk)=zdenr*(zdnds-zrhotmp*zddds) 
     489 
     490              END DO 
     491           END DO 
     492        END DO 
     493 
     494     CASE DEFAULT 
     495 
     496        IF(lwp) WRITE(numout,cform_err) 
     497        IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     498        nstop = nstop + 1 
     499 
     500     END SELECT 
     501 
     502     CALL lbc_lnk( alpha, 'T', 1. ) 
     503     CALL lbc_lnk( beta, 'T', 1. ) 
     504 
     505 
     506     ! --------------------------------------- 
     507     ! 1. Horizontal tracer gradients at T-level jk 
     508     ! --------------------------------------- 
     509     DO jk = 1, jpkm1 
     510        DO jj = 1, jpjm1 
     511           DO ji = 1, fs_jpim1   ! vector opt. 
     512              ! i-gradient of T and S at jj 
     513              zdit (ji,jj,jk) = ( tb(ji+1,jj,jk)-tb(ji,jj,jk) ) * umask(ji,jj,jk) 
     514              zdis (ji,jj,jk) = ( sb(ji+1,jj,jk)-sb(ji,jj,jk) ) * umask(ji,jj,jk) 
     515              ! j-gradient of T and S at jj 
     516              zdjt (ji,jj,jk) = ( tb(ji,jj+1,jk)-tb(ji,jj,jk) ) * vmask(ji,jj,jk) 
     517              zdjs (ji,jj,jk) = ( sb(ji,jj+1,jk)-sb(ji,jj,jk) ) * vmask(ji,jj,jk) 
     518           END DO 
     519        END DO 
     520     END DO 
     521 
     522     IF( ln_zps ) THEN      ! partial steps correction at the last level 
     523# if defined key_vectopt_loop   &&   ! defined key_mpp_omp 
     524     jj = 1 
     525        DO ji = 1, jpij-jpi   ! vector opt. (forced unrolling) 
     526# else 
     527           DO jj = 1, jpjm1 
     528              DO ji = 1, jpim1 
     529# endif 
     530                 ! last ocean level 
     531                 iku  = MIN( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1 
     532                 ikv  = MIN( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1 
     533                 ! i-gradient of T and S 
     534                 zdit (ji,jj,iku) = gtu(ji,jj) 
     535                 zdis (ji,jj,iku) = gsu(ji,jj) 
     536                 ! j-gradient of T and S 
     537                 zdjt (ji,jj,ikv) = gtv(ji,jj) 
     538                 zdjs (ji,jj,ikv) = gsv(ji,jj) 
     539# if ! defined key_vectopt_loop   ||   defined key_mpp_omp 
     540              END DO 
     541# endif 
     542           END DO 
     543        ENDIF 
     544 
     545        ! --------------------------------------- 
     546        ! 1. Vertical tracer gradient at w-level jk 
     547        ! --------------------------------------- 
     548        DO jk = 2, jpk 
     549           zdkt(:,:,jk) = ( tb(:,:,jk-1) - tb(:,:,jk) ) * tmask(:,:,jk) 
     550           zdks(:,:,jk) = ( sb(:,:,jk-1) - sb(:,:,jk) ) * tmask(:,:,jk) 
     551        END DO 
     552 
     553        zdkt(:,:,1) = 0.0 
     554        zdks(:,:,1) = 0.0 
     555 
     556        ! --------------------------------------- 
     557        ! Depth of the w-point below ML base 
     558        ! --------------------------------------- 
     559        DO jj = 1, jpj 
     560           DO ji = 1, jpi 
     561              jk = nmln(ji,jj) 
     562              zr_ml_basew(ji,jj)=1.0/fsdepw(ji,jj,jk+1) 
     563           END DO 
     564        END DO 
     565 
     566 
     567        wslp2(:,:,:)=0.0 
     568        tfw(:,:,:) = 0.0 
     569        sfw(:,:,:) = 0.0 
     570        ftu(:,:,:) = 0.0 
     571        fsu(:,:,:) = 0.0 
     572        ftv(:,:,:) = 0.0 
     573        fsv(:,:,:) = 0.0 
     574        ftud(:,:,:) = 0.0 
     575        fsud(:,:,:) = 0.0 
     576        ftvd(:,:,:) = 0.0 
     577        fsvd(:,:,:) = 0.0 
     578        psix_eiv(:,:,:) = 0.0 
     579        psiy_eiv(:,:,:) = 0.0 
     580 
     581        ! ---------------------------------------------------------------------- 
     582        ! x-z plane 
     583        ! ---------------------------------------------------------------------- 
     584 
     585        ! calculate limited triad x-slopes zsx in interior (1=<jk=<jpk-1) 
     586        DO ip=0,1 
     587           DO kp=0,1 
     588 
     589              DO jk = 1, jpkm1 
     590                 DO jj = 1, jpjm1 
     591                    DO ji = 1, fs_jpim1   ! vector opt. 
     592 
     593                       ze1ur=1.0/e1u(ji,jj) 
     594                       zdxt=zdit(ji,jj,jk)*ze1ur 
     595                       zdxs=zdis(ji,jj,jk)*ze1ur 
     596 
     597                       ze3wr=1.0/fse3w(ji+ip,jj,jk+kp) 
     598                       zdzt=zdkt(ji+ip,jj,jk+kp)*ze3wr 
     599                       zdzs=zdks(ji+ip,jj,jk+kp)*ze3wr 
     600                       ! Calculate the horizontal and vertical density gradient 
     601                       zdxrho = alpha(ji+ip,jj,jk)*zdxt+beta(ji+ip,jj,jk)*zdxs 
     602                       zabs_dzrho = ABS(alpha(ji+ip,jj,jk)*zdzt+beta(ji+ip,jj,jk)*zdzs)+zepsln 
     603                       ! Limit by slpmax, and mask by psi-point 
     604                       zsx(ji+ip,jj,jk,1-ip,kp) = umask(ji,jj,jk+kp) & 
     605                            & *zdxrho/MAX(zabs_dzrho,zr_slpmax*ABS(zdxrho)) 
     606                    END DO 
     607                 END DO 
     608              END DO 
     609 
     610           END DO 
     611        END DO 
     612 
     613        ! calculate slope of triad immediately below mixed-layer base 
     614        DO ip=0,1 
     615           DO kp=0,1 
     616              DO jj = 1, jpjm1 
     617                 DO ji = 1, fs_jpim1 
     618                    jk = nmln(ji+ip,jj) 
     619                    zsx_ml_base(ji+ip,jj,1-ip,kp)=zsx(ji+ip,jj,jk+1-kp,1-ip,kp) 
     620                 END DO 
     621              END DO 
     622           END DO 
     623        END DO 
     624 
     625        ! Below ML use limited zsx as is 
     626        ! Inside ML replace by linearly reducing zsx_ml_base towards surface 
     627        DO ip=0,1 
     628           DO kp=0,1 
     629 
     630              DO jk = 1, jpkm1 
     631 
     632                 DO jj = 1, jpjm1 
     633 
     634                    DO ji = 1, fs_jpim1   ! vector opt. 
     635                       ! k index of uppermost point(s) of triad is jk+kp-1 
     636                       ! must be .ge. nmln(ji,jj) for zfact=1. 
     637                       !                   otherwise  zfact=0. 
     638                       zfact = 1 - 1/(1 + (jk+kp-1)/nmln(ji+ip,jj)) 
     639                       zsx(ji+ip,jj,jk,1-ip,kp) = zfact*zsx(ji+ip,jj,jk,1-ip,kp) + & 
     640                            & (1.0_wp-zfact)*(fsdepw(ji+ip,jj,jk+kp)*zr_ml_basew(ji+ip,jj))*zsx_ml_base(ji+ip,jj,1-ip,kp)  
     641                    END DO 
     642 
     643                 END DO 
     644 
     645              END DO 
     646           END DO 
     647        END DO 
     648 
     649        ! Use zsx to calculate fluxes and save averaged slopes psix_eiv at psi-points 
     650        DO ip=0,1 
     651           DO kp=0,1 
     652 
     653              DO jk = 1, jpkm1 
     654 
     655                 DO jj = 1, jpjm1 
     656 
     657                    DO ji = 1, fs_jpim1   ! vector opt. 
     658 
     659                       ze1ur=1.0/e1u(ji,jj) 
     660                       zdxt=zdit(ji,jj,jk)*ze1ur 
     661                       zdxs=zdis(ji,jj,jk)*ze1ur 
     662 
     663                       ze3wr=1.0/fse3w(ji+ip,jj,jk+kp) 
     664                       zdzt=zdkt(ji+ip,jj,jk+kp)*ze3wr 
     665                       zdzs=zdks(ji+ip,jj,jk+kp)*ze3wr 
     666                       zslope=zsx(ji+ip,jj,jk,1-ip,kp) 
     667 
     668                       zvolf = 0.25_wp*e1u(ji,jj)*e2u(ji,jj)*fse3u(ji,jj,jk) 
     669 
     670                       ftu(ji,jj,jk)= ftu(ji,jj,jk)+zslope*zdzt*zvolf*ze1ur 
     671                       fsu(ji,jj,jk)= fsu(ji,jj,jk)+zslope*zdzs*zvolf*ze1ur 
     672                       ftud(ji,jj,jk)=ftud(ji,jj,jk)+fsahtu(ji,jj,jk)*zdxt*zvolf*ze1ur 
     673                       fsud(ji,jj,jk)=fsud(ji,jj,jk)+fsahtu(ji,jj,jk)*zdxs*zvolf*ze1ur 
     674                       tfw(ji+ip,jj,jk+kp)=tfw(ji+ip,jj,jk+kp)+(zvolf*ze3wr)*zslope*zdxt 
     675                       sfw(ji+ip,jj,jk+kp)=sfw(ji+ip,jj,jk+kp)+(zvolf*ze3wr)*zslope*zdxs 
     676                       wslp2(ji+ip,jj,jk+kp)=wslp2(ji+ip,jj,jk+kp)+ & 
     677                            & ((zvolf*ze3wr)/(e1t(ji+ip,jj)*e2t(ji+ip,jj)))*(zslope)**2 
     678                       psix_eiv(ji,jj,jk+kp) = psix_eiv(ji,jj,jk+kp) + 0.25_wp*zslope 
     679 
     680                    END DO 
     681                 END DO 
     682 
     683              END DO 
     684           END DO 
     685        END DO 
     686 
     687        ! ---------------------------------------------------------------------- 
     688        ! y-z plane 
     689        ! ---------------------------------------------------------------------- 
     690 
     691        ! calculate limited triad y-slopes zsy in interior (1=<jk=<jpk-1) 
     692        DO jp=0,1 
     693           DO kp=0,1 
     694 
     695              DO jk = 1, jpkm1 
     696                 DO jj = 1, jpjm1 
     697                    DO ji = 1, fs_jpim1   ! vector opt. 
     698 
     699                       ze2vr=1.0/e2v(ji,jj) 
     700                       zdyt=zdjt(ji,jj,jk)*ze2vr 
     701                       zdys=zdjs(ji,jj,jk)*ze2vr 
     702 
     703                       ze3wr=1.0/fse3w(ji,jj+jp,jk+kp) 
     704                       zdzt=zdkt(ji,jj+jp,jk+kp)*ze3wr 
     705                       zdzs=zdks(ji,jj+jp,jk+kp)*ze3wr 
     706                       ! Calculate the horizontal and vertical density gradient 
     707                       zdyrho = alpha(ji,jj+jp,jk)*zdyt+beta(ji,jj+jp,jk)*zdys 
     708                       zabs_dzrho = ABS(alpha(ji,jj+jp,jk)*zdzt+beta(ji,jj+jp,jk)*zdzs)+zepsln 
     709                       ! Limit by slpmax, and mask by psi-point 
     710                       zsy(ji,jj+jp,jk,1-jp,kp) = vmask(ji,jj,jk+kp) & 
     711                            & *zdyrho/MAX(zabs_dzrho,zr_slpmax*ABS(zdyrho)) 
     712                    END DO 
     713                 END DO 
     714              END DO 
     715 
     716           END DO 
     717        END DO 
     718 
     719        ! calculate slope of triad immediately below mixed-layer base 
     720        DO jp=0,1 
     721           DO kp=0,1 
     722              DO jj = 1, jpjm1 
     723                 DO ji = 1, fs_jpim1 
     724                    jk = nmln(ji,jj+jp) 
     725                    zsy_ml_base(ji,jj+jp,1-jp,kp)=zsy(ji,jj+jp,jk+1-kp,1-jp,kp) 
     726                 END DO 
     727              END DO 
     728           END DO 
     729        END DO 
     730 
     731        ! Below ML use limited zsy as is 
     732        ! Inside ML replace by linearly reducing zsy_ml_base towards surface 
     733        DO jp=0,1 
     734           DO kp=0,1 
     735 
     736              DO jk = 1, jpkm1 
     737 
     738                 DO jj = 1, jpjm1 
     739 
     740                    DO ji = 1, fs_jpim1   ! vector opt. 
     741                       ! k index of uppermost point(s) of triad is jk+kp-1 
     742                       ! must be .ge. nmln(ji,jj) for zfact=1. 
     743                       !                   otherwise  zfact=0. 
     744                       zfact = 1 - 1/(1 + (jk+kp-1)/nmln(ji,jj+jp)) 
     745                       zsy(ji,jj+jp,jk,1-jp,kp) = zfact*zsy(ji,jj+jp,jk,1-jp,kp) + & 
     746                            & (1.0_wp-zfact)*(fsdepw(ji,jj+jp,jk+kp)*zr_ml_basew(ji,jj+jp))*zsy_ml_base(ji,jj+jp,1-jp,kp)  
     747                    END DO 
     748 
     749                 END DO 
     750 
     751              END DO 
     752           END DO 
     753        END DO 
     754 
     755        ! Use zsy to calculate fluxes and save averaged slopes psiy_eiv at psi-points 
     756        DO jp=0,1 
     757           DO kp=0,1 
     758 
     759              DO jk = 1, jpkm1 
     760 
     761                 DO jj = 1, jpjm1 
     762 
     763                    DO ji = 1, fs_jpim1   ! vector opt. 
     764 
     765                       ze2vr=1.0/e2v(ji,jj) 
     766                       zdyt=zdjt(ji,jj,jk)*ze2vr 
     767                       zdys=zdjs(ji,jj,jk)*ze2vr 
     768 
     769                       ze3wr=1.0/fse3w(ji,jj+jp,jk+kp) 
     770                       zdzt=zdkt(ji,jj+jp,jk+kp)*ze3wr 
     771                       zdzs=zdks(ji,jj+jp,jk+kp)*ze3wr 
     772                       zslope=zsy(ji,jj+jp,jk,1-jp,kp) 
     773 
     774                       zvolf = 0.25_wp*e1v(ji,jj)*e2v(ji,jj)*fse3v(ji,jj,jk) 
     775 
     776                       ftv(ji,jj,jk)= ftv(ji,jj,jk)+zslope*zdzt*zvolf*ze2vr 
     777                       fsv(ji,jj,jk)= fsv(ji,jj,jk)+zslope*zdzs*zvolf*ze2vr 
     778                       ftvd(ji,jj,jk)=ftvd(ji,jj,jk)+fsahtv(ji,jj,jk)*zdyt*zvolf*ze2vr 
     779                       fsvd(ji,jj,jk)=fsvd(ji,jj,jk)+fsahtv(ji,jj,jk)*zdys*zvolf*ze2vr 
     780                       tfw(ji,jj+jp,jk+kp)=tfw(ji,jj+jp,jk+kp)+(zvolf*ze3wr)*zslope*zdyt 
     781                       sfw(ji,jj+jp,jk+kp)=sfw(ji,jj+jp,jk+kp)+(zvolf*ze3wr)*zslope*zdys 
     782                       wslp2(ji,jj+jp,jk+kp)=wslp2(ji,jj+jp,jk+kp)+ & 
     783                            & ((zvolf*ze3wr)/(e1t(ji,jj+jp)*e2t(ji,jj+jp)))*(zslope)**2 
     784                       psiy_eiv(ji,jj,jk+kp) = psiy_eiv(ji,jj,jk+kp) + 0.25_wp*zslope 
     785 
     786                    END DO 
     787                 END DO 
     788 
     789              END DO 
     790           END DO 
     791        END DO 
     792 
     793        tfw(:,:,1)=0.0 
     794        sfw(:,:,1)=0.0 
     795        wslp2(:,:,1)=0.0 
     796 
     797        CALL lbc_lnk( wslp2, 'W', 1. ) 
     798        CALL lbc_lnk( tfw, 'W', 1. ) 
     799        CALL lbc_lnk( sfw, 'W', 1. ) 
     800        CALL lbc_lnk( ftu, 'U', -1. ) 
     801        CALL lbc_lnk( fsu, 'U', -1. ) 
     802        CALL lbc_lnk( ftv, 'V', -1. ) 
     803        CALL lbc_lnk( fsv, 'V', -1. ) 
     804        CALL lbc_lnk( ftud, 'U', -1. ) 
     805        CALL lbc_lnk( fsud, 'U', -1. ) 
     806        CALL lbc_lnk( ftvd, 'V', -1. ) 
     807        CALL lbc_lnk( fsvd, 'V', -1. ) 
     808        CALL lbc_lnk( psix_eiv, 'U', -1. ) 
     809        CALL lbc_lnk( psiy_eiv, 'V', -1. ) 
     810 
     811 
     812      END SUBROUTINE ldf_slp_grif 
    341813 
    342814 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldftra.F90

    • Property svn:executable deleted
    r1601 r2236  
    3636   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3737   !! $Id$ 
    38    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     38   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3939   !!---------------------------------------------------------------------- 
    4040 
     
    6767      NAMELIST/namtra_ldf/ ln_traldf_lap  , ln_traldf_bilap,                  & 
    6868         &                 ln_traldf_level, ln_traldf_hor  , ln_traldf_iso,   & 
    69          &                 rn_aht_0       , rn_ahtb_0      , rn_aeiv_0 
     69         &                 ln_traldf_grif ,                                   & 
     70         &                 rn_aht_0       , rn_ahtb_0      , rn_aeiv_0,       & 
     71         &                 rn_slpmax 
    7072      !!---------------------------------------------------------------------- 
    7173 
     
    8385         WRITE(numout,*) '      laplacian operator            ln_traldf_lap   = ', ln_traldf_lap 
    8486         WRITE(numout,*) '      bilaplacian operator          ln_traldf_bilap = ', ln_traldf_bilap 
     87         WRITE(numout,*) '      griffies    operator          ln_traldf_grif  = ', ln_traldf_grif  
    8588         WRITE(numout,*) '      lateral eddy diffusivity      rn_aht_0        = ', rn_aht_0 
    8689         WRITE(numout,*) '      background hor. diffusivity   rn_ahtb_0       = ', rn_ahtb_0 
     
    8992      ENDIF 
    9093 
     94      slpmax = rn_slpmax 
    9195      !                                ! convert DOCTOR namelist names into OLD names 
    9296      aht0  = rn_aht_0 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldftra_oce.F90

    r1601 r2236  
    2020   LOGICAL , PUBLIC ::   ln_traldf_hor   = .FALSE.   !: horizontal (geopotential) direction 
    2121   LOGICAL , PUBLIC ::   ln_traldf_iso   = .TRUE.    !: iso-neutral direction 
     22   LOGICAL , PUBLIC ::   ln_traldf_grif  = .FALSE.   !: griffies skew flux 
    2223   REAL(wp), PUBLIC ::   rn_aht_0        = 2000._wp  !: lateral eddy diffusivity (m2/s) 
    2324   REAL(wp), PUBLIC ::   rn_ahtb_0       =    0._wp  !: lateral background eddy diffusivity (m2/s) 
    2425   REAL(wp), PUBLIC ::   rn_aeiv_0       = 2000._wp  !: eddy induced velocity coefficient (m2/s) 
     26   REAL(wp), PUBLIC ::   rn_slpmax       = 0.01_wp   !: slope limit 
    2527 
    2628   REAL(wp), PUBLIC ::   aht0, ahtb0, aeiv0         !!: OLD namelist names 
     29   REAL(wp), PUBLIC ::   slpmax                     !: slope limit  
    2730 
    2831#if defined key_traldf_c3d 
     
    4144   !!   'key_traldf_eiv'                              eddy induced velocity 
    4245   !!---------------------------------------------------------------------- 
    43    LOGICAL, PUBLIC, PARAMETER ::   lk_traldf_eiv   = .TRUE.   !: eddy induced velocity flag 
     46   LOGICAL, PUBLIC, PARAMETER               ::   lk_traldf_eiv   = .TRUE.   !: eddy induced velocity flag 
    4447       
    4548# if defined key_traldf_c3d 
     
    6770   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    6871   !! $Id$  
    69    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     72   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7073   !!===================================================================== 
    7174END MODULE ldftra_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obc_oce.F90

    r2200 r2236  
    233233   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    234234   !! $Id$  
    235    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     235   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    236236   !!====================================================================== 
    237237END MODULE obc_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/albedo.F90

    r1601 r2236  
    4747   !! NEMO/OPA 9.0 , LOCEAN-IPSL (2009)  
    4848   !! $Id$ 
    49    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     49   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5050   !!---------------------------------------------------------------------- 
    5151 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/cpl_oasis3.F90

    r2224 r2236  
    6666   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    6767   !! $Header$  
    68    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     68   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6969   !!---------------------------------------------------------------------- 
    7070 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/cpl_oasis4.F90

    r1715 r2236  
    120120   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    121121   !! $Id$ 
    122    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     122   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    123123   !!---------------------------------------------------------------------- 
    124124 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/fldread.F90

    r2004 r2236  
    1515   USE oce             ! ocean dynamics and tracers 
    1616   USE dom_oce         ! ocean space and time domain 
     17   USE ioipsl, ONLY :   ymds2ju, ju2ymds   ! for calendar 
    1718   USE phycst          ! ??? 
    1819   USE in_out_manager  ! I/O manager 
     
    2930      LOGICAL              ::   ln_tint     ! time interpolation or not (T/F) 
    3031      LOGICAL              ::   ln_clim     ! climatology or not (T/F) 
    31       CHARACTER(len = 7)   ::   cltype      ! type of data file 'daily', 'monthly' or yearly' 
     32      CHARACTER(len = 8)   ::   cltype      ! type of data file 'daily', 'monthly' or yearly' 
    3233      CHARACTER(len = 34)  ::   wname       ! generic name of a NetCDF weights file to be used, blank if not 
    3334      CHARACTER(len = 34)  ::   vcomp       ! symbolic component name if a vector that needs rotation 
     
    4344      LOGICAL                         ::   ln_tint      ! time interpolation or not (T/F) 
    4445      LOGICAL                         ::   ln_clim      ! climatology or not (T/F) 
    45       CHARACTER(len = 7)              ::   cltype       ! type of data file 'daily', 'monthly' or yearly' 
     46      CHARACTER(len = 8)              ::   cltype       ! type of data file 'daily', 'monthly' or yearly' 
    4647      INTEGER                         ::   num          ! iom id of the jpfld files to be read 
    4748      INTEGER                         ::   nswap_sec    ! swapping time in second since Jan. 1st 00h of nit000 year 
     
    7879      INTEGER, DIMENSION(:,:,:), POINTER      ::   data_jpj     ! array of source integers 
    7980      REAL(wp), DIMENSION(:,:,:), POINTER     ::   data_wgt     ! array of weights on model grid 
    80       REAL(wp), DIMENSION(:,:), POINTER       ::   fly_dta      ! array of values on input grid 
    81       REAL(wp), DIMENSION(:,:), POINTER       ::   col2         ! temporary array for reading in columns 
     81      REAL(wp), DIMENSION(:,:,:), POINTER       ::   fly_dta      ! array of values on input grid 
     82      REAL(wp), DIMENSION(:,:,:), POINTER       ::   col2         ! temporary array for reading in columns 
    8283   END TYPE WGT 
    8384 
     
    9394   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    9495   !! $Id$ 
    95    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     96   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    9697   !!---------------------------------------------------------------------- 
    9798 
     
    159160 
    160161               ! last record to be read in the current file 
    161                IF( sd(jf)%nfreqh == -1 ) THEN                  ;   ireclast = 12 
     162               IF( sd(jf)%nfreqh == -1 ) THEN 
     163                  IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 1 
     164                  ELSE                                         ;   ireclast = 12 
     165                  ENDIF 
    162166               ELSE                              
    163                   IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 24 * nmonth_len(nmonth) / sd(jf)%nfreqh  
    164                   ELSEIF( sd(jf)%cltype == 'daily'     ) THEN  ;   ireclast = 24                      / sd(jf)%nfreqh 
    165                   ELSE                                         ;   ireclast = 24 * nyear_len(     1 ) / sd(jf)%nfreqh  
     167                  IF(     sd(jf)%cltype      == 'monthly' ) THEN  ;   ireclast = 24 * nmonth_len(nmonth) / sd(jf)%nfreqh  
     168                  ELSEIF( sd(jf)%cltype(1:4) == 'week'    ) THEN  ;   ireclast = 24.* 7                  / sd(jf)%nfreqh 
     169                  ELSEIF( sd(jf)%cltype      == 'daily'   ) THEN  ;   ireclast = 24                      / sd(jf)%nfreqh 
     170                  ELSE                                            ;   ireclast = 24 * nyear_len(     1 ) / sd(jf)%nfreqh  
    166171                  ENDIF 
    167172               ENDIF 
     
    207212            IF( LEN(TRIM(sd(jf)%wgtname)) > 0 ) THEN 
    208213               CALL wgt_list( sd(jf), kw ) 
    209                DO jk = 1, ipk 
    210                   CALL fld_interp( sd(jf)%num, sd(jf)%clvar, kw, sd(jf)%fdta(:,:,jk,2), sd(jf)%nrec_a(1) ) 
    211                END DO 
     214               ipk = SIZE(sd(jf)%fnow,3) 
     215               IF( sd(jf)%ln_tint ) THEN 
     216                  CALL fld_interp( sd(jf)%num, sd(jf)%clvar , kw , ipk, sd(jf)%fdta(:,:,:,2) , sd(jf)%nrec_a(1) ) 
     217               ELSE 
     218                  CALL fld_interp( sd(jf)%num, sd(jf)%clvar , kw , ipk, sd(jf)%fnow(:,:,:)   , sd(jf)%nrec_a(1) ) 
     219               ENDIF 
    212220            ELSE 
    213                IF( ipk == 1 ) THEN  
    214                   CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,1,2), sd(jf)%nrec_a(1) ) 
    215                ELSE 
    216                   CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,:,2), sd(jf)%nrec_a(1) ) 
    217                ENDIF 
     221               SELECT CASE( SIZE(sd(jf)%fnow,3) ) 
     222               CASE(1)    
     223                  IF( sd(jf)%ln_tint ) THEN 
     224                     CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,1,2), sd(jf)%nrec_a(1) ) 
     225                  ELSE 
     226                     CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fnow(:,:,1)  , sd(jf)%nrec_a(1) ) 
     227                  ENDIF  
     228               CASE(jpk) 
     229                  IF( sd(jf)%ln_tint ) THEN 
     230                     CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,:,2), sd(jf)%nrec_a(1) ) 
     231                  ELSE 
     232                     CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fnow(:,:,:)  , sd(jf)%nrec_a(1) ) 
     233                  ENDIF  
     234               END SELECT 
    218235            ENDIF 
    219236            sd(jf)%rotn(2) = .FALSE. 
     
    249266                IF( kf > 0 ) THEN 
    250267                   !! fields jf,kf are two components which need to be rotated together 
    251                    DO nf = 1,2 
     268                   IF( sd(jf)%ln_tint )THEN 
     269                      DO nf = 1,2 
     270                         !! check each time level of this pair 
     271                         IF( .NOT. sd(jf)%rotn(nf) .AND. .NOT. sd(kf)%rotn(nf) ) THEN 
     272                            utmp(:,:) = 0.0 
     273                            vtmp(:,:) = 0.0 
     274                            ! 
     275                            ipk = SIZE( sd(kf)%fnow(:,:,:) ,3 ) 
     276                            DO jk = 1,ipk 
     277                               CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->i', utmp(:,:) ) 
     278                               CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->j', vtmp(:,:) ) 
     279                               sd(jf)%fdta(:,:,jk,nf) = utmp(:,:) 
     280                               sd(kf)%fdta(:,:,jk,nf) = vtmp(:,:) 
     281                            ENDDO 
     282                            ! 
     283                            sd(jf)%rotn(nf) = .TRUE. 
     284                            sd(kf)%rotn(nf) = .TRUE. 
     285                            IF( lwp .AND. kt == nit000 ) & 
     286                                      WRITE(numout,*) 'fld_read: vector pair (',  & 
     287                                                      TRIM(sd(jf)%clvar),',',TRIM(sd(kf)%clvar), & 
     288                                                      ') rotated on to model grid' 
     289                         ENDIF 
     290                      END DO 
     291                   ELSE  
    252292                      !! check each time level of this pair 
    253293                      IF( .NOT. sd(jf)%rotn(nf) .AND. .NOT. sd(kf)%rotn(nf) ) THEN 
     
    255295                         vtmp(:,:) = 0.0 
    256296                         ! 
    257                          DO jk = 1, SIZE( sd(kf)%fdta, 3 ) 
    258                             CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->i', utmp(:,:) ) 
    259                             CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->j', vtmp(:,:) ) 
    260                             sd(jf)%fdta(:,:,jk,nf) = utmp(:,:) 
    261                             sd(kf)%fdta(:,:,jk,nf) = vtmp(:,:) 
    262                          END DO 
     297                         ipk = SIZE( sd(kf)%fnow(:,:,:) ,3 ) 
     298                         DO jk = 1,ipk 
     299                            CALL rot_rep( sd(jf)%fnow(:,:,jk),sd(kf)%fnow(:,:,jk),'T', 'en->i', utmp(:,:) ) 
     300                            CALL rot_rep( sd(jf)%fnow(:,:,jk),sd(kf)%fnow(:,:,jk),'T', 'en->j', vtmp(:,:) ) 
     301                            sd(jf)%fnow(:,:,jk) = utmp(:,:) 
     302                            sd(kf)%fnow(:,:,jk) = vtmp(:,:) 
     303                         ENDDO 
    263304                         ! 
    264305                         sd(jf)%rotn(nf) = .TRUE. 
     
    269310                                                   ') rotated on to model grid' 
    270311                      ENDIF 
    271                    END DO 
     312                   ENDIF 
    272313                ENDIF 
    273314             ENDIF 
     
    301342               ENDIF 
    302343!CDIR COLLAPSE 
    303                sd(jf)%fnow(:,:,:) = sd(jf)%fdta(:,:,:,2)   ! piecewise constant field 
    304   
    305344            ENDIF 
    306345            ! 
     
    326365      TYPE(FLD), INTENT(inout) ::   sdjf        ! input field related variables 
    327366      !! 
    328       LOGICAL :: llprevyr       ! are we reading previous year  file? 
    329       LOGICAL :: llprevmth      ! are we reading previous month file? 
    330       LOGICAL :: llprevday      ! are we reading previous day   file? 
    331       LOGICAL :: llprev         ! llprevyr .OR. llprevmth .OR. llprevday 
    332       INTEGER :: idvar          ! variable id  
    333       INTEGER :: inrec          ! number of record existing for this variable 
     367      LOGICAL :: llprevyr              ! are we reading previous year  file? 
     368      LOGICAL :: llprevmth             ! are we reading previous month file? 
     369      LOGICAL :: llprevweek            ! are we reading previous week file? 
     370      LOGICAL :: llprevday             ! are we reading previous day   file? 
     371      LOGICAL :: llprev                ! llprevyr .OR. llprevmth .OR. llprevday 
     372      INTEGER :: idvar                 ! variable id  
     373      INTEGER :: inrec                 ! number of record existing for this variable 
    334374      INTEGER :: kwgt 
    335       INTEGER :: jk             ! vertical loop variable 
    336       INTEGER :: ipk            ! number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk ) 
     375      INTEGER :: jk             !vertical loop variable 
     376      INTEGER :: ipk            !number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk ) 
     377      INTEGER :: iyear, imonth, iday   ! first day of the current file in yyyy mm dd 
     378      INTEGER :: isec_week             ! number of seconds since start of the weekly file 
    337379      CHARACTER(LEN=1000) ::   clfmt   ! write format 
    338380      !!--------------------------------------------------------------------- 
    339  
     381       
    340382      ! some default definitions... 
    341383      sdjf%num = 0   ! default definition for non-opened file 
    342384      IF( sdjf%ln_clim )   sdjf%clname = TRIM( sdjf%clrootname )   ! file name defaut definition, never change in this case 
    343       llprevyr  = .FALSE. 
    344       llprevmth = .FALSE. 
    345       llprevday = .FALSE. 
     385      llprevyr   = .FALSE. 
     386      llprevmth  = .FALSE. 
     387      llprevweek = .FALSE. 
     388      llprevday  = .FALSE. 
     389      isec_week  = 0 
    346390             
    347391      ! define record informations 
     
    365409                  llprevmth = .NOT. sdjf%ln_clim                                           ! use previous month file? 
    366410                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file? 
     411               ELSE IF ( sdjf%cltype(1:4) == 'week' ) THEN !weekly file 
     412                  isec_week = 86400 * 7 
     413                  sdjf%nrec_b(1) = 24. / sdjf%nfreqh * 7                                   ! last record of previous weekly file 
    367414               ELSEIF( sdjf%cltype == 'daily' ) THEN ! daily file 
    368415                  sdjf%nrec_b(1) = 24 / sdjf%nfreqh                                        ! last record of previous day 
     
    376423            ENDIF 
    377424         ENDIF 
    378          llprev = llprevyr .OR. llprevmth .OR. llprevday 
     425         llprev = llprevyr .OR. llprevmth .OR. llprevweek .OR. llprevday 
    379426 
    380427         CALL fld_clopn( sdjf, nyear  - COUNT((/llprevyr /))                                              ,               & 
    381428            &                  nmonth - COUNT((/llprevmth/)) + 12                   * COUNT((/llprevyr /)),               & 
    382429            &                  nday   - COUNT((/llprevday/)) + nmonth_len(nmonth-1) * COUNT((/llprevmth/)), .NOT. llprev ) 
    383           
     430 
     431         IF ( sdjf%cltype(1:4) == 'week' ) THEN 
     432            isec_week  = ksec_week( sdjf%cltype(6:8) ) 
     433            if(lwp)write(numout,*)'cbr test2 isec_week = ',isec_week 
     434            llprevmth  = ( isec_week .GT. nsec_month ) 
     435            llprevyr   = llprevmth  .AND. nmonth==1 
     436         ENDIF 
     437         ! 
     438         iyear  = nyear  - COUNT((/llprevyr /)) 
     439         imonth = nmonth - COUNT((/llprevmth/)) + 12* COUNT((/llprevyr /)) 
     440         iday   = nday   - COUNT((/llprevday/)) + nmonth_len(nmonth-1) * COUNT((/llprevmth/)) - INT( isec_week )/86400 
     441         ! 
     442         CALL fld_clopn( sdjf , iyear , imonth , iday , .NOT. llprev ) 
     443 
    384444         ! if previous year/month/day file does not exist, we switch to the current year/month/day 
    385445         IF( llprev .AND. sdjf%num <= 0 ) THEN 
     
    399459 
    400460         ! read before data into sdjf%fdta(:,:,2) because we will swap data in the following part of fld_read 
    401          ipk = SIZE( sdjf%fdta, 3 ) 
    402461         IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN 
    403462            CALL wgt_list( sdjf, kwgt ) 
    404             DO jk = 1, ipk 
    405                CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,jk,2), sdjf%nrec_b(1) ) 
    406             END DO 
     463            ipk = SIZE(sdjf%fnow,3) 
     464            IF( sdjf%ln_tint ) THEN 
     465               CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, ipk, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) ) 
     466            ELSE 
     467               CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, ipk, sdjf%fnow(:,:,:)  , sdjf%nrec_a(1) ) 
     468            ENDIF 
    407469         ELSE 
    408             IF( ipk == 1 ) THEN 
    409                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_b(1) ) 
    410             ELSE 
    411                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_b(1) ) 
    412             ENDIF 
     470            SELECT CASE( SIZE(sdjf%fnow,3) ) 
     471            CASE(1) 
     472               IF( sdjf%ln_tint ) THEN 
     473                  CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_b(1) ) 
     474               ELSE 
     475                  CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fnow(:,:,1)  , sdjf%nrec_b(1) ) 
     476               ENDIF 
     477            CASE(jpk) 
     478               IF( sdjf%ln_tint ) THEN 
     479                  CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_b(1) ) 
     480               ELSE 
     481                  CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fnow(:,:,:)  , sdjf%nrec_b(1) ) 
     482               ENDIF 
     483            END SELECT 
    413484         ENDIF 
    414485         sdjf%rotn(2) = .FALSE. 
     
    422493 
    423494      IF( sdjf%num <= 0 )   CALL fld_clopn( sdjf, nyear, nmonth, nday )   ! make sure current year/month/day file is opened 
     495      ! make sure current year/month/day file is opened 
     496      IF( sdjf%num == 0 ) THEN 
     497         isec_week   = 0 
     498         llprevyr    = .FALSE. 
     499         llprevmth   = .FALSE. 
     500         llprevweek  = .FALSE. 
     501         ! 
     502         IF ( sdjf%cltype(1:4) == 'week' ) THEN 
     503            isec_week  = ksec_week( sdjf%cltype(6:8) ) 
     504            llprevmth  = ( isec_week .GT. nsec_month ) 
     505            llprevyr   = llprevmth  .AND. nmonth==1 
     506         ENDIF 
     507         ! 
     508         iyear  = nyear  - COUNT((/llprevyr /)) 
     509         imonth = nmonth - COUNT((/llprevmth/)) + 12* COUNT((/llprevyr /)) 
     510         iday   = nday   + nmonth_len(nmonth-1) * COUNT((/llprevmth/)) - isec_week/86400 
     511         ! 
     512         CALL fld_clopn( sdjf, iyear, imonth, iday ) 
     513      ENDIF  
    424514 
    425515      sdjf%nswap_sec = nsec_year + nsec1jan000 - 1   ! force read/update the after data in the following part of fld_read  
    426        
     516      
     517 
    427518   END SUBROUTINE fld_init 
    428519 
     
    442533      REAL(wp) ::   ztmp        ! temporary variable 
    443534      INTEGER  ::   ifreq_sec   ! frequency mean (in seconds) 
     535      INTEGER  ::   isec_week   ! number of seconds since the start of the weekly file 
    444536      !!---------------------------------------------------------------------- 
    445537      ! 
     
    458550            !       forcing record :  nmonth  
    459551            !                             
     552            ztmp  = 0.e0 
    460553            ztmp  = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5 
    461554         ELSE 
     
    468561         ENDIF 
    469562 
    470          sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time 
    471          irec = irec - 1                                                ! move back to previous record 
    472          sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time 
     563         IF( sdjf%cltype == 'monthly' ) THEN 
     564 
     565            sdjf%nrec_b(:) = (/ 0, nmonth_half(irec - 1 ) + nsec1jan000 /) 
     566            sdjf%nrec_a(:) = (/ 1, nmonth_half(irec     ) + nsec1jan000 /) 
     567 
     568            IF( ztmp  == 1. ) THEN 
     569              sdjf%nrec_b(1) = 1 
     570              sdjf%nrec_a(1) = 2 
     571            ENDIF 
     572 
     573         ELSE 
     574 
     575            sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time 
     576            irec = irec - 1                                                ! move back to previous record 
     577            sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time 
     578 
     579         ENDIF 
    473580         ! 
    474581      ELSE                              ! higher frequency mean (in hours) 
    475582         ! 
    476583         ifreq_sec = sdjf%nfreqh * 3600   ! frequency mean (in seconds) 
     584         IF( sdjf%cltype(1:4) == 'week'    ) isec_week = ksec_week( sdjf%cltype(6:8)) !since the first day of the current week 
    477585         ! number of second since the beginning of the file 
    478          IF(     sdjf%cltype == 'monthly' ) THEN   ;   ztmp = REAL(nsec_month,wp)   ! since 00h on the 1st day of the current month 
    479          ELSEIF( sdjf%cltype == 'daily'   ) THEN   ;   ztmp = REAL(nsec_day  ,wp)   ! since 00h of the current day 
    480          ELSE                                      ;   ztmp = REAL(nsec_year ,wp)   ! since 00h on Jan 1 of the current year 
     586         IF(     sdjf%cltype      == 'monthly' ) THEN   ;   ztmp = REAL(nsec_month ,wp)  ! since 00h on the 1st day of the current month 
     587         ELSEIF( sdjf%cltype(1:4) == 'week'    ) THEN   ;   ztmp = REAL(isec_week  ,wp)  ! since the first day of the current week 
     588         ELSEIF( sdjf%cltype      == 'daily'   ) THEN   ;   ztmp = REAL(nsec_day   ,wp)  ! since 00h of the current day 
     589         ELSE                                           ;   ztmp = REAL(nsec_year  ,wp)  ! since 00h on Jan 1 of the current year 
    481590         ENDIF 
    482591         IF( sdjf%ln_tint ) THEN                ! time interpolation, shift by 1/2 record 
     
    514623         ! after record index and second since Jan. 1st 00h of nit000 year 
    515624         sdjf%nrec_a(:) = (/ irec, ifreq_sec * irec - ifreq_sec / 2 + nsec1jan000 /) 
    516          IF( sdjf%cltype == 'monthly' )   &   ! add the number of seconds between 00h Jan 1 and the end of previous month 
     625         IF( sdjf%cltype == 'monthly' )       &   ! add the number of seconds between 00h Jan 1 and the end of previous month 
    517626            sdjf%nrec_a(2) = sdjf%nrec_a(2) + isecd * SUM(nmonth_len(1:nmonth -1))   ! ok if nmonth=1 
    518          IF( sdjf%cltype == 'daily'   )   &   ! add the number of seconds between 00h Jan 1 and the end of previous day 
     627         IF( sdjf%cltype(1:4) == 'week'   )   &   ! add the number of seconds between 00h Jan 1 and the end of previous week  
     628            sdjf%nrec_a(2) = sdjf%nrec_a(2) + ( nsec_year - isec_week ) 
     629         IF( sdjf%cltype == 'daily'   )       &   ! add the number of seconds between 00h Jan 1 and the end of previous day 
    519630            sdjf%nrec_a(2) = sdjf%nrec_a(2) + isecd * ( nday_year - 1 ) 
    520631 
     
    522633         irec = irec - 1.                           ! move back to previous record 
    523634         sdjf%nrec_b(:) = (/ irec, ifreq_sec * irec - ifreq_sec / 2 + nsec1jan000 /) 
    524          IF( sdjf%cltype == 'monthly' )   &   ! add the number of seconds between 00h Jan 1 and the end of previous month 
     635         IF( sdjf%cltype == 'monthly' )       &   ! add the number of seconds between 00h Jan 1 and the end of previous month 
    525636            sdjf%nrec_b(2) = sdjf%nrec_b(2) + isecd * SUM(nmonth_len(1:nmonth -1))   ! ok if nmonth=1 
    526          IF( sdjf%cltype == 'daily'   )   &   ! add the number of seconds between 00h Jan 1 and the end of previous day 
     637         IF( sdjf%cltype(1:4) == 'week'   )   &   ! add the number of seconds between 00h Jan 1 and the end of previous week 
     638            sdjf%nrec_b(2) = sdjf%nrec_b(2) + ( nsec_year - isec_week ) 
     639         IF( sdjf%cltype == 'daily'   )       &   ! add the number of seconds between 00h Jan 1 and the end of previous day 
    527640            sdjf%nrec_b(2) = sdjf%nrec_b(2) + isecd * ( nday_year - 1 ) 
    528641 
     
    545658      !! ** Method  :    
    546659      !!---------------------------------------------------------------------- 
    547       TYPE(FLD), INTENT(inout)           ::   sdjf     ! input field related variables 
    548       INTEGER  , INTENT(in   )           ::   kyear    ! year value 
    549       INTEGER  , INTENT(in   )           ::   kmonth   ! month value 
    550       INTEGER  , INTENT(in   )           ::   kday     ! day value 
    551       LOGICAL  , INTENT(in   ), OPTIONAL ::   ldstop   ! stop if open to read a non-existing file (default = .TRUE.) 
     660      TYPE(FLD), INTENT(inout)           ::   sdjf                      ! input field related variables 
     661      INTEGER  , INTENT(in   )           ::   kyear                     ! year value 
     662      INTEGER  , INTENT(in   )           ::   kmonth                    ! month value 
     663      INTEGER  , INTENT(in   )           ::   kday                      ! day value 
     664      LOGICAL  , INTENT(in   ), OPTIONAL ::   ldstop                    ! stop if open to read a non-existing file (default = .TRUE.) 
     665      INTEGER                            ::   iyear, imonth, iday       ! firt day of the current week in yyyy mm dd 
     666      REAL(wp)                           ::   zsec, zjul                !temp variable 
    552667 
    553668      IF( sdjf%num /= 0 )   CALL iom_close( sdjf%num )   ! close file if already open 
    554669      ! build the new filename if not climatological data 
    555       IF( .NOT. sdjf%ln_clim ) THEN   ;   WRITE(sdjf%clname, '(a,"_y",i4.4)' ) TRIM( sdjf%clrootname ), kyear    ! add year 
    556          IF( sdjf%cltype /= 'yearly' )    WRITE(sdjf%clname, '(a,"m" ,i2.2)' ) TRIM( sdjf%clname     ), kmonth   ! add month 
    557          IF( sdjf%cltype == 'daily'  )    WRITE(sdjf%clname, '(a,"d" ,i2.2)' ) TRIM( sdjf%clname     ), kday     ! add day 
     670      sdjf%clname=TRIM(sdjf%clrootname) 
     671      ! 
     672      IF(  sdjf%cltype(1:4) == 'week' .AND. nn_leapy==0 )CALL ctl_stop( 'fld_clopn: weekly file and nn_leapy=0 are not compatible' ) 
     673      ! 
     674      IF( .NOT. sdjf%ln_clim ) THEN    
     675         WRITE(sdjf%clname, '(a,"_y",i4.4)' ) TRIM( sdjf%clrootname ), kyear    ! add year 
     676         IF( sdjf%cltype /= 'yearly'        )   &  
     677            &     WRITE(sdjf%clname, '(a,"m" ,i2.2)' ) TRIM( sdjf%clname ), kmonth   ! add month 
     678         IF( sdjf%cltype == 'daily'  .OR. sdjf%cltype(1:4) == 'week' ) & 
     679            &     WRITE(sdjf%clname, '(a,"d" ,i2.2)' ) TRIM( sdjf%clname ), kday     ! add day 
     680      ELSE 
     681         ! build the new filename if climatological data 
     682         IF( sdjf%cltype == 'monthly' )   WRITE(sdjf%clname, '(a,"_m" ,i2.2)' ) TRIM( sdjf%clrootname ), kmonth   ! add month 
    558683      ELSE 
    559684         ! build the new filename if climatological data 
     
    610735               &                          ' pairing    : '    , TRIM( sdf(jf)%vcomp      ),   & 
    611736               &                          ' data type: '      ,       sdf(jf)%cltype 
     737            call flush(numout) 
    612738         END DO 
    613739      ENDIF 
     
    707833      INTEGER                                 ::   inum          ! temporary logical unit 
    708834      INTEGER                                 ::   id            ! temporary variable id 
     835      INTEGER                                 ::   ipk           ! temporary vertical dimension 
    709836      CHARACTER (len=5)                       ::   aname 
    710837      INTEGER , DIMENSION(3)                  ::   ddims 
     
    869996         ! SA: +3 stencil is a patch to avoid out-of-bound computation in some configuration.  
    870997         ! a more robust solution will be given in next release 
    871          ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3) ) 
    872          IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col2(2,ref_wgts(nxt_wgt)%jpjwgt+3) ) 
     998         ipk =  SIZE(sd%fnow,3) 
     999         ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3 ,ipk) ) 
     1000         IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col2(2,ref_wgts(nxt_wgt)%jpjwgt+3,ipk) ) 
    8731001 
    8741002         nxt_wgt = nxt_wgt + 1 
     
    8801008   END SUBROUTINE fld_weight 
    8811009 
    882    SUBROUTINE fld_interp(num, clvar, kw, dta, nrec) 
     1010   SUBROUTINE fld_interp(num, clvar, kw, kk, dta, nrec) 
    8831011      !!--------------------------------------------------------------------- 
    8841012      !!                    ***  ROUTINE fld_interp  *** 
     
    8921020      CHARACTER(LEN=*), INTENT(in)                        ::   clvar               ! variable name 
    8931021      INTEGER,          INTENT(in)                        ::   kw                  ! weights number 
    894       REAL(wp),         INTENT(inout), DIMENSION(jpi,jpj) ::   dta                 ! output field on model grid 
     1022      INTEGER,          INTENT(in)                        ::   kk                  ! vertical dimension of kk 
     1023      REAL(wp),         INTENT(inout), DIMENSION(jpi,jpj,kk) ::   dta              ! output field on model grid 
    8951024      INTEGER,          INTENT(in)                        ::   nrec                ! record number to read (ie time slice) 
    8961025      !!  
    897       INTEGER, DIMENSION(2)                               ::   rec1,recn           ! temporary arrays for start and length 
     1026      INTEGER, DIMENSION(3)                               ::   rec1,recn           ! temporary arrays for start and length 
    8981027      INTEGER                                             ::  jk, jn, jm           ! loop counters 
    8991028      INTEGER                                             ::  ni, nj               ! lengths 
     
    9181047      rec1(1) = MAX( jpimin-1, 1 ) 
    9191048      rec1(2) = MAX( jpjmin-1, 1 ) 
     1049      rec1(3) = 1 
    9201050      recn(1) = MIN( jpiwid+2, ref_wgts(kw)%ddims(1)-rec1(1)+1 ) 
    9211051      recn(2) = MIN( jpjwid+2, ref_wgts(kw)%ddims(2)-rec1(2)+1 ) 
     1052      recn(3) = kk 
    9221053 
    9231054      !! where we need to read it to 
     
    9271058      jpj2 = jpj1 + recn(2) - 1 
    9281059 
    929       ref_wgts(kw)%fly_dta(:,:) = 0.0 
    930       CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2), nrec, rec1, recn) 
     1060      ref_wgts(kw)%fly_dta(:,:,:) = 0.0 
     1061      SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) ) 
     1062      CASE(1) 
     1063           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn) 
     1064      CASE(jpk)   
     1065           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn) 
     1066      END SELECT  
    9311067 
    9321068      !! first four weights common to both bilinear and bicubic 
    9331069      !! note that we have to offset by 1 into fly_dta array because of halo 
    934       dta(:,:) = 0.0 
     1070      dta(:,:,:) = 0.0 
    9351071      DO jk = 1,4 
    936         DO jn = 1, jpj 
    937           DO jm = 1,jpi 
     1072        DO jn = 1, nlcj 
     1073          DO jm = 1,nlci 
    9381074            ni = ref_wgts(kw)%data_jpi(jm,jn,jk) 
    9391075            nj = ref_wgts(kw)%data_jpj(jm,jn,jk) 
    940             dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1) 
     1076            dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1,jk) 
    9411077          END DO 
    9421078        END DO 
     
    9471083        !! fix up halo points that we couldnt read from file 
    9481084        IF( jpi1 == 2 ) THEN 
    949            ref_wgts(kw)%fly_dta(jpi1-1,:) = ref_wgts(kw)%fly_dta(jpi1,:) 
     1085           ref_wgts(kw)%fly_dta(jpi1-1,:,:) = ref_wgts(kw)%fly_dta(jpi1,:,:) 
    9501086        ENDIF 
    9511087        IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN 
    952            ref_wgts(kw)%fly_dta(jpi2+1,:) = ref_wgts(kw)%fly_dta(jpi2,:) 
     1088           ref_wgts(kw)%fly_dta(jpi2+1,:,:) = ref_wgts(kw)%fly_dta(jpi2,:,:) 
    9531089        ENDIF 
    9541090        IF( jpj1 == 2 ) THEN 
    955            ref_wgts(kw)%fly_dta(:,jpj1-1) = ref_wgts(kw)%fly_dta(:,jpj1) 
     1091           ref_wgts(kw)%fly_dta(:,jpj1-1,:) = ref_wgts(kw)%fly_dta(:,jpj1,:) 
    9561092        ENDIF 
    9571093        IF( jpj2 + jpjmin - 1 == ref_wgts(kw)%ddims(2)+1 .AND. jpj2 .lt. jpjwid+2 ) THEN 
    958            ref_wgts(kw)%fly_dta(:,jpj2+1) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2) - ref_wgts(kw)%fly_dta(:,jpj2-1) 
     1094           ref_wgts(kw)%fly_dta(:,jpj2+1,:) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2,:) - ref_wgts(kw)%fly_dta(:,jpj2-1,:) 
    9591095        ENDIF 
    9601096 
     
    9691105           IF( jpi1 == 2 ) THEN 
    9701106              rec1(1) = ref_wgts(kw)%ddims(1) - 1 
    971               CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2), nrec, rec1, recn) 
    972               ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2) = ref_wgts(kw)%col2(ref_wgts(kw)%offset+1,jpj1:jpj2) 
     1107              SELECT CASE( SIZE( ref_wgts(kw)%col2(:,jpj1:jpj2,:),3) ) 
     1108              CASE(1) 
     1109                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,1), nrec, rec1, recn) 
     1110              CASE(jpk)          
     1111                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,:), nrec, rec1, recn) 
     1112              END SELECT       
     1113              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2,:) = ref_wgts(kw)%col2(ref_wgts(kw)%offset+1,jpj1:jpj2,:) 
    9731114           ENDIF 
    9741115           IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN 
    9751116              rec1(1) = 1 
    976               CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2), nrec, rec1, recn) 
    977               ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2) = ref_wgts(kw)%col2(2-ref_wgts(kw)%offset,jpj1:jpj2) 
     1117              SELECT CASE( SIZE( ref_wgts(kw)%col2(:,jpj1:jpj2,:),3) ) 
     1118              CASE(1) 
     1119                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,1), nrec, rec1, recn) 
     1120              CASE(jpk) 
     1121                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,:), nrec, rec1, recn) 
     1122              END SELECT 
     1123              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2,:) = ref_wgts(kw)%col2(2-ref_wgts(kw)%offset,jpj1:jpj2,:) 
    9781124           ENDIF 
    9791125        ENDIF 
     
    9811127        ! gradient in the i direction 
    9821128        DO jk = 1,4 
    983           DO jn = 1, jpj 
    984             DO jm = 1,jpi 
     1129          DO jn = 1, nlcj 
     1130            DO jm = 1,nlci 
    9851131              ni = ref_wgts(kw)%data_jpi(jm,jn,jk) 
    9861132              nj = ref_wgts(kw)%data_jpj(jm,jn,jk) 
    987               dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         & 
    988                                (ref_wgts(kw)%fly_dta(ni+2,nj+1) - ref_wgts(kw)%fly_dta(ni,nj+1)) 
     1133              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         & 
     1134                               (ref_wgts(kw)%fly_dta(ni+2,nj+1,:) - ref_wgts(kw)%fly_dta(ni,nj+1,:)) 
    9891135            END DO 
    9901136          END DO 
     
    9931139        ! gradient in the j direction 
    9941140        DO jk = 1,4 
    995           DO jn = 1, jpj 
    996             DO jm = 1,jpi 
     1141          DO jn = 1, nlcj 
     1142            DO jm = 1,nlci 
    9971143              ni = ref_wgts(kw)%data_jpi(jm,jn,jk) 
    9981144              nj = ref_wgts(kw)%data_jpj(jm,jn,jk) 
    999               dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         & 
    1000                                (ref_wgts(kw)%fly_dta(ni+1,nj+2) - ref_wgts(kw)%fly_dta(ni+1,nj)) 
     1145              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         & 
     1146                               (ref_wgts(kw)%fly_dta(ni+1,nj+2,:) - ref_wgts(kw)%fly_dta(ni+1,nj,:)) 
    10011147            END DO 
    10021148          END DO 
     
    10091155              ni = ref_wgts(kw)%data_jpi(jm,jn,jk) 
    10101156              nj = ref_wgts(kw)%data_jpj(jm,jn,jk) 
    1011               dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( & 
    1012                                (ref_wgts(kw)%fly_dta(ni+2,nj+2) - ref_wgts(kw)%fly_dta(ni  ,nj+2)) -   & 
    1013                                (ref_wgts(kw)%fly_dta(ni+2,nj  ) - ref_wgts(kw)%fly_dta(ni  ,nj  ))) 
     1157              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( & 
     1158                               (ref_wgts(kw)%fly_dta(ni+2,nj+2,:) - ref_wgts(kw)%fly_dta(ni  ,nj+2,:)) -   & 
     1159                               (ref_wgts(kw)%fly_dta(ni+2,nj  ,:) - ref_wgts(kw)%fly_dta(ni  ,nj  ,:))) 
    10141160            END DO 
    10151161          END DO 
     
    10191165 
    10201166   END SUBROUTINE fld_interp 
    1021    
     1167 
     1168   FUNCTION ksec_week( cdday ) 
     1169      !!--------------------------------------------------------------------- 
     1170      !!                    ***  FUNCTION kshift_week ***  
     1171      !! 
     1172      !! ** Purpose :   
     1173      !! 
     1174      !! ** Method  : 
     1175      !!--------------------------------------------------------------------- 
     1176      CHARACTER(len=*), INTENT(in)   ::   cdday   !3 first letters of the first day of the weekly file 
     1177      !! 
     1178      INTEGER                        ::   ksec_week  ! output variable 
     1179      INTEGER                        ::   ijul       !temp variable 
     1180      INTEGER                        ::   ishift     !temp variable 
     1181      CHARACTER(len=3),DIMENSION(7)  ::   cl_week  
     1182      !!---------------------------------------------------------------------- 
     1183      cl_week = (/"sun","sat","fri","thu","wed","tue","mon"/) 
     1184      DO ijul=1,7 
     1185         IF(  cl_week(ijul)==TRIM(cdday) ) EXIT 
     1186      ENDDO 
     1187      IF( ijul .GT. 7 ) CALL ctl_stop( 'ksec_week: wrong day for sdjf%cltype(6:8): ',TRIM(cdday) ) 
     1188      ! 
     1189      ishift = ( ijul  ) * 86400 
     1190      !  
     1191      ksec_week = nsec_week + ishift 
     1192      ksec_week = MOD( ksec_week , 86400*7 ) 
     1193      if(lwp)write(numout,*)'cbr ijul ksec_week ',ijul,ksec_week 
     1194      !  
     1195   END FUNCTION ksec_week 
     1196 
    10221197END MODULE fldread 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/geo2ocean.F90

    r1970 r2236  
    2727                                             ! they are only a useless overlay of rot_rep 
    2828 
     29   PUBLIC   obs_rot 
     30 
    2931   REAL(wp), DIMENSION(jpi,jpj) ::   & 
    3032      gsint, gcost,   &  ! cos/sin between model grid lines and NP direction at T point 
     
    4042   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    4143   !! $Id$  
    42    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     44   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4345   !!---------------------------------------------------------------------- 
    4446 
     
    522524   END SUBROUTINE repere 
    523525 
     526 
     527   SUBROUTINE obs_rot ( psinu, pcosu, psinv, pcosv ) 
     528      !!---------------------------------------------------------------------- 
     529      !!                  ***  ROUTINE obs_rot  *** 
     530      !! 
     531      !! ** Purpose :   Copy gsinu, gcosu, gsinv and gsinv 
     532      !!                to input data for rotations of 
     533      !!                current at observation points 
     534      !! 
     535      !! History : 
     536      !!   9.2  !  09-02  (K. Mogensen) 
     537      !!---------------------------------------------------------------------- 
     538      REAL(wp), DIMENSION(jpi,jpj), INTENT( OUT )::   & 
     539         & psinu, pcosu, psinv, pcosv! copy of data 
     540 
     541      !!---------------------------------------------------------------------- 
     542 
     543      ! Initialization of gsin* and gcos* at first call 
     544      ! ----------------------------------------------- 
     545 
     546      IF( lmust_init ) THEN 
     547         IF(lwp) WRITE(numout,*) 
     548         IF(lwp) WRITE(numout,*) ' obs_rot : geographic <--> stretched' 
     549         IF(lwp) WRITE(numout,*) ' ~~~~~~~   coordinate transformation' 
     550 
     551         CALL angle       ! initialization of the transformation 
     552         lmust_init = .FALSE. 
     553 
     554      ENDIF 
     555 
     556      psinu(:,:) = gsinu(:,:) 
     557      pcosu(:,:) = gcosu(:,:) 
     558      psinv(:,:) = gsinv(:,:) 
     559      pcosv(:,:) = gcosv(:,:) 
     560 
     561   END SUBROUTINE obs_rot 
     562 
     563 
    524564  !!====================================================================== 
    525565END MODULE geo2ocean 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/oasis4_date.F90

    r1156 r2236  
    1212   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    1313   !! $Id$ 
    14    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     14   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    1515   !!---------------------------------------------------------------------- 
    1616!##################### WARNING coupled mode ############################### 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbc_ice.F90

    r1482 r2236  
    6363   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009) 
    6464   !! $Id$  
    65    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     65   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6666   !!---------------------------------------------------------------------- 
    6767 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbc_oce.F90

    r2148 r2236  
    8383   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    8484   !! $Id$ 
    85    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     85   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    8686   !!====================================================================== 
    8787END MODULE sbc_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcana.F90

    r2200 r2236  
    4141   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4242   !! $Id$ 
    43    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     43   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4444   !!---------------------------------------------------------------------- 
    4545 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcblk_clio.F90

    r1951 r2236  
    8383   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    8484   !! $Id$  
    85    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     85   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    8686   !!---------------------------------------------------------------------- 
    8787 
     
    160160            CALL ctl_stop( 'sbc_blk_clio: unable to allocate sf structure' )   ;   RETURN 
    161161         ENDIF 
    162  
    163162         DO ifpr= 1, jpfld 
    164             ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1  ) ) 
    165             ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) ) 
    166          END DO 
    167  
    168  
     163            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) ) 
     164            IF( slf_i(ifpr)%ln_tint ) ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) ) 
     165         END DO 
    169166         ! fill sf with slf_i and control print 
    170167         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_clio', 'flux formulation for ocean surface boundary condition', 'namsbc_clio' ) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcblk_core.F90

    r2228 r2236  
    7474   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    7575   !! $Id$ 
    76    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     76   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7777   !!---------------------------------------------------------------------- 
    7878CONTAINS 
     
    169169         ENDIF 
    170170         DO ifpr= 1, jfld 
    171             ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1  ) ) 
    172             ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) ) 
     171            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) ) 
     172            IF( slf_i(ifpr)%ln_tint ) ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) ) 
    173173         END DO 
    174174         !                                         ! fill sf with slf_i and control print 
     
    269269!CDIR COLLAPSE 
    270270      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave 
    271                        
    272271      ! ----------------------------------------------------------------------------- ! 
    273272      !     II    Turbulent FLUXES                                                    ! 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbccpl.F90

    r2228 r2236  
    166166   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    167167   !! $Id$ 
    168    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     168   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    169169   !!---------------------------------------------------------------------- 
    170170 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcflx.F90

    r2228 r2236  
    4242   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    4343   !! $Id$ 
    44    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     44   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4545   !!---------------------------------------------------------------------- 
    4646CONTAINS 
     
    115115         ENDIF 
    116116         DO ji= 1, jpfld 
    117             ALLOCATE( sf(ji)%fnow(jpi,jpj,1  ) ) 
    118             ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) ) 
     117            ALLOCATE( sf(ji)%fnow(jpi,jpj,1) ) 
     118            IF( slf_i(ji)%ln_tint ) ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) ) 
    119119         END DO 
    120120         !                                         ! fill sf with slf_i and control print 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcfwb.F90

    r2000 r2236  
    4343   !!  OPA 9.0 , LOCEAN-IPSL (2006)  
    4444   !! $Id$ 
    45    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     45   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4646   !!---------------------------------------------------------------------- 
    4747CONTAINS 
     
    6666      INTEGER  ::   inum                  ! temporary logical unit 
    6767      INTEGER  ::   ikty, iyear           !  
    68       REAL(wp) ::   z_fwf, z_fwf_nsrf       ! temporary scalars 
     68      REAL(wp) ::   z_fwf, z_fwf_nsrf, zsum_fwf, zsum_erp       ! temporary scalars 
    6969      REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread 
    7070      REAL(wp), DIMENSION(jpi,jpj) ::   ztmsk_neg, ztmsk_pos, ztmsk_tospread 
     
    161161            ! fwf global mean  
    162162            z_fwf = glob_sum( e1e2_i(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area 
    163             ! 
     163            IF( lk_mpp )   CALL  mpp_sum( z_fwf ) 
     164            IF( lk_mpp )   CALL  mpp_sum( zsurf_neg ) 
     165            IF( lk_mpp )   CALL  mpp_sum( zsurf_pos ) 
    164166             
    165167            IF( z_fwf < 0.e0 ) THEN 
     
    174176 
    175177            ! fwf global mean over <0 or >0 erp area 
    176             z_fwf_nsrf = SUM( e1e2_i(:,:) * z_fwf ) / ( zsurf_tospread + rsmall ) 
     178            zsum_fwf = SUM( e1e2_i(:,:) * z_fwf ) 
     179            IF( lk_mpp )   CALL  mpp_sum( zsum_fwf ) 
     180            z_fwf_nsrf =  zsum_fwf / ( zsurf_tospread + rsmall ) 
    177181            ! weight to respect erp field 2D structure  
     182!!gm  Strange           
    178183            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( SUM( ztmsk_tospread(:,:) * erp(:,:) * e1e2_i(:,:) ) + rsmall ) 
    179184            ! final correction term to apply 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcice_if.F90

    r1951 r2236  
    3232   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    3333   !! $Id$ 
    34    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     34   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3535   !!---------------------------------------------------------------------- 
    3636 
     
    8181            CALL ctl_stop( 'sbc_ice_if: unable to allocate sf_ice structure' )   ;   RETURN 
    8282         ENDIF 
    83          ALLOCATE( sf_ice(1)%fnow(jpi,jpj,1  ) ) 
    84          ALLOCATE( sf_ice(1)%fdta(jpi,jpj,1,2) ) 
     83         ALLOCATE( sf_ice(1)%fnow(jpi,jpj,1) ) 
     84         IF( sn_ice%ln_tint ) ALLOCATE( sf_ice(1)%fdta(jpi,jpj,1,2) ) 
    8585 
    8686 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcice_lim.F90

    r1715 r2236  
    1919   !!---------------------------------------------------------------------- 
    2020   USE oce             ! ocean dynamics and tracers 
    21    USE c1d             ! 1d configuration 
    2221   USE dom_oce         ! ocean space and time domain 
    2322   USE lib_mpp 
     
    6564   !! NEMO/LIM 3.0 , UCL-LOCEAN-IPSL  (2008) 
    6665   !! $Id$ 
    67    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     66   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6867   !!---------------------------------------------------------------------- 
    6968 
     
    196195         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx, 1, ' - Beginning the time step - ' )   ! control print 
    197196         ! 
    198          IF( .NOT. lk_c1d ) THEN                     ! Ice dynamics & transport (not in 1D case) 
     197#if ! defined key_c1d 
     198         ! Ice dynamics & transport (not in 1D case) 
    199199                          CALL lim_dyn( kt )              ! Ice dynamics    ( rheology/dynamics ) 
    200200                          CALL lim_trp( kt )              ! Ice transport   ( Advection/diffusion ) 
     
    203203         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx,-1, ' - ice dyn & trp - ' )   ! control print 
    204204                          CALL lim_itd_me                 ! Mechanical redistribution ! (ridging/rafting) 
    205          ENDIF 
     205#endif 
    206206         ! 
    207207         !                                           ! Ice thermodynamics  
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90

    r2224 r2236  
    88   !! History :  1.0   !  06-2006  (G. Madec)  from icestp_2.F90 
    99   !!            3.0   !  08-2008  (S. Masson, E. .... ) coupled interface 
     10   !!            3.3   !  05-2009  (G.Garric) addition of the lim2_evp case 
    1011   !!---------------------------------------------------------------------- 
    1112#if defined key_lim2 
     
    1718   !!---------------------------------------------------------------------- 
    1819   USE oce             ! ocean dynamics and tracers 
    19    USE c1d             ! 1d configuration 
    2020   USE dom_oce         ! ocean space and time domain 
    2121   USE lib_mpp 
     
    5353   PUBLIC sbc_ice_lim_2 ! routine called by sbcmod.F90 
    5454    
    55    CHARACTER(len=1) ::   cl_grid = 'B'     ! type of grid used in ice dynamics 
    56  
    5755   !! * Substitutions 
    5856#  include "domzgr_substitute.h90" 
     
    6159   !! NEMO/SBC  3.0 , LOCEAN-IPSL (2008)  
    6260   !! $Id$ 
    63    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     61   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6462   !!---------------------------------------------------------------------- 
    6563 
     
    172170         !  Ice model step  ! 
    173171         ! ---------------- ! 
     172         numit = numit + nn_fsbc                                             ! Ice model time step 
    174173 
    175174                                        CALL lim_rst_opn_2  ( kt )      ! Open Ice restart file 
    176          IF( .NOT. lk_c1d ) THEN                                        ! Ice dynamics & transport (not in 1D case) 
     175#if ! defined key_c1d 
     176            ! Ice dynamics & transport (not in 1D case) 
    177177                                        CALL lim_dyn_2      ( kt )           ! Ice dynamics    ( rheology/dynamics ) 
    178178                                        CALL lim_trp_2      ( kt )           ! Ice transport   ( Advection/diffusion ) 
    179179            IF( ln_limdmp )             CALL lim_dmp_2      ( kt )           ! Ice damping  
    180          ENDIF 
     180#endif 
    181181#if defined key_coupled 
    182182         IF( ksbc == 5    )             CALL sbc_cpl_ice_flx( reshape( frld, (/jpi,jpj,1/) ),        & 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcmod.F90

    r2228 r2236  
    88   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps 
    99   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle 
     10   !!            3.3   !  09-2010  (D. Storkey) add ice boundary conditions (BDY) 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    3435   USE sbcfwb           ! surface boundary condition: freshwater budget 
    3536   USE closea           ! closed sea 
     37   USE bdy_par         ! unstructured open boundary data variables 
     38   USE bdyice          ! unstructured open boundary data  (bdy_ice routine) 
    3639 
    3740   USE prtctl           ! Print control                    (prt_ctl routine) 
     
    5356   !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
    5457   !! $Id$ 
    55    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     58   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5659   !!---------------------------------------------------------------------- 
    5760CONTAINS 
     
    238241         !                                                       
    239242      CASE(  2 )   ;       CALL sbc_ice_lim_2( kt, nsbc )             ! LIM 2.0 ice model 
     243                           IF( lk_bdy ) CALL bdy_ice( kt ) 
    240244         !                                                      
    241245      CASE(  3 )   ;       CALL sbc_ice_lim  ( kt, nsbc, nn_ico_cpl)  ! LIM 3.0 ice model 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcrnf.F90

    r2148 r2236  
    2525   PRIVATE 
    2626 
    27    PUBLIC sbc_rnf          ! routine call in step module 
    28  
    29    !                                                     !!* namsbc_rnf namelist * 
     27   PUBLIC sbc_rnf          ! routine call in sbcmod module 
     28   PUBLIC sbc_rnf_div      ! routine called in sshwzv module 
     29 
     30   !                                                      !!* namsbc_rnf namelist * 
    3031   CHARACTER(len=100), PUBLIC ::   cn_dir       = './'    !: Root directory for location of ssr files 
     32   LOGICAL           , PUBLIC ::   ln_rnf_depth = .false. !: depth       river runoffs attribute specified in a file 
     33   LOGICAL           , PUBLIC ::   ln_rnf_temp  = .false. !: temperature river runoffs attribute specified in a file  
     34   LOGICAL           , PUBLIC ::   ln_rnf_sal   = .false. !: salinity    river runoffs attribute specified in a file  
    3135   LOGICAL           , PUBLIC ::   ln_rnf_emp   = .false. !: runoffs into a file to be read or already into precipitation 
    3236   TYPE(FLD_N)       , PUBLIC ::   sn_rnf                 !: information about the runoff file to be read 
    3337   TYPE(FLD_N)       , PUBLIC ::   sn_cnf                 !: information about the runoff mouth file to be read 
    34    TYPE(FLD_N)                ::   sn_sal_rnf             !: information about the salinities of runoff file to be read   
    35    TYPE(FLD_N)                ::   sn_tmp_rnf             !: information about the temperatures of runoff file to be read   
     38   TYPE(FLD_N)                ::   sn_s_rnf               !: information about the salinities of runoff file to be read   
     39   TYPE(FLD_N)                ::   sn_t_rnf               !: information about the temperatures of runoff file to be read   
    3640   TYPE(FLD_N)                ::   sn_dep_rnf             !: information about the depth which river inflow affects 
    3741   LOGICAL           , PUBLIC ::   ln_rnf_mouth = .false. !: specific treatment in mouths vicinity 
    3842   REAL(wp)          , PUBLIC ::   rn_hrnf      = 0.e0    !: runoffs, depth over which enhanced vertical mixing is used 
    3943   REAL(wp)          , PUBLIC ::   rn_avt_rnf   = 0.e0    !: runoffs, value of the additional vertical mixing coef. [m2/s] 
    40    LOGICAL           , PUBLIC ::   ln_rnf_att   = .false. !: river runoffs attributes (temp, sal & depth) are specified in a file  
    4144   REAL(wp)          , PUBLIC ::   rn_rfact     = 1.e0    !: multiplicative factor for runoff 
    4245 
    43    INTEGER , PUBLIC                     ::   nkrnf = 0   !: number of levels over which Kz is increased at river mouths 
    44    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rnfmsk      !: river mouth mask (hori.) 
    45    REAL(wp), PUBLIC, DIMENSION(jpk)     ::   rnfmsk_z    !: river mouth mask (vert.) 
    46  
    47    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_rnf        !: structure of input river runoff (file information, fields read) 
    48  
    49    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_sal_rnf    !: structure of input river runoff salinity (file information, fields read)   
    50    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_tem_rnf    !: structure of input river runoff temperature (file information, fields read)   
     46   INTEGER , PUBLIC                     ::   nkrnf = 0    !: number of levels over which Kz is increased at river mouths 
     47   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rnfmsk       !: river mouth mask (hori.) 
     48   REAL(wp), PUBLIC, DIMENSION(jpk)     ::   rnfmsk_z     !: river mouth mask (vert.) 
     49 
     50   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_rnf       !: structure of input river runoff (file information, fields read) 
     51 
     52   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_s_rnf     !: structure of input river runoff salinity (file information, fields read)   
     53   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_t_rnf     !: structure of input river runoff temperature (file information, fields read)   
    5154  
    52    REAL,    PUBLIC, DIMENSION(jpi,jpj) ::  rnf_dep         !: depth of runoff in m   
    53    INTEGER, PUBLIC, DIMENSION(jpi,jpj) ::  rnf_mod_dep     !: depth of runoff in model levels   
    54    REAL,    PUBLIC, DIMENSION(jpi,jpj) ::  rnf_sal         !: salinity of river runoff   
    55    REAL,    PUBLIC, DIMENSION(jpi,jpj) ::  rnf_tmp         !: temperature of river runoff   
    56    
    57    INTEGER  ::  ji, jj ,jk    ! dummy loop indices   
    58    INTEGER  ::  inum          ! temporary logical unit   
    59    
     55   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   h_rnf        !: depth of runoff in m 
     56   INTEGER,  PUBLIC, DIMENSION(jpi,jpj) ::   nk_rnf       !: depth of runoff in model levels 
     57 
     58   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,2) ::  tsc_rnf  !: temperature & salinity content of river runoffs   [K.m/s & PSU.m/s] 
     59 
    6060   !! * Substitutions   
    6161#  include "domzgr_substitute.h90"   
    62  
    6362   !!---------------------------------------------------------------------- 
    6463   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    6564   !! $Id$ 
    66    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     65   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6766   !!---------------------------------------------------------------------- 
    6867 
     
    8483      !! 
    8584      INTEGER  ::   ji, jj   ! dummy loop indices 
     85      REAL(wp) ::   z1_rau0  ! local scalar 
    8686      !!---------------------------------------------------------------------- 
    8787      !                                    
    88       IF( kt == nit000 )  CALL sbc_rnf_init     ! Read namelist and allocate structures  
     88      IF( kt == nit000 )   CALL sbc_rnf_init                           ! Read namelist and allocate structures 
    8989 
    9090      !                                                   !-------------------! 
     
    9292         !                                                !-------------------! 
    9393         ! 
    94          CALL fld_read( kt, nn_fsbc, sf_rnf )   ! Read Runoffs data and provides it 
    95          !                                      ! at the current time-step 
    96          IF ( ln_rnf_att ) THEN   
    97             CALL fld_read ( kt, nn_fsbc, sf_sal_rnf )   
    98             CALL fld_read ( kt, nn_fsbc, sf_tem_rnf )   
    99          ENDIF   
     94                             CALL fld_read ( kt, nn_fsbc, sf_rnf )      ! Read Runoffs data and provide it at kt  
     95         IF( ln_rnf_temp )   CALL fld_read ( kt, nn_fsbc, sf_t_rnf )    ! idem for runoffs temperature if required 
     96         IF( ln_rnf_sal  )   CALL fld_read ( kt, nn_fsbc, sf_s_rnf )    ! idem for runoffs salinity    if required 
    10097 
    10198         ! Runoff reduction only associated to the ORCA2_LIM configuration 
     
    113110         IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN 
    114111            rnf(:,:)  = rn_rfact * ( sf_rnf(1)%fnow(:,:,1) )   
    115             IF ( ln_rnf_att ) THEN   
    116                rnf_sal(:,:) = ( sf_sal_rnf(1)%fnow(:,:,1) )   
    117                rnf_tmp(:,:) = ( sf_tem_rnf(1)%fnow(:,:,1) )   
    118             ELSE   
    119                rnf_sal(:,:) = 0   
    120                rnf_tmp(:,:) = -999   
     112            ! 
     113            z1_rau0 = 1.e0 / rau0 
     114            !                                                              ! set temperature & salinity content of runoffs 
     115            IF( ln_rnf_temp )   THEN                                       ! use runoffs temperature data 
     116               tsc_rnf(:,:,jp_tem) = ( sf_t_rnf(1)%fnow(:,:,1) ) * rnf(:,:) * z1_rau0 
     117               WHERE( sf_t_rnf(1)%fnow(:,:,1) == -999 )                      ! if missing data value use SST as runoffs temperature   
     118                   tsc_rnf(:,:,jp_tem) = sst_m(:,:) * rnf(:,:) * z1_rau0 
     119               ENDWHERE 
     120            ELSE                                                           ! use SST as runoffs temperature 
     121               tsc_rnf(:,:,jp_tem) = sst_m(:,:) * rnf(:,:) * z1_rau0 
    121122            ENDIF   
    122             CALL iom_put( "runoffs", rnf )         ! runoffs 
     123            !                                                              ! use runoffs salinity data  
     124            IF( ln_rnf_sal ) tsc_rnf(:,:,jp_sal) = ( sf_s_rnf(1)%fnow(:,:,1) ) * rnf(:,:) * z1_rau0 
     125            !                                                              ! else use S=0 for runoffs (done one for all in the init) 
     126            ! 
     127            IF( ln_rnf_temp .OR. ln_rnf_sal ) THEN                         ! runoffs as outflow: use ocean SST and SSS 
     128               WHERE( rnf(:,:) < 0.e0 )                                    ! example baltic model when flow is out of domain  
     129                  tsc_rnf(:,:,jp_tem) = sst_m(:,:) * rnf(:,:) * z1_rau0 
     130                  tsc_rnf(:,:,jp_sal) = sss_m(:,:) * rnf(:,:) * z1_rau0 
     131               ENDWHERE 
     132            ENDIF 
     133 
     134            CALL iom_put( "runoffs", rnf )         ! output runoffs arrays 
    123135         ENDIF 
    124136         ! 
     
    127139   END SUBROUTINE sbc_rnf 
    128140 
     141   SUBROUTINE sbc_rnf_div( phdivn ) 
     142      !!---------------------------------------------------------------------- 
     143      !!                  ***  ROUTINE sbc_rnf  *** 
     144      !!        
     145      !! ** Purpose :   update the horizontal divergence with the runoff inflow 
     146      !! 
     147      !! ** Method  :    
     148      !!                CAUTION : rnf is positive (inflow) decreasing the  
     149      !!                          divergence and expressed in m/s 
     150      !! 
     151      !! ** Action  :   phdivn   decreased by the runoff inflow 
     152      !!---------------------------------------------------------------------- 
     153      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   phdivn   ! horizontal divergence 
     154      !! 
     155      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     156      REAL(wp) ::   z1_rau0   ! local scalar 
     157      !!---------------------------------------------------------------------- 
     158      ! 
     159      z1_rau0 = 1.e0 / rau0 
     160      IF( ln_rnf_depth ) THEN      !==   runoff distributed over several levels   ==! 
     161         IF( lk_vvl ) THEN             ! variable volume case  
     162            DO jj = 1, jpj                   ! update the depth over which runoffs are distributed 
     163               DO ji = 1, jpi 
     164                  h_rnf(ji,jj) = 0.e0  
     165                  DO jk = 1, nk_rnf(ji,jj)                           ! recalculates h_rnf to be the depth in metres 
     166                     h_rnf(ji,jj) = h_rnf(ji,jj) + fse3t(ji,jj,jk)   ! to the bottom of the relevant grid box  
     167                  END DO  
     168                  !                          ! apply the runoff input flow 
     169                  DO jk = 1, nk_rnf(ji,jj) 
     170                     phdivn(ji,jj,jk) = phdivn(ji,jj,jk) - rnf(ji,jj) * z1_rau0 / h_rnf(ji,jj) 
     171                  END DO 
     172               END DO 
     173            END DO 
     174         ELSE                          ! constant volume case : just apply the runoff input flow 
     175            DO jj = 1, jpj 
     176               DO ji = 1, jpi 
     177                  DO jk = 1, nk_rnf(ji,jj) 
     178                     phdivn(ji,jj,jk) = phdivn(ji,jj,jk) - rnf(ji,jj) * z1_rau0 / h_rnf(ji,jj) 
     179                  END DO 
     180               END DO 
     181            END DO 
     182         ENDIF 
     183      ELSE                       !==   runoff put only at the surface   ==! 
     184         phdivn(:,:,1) = phdivn(:,:,1) - rnf(:,:) * z1_rau0 / fse3t(:,:,1) 
     185      ENDIF 
     186      ! 
     187   END SUBROUTINE sbc_rnf_div 
     188 
    129189 
    130190   SUBROUTINE sbc_rnf_init 
     
    138198      !! ** Action  : - read parameters 
    139199      !!---------------------------------------------------------------------- 
    140       INTEGER  ::   ierror   ! temporary integer 
    141200      CHARACTER(len=32) ::   rn_dep_file   ! runoff file name   
     201      INTEGER           ::   inum        ! temporary integers 
     202      INTEGER           ::   ierror   ! temporary integer 
    142203      !!  
    143       NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, sn_rnf, sn_cnf, sn_sal_rnf, sn_tmp_rnf, sn_dep_rnf,   &   
    144          &                 ln_rnf_mouth, ln_rnf_att, rn_hrnf, rn_avt_rnf, rn_rfact   
     204      NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, ln_rnf_depth, ln_rnf_temp, ln_rnf_sal,   & 
     205         &                 sn_rnf, sn_cnf    , sn_s_rnf    , sn_t_rnf   , sn_dep_rnf,   &   
     206         &                 ln_rnf_mouth      , rn_hrnf     , rn_avt_rnf , rn_rfact   
    145207      !!---------------------------------------------------------------------- 
    146208 
     
    154216      sn_cnf = FLD_N( 'runoffs',     0     , 'sorunoff' ,  .FALSE.   , .true. ,   'yearly'  , ''       , ''         ) 
    155217 
    156       sn_sal_rnf = FLD_N( 'runoffs',  24.  , 'rosaline' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  )   
    157       sn_tmp_rnf = FLD_N( 'runoffs',  24.  , 'rotemper' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  )   
     218      sn_s_rnf = FLD_N( 'runoffs',  24.  , 'rosaline' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  )   
     219      sn_t_rnf = FLD_N( 'runoffs',  24.  , 'rotemper' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  )   
    158220      sn_dep_rnf = FLD_N( 'runoffs',   0.  , 'rodepth'  ,  .FALSE.   , .true. ,   'yearly'  , ''    , ''  )   
    159221      ! 
     
    178240      !                                   ! ================== 
    179241      ! 
    180       IF( ln_rnf_emp ) THEN                     ! runoffs directly provided in the precipitations 
     242      IF( ln_rnf_emp ) THEN                     !==  runoffs directly provided in the precipitations  ==! 
    181243         IF(lwp) WRITE(numout,*) 
    182244         IF(lwp) WRITE(numout,*) '          runoffs directly provided in the precipitations' 
    183          IF ( ln_rnf_att ) THEN 
    184            CALL ctl_warn( 'runoffs already included in precipitations & so runoff attributes will not be used' )  
    185            ln_rnf_att = .FALSE. 
    186          ENDIF 
    187          ! 
    188       ELSE                                      ! runoffs read in a file : set sf_rnf structure  
    189          ! 
    190          ! Allocate sf_rnf structure and (if required) sf_sal_rnf and sf_tem_rnf structures 
    191          ALLOCATE( sf_rnf(1), STAT=ierror ) 
     245         IF( ln_rnf_depth .OR. ln_rnf_temp .OR. ln_rnf_sal ) THEN 
     246           CALL ctl_warn( 'runoffs already included in precipitations, so runoff (T,S, depth) attributes will not be used' )  
     247           ln_rnf_depth = .FALSE.   ;   ln_rnf_temp = .FALSE.   ;   ln_rnf_sal = .FALSE. 
     248         ENDIF 
     249         ! 
     250      ELSE                                      !==  runoffs read in a file : set sf_rnf structure  ==! 
     251         ! 
     252         ALLOCATE( sf_rnf(1), STAT=ierror )         ! Create sf_rnf structure (runoff inflow) 
     253         IF(lwp) WRITE(numout,*) 
     254         IF(lwp) WRITE(numout,*) '          runoffs inflow read in a file' 
    192255         IF( ierror > 0 ) THEN 
    193256            CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN 
    194257         ENDIF 
    195          ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1) ) 
    196          ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) ) 
    197  
    198          IF( ln_rnf_att ) THEN 
    199             ALLOCATE( sf_sal_rnf(1), STAT=ierror ) 
     258         ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1)   ) 
     259         IF( sn_rnf%ln_tint ) ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) ) 
     260         !                                          ! fill sf_rnf with the namelist (sn_rnf) and control print 
     261         CALL fld_fill( sf_rnf, (/ sn_rnf /), cn_dir, 'sbc_rnf_init', 'read runoffs data', 'namsbc_rnf' ) 
     262         ! 
     263         IF( ln_rnf_temp ) THEN                     ! Create (if required) sf_t_rnf structure 
     264            IF(lwp) WRITE(numout,*) 
     265            IF(lwp) WRITE(numout,*) '          runoffs temperatures read in a file' 
     266            ALLOCATE( sf_t_rnf(1), STAT=ierror  ) 
    200267            IF( ierror > 0 ) THEN 
    201                CALL ctl_stop( 'sbc_sal_rnf: unable to allocate sf_sal_rnf structure' )   ;   RETURN 
     268               CALL ctl_stop( 'sbc_rnf_init: unable to allocate sf_t_rnf structure' )   ;   RETURN 
    202269            ENDIF 
    203             ALLOCATE( sf_sal_rnf(1)%fnow(jpi,jpj,1) ) 
    204             ALLOCATE( sf_sal_rnf(1)%fdta(jpi,jpj,1,2) ) 
    205  
    206             ALLOCATE( sf_tem_rnf(1), STAT=ierror ) 
     270            ALLOCATE( sf_t_rnf(1)%fnow(jpi,jpj,1)   ) 
     271            IF( sn_t_rnf%ln_tint ) ALLOCATE( sf_t_rnf(1)%fdta(jpi,jpj,1,2) ) 
     272            CALL fld_fill (sf_t_rnf, (/ sn_t_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff temperature data', 'namsbc_rnf' )   
     273         ENDIF 
     274         ! 
     275         IF( ln_rnf_sal  ) THEN                     ! Create (if required) sf_s_rnf and sf_t_rnf structures 
     276            IF(lwp) WRITE(numout,*) 
     277            IF(lwp) WRITE(numout,*) '          runoffs salinities read in a file' 
     278            ALLOCATE( sf_s_rnf(1), STAT=ierror  ) 
    207279            IF( ierror > 0 ) THEN 
    208                 CALL ctl_stop( 'sbc_tmp_rnf: unable to allocate sf_tem_rnf structure' )   ;   RETURN 
     280               CALL ctl_stop( 'sbc_rnf_init: unable to allocate sf_s_rnf structure' )   ;   RETURN 
    209281            ENDIF 
    210             ALLOCATE( sf_tem_rnf(1)%fnow(jpi,jpj,1) ) 
    211             ALLOCATE( sf_tem_rnf(1)%fdta(jpi,jpj,1,2) ) 
    212          ENDIF 
    213          ! fill sf_rnf with sn_rnf and control print 
    214          CALL fld_fill( sf_rnf, (/ sn_rnf /), cn_dir, 'sbc_rnf_init', 'read runoffs data', 'namsbc_rnf' ) 
     282            ALLOCATE( sf_s_rnf(1)%fnow(jpi,jpj,1)  ) 
     283            IF( sn_s_rnf%ln_tint ) ALLOCATE( sf_s_rnf(1)%fdta(jpi,jpj,1,2) ) 
     284            CALL fld_fill (sf_s_rnf, (/ sn_s_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff salinity data', 'namsbc_rnf' )   
     285         ENDIF 
     286 
    215287  
    216          IF ( ln_rnf_att ) THEN   
    217             CALL fld_fill (sf_sal_rnf, (/ sn_sal_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff salinity data', 'namsbc_rnf' )   
    218             CALL fld_fill (sf_tem_rnf, (/ sn_tmp_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff temperature data', 'namsbc_rnf' )   
    219    
     288         IF ( ln_rnf_depth ) THEN                     ! depth of runoffs set from a file  
     289            IF(lwp) WRITE(numout,*) 
     290            IF(lwp) WRITE(numout,*) '          runoffs depth read in a file' 
    220291            rn_dep_file = TRIM( cn_dir )//TRIM( sn_dep_rnf%clname )   
    221292            CALL iom_open ( rn_dep_file, inum )                           ! open file   
    222             CALL iom_get  ( inum, jpdom_data, sn_dep_rnf%clvar, rnf_dep )    ! read the river mouth array   
     293            CALL iom_get  ( inum, jpdom_data, sn_dep_rnf%clvar, h_rnf )    ! read the river mouth array   
    223294            CALL iom_close( inum )                                      ! close file   
    224295   
    225             rnf_mod_dep(:,:) = 0.   
    226             DO jj = 1, jpj   
    227               DO ji = 1, jpi   
    228                 IF ( rnf_dep(ji,jj) > 0.e0 ) THEN   
    229                   jk = 2   
    230                   DO WHILE ( jk /= jpkm1 .AND. fsdept(ji,jj,jk) < rnf_dep(ji,jj) ) ;  jk = jk + 1 ;   ENDDO   
    231                   rnf_mod_dep(ji,jj) = jk   
    232                 ELSE IF ( rnf_dep(ji,jj) == -1. ) THEN   
    233                   rnf_mod_dep(ji,jj) = 1.   
    234                 ELSE IF ( rnf_dep(ji,jj) == -999 ) THEN   
    235                   rnf_mod_dep(ji,jj) = jpkm1   
    236                 ELSE IF ( rnf_dep(ji,jj) /= 0. ) THEN   
     296            nk_rnf(:,:)=0                              ! set the number of level over which river runoffs are applied 
     297            DO jj=1,jpj   
     298              DO ji=1,jpi   
     299                IF ( h_rnf(ji,jj) > 0.e0 ) THEN   
     300                  jk=2   
     301                  DO WHILE ( jk/=(mbathy(ji,jj)-1) .AND. fsdept(ji,jj,jk) < h_rnf(ji,jj) );  jk=jk+1;   ENDDO   
     302                  nk_rnf(ji,jj)=jk   
     303                ELSE IF ( h_rnf(ji,jj) == -1   ) THEN   ;  nk_rnf(ji,jj)=1   
     304                ELSE IF ( h_rnf(ji,jj) == -999 ) THEN   ;  nk_rnf(ji,jj)=mbathy(ji,jj)-1 
     305                ELSE IF ( h_rnf(ji,jj) /= 0 ) THEN   
    237306                  CALL ctl_stop( 'runoff depth not positive, and not -999 or -1, rnf value in file fort.999'  )   
    238307                  WRITE(999,*) 'ji, jj, rnf(ji,jj) :', ji, jj, rnf(ji,jj)   
     
    240309              ENDDO   
    241310            ENDDO   
    242          ELSE   
    243             rnf_mod_dep(:,:) = 1.   
     311            DO jj=1,jpj                               ! set the associated depth  
     312              DO ji=1,jpi  
     313                h_rnf(ji,jj)=0.e0 
     314                DO jk=1,nk_rnf(ji,jj)                         
     315                   h_rnf(ji,jj)=h_rnf(ji,jj)+fse3t(ji,jj,jk)   
     316                ENDDO 
     317              ENDDO 
     318            ENDDO 
     319         ELSE                                       ! runoffs applied at the surface  
     320            nk_rnf(:,:)=1   
     321            h_rnf(:,:)=fse3t(:,:,1) 
    244322         ENDIF   
    245323      !  
    246324      ENDIF 
    247       ! 
    248  
     325 
     326      tsc_rnf(:,:,:) = 0.e0                 ! runoffs temperature & salinty contents initilisation 
    249327      !                                   ! ======================== 
    250328      !                                   !   River mouth vicinity 
     
    256334         !                                      !    - mixed upstream-centered (ln_traadv_cen2=T) 
    257335         ! 
    258          !                                          ! Number of level over which Kz increase 
    259          IF ( ln_rnf_att )  &  
    260               &  CALL ctl_warn( 'increased mixing turned on but effects may already be spread through depth by ln_rnf_att' )  
    261          nkrnf = 0 
     336         IF ( ln_rnf_depth )   CALL ctl_warn( 'sbc_rnf_init: increased mixing turned on but effects may already',   & 
     337            &                                              'be spread through depth by ln_rnf_depth'               )  
     338         ! 
     339         nkrnf = 0                                  ! Number of level over which Kz increase 
    262340         IF( rn_hrnf > 0.e0 ) THEN 
    263341            nkrnf = 2 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcssm.F90

    r1715 r2236  
    2929   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    3030   !! $Id$ 
    31    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     31   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3232   !!---------------------------------------------------------------------- 
    3333 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcssr.F90

    r1951 r2236  
    4848   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4949   !! $Id$ 
    50    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     50   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5151   !!---------------------------------------------------------------------- 
    5252 
     
    115115               CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sst structure' )   ;   RETURN 
    116116            ENDIF 
    117             ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1  ) ) 
    118             ALLOCATE( sf_sst(1)%fdta(jpi,jpj,1,2) ) 
     117            ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1) ) 
    119118            ! 
    120119            ! fill sf_sst with sn_sst and control print 
    121120            CALL fld_fill( sf_sst, (/ sn_sst /), cn_dir, 'sbc_ssr', 'SST restoring term toward SST data', 'namsbc_ssr' ) 
     121            IF( sf_sst(1)%ln_tint ) ALLOCATE( sf_sst(1)%fdta(jpi,jpj,1,2) ) 
    122122         ENDIF 
    123123         ! 
     
    128128               CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sss structure' )   ;   RETURN 
    129129            ENDIF 
    130             ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1  ) ) 
    131             ALLOCATE( sf_sss(1)%fdta(jpi,jpj,1,2) ) 
     130            ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1) ) 
    132131            ! 
    133132            ! fill sf_sss with sn_sss and control print 
    134133            CALL fld_fill( sf_sss, (/ sn_sss /), cn_dir, 'sbc_ssr', 'SSS restoring term toward SSS data', 'namsbc_ssr' ) 
     134            IF( sf_sss(1)%ln_tint )ALLOCATE( sf_sss(1)%fdta(jpi,jpj,1,2) ) 
    135135         ENDIF 
    136136         ! 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SOL/sol_oce.F90

    r1601 r2236  
    5252   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    5353   !! $Id$  
    54    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     54   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5555   !!---------------------------------------------------------------------- 
    5656END MODULE sol_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SOL/solmat.F90

    r2224 r2236  
    1515   !!             3.2  ! 2009-06  (S. Masson)  distributed restart using iom 
    1616   !!              -   ! 2009-07  (R. Benshila)  suppression of rigid-lid option 
     17   !!             3.3  ! 2010-09  (D. Storkey) update for BDY module. 
    1718   !!---------------------------------------------------------------------- 
    1819 
     
    2627   USE phycst          ! physical constants 
    2728   USE obc_oce         ! ocean open boundary conditions 
     29   USE bdy_oce         ! unstructured open boundary conditions 
    2830   USE lbclnk          ! lateral boudary conditions 
    2931   USE lib_mpp         ! distributed memory computing 
     
    3840   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3941   !! $Id$  
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4143   !!---------------------------------------------------------------------- 
    4244 
     
    8082      ENDIF 
    8183 
    82 #if defined key_dynspg_flt  
     84#if defined key_dynspg_flt && ! defined key_bdy 
    8385#   if ! defined key_obc 
    8486 
     
    158160    ENDIF 
    159161#   endif 
     162 
     163#  elif defined key_dynspg_flt && defined key_bdy  
     164 
     165      !   defined gcdmat in the case of unstructured open boundaries 
     166      DO jj = 2, jpjm1 
     167         DO ji = 2, jpim1 
     168            zcoef = z2dt * z2dt * grav * bmask(ji,jj) 
     169 
     170            !  south coefficient 
     171            zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1) 
     172            zcoefs = zcoefs * bdyvmask(ji,jj-1) 
     173            gcp(ji,jj,1) = zcoefs 
     174 
     175            !  west coefficient 
     176            zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj) 
     177            zcoefw = zcoefw * bdyumask(ji-1,jj) 
     178            gcp(ji,jj,2) = zcoefw 
     179 
     180            !  east coefficient 
     181            zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj) 
     182            zcoefe = zcoefe * bdyumask(ji,jj) 
     183            gcp(ji,jj,3) = zcoefe 
     184 
     185            !  north coefficient 
     186            zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj) 
     187            zcoefn = zcoefn * bdyvmask(ji,jj) 
     188            gcp(ji,jj,4) = zcoefn 
     189 
     190            ! diagonal coefficient 
     191            gcdmat(ji,jj) = e1t(ji,jj)*e2t(ji,jj)*bmask(ji,jj) & 
     192                            - zcoefs -zcoefw -zcoefe -zcoefn 
     193         END DO 
     194      END DO 
     195 
    160196#endif 
    161197 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SOL/solpcg.F90

    r1976 r2236  
    2626   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    2727   !! $Id$  
    28    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     28   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    2929   !!---------------------------------------------------------------------- 
    3030CONTAINS 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SOL/solsor.F90

    r1976 r2236  
    3232   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3333   !! $Id$  
    34    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     34   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3535   !!---------------------------------------------------------------------- 
    3636 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SOL/solver.F90

    r1976 r2236  
    3333   !! NEMO/OPA 9.0 , LOCEAN-IPSL (2009)  
    3434   !! $Id$  
    35    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     35   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3636   !!---------------------------------------------------------------------- 
    3737 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/eosbn2.F90

    r2104 r2236  
    6464   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    6565   !! $Id$ 
    66    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     66   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6767   !!---------------------------------------------------------------------- 
    6868 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv.F90

    r2104 r2236  
    5151   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    5252   !! $Id$ 
    53    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     53   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5454   !!---------------------------------------------------------------------- 
    5555 
     
    8383      zwn(:,:,jpk) = 0.e0                                                     ! no transport trough the bottom 
    8484      ! 
    85       IF( lk_traldf_eiv )   CALL tra_adv_eiv( kt, zun, zvn, zwn, 'TRA' )      ! add the eiv transport (if necessary) 
     85      IF( lk_traldf_eiv .AND. .NOT. ln_traldf_grif )   & 
     86         &                  CALL tra_adv_eiv( kt, zun, zvn, zwn, 'TRA' )      ! add the eiv transport (if necessary) 
    8687      ! 
    8788      CALL iom_put( "uoce_eff", zun )                                         ! output effective transport       
    8889      CALL iom_put( "voce_eff", zvn ) 
    8990      CALL iom_put( "woce_eff", zwn ) 
    90  
    9191 
    9292      SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==! 
     
    9797      CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  UBS  
    9898      CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  QUICKEST  
     99 
    99100      ! 
    100101      CASE (-1 )                                      !==  esopa: test all possibility with control print  ==! 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_cen2.F90

    r2104 r2236  
    4848   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4949   !! $Id$ 
    50    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     50   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5151   !!---------------------------------------------------------------------- 
    5252 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_eiv.F90

    r2104 r2236  
    4141   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4242   !! $Id$ 
    43    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     43   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4444   !!---------------------------------------------------------------------- 
    4545 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_muscl.F90

    r2104 r2236  
    4040   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4141   !! $Id$  
    42    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4343   !!---------------------------------------------------------------------- 
    4444 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_muscl2.F90

    r2104 r2236  
    3838   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    3939   !! $Id$  
    40    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4141   !!---------------------------------------------------------------------- 
    4242 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_qck.F90

    r2104 r2236  
    4141   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4242   !! $Id:  $ 
    43    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     43   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4444   !!---------------------------------------------------------------------- 
    4545 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90

    r2104 r2236  
    4747   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4848   !! $Id$ 
    49    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     49   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5050   !!---------------------------------------------------------------------- 
    5151 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traadv_ubs.F90

    r2104 r2236  
    3636   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    3737   !! $Id$ 
    38    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     38   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    3939   !!---------------------------------------------------------------------- 
    4040 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/trabbc.F90

    r2148 r2236  
    4444   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4545   !! $Id$  
    46    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     46   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4747   !!---------------------------------------------------------------------- 
    4848 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/trabbl.F90

    r2148 r2236  
    7474   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    7575   !! $Id$ 
    76    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     76   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7777   !!---------------------------------------------------------------------- 
    7878 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/tradmp.F90

    r2104 r2236  
    5151   LOGICAL, PUBLIC            ::   lk_tradmp = .TRUE.     !: internal damping flag 
    5252#endif 
     53   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   strdmp   !: damping salinity trend (psu/s) 
     54   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   ttrdmp   !: damping temperature trend (Centigrade/s) 
    5355   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   resto    !: restoring coeff. on T and S (s-1) 
    5456    
     
    6769   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    6870   !! $Id$  
    69    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     71   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7072   !!---------------------------------------------------------------------- 
    7173 
     
    9294      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    9395      !! 
     96      REAL(wp) ::   zta, zsa       ! temporary scalars 
    9497      INTEGER ::   ji, jj, jk   ! dummy loop indices 
    9598      REAL(wp) ::  zta, zsa 
     
    112115                  tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + zta 
    113116                  tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + zsa 
     117                  ! save the salinity trend (used in asmtrj) 
     118                  strdmp(ji,jj,jk) = zsa 
     119                  ttrdmp(ji,jj,jk) = zta 
    114120               END DO 
    115121            END DO 
     
    123129                     zta = resto(ji,jj,jk) * ( t_dta(ji,jj,jk) - tsb(ji,jj,jk,jp_tem) ) 
    124130                     zsa = resto(ji,jj,jk) * ( s_dta(ji,jj,jk) - tsb(ji,jj,jk,jp_sal) ) 
    125                      tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + zta 
    126                      tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + zsa 
     131                  ELSE 
     132                     zta = 0.e0 
     133                     zsa = 0.e0    
    127134                  ENDIF 
     135                  tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + zta 
     136                  tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + zsa 
     137                  ! save the salinity trend (used in asmtrj) 
     138                  strdmp(ji,jj,jk) = zsa 
     139                  ttrdmp(ji,jj,jk) = zta 
    128140               END DO 
    129141            END DO 
     
    137149                     zta = resto(ji,jj,jk) * ( t_dta(ji,jj,jk) - tsb(ji,jj,jk,jp_tem) ) 
    138150                     zsa = resto(ji,jj,jk) * ( s_dta(ji,jj,jk) - tsb(ji,jj,jk,jp_sal) ) 
    139                      tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + zta 
    140                      tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + zsa 
     151                  ELSE 
     152                     zta = 0.e0 
     153                     zsa = 0.e0    
    141154                  ENDIF 
     155                  ! add the trends to the general tracer trends 
     156                  tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + zta 
     157                  tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + zsa 
     158                  ! save the salinity trend (used in asmtrj) 
     159                  strdmp(ji,jj,jk) = zsa 
     160                  ttrdmp(ji,jj,jk) = zta 
    142161               END DO 
    143162            END DO 
     
    208227         &   CALL ctl_stop( 'no temperature and/or salinity data define key_dtatem and key_dtasal' ) 
    209228 
     229      strdmp(:,:,:) = 0.e0       ! internal damping salinity trend (used in asmtrj) 
     230      ttrdmp(:,:,:) = 0.e0 
    210231      !                          ! Damping coefficients initialization 
    211232      IF( lzoom ) THEN   ;   CALL dtacof_zoom( resto ) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traldf.F90

    • Property svn:executable deleted
    r2104 r2236  
    2121   USE traldf_bilap    ! lateral mixing             (tra_ldf_bilap routine) 
    2222   USE traldf_iso      ! lateral mixing               (tra_ldf_iso routine) 
     23   USE traldf_iso_grif ! lateral mixing          (tra_ldf_iso_grif routine) 
    2324   USE traldf_lap      ! lateral mixing               (tra_ldf_lap routine) 
    2425   USE trdmod_oce      ! ocean space and time domain 
     
    4647   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4748   !! $Id$  
    48    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     49   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4950   !!---------------------------------------------------------------------- 
    5051 
     
    7071      SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend 
    7172      CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, 'TRA', gtsu, gtsv, tsb, tsa, jpts        )  ! iso-level laplacian 
    72       CASE ( 1 )   ;   CALL tra_ldf_iso   ( kt, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )  ! rotated laplacian  
     73      CASE ( 1 )     
     74         IF ( ln_traldf_grif ) THEN 
     75            CALL tra_ldf_iso_grif    ( kt )           ! Griffies quarter-cell formulation 
     76         ELSE 
     77            CALL tra_ldf_iso   ( kt, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )  ! rotated laplacian 
     78         ENDIF 
    7379      CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, 'TRA', gtsu, gtsv, tsb, tsa, jpts        )  ! iso-level bilaplacian 
    7480      CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, 'TRA',             tsb, tsa, jpts        )  ! s-coord. horizontal bilap. 
     
    7884         CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf0 - Ta: ', mask1=tmask,               & 
    7985         &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    80          CALL tra_ldf_iso   ( kt, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )   
     86         IF ( ln_traldf_grif ) THEN 
     87            CALL tra_ldf_iso_grif    ( kt ) 
     88         ELSE 
     89            CALL tra_ldf_iso   ( kt, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 )   
     90         ENDIF 
    8191         CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf1 - Ta: ', mask1=tmask,               & 
    8292         &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
     
    144154         WRITE(numout,*) '      horizontal (geopotential)   ln_traldf_hor   = ', ln_traldf_hor 
    145155         WRITE(numout,*) '      iso-neutral                 ln_traldf_iso   = ', ln_traldf_iso 
     156         WRITE(numout,*) '      iso-neutral (Griffies)      ln_traldf_grif  = ', ln_traldf_grif 
    146157      ENDIF 
    147158 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traldf_iso.F90

    r2104 r2236  
    4545   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4646   !! $Id$ 
    47    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     47   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4848   !!---------------------------------------------------------------------- 
    4949 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/tranpc.F90

    r2104 r2236  
    3333   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3434   !! $Id$  
    35    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     35   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3636   !!---------------------------------------------------------------------- 
    3737 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/tranxt.F90

    r2148 r2236  
    4242   USE traqsr          ! penetrative solar radiation (needed for nksr) 
    4343   USE traswp          ! swap array 
     44   USE obc_oce  
     45#if defined key_agrif 
    4446   USE agrif_opa_update 
    4547   USE agrif_opa_interp 
     48#endif 
    4649 
    4750   IMPLICIT NONE 
     
    6063   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    6164   !! $Id$ 
    62    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     65   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6366   !!---------------------------------------------------------------------- 
    6467 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/traqsr.F90

    r2224 r2236  
    5959   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    6060   !! $Id$ 
    61    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     61   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6262   !!---------------------------------------------------------------------- 
    6363 
     
    380380               ENDIF 
    381381               ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1)   ) 
    382                ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) ) 
     382               IF( sn_chl%ln_tint )ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) ) 
    383383               !                                        ! fill sf_chl with sn_chl and control print 
    384384               CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init',   & 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/trasbc.F90

    r2148 r2236  
    2727   USE sbcmod          ! ln_rnf   
    2828   USE iom 
     29   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2930 
    3031   IMPLICIT NONE 
     
    3940   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4041   !! $Id$ 
    41    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4243   !!---------------------------------------------------------------------- 
    4344 
     
    107108      !! 
    108109      INTEGER  ::   ji, jj, jk           ! dummy loop indices   
    109       REAL(wp) ::   zta, zsa, zrnf       ! local scalars, adjustment to temperature and salinity   
    110       REAL(wp) ::   zsrau, zse3t, zdep   ! local scalars, 1/density, 1/height of box, 1/height of effected water column   
    111       REAL(wp) ::   zdheat, zdsalt       ! total change of temperature and salinity   
    112110      REAL(wp) ::   zfact, z1_e3t        !  
    113111      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrdt, ztrds 
     
    179177         END DO 
    180178      ENDIF 
    181                                                    ! Concentration dilution effect on (t,s) due to   
    182                                                    ! river runoff without T, S and depth attributes 
    183       IF( ln_rnf ) THEN  
    184          ! 
    185          IF( lk_vvl ) THEN                            ! Variable Volume case  
    186             !                                         ! cooling/heating effect of runoff & No salinity concent./dilut. effect 
    187             DO jj = 2, jpj 
    188                DO ji = fs_2, fs_jpim1   ! vector opt. 
    189                   sbc_hc_n(ji,jj) = sbc_hc_n(ji,jj) + zsrau * rnf(ji,jj) * tsn(ji,jj,1,jp_tem) 
    190                END DO 
    191             END DO 
    192          ELSE                                         ! Constant Volume case 
    193             !                                         ! concent./dilut. effect only 
    194             DO jj = 2, jpj  
    195                DO ji = fs_2, fs_jpim1   ! vector opt. 
    196                   sbc_sc_n(ji,jj) = sbc_sc_n(ji,jj) - zsrau * rnf(ji,jj) * tsn(ji,jj,1,jp_sal) 
    197                END DO 
    198             END DO 
    199          ENDIF 
    200          !   
    201       ENDIF 
    202       !                                          Add to the general trend 
    203       !                                          ************************ 
     179      ! Concentration dilution effect on (t,s) due to evapouration, precipitation and qns, but not river runoff   
    204180      DO jj = 2, jpj 
    205181         DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    219195         CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_sc_n ) 
    220196      ENDIF 
    221  
    222       IF( ln_rnf .AND. ln_rnf_att ) THEN        ! Concentration / dilution effect on (t,s) due to river runoff   
    223         ! 
    224         DO jj = 1, jpj   
    225            DO ji = 1, jpi   
    226               zdep  = 1. / rnf_dep(ji,jj)   
    227               zse3t = 1. / fse3t(ji,jj,1)   
    228               rnf_dep(ji,jj) = 0.e0 
    229               DO jk = 1, rnf_mod_dep(ji,jj)                          ! recalculates rnf_dep to be the depth   
    230                 rnf_dep(ji,jj) = rnf_dep(ji,jj) + fse3t(ji,jj,jk)    ! in metres to the bottom of the relevant grid box   
    231               END DO 
    232               IF( rnf_tmp(ji,jj) == -999 )   rnf_tmp(ji,jj) = tsn(ji,jj,1,jp_tem)   ! if not specified set runoff temp to be sst   
    233    
    234               IF( rnf(ji,jj) > 0.e0 ) THEN   
    235                 ! 
    236                 zrnf = rnf(ji,jj) * zsrau * zdep 
    237                 IF( lk_vvl ) THEN   
    238                   ! indirect flux, concentration or dilution effect : force a dilution effect in all levels  
    239                   zdheat = 0.e0   
    240                   zdsalt = 0.e0   
    241                   DO jk = 1, rnf_mod_dep(ji,jj)   
    242                     zta = -tsn(ji,jj,jk,jp_tem) * zrnf   
    243                     zsa = -tsn(ji,jj,jk,jp_sal) * zrnf   
    244                     tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + zta        ! add the trend to the general tracer trend 
    245                     tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + zsa 
    246                     zdheat = zdheat + zta * fse3t(ji,jj,jk)   
    247                     zdsalt = zdsalt + zsa * fse3t(ji,jj,jk)   
    248                   END DO   
    249                   ! negate this total change in heat and salt content from top level    !!gm I don't understand this 
    250                   tsa(ji,jj,1,jp_tem) = tsa(ji,jj,1,jp_tem) - zdheat * zse3t 
    251                   tsa(ji,jj,1,jp_sal) = tsa(ji,jj,1,jp_sal) - zdsalt * zse3t 
    252      
    253                   DO jk = 1, rnf_mod_dep(ji,jj)   
    254                     tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + rnf_tmp(ji,jj) * zrnf 
    255                     tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + rnf_sal(ji,jj) * zrnf 
    256                   END DO   
    257                 ELSE   
    258                   DO jk = 1, rnf_mod_dep(ji,jj)   
    259                     tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + ( rnf_tmp(ji,jj) - tsn(ji,jj,jk,jp_tem) ) * zrnf 
    260                     tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + ( rnf_sal(ji,jj) - tsn(ji,jj,jk,jp_sal) ) * zrnf 
    261                   END DO   
    262                 ENDIF   
    263    
    264               ELSEIF( rnf(ji,jj) < 0.e0 ) THEN   ! for use in baltic when flow is out of domain, want no change in temp and sal   
    265    
    266                 IF( lk_vvl ) THEN   
    267                   ! calculate automatic adjustment to sal and temp due to dilution/concentraion effect    
    268                   zrnf = rnf(ji,jj) * zsrau * zse3t 
    269                   tsa(ji,jj,1,jp_tem) = tsa(ji,jj,1,jp_tem) + tsn(ji,jj,1,jp_tem) * zrnf  
    270                   tsa(ji,jj,1,jp_sal) = tsa(ji,jj,1,jp_sal) + tsn(ji,jj,1,jp_sal) * zrnf 
    271                 ENDIF   
    272    
    273               ENDIF   
    274    
    275            END DO   
    276         END DO   
    277         ! 
     197      !                             !==  Runoffs  ==! 
     198      ! Effect on (t,s) due to river runoff (dilution effect automatically applied via vertical tracer advection)  
     199      IF( ln_rnf ) THEN   
     200         DO jj = 2, jpj  
     201            DO ji = fs_2, fs_jpim1 
     202               zdep = 1. / h_rnf(ji,jj)   
     203               IF ( rnf(ji,jj) .ne. 0.0 ) THEN 
     204                  DO jk = 1, nk_rnf(ji,jj) 
     205                                        tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + tsc_rnf(ji,jj,jp_tem) * zdep 
     206                     IF( ln_rnf_sal )   tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) + tsc_rnf(ji,jj,jp_sal) * zdep 
     207                  ENDDO 
     208               ENDIF 
     209            ENDDO   
     210         ENDDO   
    278211      ENDIF   
     212!!gm  It should be useless 
     213      CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1. )    ;    CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1. ) 
    279214 
    280215      IF( l_trdtra )   THEN                      ! save the horizontal diffusive trends for further diagnostics 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/trazdf.F90

    r2104 r2236  
    4949   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    5050   !! $Id$ 
    51    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     51   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5252   !!---------------------------------------------------------------------- 
    5353 
     
    121121      USE zdftke_old 
    122122      USE zdftke 
     123      USE zdfgls 
    123124      USE zdfkpp 
    124125      !!---------------------------------------------------------------------- 
     
    130131 
    131132      ! Force implicit schemes 
    132       IF( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfkpp )   nzdf = 1      ! TKE or KPP physics 
    133       IF( ln_traldf_iso                               )   nzdf = 1      ! iso-neutral lateral physics 
    134       IF( ln_traldf_hor .AND. ln_sco                  )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
     133      IF( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp )   nzdf = 1      ! TKE, GLS or KPP physics 
     134      IF( ln_traldf_iso                                              )   nzdf = 1      ! iso-neutral lateral physics 
     135      IF( ln_traldf_hor .AND. ln_sco                                 )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
    135136      IF( ln_zdfexp .AND. nzdf == 1 )   CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator',   & 
    136137            &                         ' TKE or KPP scheme, the implicit scheme is required, set ln_zdfexp = .false.' ) 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/trazdf_exp.F90

    r2104 r2236  
    4343   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4444   !! $Id$ 
    45    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     45   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4646   !!---------------------------------------------------------------------- 
    4747 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRA/trazdf_imp.F90

    r2104 r2236  
    4646   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4747   !! $Id$ 
    48    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     48   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4949   !!---------------------------------------------------------------------- 
    5050CONTAINS 
     
    141141         IF( cdtype == 'TRA' .AND. jn == jp_tem )  THEN  
    142142#if defined key_ldfslp 
     143            IF( ln_traldf_grif ) THEN 
     144               DO jk = 2, jpkm1 
     145                  DO jj = 2, jpjm1 
     146                     DO ji = fs_2, fs_jpim1   ! vector opt. 
     147                        zavi = fsahtw(ji,jj,jk) * wslp2(ji,jj,jk)         ! vertical mixing coef. due to lateral mixing 
     148                        zwt(ji,jj,jk) = avt(ji,jj,jk) + zavi              ! zwt=avt+zavi (total vertical mixing coef. on temperature) 
     149                     END DO 
     150                  END DO 
     151               END DO 
    143152            ! update and save of avt (and avs if double diffusive mixing) 
    144             IF( l_traldf_rot ) THEN 
     153            ELSE IF( l_traldf_rot ) THEN 
    145154               DO jk = 2, jpkm1 
    146155                  DO jj = 2, jpjm1 
     
    172181               END DO 
    173182            END DO 
    174             ! Surface boudary conditions 
    175             DO jj = 2, jpjm1 
    176                DO ji = fs_2, fs_jpim1   ! vector opt. 
    177                  ze3ta = ( 1. - znvvl ) +  znvvl * fse3t_a(ji,jj,1)    ! after scale factor at T-point 
    178                  zwi(ji,jj,1) = 0.e0 
    179                  zwd(ji,jj,1) = ze3ta - zws(ji,jj,1) 
    180                END DO 
    181             END DO 
    182183            ! first recurrence:   Tk = Dk - Ik Sk-1 / Tk-1   (increasing k) 
    183184            DO jj = 2, jpjm1 
     
    196197         ELSE IF( ( cdtype == 'TRA' .AND. jn == jp_sal ) .OR. ( cdtype == 'TRC' .AND. jn == 1 ) ) THEN 
    197198#if defined key_ldfslp 
    198             ! update and save of avt (and avs if double diffusive mixing) 
    199             IF( l_traldf_rot ) THEN 
     199            IF( ln_traldf_grif ) THEN 
     200               DO jk = 2, jpkm1 
     201                  DO jj = 2, jpjm1 
     202                     DO ji = fs_2, fs_jpim1   ! vector opt. 
     203                        zavi = fsahtw(ji,jj,jk) * wslp2(ji,jj,jk)         ! vertical mixing coef. due to lateral mixing 
     204                        zwt(ji,jj,jk) = fsavs(ji,jj,jk) + zavi              ! zwt=avt+zavi (total vertical mixing coef. on temperature) 
     205                     END DO 
     206                  END DO 
     207               END DO 
     208            ELSE IF( l_traldf_rot ) THEN 
    200209               DO jk = 2, jpkm1 
    201210                  DO jj = 2, jpjm1 
     
    273282            END DO 
    274283         END DO 
    275           
    276          ! third recurrence: Xk = (Zk - Sk Xk+1 ) / Tk 
    277          ! Save the masked temperature after in ta 
    278          ! (c a u t i o n:  temperature not its trend, Leap-frog scheme done it will not be done in tranxt) 
     284 
     285         ! third recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk 
    279286         DO jj = 2, jpjm1 
    280287            DO ji = fs_2, fs_jpim1 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdicp.F90

    r2104 r2236  
    4545   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4646   !! $Id$ 
    47    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     47   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4848   !!---------------------------------------------------------------------- 
    4949 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdicp_oce.F90

    r1601 r2236  
    8686   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    8787   !! $Id$  
    88    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     88   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    8989   !!====================================================================== 
    9090END MODULE trdicp_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdmld_oce.F90

    r1152 r2236  
    8585   !!  OPA 9.0 , LOCEAN-IPSL (2005)  
    8686   !! $Id$  
    87    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     87   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    8888   !!====================================================================== 
    8989END MODULE trdmld_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdmld_rst.F90

    r1715 r2236  
    2525   !! OPA 9.0 , LOCEAN-IPSL (2006)  
    2626   !! $Id$  
    27    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     27   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    2828   !!--------------------------------------------------------------------------------- 
    2929   
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdmod.F90

    r2104 r2236  
    3939   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4040   !! $Id$ 
    41    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     41   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4242   !!---------------------------------------------------------------------- 
    4343 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdmod_oce.F90

    r2104 r2236  
    7575   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    7676   !! $Id$ 
    77    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     77   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7878   !!====================================================================== 
    7979END MODULE trdmod_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdvor.F90

    r1715 r2236  
    6666   !!   OPA 9.0 , LOCEAN-IPSL (2005)  
    6767   !! $Id$  
    68    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     68   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    6969   !!---------------------------------------------------------------------- 
    7070   
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/TRD/trdvor_oce.F90

    r1152 r2236  
    3636   !!  OPA 9.0 , LOCEAN-IPSL (2005)  
    3737   !! $Id$  
    38    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     38   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3939   !!====================================================================== 
    4040END MODULE trdvor_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdf_oce.F90

    r1601 r2236  
    4141   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4242   !! $Id$  
    43    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     43   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4444   !!====================================================================== 
    4545END MODULE zdf_oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfbfr.F90

    r2104 r2236  
    3030    
    3131   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   bfrua , bfrva   !: Bottom friction coefficients set in zdfbfr 
     32#if defined key_zdfgls 
     33   REAL(wp), PUBLIC                     ::   rn_hbro =  0.003_wp  ! Bottom roughness (m) 
     34   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   wbotu, wbotv    !  Bottom stresses 
     35#endif 
    3236 
    3337   !                                    !!* Namelist nambfr: bottom friction namelist * 
     
    4650   !! NEMO/OPA 3,3 , LOCEAN-IPSL (2010)  
    4751   !! $Id$ 
    48    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     52   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4953   !!---------------------------------------------------------------------- 
    5054 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfddm.F90

    r2104 r2236  
    4242   !! NEMO/OPA 3,3 , LOCEAN-IPSL (2010)  
    4343   !! $Id$ 
    44    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     44   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4545   !!---------------------------------------------------------------------- 
    4646 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfevd.F90

    r1681 r2236  
    3333   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3434   !! $Id$ 
    35    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     35   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    3636   !!---------------------------------------------------------------------- 
    3737 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfini.F90

    r1601 r2236  
    2020   USE zdftke_old      ! TKE vertical mixing  (old scheme) 
    2121   USE zdftke          ! TKE vertical mixing 
     22   USE zdfgls          ! GLS vertical mixing 
    2223   USE zdfkpp          ! KPP vertical mixing           
    2324   USE zdfddm          ! double diffusion mixing       
     
    3940   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    4041   !! $Id$ 
    41    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4243   !!---------------------------------------------------------------------- 
    4344    
     
    106107         ioptio = ioptio+1 
    107108      ENDIF 
     109      IF( lk_zdfgls ) THEN 
     110         IF(lwp) WRITE(numout,*) '      GLS dependent eddy coefficients' 
     111         ioptio = ioptio+1 
     112      ENDIF 
    108113      IF( lk_zdfkpp ) THEN 
    109114         IF(lwp) WRITE(numout,*) '      KPP dependent eddy coefficients' 
     
    128133         IF(lwp) WRITE(numout,*) '      use the 1.5 turbulent closure' 
    129134      ENDIF 
     135      IF( lk_zdfgls ) THEN 
     136         IF(lwp) WRITE(numout,*) '      use the GLS closure scheme' 
     137      ENDIF 
    130138      IF( lk_zdfkpp ) THEN 
    131139         IF(lwp) WRITE(numout,*) '      use the KPP closure scheme' 
     
    136144      ENDIF 
    137145      IF ( ioptio > 1 .AND. .NOT. lk_esopa )   CALL ctl_stop( ' chose between ln_zdfnpc and ln_zdfevd' ) 
    138       IF( ioptio == 0 .AND. .NOT.( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfkpp ) ) & 
    139          CALL ctl_stop( ' except for TKE sor KPP physics, a convection scheme is', & 
     146      IF( ioptio == 0 .AND. .NOT.( lk_zdftke_old .OR. lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp ) ) & 
     147         CALL ctl_stop( ' except for TKE, GLS or KPP physics, a convection scheme is', & 
    140148         &              ' required: ln_zdfevd or ln_zdfnpc logicals' ) 
    141149 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfkpp.F90

    r2104 r2236  
    148148   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    149149   !! $Id$ 
    150    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     150   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    151151   !!---------------------------------------------------------------------- 
    152152 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfmxl.F90

    r1585 r2236  
    3131   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3232   !! $Id$  
    33    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     33   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3434   !!---------------------------------------------------------------------- 
    3535 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdfric.F90

    r2104 r2236  
    4646   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4747   !! $Id$ 
    48    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     48   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    4949   !!---------------------------------------------------------------------- 
    5050CONTAINS 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdftke.F90

    r2104 r2236  
    8989 
    9090   REAL(wp), DIMENSION(jpi,jpj)     ::   htau      ! depth of tke penetration (nn_htau) 
    91    REAL(wp), DIMENSION(jpi,jpj,jpk) ::   en        ! now turbulent kinetic energy   [m2/s2] 
     91   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   en        ! now turbulent kinetic energy   [m2/s2] 
    9292   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   dissl     ! now mixing lenght of dissipation 
    9393 
     
    9898   !! NEMO/OPA 3,3 , LOCEAN-IPSL (2010)  
    9999   !! $Id: $ 
    100    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     100   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    101101   !!---------------------------------------------------------------------- 
    102102 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdftke_old.F90

    r2104 r2236  
    9494   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
    9595   !! $Id$ 
    96    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     96   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    9797   !!---------------------------------------------------------------------- 
    9898 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/ZDF/zdftmx.F90

    r2104 r2236  
    5151   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    5252   !! $Id: $ 
    53    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     53   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5454   !!---------------------------------------------------------------------- 
    5555 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/istate.F90

    r2148 r2236  
    3535   USE in_out_manager  ! I/O manager 
    3636   USE iom             ! I/O library 
    37    USE c1d             ! re-initialization of u-v mask for the 1D configuration 
    3837   USE zpshde          ! partial step: hor. derivative (zps_hde routine) 
    3938   USE eosbn2          ! equation of state            (eos bn2 routine) 
     
    5655   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    5756   !! $Id$ 
    58    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     57   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5958   !!---------------------------------------------------------------------- 
    6059 
     
    128127         CALL tra_swap                     ! swap 3D arrays (tb,sb,tn,sn)  in a 4D array 
    129128         CALL eos( tsb, rhd, rhop )        ! before potential and in situ densities 
    130          IF( ln_zps .AND. .NOT. lk_c1d )   CALL zps_hde( nit000, jpts, tsb, gtsu, gtsv,  & ! zps: before hor. gradient 
    131             &                                                          rhd, gru , grv  )   ! of t,s,rd at ocean bottom 
     129#if ! defined key_c1d 
     130         IF( ln_zps )   CALL zps_hde( nit000, jpts, tsb, gtsu, gtsv,  & ! zps: before hor. gradient 
     131            &                                       rhd, gru , grv  )   ! of t,s,rd at ocean bottom 
     132#endif 
    132133         !    
    133134         ! - ML - sshn could be modified by istate_eel, so that initialization of fse3t_b is done here 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/lib_cray.f90

    r1601 r2236  
    1010!! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt  
    1111!!---------------------------------------------------------------------- 
    12      SUBROUTINE wheneq ( i, x, j, t, ind, nn ) 
     12SUBROUTINE wheneq ( i, x, j, t, ind, nn ) 
    1313        IMPLICIT NONE 
    1414 
     
    2828        END DO  
    2929 
    30      END SUBROUTINE wheneq 
     30END SUBROUTINE wheneq 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/lib_mpp.F90

    r2004 r2236  
    7171   PUBLIC   mpprecv, mppsend, mppscatter, mppgather 
    7272   PUBLIC   mppobc, mpp_ini_ice, mpp_ini_znl 
    73 #if defined key_oasis3 || defined key_oasis4 
    7473   PUBLIC   mppsize, mpprank 
    75 #endif 
    7674 
    7775# if defined key_mpp_rep1 
     
    176174   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    177175   !! $Id$ 
    178    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     176   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    179177   !!---------------------------------------------------------------------- 
    180178 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/oce.F90

    r2148 r2236  
    4848   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4949   !! $Id$  
    50    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     50   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    5151   !!====================================================================== 
    5252END MODULE oce 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/opa.F90

    r2224 r2236  
    2525   !!             -   ! 2007-07  (J. Chanut, A. Sellar) Unstructured open boundaries (BDY) 
    2626   !!            3.2  ! 2009-08  (S. Masson)  open/write in the listing file in mpp 
    27    !!            3.3  ! 2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
     27   !!            3.3  ! 2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface  
     28   !!             -   ! 2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    2829   !!---------------------------------------------------------------------- 
    2930 
     
    4748   USE zdfini 
    4849   USE phycst          ! physical constant                  (par_cst routine) 
     50   USE trdmod          ! momentum/tracers trends       (trd_mod_init routine) 
     51   USE asminc          ! assimilation increments       (asm_inc_init routine) 
     52   USE asmtrj          ! writing out state trajectory 
     53   USE sshwzv          ! vertical velocity used in asm 
     54   USE diaptr          ! poleward transports           (dia_ptr_init routine) 
     55   USE diaobs          ! Observation diagnostics       (dia_obs_init routine) 
    4956   USE step            ! OPA time-stepping                  (stp     routine) 
    5057#if defined key_oasis3 
     
    5360   USE cpl_oasis4      ! OASIS4 coupling (not working) 
    5461#endif 
     62#if defined key_c1d 
    5563   USE c1d             ! 1D configuration 
    5664   USE step_c1d        ! Time stepping loop for the 1D configuration 
     65#endif 
    5766#if defined key_top 
    5867   USE trcini          ! passive tracer initialisation 
     
    7483   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    7584   !! $Id$ 
    76    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     85   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    7786   !!---------------------------------------------------------------------- 
    7887 
     
    114123      !                            !-----------------------! 
    115124      istp = nit000 
    116       IF( lk_c1d ) THEN                 !==  1D configuration  ==! 
     125#if defined key_c1d 
    117126         DO WHILE ( istp <= nitend .AND. nstop == 0 ) 
    118127            CALL stp_c1d( istp ) 
    119128            istp = istp + 1 
    120129         END DO 
    121       ELSE                              !==  3D ocean with  ==! 
     130#else 
     131          IF( lk_asminc ) THEN 
     132             IF( ln_bkgwri ) CALL asm_bkg_wri( nit000 - 1 )    ! Output background fields 
     133             IF( ln_trjwri ) CALL asm_trj_wri( nit000 - 1 )    ! Output trajectory fields 
     134             IF( ln_asmdin ) THEN                        ! Direct initialization 
     135                IF( ln_trainc ) CALL tra_asm_inc( nit000 - 1 )    ! Tracers 
     136                IF( ln_dyninc ) THEN  
     137                   CALL dyn_asm_inc( nit000 - 1 )    ! Dynamics 
     138                   IF ( ln_asmdin ) CALL ssh_wzv ( nit000 - 1 )      ! update vertical velocity  
     139                ENDIF 
     140                IF( ln_sshinc ) CALL ssh_asm_inc( nit000 - 1 )    ! SSH 
     141             ENDIF 
     142          ENDIF 
     143         
    122144         DO WHILE ( istp <= nitend .AND. nstop == 0 ) 
    123145#if defined key_agrif 
     
    129151            IF( lk_mpp )   CALL mpp_max( nstop ) 
    130152         END DO 
    131       ENDIF 
     153#endif 
     154 
     155      IF( lk_diaobs ) CALL dia_obs_wri 
    132156        
    133157      !                            !------------------------! 
     
    184208#else 
    185209# if defined key_oasis3 || defined key_oasis4 
    186       CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis 
     210      IF( Agrif_Root() ) THEN 
     211         CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis 
     212      ENDIF 
    187213      narea = mynode( cltxt, ilocal_comm )    ! Nodes selection (control print return in cltxt) 
    188214# else 
     
    222248      ELSE                            ;   CALL mpp_init2     ! eliminate land processors 
    223249      ENDIF 
     250!!gm c1d case can be moved in dom_init routine 
     251#if defined key_c1d 
     252         CALL cor_c1d                            ! Coriolis defined at T-point 
     253         umask(:,:,:) = tmask(:,:,:)             ! U, V and T-points are the same 
     254         vmask(:,:,:) = tmask(:,:,:)             !  
     255#endif 
     256!!gm c1d end 
    224257 
    225258      !                                      ! General initialization 
     
    282315                            CALL dia_hsb_init   ! heat content, salt content and volume budgets 
    283316                            CALL trd_mod_init   ! Mixed-layer/Vorticity/Integral constraints trends 
     317      IF( lk_diaobs    ) THEN 
     318         CALL dia_obs_init                  ! Initialize observational data 
     319         CALL dia_obs( nit000 - 1 )         ! Observation operator for restart 
     320      ENDIF       
     321      IF( lk_asminc    )    CALL asm_inc_init     ! Initialize assimilation increments 
     322      IF(lwp) WRITE(numout,*)'Euler time step switch is ', neuler 
     323 
    284324      ! 
    285325   END SUBROUTINE opa_init 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/par_oce.F90

    r2104 r2236  
    1818   !! if we dont use massively parallel computer (parameters jpni=jpnj=1) so jpiglo=jpi and jpjglo=jpj 
    1919#if ! defined key_mpp_dyndist  
    20    INTEGER, PUBLIC, PARAMETER ::   jpni   = 1   !: number of processors following i  
    21    INTEGER, PUBLIC, PARAMETER ::   jpnj   = 1   !: number of processors following j 
    22    INTEGER, PUBLIC, PARAMETER ::   jpnij  = 1   !: nb of local domain = nb of processors ( <= jpni x jpnj ) 
     20   INTEGER, PUBLIC, PARAMETER ::    &  !: 
     21# if ! defined key_nproci 
     22      jpni   = 1,                   &  !: number of processors following i 
     23      jpnj   = 1,                   &  !: number of processors following j 
     24      jpnij  = 1                       !: nb of local domain = nb of processors  
     25      !                                !  ( <= jpni x jpnj ) 
     26# else 
     27      jpni   = key_nproci,          &  !: number of processors following i 
     28      jpnj   = key_nprocj,          &  !: number of processors following j 
     29#  if ! defined key_nprocij 
     30      jpnij  = key_nproci * key_nprocj !: nb of local domain = nb of processors  
     31      !                                !  ( <= jpni x jpnj ) 
     32#  else 
     33      jpnij  = key_nprocij             !: nb of local domain = nb of processors  
     34      !                                !  ( <= jpni x jpnj ) 
     35#  endif 
     36# endif 
    2337#else 
    2438   INTEGER, PUBLIC            ::   jpni         !: number of processors following i  
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/step.F90

    r2200 r2236  
    2121   !!            3.2  !  2009-02  (G. Madec, R. Benshila)  reintroduicing z*-coordinate 
    2222   !!             -   !  2009-06  (S. Masson, G. Madec)  TKE restart compatible with key_cpl 
    23    !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase + merge TRC-TRA 
     23   !!            3.3  !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface 
     24   !!             -   !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase + merge TRC-TRA 
    2425   !!---------------------------------------------------------------------- 
    2526 
     
    3233#endif 
    3334 
     35   USE asminc          ! assimilation increments    (tra_asm_inc, dyn_asm_inc routines) 
     36   USE stpctl          ! time stepping control            (stp_ctl routine) 
     37   USE restart         ! ocean restart                    (rst_wri routine) 
     38   USE prtctl          ! Print control                    (prt_ctl routine) 
     39 
     40#if defined key_agrif 
     41   USE agrif_opa_sponge ! Momemtum and tracers sponges 
     42#endif 
     43 
    3444   IMPLICIT NONE 
    3545   PRIVATE 
     
    4353   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4454   !! $Id$ 
    45    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     55   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4656   !!---------------------------------------------------------------------- 
    4757 
     
    112122      IF( lk_zdftke_old )   CALL zdf_tke_old( kstp )  ! TKE closure scheme for Kz (old scheme) 
    113123      IF( lk_zdftke     )   CALL zdf_tke    ( kstp )  ! TKE closure scheme for Kz 
     124      IF( lk_zdfgls     )   CALL zdf_gls    ( kstp )  ! GLS closure scheme for Kz 
    114125      IF( lk_zdfkpp     )   CALL zdf_kpp    ( kstp )  ! KPP closure scheme for Kz 
    115126      IF( lk_zdfcst     )   THEN                      ! Constant Kz (reset avt, avm[uv] to the background value) 
     
    131142                                                      ! write tke information in the restart file 
    132143      IF( lrst_oce .AND. lk_zdftke )   CALL tke_rst( kstp, 'WRITE' ) 
     144                                                      ! write gls information in the restart file 
     145      IF( lrst_oce .AND. lk_zdfgls )   CALL gls_rst( kstp, 'WRITE' ) 
    133146      ! 
    134147      !  LATERAL  PHYSICS  
     
    138151         IF( ln_zps )    CALL zps_hde( kstp, jpts, tsb, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient 
    139152            &                                      rhd, gru , grv  )      ! of t, s, rd at the last ocean level 
     153         IF ( .NOT. ln_traldf_grif ) THEN 
    140154                         CALL ldf_slp( kstp, rhd, rn2b )        ! before slope of the lateral mixing 
     155         ELSE 
     156                         CALL ldf_slp_grif( kstp ) 
     157                         IF ( ln_dynldf_bilap .OR. ln_dynldf_iso ) CALL ldf_slp( kstp, rhd, rn2b ) 
     158      ENDIF 
    141159      ENDIF 
    142160#if defined key_traldf_c2d 
     
    152170      IF( lk_diahdy  )   CALL dia_hdy( kstp )         ! dynamical heigh diagnostics 
    153171      IF( lk_diafwb  )   CALL dia_fwb( kstp )         ! Fresh water budget diagnostics 
     172      IF( lk_diaobs  )   CALL dia_obs( kstp )         ! obs-minus-model (assimilation) diagnostics 
    154173      IF( ln_diaptr  )   CALL dia_ptr( kstp )         ! Poleward TRansports diagnostics 
    155174      IF( lk_diaar5  )   CALL dia_ar5( kstp )         ! ar5 diag 
     
    168187                             tsa(:,:,:,:) = 0.e0               ! set tracer trends to zero 
    169188 
     189      IF(  ln_asmiau .AND. & 
     190         & ln_trainc     )   CALL tra_asm_inc( kstp )       ! apply tracer assimilation increment 
    170191                             CALL tra_sbc    ( kstp )       ! surface boundary condition 
    171192      IF( ln_traqsr      )   CALL tra_qsr    ( kstp )       ! penetrative solar radiation qsr 
     
    206227                               va(:,:,:) = 0.e0 
    207228 
     229      IF(  ln_asmiau .AND. & 
     230         & ln_dyninc     )     CALL dyn_asm_inc( kstp )       ! apply dynamics assimilation increment 
    208231                               CALL dyn_adv( kstp )         ! advection (vector or flux form) 
    209232                               CALL dyn_vor( kstp )         ! vorticity term including Coriolis 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/stpctl.F90

    r1588 r2236  
    2929   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    3030   !! $Id$ 
    31    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     31   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt) 
    3232   !!---------------------------------------------------------------------- 
    3333 
  • branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/trc_oce.F90

    r2104 r2236  
    4040   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)  
    4141   !! $Id$  
    42    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)  
     42   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)  
    4343   !!---------------------------------------------------------------------- 
    4444 
Note: See TracChangeset for help on using the changeset viewer.