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 14072 for NEMO/trunk/src/OCE/TRA/zpshde.F90 – NEMO

Ignore:
Timestamp:
2020-12-04T08:48:38+01:00 (3 years ago)
Author:
laurent
Message:

Merging branch "2020/dev_r13648_ASINTER-04_laurent_bulk_ice", ticket #2369

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/TRA/zpshde.F90

    r13982 r14072  
    77   !!   NEMO     1.0  !  2002-08  (G. Madec E. Durand)  Optimization and Free form 
    88   !!             -   !  2004-03  (C. Ethe)  adapted for passive tracers 
    9    !!            3.3  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA  
     9   !!            3.3  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA 
    1010   !!            3.6  !  2014-11  (P. Mathiot) Add zps_hde_isf (needed to open a cavity) 
    1111   !!====================================================================== 
    12     
     12 
    1313   !!---------------------------------------------------------------------- 
    1414   !!   zps_hde      :  Horizontal DErivative of T, S and rd at the last 
     
    6666      !!---------------------------------------------------------------------- 
    6767      !!                     ***  ROUTINE zps_hde  *** 
    68       !!                     
     68      !! 
    6969      !! ** Purpose :   Compute the horizontal derivative of T, S and rho 
    7070      !!      at u- and v-points with a linear interpolation for z-coordinate 
    7171      !!      with partial steps. 
    7272      !! 
    73       !! ** Method  :   In z-coord with partial steps, scale factors on last  
    74       !!      levels are different for each grid point, so that T, S and rd  
     73      !! ** Method  :   In z-coord with partial steps, scale factors on last 
     74      !!      levels are different for each grid point, so that T, S and rd 
    7575      !!      points are not at the same depth as in z-coord. To have horizontal 
    76       !!      gradients again, we interpolate T and S at the good depth :  
    77       !!      Linear interpolation of T, S    
     76      !!      gradients again, we interpolate T and S at the good depth : 
     77      !!      Linear interpolation of T, S 
    7878      !!         Computation of di(tb) and dj(tb) by vertical interpolation: 
    7979      !!          di(t) = t~ - t(i,j,k) or t(i+1,j,k) - t~ 
    8080      !!          dj(t) = t~ - t(i,j,k) or t(i,j+1,k) - t~ 
    8181      !!         This formulation computes the two cases: 
    82       !!                 CASE 1                   CASE 2   
     82      !!                 CASE 1                   CASE 2 
    8383      !!         k-1  ___ ___________   k-1   ___ ___________ 
    8484      !!                    Ti  T~                  T~  Ti+1 
     
    8787      !!                  |   |____                ____|   | 
    8888      !!              ___ |   |   |           ___  |   |   | 
    89       !!                   
     89      !! 
    9090      !!      case 1->   e3w(i+1,:,:,Kmm) >= e3w(i,:,:,Kmm) ( and e3w(:,j+1,:,Kmm) >= e3w(:,j,:,Kmm) ) then 
    9191      !!          t~ = t(i+1,j  ,k) + (e3w(i+1,j,k,Kmm) - e3w(i,j,k,Kmm)) * dk(Ti+1)/e3w(i+1,j,k,Kmm) 
     
    9595      !!          t~ = t(i,j,k) + (e3w(i,j,k,Kmm) - e3w(i+1,j,k,Kmm)) * dk(Ti)/e3w(i,j,k,Kmm) 
    9696      !!        ( t~ = t(i,j,k) + (e3w(i,j,k,Kmm) - e3w(i,j+1,k,Kmm)) * dk(Tj)/e3w(i,j,k,Kmm) ) 
    97       !!          Idem for di(s) and dj(s)           
     97      !!          Idem for di(s) and dj(s) 
    9898      !! 
    9999      !!      For rho, we call eos which will compute rd~(t~,s~) at the right 
     
    175175      ! 
    176176      IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgtu(:,:,:), 'U', -1.0_wp , pgtv(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond. 
    177       !                 
     177      ! 
    178178      IF( PRESENT( prd ) ) THEN    !==  horizontal derivative of density anomalies (rd)  ==!    (optional part) 
    179179         pgru(:,:) = 0._wp 
     
    192192         END_2D 
    193193         ! 
    194          CALL eos( zti, zhi, zri )        ! interpolated density from zti, ztj  
    195          CALL eos( ztj, zhj, zrj )        ! at the partial step depth output in  zri, zrj  
     194         CALL eos( zti, zhi, zri )        ! interpolated density from zti, ztj 
     195         CALL eos( ztj, zhj, zrj )        ! at the partial step depth output in  zri, zrj 
    196196         ! 
    197197         DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )              ! Gradient of density at the last level 
     
    244244      !!---------------------------------------------------------------------- 
    245245      !!                     ***  ROUTINE zps_hde_isf  *** 
    246       !!                     
     246      !! 
    247247      !! ** Purpose :   Compute the horizontal derivative of T, S and rho 
    248248      !!      at u- and v-points with a linear interpolation for z-coordinate 
    249249      !!      with partial steps for top (ice shelf) and bottom. 
    250250      !! 
    251       !! ** Method  :   In z-coord with partial steps, scale factors on last  
    252       !!      levels are different for each grid point, so that T, S and rd  
     251      !! ** Method  :   In z-coord with partial steps, scale factors on last 
     252      !!      levels are different for each grid point, so that T, S and rd 
    253253      !!      points are not at the same depth as in z-coord. To have horizontal 
    254254      !!      gradients again, we interpolate T and S at the good depth : 
    255255      !!      For the bottom case: 
    256       !!      Linear interpolation of T, S    
     256      !!      Linear interpolation of T, S 
    257257      !!         Computation of di(tb) and dj(tb) by vertical interpolation: 
    258258      !!          di(t) = t~ - t(i,j,k) or t(i+1,j,k) - t~ 
    259259      !!          dj(t) = t~ - t(i,j,k) or t(i,j+1,k) - t~ 
    260260      !!         This formulation computes the two cases: 
    261       !!                 CASE 1                   CASE 2   
     261      !!                 CASE 1                   CASE 2 
    262262      !!         k-1  ___ ___________   k-1   ___ ___________ 
    263263      !!                    Ti  T~                  T~  Ti+1 
     
    266266      !!                  |   |____                ____|   | 
    267267      !!              ___ |   |   |           ___  |   |   | 
    268       !!                   
     268      !! 
    269269      !!      case 1->   e3w(i+1,j,k,Kmm) >= e3w(i,j,k,Kmm) ( and e3w(i,j+1,k,Kmm) >= e3w(i,j,k,Kmm) ) then 
    270270      !!          t~ = t(i+1,j  ,k) + (e3w(i+1,j  ,k,Kmm) - e3w(i,j,k,Kmm)) * dk(Ti+1)/e3w(i+1,j  ,k,Kmm) 
     
    274274      !!          t~ = t(i,j,k) + (e3w(i,j,k,Kmm) - e3w(i+1,j  ,k,Kmm)) * dk(Ti)/e3w(i,j,k,Kmm) 
    275275      !!        ( t~ = t(i,j,k) + (e3w(i,j,k,Kmm) - e3w(i  ,j+1,k,Kmm)) * dk(Tj)/e3w(i,j,k,Kmm) ) 
    276       !!          Idem for di(s) and dj(s)           
     276      !!          Idem for di(s) and dj(s) 
    277277      !! 
    278278      !!      For rho, we call eos which will compute rd~(t~,s~) at the right 
     
    364364      ! horizontal derivative of density anomalies (rd) 
    365365      IF( PRESENT( prd ) ) THEN         ! depth of the partial step level 
    366          pgru(:,:)=0.0_wp   ; pgrv(:,:)=0.0_wp ;  
     366         pgru(:,:)=0.0_wp   ; pgrv(:,:)=0.0_wp ; 
    367367         ! 
    368368         DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) 
     
    418418            ! the only common depth between cells (i,j) and (i,j+1) is gdepw_0 
    419419            ze3wu  =  gdept(ji,jj,iku,Kmm) - gdept(ji+1,jj,iku,Kmm) 
    420             ze3wv  =  gdept(ji,jj,ikv,Kmm) - gdept(ji,jj+1,ikv,Kmm)  
     420            ze3wv  =  gdept(ji,jj,ikv,Kmm) - gdept(ji,jj+1,ikv,Kmm) 
    421421 
    422422            ! i- direction 
     
    463463            ikv = mikv(ji,jj) 
    464464            ze3wu  =  gdept(ji,jj,iku,Kmm) - gdept(ji+1,jj,iku,Kmm) 
    465             ze3wv  =  gdept(ji,jj,ikv,Kmm) - gdept(ji,jj+1,ikv,Kmm)  
     465            ze3wv  =  gdept(ji,jj,ikv,Kmm) - gdept(ji,jj+1,ikv,Kmm) 
    466466            ! 
    467467            IF( ze3wu >= 0._wp ) THEN   ;   zhi(ji,jj) = gdept(ji  ,jj,iku,Kmm)    ! i-direction: case 1 
     
    475475         END_2D 
    476476         ! 
    477          CALL eos( zti, zhi, zri )        ! interpolated density from zti, ztj  
    478          CALL eos( ztj, zhj, zrj )        ! at the partial step depth output in  zri, zrj  
    479          ! 
    480          DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) 
    481             iku = miku(ji,jj)  
    482             ikv = mikv(ji,jj)  
     477         CALL eos( zti, zhi, zri )        ! interpolated density from zti, ztj 
     478         CALL eos( ztj, zhj, zrj )        ! at the partial step depth output in  zri, zrj 
     479         ! 
     480         DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) 
     481            iku = miku(ji,jj) 
     482            ikv = mikv(ji,jj) 
    483483            ze3wu  =  gdept(ji,jj,iku,Kmm) - gdept(ji+1,jj,iku,Kmm) 
    484             ze3wv  =  gdept(ji,jj,ikv,Kmm) - gdept(ji,jj+1,ikv,Kmm)  
     484            ze3wv  =  gdept(ji,jj,ikv,Kmm) - gdept(ji,jj+1,ikv,Kmm) 
    485485 
    486486            IF( ze3wu >= 0._wp ) THEN ; pgrui(ji,jj) = ssumask(ji,jj) * ( zri(ji  ,jj      ) - prd(ji,jj,iku) ) ! i: 1 
     
    494494         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgrui, 'U', -1.0_wp , pgrvi, 'V', -1.0_wp )   ! Lateral boundary conditions 
    495495         ! 
    496       END IF   
     496      END IF 
    497497      ! 
    498498      IF( ln_timing )   CALL timing_stop( 'zps_hde_isf') 
Note: See TracChangeset for help on using the changeset viewer.