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

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2528 for trunk/NEMOGCM/NEMO/OPA_SRC/DYN/divcur.F90 – NEMO

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

Update NEMOGCM from branch nemo_v3_3_beta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/DYN/divcur.F90

    • Property svn:eol-style deleted
    r1792 r2528  
    44   !! Ocean diagnostic variable : horizontal divergence and relative vorticity 
    55   !!============================================================================== 
     6   !! History :  OPA  ! 1987-06  (P. Andrich, D. L Hostis)  Original code 
     7   !!            4.0  ! 1991-11  (G. Madec) 
     8   !!            6.0  ! 1993-03  (M. Guyon)  symetrical conditions 
     9   !!            7.0  ! 1996-01  (G. Madec)  s-coordinates 
     10   !!            8.0  ! 1997-06  (G. Madec)  lateral boundary cond., lbc 
     11   !!            8.1  ! 1997-08  (J.M. Molines)  Open boundaries 
     12   !!            8.2  ! 2000-03  (G. Madec)  no slip accurate 
     13   !!  NEMO      1.0  ! 2002-09  (G. Madec, E. Durand)  Free form, F90 
     14   !!             -   ! 2005-01  (J. Chanut) Unstructured open boundaries 
     15   !!             -   ! 2003-08  (G. Madec)  merged of cur and div, free form, F90 
     16   !!             -   ! 2005-01  (J. Chanut, A. Sellar) unstructured open boundaries 
     17   !!            3.3  ! 2010-09  (D.Storkey and E.O'Dea) bug fixes for BDY module 
     18   !!             -   ! 2010-10  (R. Furner, G. Madec) runoff and cla added directly here 
     19   !!---------------------------------------------------------------------- 
    620 
    721   !!---------------------------------------------------------------------- 
     
    923   !!                vorticity fields 
    1024   !!---------------------------------------------------------------------- 
    11    !! * Modules used 
    1225   USE oce             ! ocean dynamics and tracers 
    1326   USE dom_oce         ! ocean space and time domain 
     27   USE sbc_oce, ONLY : ln_rnf   ! surface boundary condition: ocean 
     28   USE sbcrnf          ! river runoff  
     29   USE obc_oce         ! ocean lateral open boundary condition 
     30   USE cla             ! cross land advection             (cla_div routine) 
    1431   USE in_out_manager  ! I/O manager 
    15    USE obc_oce         ! ocean lateral open boundary condition 
    16    USE bdy_oce        ! Unstructured open boundaries variables 
    1732   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    1833 
     
    2035   PRIVATE 
    2136 
    22    !! * Accessibility 
    23    PUBLIC div_cur    ! routine called by step.F90 and istate.F90 
     37   PUBLIC   div_cur    ! routine called by step.F90 and istate.F90 
    2438 
    2539   !! * Substitutions 
     
    2741#  include "vectopt_loop_substitute.h90" 
    2842   !!---------------------------------------------------------------------- 
    29    !!   OPA 9.0 , LOCEAN-IPSL (2005)  
     43   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    3044   !! $Id$  
    31    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt  
    32    !!---------------------------------------------------------------------- 
    33  
     45   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     46   !!---------------------------------------------------------------------- 
    3447CONTAINS 
    3548 
     
    4760      !!      vorticity at before and now time-step 
    4861      !! 
    49       !! ** Method  :  
    50       !!      I.  divergence : 
     62      !! ** Method  : I.  divergence : 
    5163      !!         - save the divergence computed at the previous time-step 
    5264      !!      (note that the Asselin filter has not been applied on hdivb) 
    5365      !!         - compute the now divergence given by : 
    5466      !!         hdivn = 1/(e1t*e2t*e3t) ( di[e2u*e3u un] + dj[e1v*e3v vn] ) 
    55       !!      Note: if lk_zco=T, e3u=e3v=e3t, they are simplified in the 
    56       !!      above expression 
    57       !!         - apply lateral boundary conditions on hdivn  
    58       !!      II. vorticity : 
     67      !!      correct hdiv with runoff inflow (div_rnf) and cross land flow (div_cla)  
     68      !!              II. vorticity : 
    5969      !!         - save the curl computed at the previous time-step 
    6070      !!            rotb = rotn 
     
    6272      !!         - compute the now curl in tensorial formalism: 
    6373      !!            rotn = 1/(e1f*e2f) ( di[e2v vn] - dj[e1u un] ) 
    64       !!         - apply lateral boundary conditions on rotn through a call 
    65       !!      of lbc_lnk routine. 
    6674      !!         - Coastal boundary condition: 'key_noslip_accurate' defined, 
    6775      !!      the no-slip boundary condition is computed using Schchepetkin 
     
    6977      !!      For example, along east coast, the one-sided finite difference 
    7078      !!      approximation used for di[v] is: 
    71       !!         di[e2v vn] =  1/(e1f*e2f) 
    72       !!                    * ( (e2v vn)(i) + (e2v vn)(i-1) + (e2v vn)(i-2) ) 
     79      !!         di[e2v vn] =  1/(e1f*e2f) * ( (e2v vn)(i) + (e2v vn)(i-1) + (e2v vn)(i-2) ) 
    7380      !! 
    7481      !! ** Action  : - update hdivb, hdivn, the before & now hor. divergence 
    7582      !!              - update rotb , rotn , the before & now rel. vorticity 
    76       !! 
    77       !! History : 
    78       !!   8.2  !  00-03  (G. Madec)  no slip accurate 
    79       !!   9.0  !  03-08  (G. Madec)  merged of cur and div, free form, F90 
    80       !!        !  05-01  (J. Chanut, A. Sellar) unstructured open boundaries 
    81       !!---------------------------------------------------------------------- 
    82       !! * Arguments 
     83      !!---------------------------------------------------------------------- 
    8384      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    84        
    85       !! * Local declarations 
     85      ! 
    8686      INTEGER ::   ji, jj, jk     ! dummy loop indices 
    8787      INTEGER ::   ii, ij, jl     ! temporary integer 
    8888      INTEGER ::   ijt, iju       ! temporary integer 
     89      REAL(wp) ::  zraur, zdep 
    8990      REAL(wp), DIMENSION(   jpi  ,1:jpj+2) ::   zwu   ! workspace 
    9091      REAL(wp), DIMENSION(-1:jpi+2,  jpj  ) ::   zwv   ! workspace 
     
    100101      DO jk = 1, jpkm1                                 ! Horizontal slab 
    101102         !                                             ! =============== 
    102  
     103         ! 
    103104         hdivb(:,:,jk) = hdivn(:,:,jk)    ! time swap of div arrays 
    104105         rotb (:,:,jk) = rotn (:,:,jk)    ! time swap of rot arrays 
    105  
     106         ! 
    106107         !                                             ! -------- 
    107108         ! Horizontal divergence                       !   div 
     
    109110         DO jj = 2, jpjm1 
    110111            DO ji = fs_2, fs_jpim1   ! vector opt. 
    111 #if defined key_zco 
    112                hdivn(ji,jj,jk) = (  e2u(ji,jj) * un(ji,jj,jk) - e2u(ji-1,jj  ) * un(ji-1,jj  ,jk)      & 
    113                   &               + e1v(ji,jj) * vn(ji,jj,jk) - e1v(ji  ,jj-1) * vn(ji  ,jj-1,jk)  )   & 
    114                   &            / ( e1t(ji,jj) * e2t(ji,jj) ) 
    115 #else 
    116112               hdivn(ji,jj,jk) =   & 
    117113                  (  e2u(ji,jj)*fse3u(ji,jj,jk) * un(ji,jj,jk) - e2u(ji-1,jj  )*fse3u(ji-1,jj  ,jk) * un(ji-1,jj  ,jk)       & 
    118114                   + e1v(ji,jj)*fse3v(ji,jj,jk) * vn(ji,jj,jk) - e1v(ji  ,jj-1)*fse3v(ji  ,jj-1,jk) * vn(ji  ,jj-1,jk)  )    & 
    119115                  / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) ) 
    120 #endif 
    121116            END DO 
    122117         END DO 
     
    131126            IF( lp_obc_south )   hdivn(nis0  :nis1  ,njs0  :njs1  ,jk) = 0.e0      ! south 
    132127         ENDIF 
    133 #endif          
    134 #if defined key_bdy 
    135          ! unstructured open boundaries (div must be zero behind the open boundary) 
    136          DO jj = 1, jpj 
    137             DO ji = 1, jpi 
    138                hdivn(ji,jj,jk)=hdivn(ji,jj,jk)*bdytmask(ji,jj) 
    139             END DO 
    140          END DO 
    141128#endif          
    142129         IF( .NOT. AGRIF_Root() ) THEN 
     
    210197            DO ji = 1, fs_jpim1   ! vector opt. 
    211198               rotn(ji,jj,jk) = (  zwv(ji+1,jj  ) - zwv(ji,jj)      & 
    212                                  - zwu(ji  ,jj+1) + zwu(ji,jj)  )   & 
    213                               * fmask(ji,jj,jk) / ( e1f(ji,jj)*e2f(ji,jj) ) 
     199                  &              - zwu(ji  ,jj+1) + zwu(ji,jj)  ) * fmask(ji,jj,jk) / ( e1f(ji,jj)*e2f(ji,jj) ) 
    214200            END DO 
    215201         END DO 
     
    240226               * ( -4. * zwu(ii,ij) + zwu(ii,ij-1) - 0.2 * zwu(ii,ij-2) ) 
    241227         END DO 
    242  
    243228         !                                             ! =============== 
    244229      END DO                                           !   End of slab 
    245230      !                                                ! =============== 
     231 
     232      IF( ln_rnf      )   CALL sbc_rnf_div( hdivn )          ! runoffs (update hdivn field) 
     233      IF( nn_cla == 1 )   CALL cla_div    ( kt )             ! Cross Land Advection (Update Hor. divergence) 
    246234       
    247235      ! 4. Lateral boundary conditions on hdivn and rotn 
    248236      ! ---------------------------------=======---====== 
    249       CALL lbc_lnk( hdivn, 'T', 1. )     ! T-point, no sign change 
    250       CALL lbc_lnk( rotn , 'F', 1. )     ! F-point, no sign change 
    251  
     237      CALL lbc_lnk( hdivn, 'T', 1. )   ;   CALL lbc_lnk( rotn , 'F', 1. )    ! lateral boundary cond. (no sign change) 
     238      ! 
    252239   END SUBROUTINE div_cur 
    253240    
     
    269256      !!      - compute the now divergence given by : 
    270257      !!         hdivn = 1/(e1t*e2t*e3t) ( di[e2u*e3u un] + dj[e1v*e3v vn] ) 
    271       !!      Note: if lk_zco=T, e3u=e3v=e3t, they are simplified in the  
    272       !!      above expression 
    273       !!      - apply lateral boundary conditions on hdivn  
     258      !!      correct hdiv with runoff inflow (div_rnf) and cross land flow (div_cla)  
    274259      !!              - Relavtive Vorticity : 
    275260      !!      - save the curl computed at the previous time-step (rotb = rotn) 
     
    277262      !!      - compute the now curl in tensorial formalism: 
    278263      !!            rotn = 1/(e1f*e2f) ( di[e2v vn] - dj[e1u un] ) 
    279       !!      - apply lateral boundary conditions on rotn through a call to 
    280       !!      routine lbc_lnk routine. 
    281264      !!      Note: Coastal boundary condition: lateral friction set through 
    282265      !!      the value of fmask along the coast (see dommsk.F90) and shlat 
     
    285268      !! ** Action  : - update hdivb, hdivn, the before & now hor. divergence 
    286269      !!              - update rotb , rotn , the before & now rel. vorticity 
    287       !! 
    288       !! History : 
    289       !!   1.0  !  87-06  (P. Andrich, D. L Hostis)  Original code 
    290       !!   4.0  !  91-11  (G. Madec) 
    291       !!   6.0  !  93-03  (M. Guyon)  symetrical conditions 
    292       !!   7.0  !  96-01  (G. Madec)  s-coordinates 
    293       !!   8.0  !  97-06  (G. Madec)  lateral boundary cond., lbc 
    294       !!   8.1  !  97-08  (J.M. Molines)  Open boundaries 
    295       !!   9.0  !  02-09  (G. Madec, E. Durand)  Free form, F90 
    296       !!        !  05-01  (J. Chanut) Unstructured open boundaries 
    297       !!---------------------------------------------------------------------- 
    298       !! * Arguments 
     270      !!---------------------------------------------------------------------- 
    299271      INTEGER, INTENT( in ) ::   kt     ! ocean time-step index 
    300        
    301       !! * Local declarations 
     272      ! 
    302273      INTEGER  ::   ji, jj, jk          ! dummy loop indices 
     274      REAL(wp) ::  zraur, zdep 
    303275      !!---------------------------------------------------------------------- 
    304276 
     
    312284      DO jk = 1, jpkm1                                 ! Horizontal slab 
    313285         !                                             ! =============== 
    314  
     286         ! 
    315287         hdivb(:,:,jk) = hdivn(:,:,jk)    ! time swap of div arrays 
    316288         rotb (:,:,jk) = rotn (:,:,jk)    ! time swap of rot arrays 
    317  
     289         ! 
    318290         !                                             ! -------- 
    319291         ! Horizontal divergence                       !   div  
     
    321293         DO jj = 2, jpjm1 
    322294            DO ji = fs_2, fs_jpim1   ! vector opt. 
    323 #if defined key_zco 
    324                hdivn(ji,jj,jk) = (  e2u(ji,jj) * un(ji,jj,jk) - e2u(ji-1,jj  ) * un(ji-1,jj  ,jk)      & 
    325                   &               + e1v(ji,jj) * vn(ji,jj,jk) - e1v(ji  ,jj-1) * vn(ji  ,jj-1,jk)  )   &  
    326                   / ( e1t(ji,jj) * e2t(ji,jj) ) 
    327 #else 
    328295               hdivn(ji,jj,jk) =   & 
    329                   (  e2u(ji,jj)*fse3u(ji,jj,jk) * un(ji,jj,jk) - e2u(ji-1,jj  )*fse3u(ji-1,jj  ,jk) * un(ji-1,jj  ,jk)       & 
    330                    + e1v(ji,jj)*fse3v(ji,jj,jk) * vn(ji,jj,jk) - e1v(ji  ,jj-1)*fse3v(ji  ,jj-1,jk) * vn(ji  ,jj-1,jk)  )    & 
     296                  (  e2u(ji,jj)*fse3u(ji,jj,jk) * un(ji,jj,jk) - e2u(ji-1,jj)*fse3u(ji-1,jj,jk) * un(ji-1,jj,jk)       & 
     297                   + e1v(ji,jj)*fse3v(ji,jj,jk) * vn(ji,jj,jk) - e1v(ji,jj-1)*fse3v(ji,jj-1,jk) * vn(ji,jj-1,jk)  )    & 
    331298                  / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) ) 
    332 #endif 
    333299            END DO   
    334300         END DO   
     
    344310         ENDIF 
    345311#endif          
    346 #if defined key_bdy 
    347          ! unstructured open boundaries (div must be zero behind the open boundary) 
    348          DO jj = 1, jpj 
    349            DO ji = 1, jpi 
    350              hdivn(ji,jj,jk)=hdivn(ji,jj,jk)*bdytmask(ji,jj) 
    351            END DO 
    352          END DO 
    353 #endif         
    354312         IF( .NOT. AGRIF_Root() ) THEN 
    355313            IF ((nbondi ==  1).OR.(nbondi == 2)) hdivn(nlci-1 , :     ,jk) = 0.e0      ! east 
     
    372330      END DO                                           !   End of slab 
    373331      !                                                ! =============== 
    374        
     332 
     333      IF( ln_rnf      )   CALL sbc_rnf_div( hdivn )          ! runoffs (update hdivn field) 
     334      IF( nn_cla == 1 )   CALL cla_div    ( kt )             ! Cross Land Advection (update hdivn field) 
     335 
    375336      ! 4. Lateral boundary conditions on hdivn and rotn 
    376337      ! ---------------------------------=======---====== 
    377       CALL lbc_lnk( hdivn, 'T', 1. )       ! T-point, no sign change 
    378       CALL lbc_lnk( rotn , 'F', 1. )       ! F-point, no sign change 
    379  
     338      CALL lbc_lnk( hdivn, 'T', 1. )   ;   CALL lbc_lnk( rotn , 'F', 1. )     ! lateral boundary cond. (no sign change) 
     339      ! 
    380340   END SUBROUTINE div_cur 
    381341    
Note: See TracChangeset for help on using the changeset viewer.