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 834 for trunk/NEMO/LIM_SRC_3/limrhg.F90 – NEMO

Ignore:
Timestamp:
2008-03-07T18:11:35+01:00 (16 years ago)
Author:
ctlod
Message:

Clean comments and useless lines, see ticket:#72

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/LIM_SRC_3/limrhg.F90

    r825 r834  
    22   !!====================================================================== 
    33   !!                     ***  MODULE  limrhg  *** 
    4    !!   Ice rheology :  performs sea ice rheology 
     4   !!   Ice rheology : sea ice rheology 
    55   !!====================================================================== 
    66#if defined key_lim3 
    77   !!---------------------------------------------------------------------- 
    8    !!   'key_lim3'                                     LIM sea-ice model 
     8   !!   'key_lim3'                                      LIM3 sea-ice model 
    99   !!---------------------------------------------------------------------- 
    1010   !!   lim_rhg   : computes ice velocities 
     
    3636      rone    = 1.e0 
    3737   !!---------------------------------------------------------------------- 
    38    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)  
     38   !!   LIM 3.0,  UCL-LOCEAN-IPSL (2008)  
    3939   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limrhg.F90,v 1.5 2005/03/27 18:34:42 opalod Exp $  
    4040   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt  
     
    4444 
    4545   SUBROUTINE lim_rhg( k_j1, k_jpj ) 
     46 
    4647      !!------------------------------------------------------------------- 
    47       !!                 ***  SUBROUTINR lim_rhg  *** 
    48       !! 
    49       !! ** purpose :   determines sea ice drift from wind stress, ice-ocean 
     48      !!                 ***  SUBROUTINE lim_rhg  *** 
     49      !!                          EVP-C-grid 
     50      !! 
     51      !! ** purpose : determines sea ice drift from wind stress, ice-ocean 
    5052      !!  stress and sea-surface slope. Ice-ice interaction is described by  
    51       !!  a non-linear elasto-viscous-plastic law including shear strength  
    52       !!  and a bulk rheology (Hunke and Dukowicz, 2002).    
    53       !! 
    54       !!  Grid B: 
    55       !!  the routine calculates 4 estimates of the divergence, tension,  
    56       !!  and shear on each corner of a given scalar grid box. Likewise, 
    57       !!  four estimates of the components of the stress tensor are  
    58       !!  calculated on each corner. The internal forces on a corner are  
    59       !!  calculated as averages of the four stress tensor contributions. 
    60       !! 
    61       !! ** Action  : - compute u_ice, v_ice the sea-ice velocity 
    62       !! 
    63       !! ** NOTE : for the ice dynamics, the labeling convention is  
    64       !!  that the velocity point (i,j) is located on the southwest corner 
    65       !!  of a scalar (i,j) grid box. This choice is somewhat unfortunate, 
    66       !!  as most models locate the velocity point (i,j) on the northeast 
    67       !!  corner... 
    68       !! 
    69       !! ** MORE IMPORTANT NOTES : related to the note above, it is crucial  
    70       !!  to make sure that all variables and coefficients are located on 
    71       !!  right points of the grid. Verify everywhere! 
     53      !!  a non-linear elasto-viscous-plastic (EVP) law including shear  
     54      !!  strength and a bulk rheology (Hunke and Dukowicz, 2002).    
     55      !! 
     56      !!  The points in the C-grid look like this, dear reader 
     57      !! 
     58      !!                              (ji,jj) 
     59      !!                                 | 
     60      !!                                 | 
     61      !!                      (ji-1,jj)  |  (ji,jj) 
     62      !!                             ---------    
     63      !!                            |         | 
     64      !!                            | (ji,jj) |------(ji,jj) 
     65      !!                            |         | 
     66      !!                             ---------    
     67      !!                     (ji-1,jj-1)     (ji,jj-1) 
     68      !! 
     69      !! ** Inputs  : - wind forcing (stress), oceanic currents 
     70      !!                ice total volume (vt_i) per unit area 
     71      !!                snow total volume (vt_s) per unit area 
     72      !! 
     73      !! ** Action  : - compute u_ice, v_ice : the components of the  
     74      !!                sea-ice velocity vector 
     75      !!              - compute delta_i, shear_i, divu_i, which are inputs 
     76      !!                of the ice thickness distribution 
     77      !! 
     78      !! ** Steps   : 1) Compute ice snow mass, ice strength  
     79      !!              2) Compute wind, oceanic stresses, mass terms and 
     80      !!                 coriolis terms of the momentum equation 
     81      !!              3) Solve the momentum equation (iterative procedure) 
     82      !!              4) Prevent high velocities if the ice is thin 
     83      !!              5) Recompute invariants of the strain rate tensor 
     84      !!                 which are inputs of the ITD, store stress 
     85      !!                 for the next time step 
     86      !!              6) Control prints of residual (convergence) 
     87      !!                 and charge ellipse. 
     88      !!                 The user should make sure that the parameters 
     89      !!                 nevp, telast and creepl maintain stress state 
     90      !!                 on the charge ellipse for plastic flow 
     91      !!                 e.g. in the Canadian Archipelago 
     92      !! 
     93      !! ** References : Hunke and Dukowicz, JPO97 
     94      !!                 Bouillon et al., 08, in prep (update this when 
     95      !!                 published) 
     96      !!                 Vancoppenolle et al., OM08 
    7297      !! 
    7398      !! History : 
    74       !!   1.0  !  07-03  (M.A. Morales Maqueda, S. Bouillon, M. Vancoppenolle)  
    75       !!                  EVP, C grid, LIM3 
     99      !!   1.0  !  07-03  (M.A. Morales Maqueda, S. Bouillon) 
     100      !!   2.0  !  08-03  M. Vancoppenolle : LIM3 
    76101      !! 
    77102      !!------------------------------------------------------------------- 
     
    79104      ! 
    80105      INTEGER, INTENT(in) :: & 
    81          k_j1 ,  &            !: southern j-index for ice computation 
    82          k_jpj                !: northern j-index for ice computation 
     106         k_j1 ,                      & !: southern j-index for ice computation 
     107         k_jpj                         !: northern j-index for ice computation 
    83108 
    84109      ! * Local variables 
    85       INTEGER ::   ji, jj, jl !: dummy loop indices 
     110      INTEGER ::   ji, jj              !: dummy loop indices 
    86111 
    87112      INTEGER  :: & 
    88          iim1, ijm1, iip1 , ijp1   , & ! temporary integers 
    89          iter, jter                    !    "          " 
     113         iter, jter                    !: temporary integers 
    90114 
    91115      CHARACTER (len=50) ::   charout 
    92116 
    93117      REAL(wp) :: & 
    94          zt11  , zt12  , zt21  , zt22  ,   &  ! temporary scalars 
    95          ztagnx, ztagny , delta               !    "         " 
     118         zt11, zt12, zt21, zt22,     & !: temporary scalars 
     119         ztagnx, ztagny,             & !: wind stress on U/V points                        
     120         delta                         ! 
    96121 
    97122      REAL(wp) :: & 
    98          za, zstms, zsang, zmask 
    99  
    100       REAL(wp),DIMENSION(jpi,jpj) ::   & 
    101          zpresh, zpreshc, zfrld1, zfrld2, zmass1, zmass2, zcorl1, zcorl2, & 
    102          za1ct, za2ct, zc1, zusw ,                      & 
    103          u_oce1, v_oce1, u_oce2, v_oce2, u_ice2, v_ice1 
     123         za,                         & !: 
     124         zstms,                      & !: temporary scalar for ice strength 
     125         zsang,                      & !: temporary scalar for coriolis term 
     126         zmask                         !: mask for the computation of ice mass 
     127 
     128      REAL(wp),DIMENSION(jpi,jpj) :: & 
     129         zpresh        ,             & !: temporary array for ice strength 
     130         zpreshc       ,             & !: Ice strength on grid cell corners (zpreshc) 
     131         zfrld1, zfrld2,             & !: lead fraction on U/V points                                     
     132         zmass1, zmass2,             & !: ice/snow mass on U/V points                                     
     133         zcorl1, zcorl2,             & !: coriolis parameter on U/V points 
     134         za1ct, za2ct  ,             & !: temporary arrays 
     135         zc1           ,             & !: ice mass 
     136         zusw          ,             & !: temporary weight for the computation 
     137                                       !: of ice strength 
     138         u_oce1, v_oce1,             & !: ocean u/v component on U points                            
     139         u_oce2, v_oce2,             & !: ocean u/v component on V points 
     140         u_ice2,                     & !: ice u component on V point 
     141         v_ice1                        !: ice v component on U point 
    104142 
    105143      REAL(wp) :: & 
    106          dtevp,dtotel,ecc2,z0,zr,zcca,zccb,denr, & 
    107          zu_ice2,zv_ice1, zddc, zdtc, zdst, zdsshx, zdsshy, & 
    108          sigma1, sigma2 
    109  
    110       REAL(wp),DIMENSION(jpi,jpj) ::   & 
    111          zf1, zf2 
    112  
    113       REAL(wp),DIMENSION(jpi,jpj) ::   & 
    114          zdd,                & !: Divergence [ 
    115          zdt,                & !: 
    116          zds,                & !: 
    117          deltat,             & 
    118          deltac,             & 
    119          zs1,                & 
    120          zs2,                & 
    121          zs12 
    122  
    123       REAL :: & 
    124          zumax                 !: Maximal tolerated ice velocity 
    125  
    126       REAL(wp) ::            & 
    127          zresm                 !: Maximal error on ice velocity 
    128  
    129       REAL(wp),DIMENSION(jpi,jpj) ::   & 
    130          zu_ice           ,  & !: Ice velocity on previous time step 
    131          zv_ice           ,  & 
    132          zresr                 !: Local error on velocity 
     144         dtevp,                      & !: time step for subcycling 
     145         dtotel,                     & !: 
     146         ecc2,                       & !: square of yield ellipse eccenticity 
     147         z0,                         & !: temporary scalar 
     148         zr,                         & !: temporary scalar 
     149         zcca, zccb,                 & !: temporary scalars 
     150         zu_ice2,                    & !:  
     151         zv_ice1,                    & !: 
     152         zddc, zdtc,                 & !: temporary array for delta on corners 
     153         zdst,                       & !: temporary array for delta on centre 
     154         zdsshx, zdsshy,             & !: term for the gradient of ocean surface 
     155         sigma1, sigma2                !: internal ice stress 
     156 
     157      REAL(wp),DIMENSION(jpi,jpj) :: & 
     158         zf1, zf2                      !: arrays for internal stresses 
     159 
     160      REAL(wp),DIMENSION(jpi,jpj) :: & 
     161         zdd, zdt,                   & !: Divergence and tension at centre of grid cells 
     162         zds,                        & !: Shear on northeast corner of grid cells 
     163         deltat,                     & !: Delta at centre of grid cells 
     164         deltac,                     & !: Delta on corners 
     165         zs1, zs2,                   & !: Diagonal stress tensor components zs1 and zs2  
     166         zs12                          !: Non-diagonal stress tensor component zs12 
    133167 
    134168      REAL(wp) :: & 
    135          zindb            ,  & !: ice (1) or not (0)       
    136          zdummy                !: ice computation 
     169         zresm            ,          & !: Maximal error on ice velocity 
     170         zindb            ,          & !: ice (1) or not (0)       
     171         zdummy                        !: dummy argument 
     172 
     173      REAL(wp),DIMENSION(jpi,jpj) :: & 
     174         zu_ice           ,          & !: Ice velocity on previous time step 
     175         zv_ice           ,          & 
     176         zresr                         !: Local error on velocity 
    137177 
    138178      INTEGER :: & 
    139179         stress_mean_swi = 1 
    140  
    141       !!---------------------------------------------------------------------- 
    142           
    143 ! 
    144 !------------------------------------------------------------------------------! 
    145 ! 0) Ice-Snow mass (zc1), ice strength (zpresh)                                ! 
    146 !------------------------------------------------------------------------------! 
    147 ! 
    148       ! Maximal tolerated velocity 
    149 !     zumax = 1.0 
    150  
     180! 
     181!------------------------------------------------------------------------------! 
     182! 1) Ice-Snow mass (zc1), ice strength (zpresh)                                ! 
     183!------------------------------------------------------------------------------! 
     184! 
    151185      ! Put every vector to 0 
    152186      zpresh(:,:)  = 0.0 ; zpreshc(:,:) = 0.0 ; zfrld1(:,:)  = 0.0 
     
    154188      za1ct(:,:)   = 0.0 ; za2ct(:,:)   = 0.0  
    155189      zc1(:,:)     = 0.0 ; zusw(:,:)    = 0.0 
    156  
    157190      u_oce1(:,:)  = 0.0 ; v_oce1(:,:)  = 0.0 ; u_oce2(:,:)  = 0.0 
    158191      v_oce2(:,:)  = 0.0 ; u_ice2(:,:)  = 0.0 ; v_ice1(:,:)  = 0.0 
    159  
    160       zf1(:,:) = 0.0     ; zf2(:,:) = 0.0 
    161  
     192      zf1(:,:)     = 0.0 ; zf2(:,:) = 0.0 
    162193      zdd(:,:)     = 0.0 ; zdt(:,:)     = 0.0 ; zds(:,:)     = 0.0 
    163194      deltat(:,:)  = 0.0 ; deltac(:,:)  = 0.0  
    164  
    165 ! 
    166 !------------------------------------------------------------------------------! 
    167 ! 1) Ice-Snow mass (zc1), ice strength (zpresh)                                ! 
    168 !------------------------------------------------------------------------------! 
    169 ! 
    170       ! compute ice strength 
     195      zpresh(:,:)  = 0.0  
     196 
     197      ! Ice strength on T-points 
    171198      CALL lim_itd_me_icestrength(ridge_scheme_swi) 
    172199 
    173       zpresh(:,:) = 0.0  
    174  
     200      ! Ice mass and temp variables 
    175201      DO jj = k_j1 , k_jpj-1 
    176202         DO ji = 1 , jpi 
     
    178204            zpresh(ji,jj) = tms(ji,jj) *  strength(ji,jj) / 2. 
    179205            ! tmi = 1 where ther is ice or on land 
     206            ! Claude sees a bug, next line : tmi(ji,jj) 
    180207            tmi           = 1.0 - ( 1.0 - MAX( 0.0 , SIGN ( 1.0 , vt_i(ji,jj) - & 
    181208                                    epsd ) ) ) * tms(ji,jj) 
     
    186213      CALL lbc_lnk( zpresh(:,:), 'T',  1. ) 
    187214 
    188       ! Ice strength (zpreshc) on grid cell corners (needed for     
    189       ! calculation of shear stress  
     215! Claude sees a bug 
     216!     CALL lbc_lnk( tmi(:,:), 'T',  1. ) 
     217 
     218      ! Ice strength on grid cell corners (zpreshc) 
     219      ! needed for calculation of shear stress  
    190220      DO jj = k_j1+1, k_jpj-1 
    191221         DO ji = 2, jpim1 
    192              zstms          =  tms(ji+1,jj+1) * wght(ji+1,jj+1,2,2) + tms(ji,jj+1) * wght(ji+1,jj+1,1,2)           & 
    193                 &            + tms(ji+1,jj  ) * wght(ji+1,jj+1,2,1) + tms(ji,jj  ) * wght(ji+1,jj+1,1,1) 
     222             zstms          =  tms(ji+1,jj+1) * wght(ji+1,jj+1,2,2) + & 
     223                &              tms(ji,jj+1)   * wght(ji+1,jj+1,1,2) + & 
     224                &              tms(ji+1,jj)   * wght(ji+1,jj+1,2,1) + & 
     225                &              tms(ji,jj)     * wght(ji+1,jj+1,1,1) 
    194226             zusw(ji,jj)    = 1.0 / MAX( zstms, epsd ) 
    195              zpreshc(ji,jj)  = (  zpresh(ji+1,jj+1) * wght(ji+1,jj+1,2,2) + zpresh(ji,jj+1) * wght(ji+1,jj+1,1,2)  & 
    196                 &              + zpresh(ji+1,jj   ) * wght(ji+1,jj+1,2,1) + zpresh(ji,jj  ) * wght(ji+1,jj+1,1,1) ) & 
    197                 &              * zusw(ji,jj) 
     227             zpreshc(ji,jj) = (  zpresh(ji+1,jj+1) * wght(ji+1,jj+1,2,2) + & 
     228                &                zpresh(ji,jj+1)   * wght(ji+1,jj+1,1,2) + & 
     229                &                zpresh(ji+1,jj)   * wght(ji+1,jj+1,2,1) + &  
     230                &                zpresh(ji,jj)     * wght(ji+1,jj+1,1,1)   & 
     231                &             ) * zusw(ji,jj) 
    198232         END DO 
    199233      END DO 
     
    233267 
    234268            ! Mass, coriolis coeff. and currents 
    235             zmass1(ji,jj) = (zt12*zc1(ji,jj)+zt11*zc1(ji+1,jj))/(zt11+zt12+epsd) 
    236             zmass2(ji,jj) = (zt22*zc1(ji,jj)+zt21*zc1(ji,jj+1))/(zt21+zt22+epsd) 
    237  
    238             zcorl1(ji,jj)  = zmass1(ji,jj)*(e1t(ji+1,jj)*fcor(ji,jj)+e1t(ji,jj)*fcor(ji+1,jj))/(e1t(ji,jj)+e1t(ji+1,jj)+epsd) 
    239             zcorl2(ji,jj)  = zmass2(ji,jj)*(e2t(ji,jj+1)*fcor(ji,jj)+e2t(ji,jj)*fcor(ji,jj+1))/(e2t(ji,jj+1)+e2t(ji,jj)+epsd) 
    240             ! 
    241             ! Reminder: since this is a C grid, the location of ocean currents  
    242             ! calculated by OPA should coincide with ice model vector points: 
    243             ! no need for interpolation once the definition of u_io and v_io 
    244             ! has been changed in module "icestp". Arrays u_oce1 and v_oce2 could 
    245             ! then be replaced by u_oce and v_oce, respectively. 
     269            zmass1(ji,jj) = ( zt12*zc1(ji,jj) + zt11*zc1(ji+1,jj) ) / (zt11+zt12+epsd) 
     270            zmass2(ji,jj) = ( zt22*zc1(ji,jj) + zt21*zc1(ji,jj+1) ) / (zt21+zt22+epsd) 
     271            zcorl1(ji,jj) = zmass1(ji,jj) * ( e1t(ji+1,jj)*fcor(ji,jj) + & 
     272                                              e1t(ji,jj)*fcor(ji+1,jj) ) & 
     273                                           / (e1t(ji,jj) + e1t(ji+1,jj) + epsd ) 
     274            zcorl2(ji,jj) = zmass2(ji,jj) * ( e2t(ji,jj+1)*fcor(ji,jj) + & 
     275                                              e2t(ji,jj)*fcor(ji,jj+1) ) & 
     276                                          / ( e2t(ji,jj+1) + e2t(ji,jj) + epsd ) 
    246277            ! 
    247278            u_oce1(ji,jj)  = u_io(ji,jj) 
    248  
    249             ! SB modif because ocean has no slip boundary condition 
     279            v_oce2(ji,jj)  = v_io(ji,jj) 
     280 
     281            ! Ocean has no slip boundary condition 
    250282            v_oce1(ji,jj)  = 0.5*( (v_io(ji,jj)+v_io(ji,jj-1))*e1t(ji+1,jj)    & 
    251283                &                 +(v_io(ji+1,jj)+v_io(ji+1,jj-1))*e1t(ji,jj)) & 
    252284                &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)   
    253285 
    254             u_oce2(ji,jj)  = 0.5*( (u_io(ji,jj)+u_io(ji-1,jj))*e2t(ji,jj+1)    & 
     286            u_oce2(ji,jj)  = 0.5*((u_io(ji,jj)+u_io(ji-1,jj))*e2t(ji,jj+1)     & 
    255287                &                 +(u_io(ji,jj+1)+u_io(ji-1,jj+1))*e2t(ji,jj)) & 
    256                 &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj) 
    257      
    258             v_oce2(ji,jj)  = v_io(ji,jj) 
     288                &                / (e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj) 
    259289 
    260290            ! Wind stress. 
     
    262292            ztagny = ( 1. - zfrld2(ji,jj) ) * gtauy(ji,jj) 
    263293 
    264             ! Computation of the velocity field taking into account the ice-ice interaction.                                  
     294            ! Computation of the velocity field taking into account the ice internal interaction. 
    265295            ! Terms that are independent of the velocity field. 
    266             ! Reminder: does zcorl*(-v_oce,u_oce) represent the surface pressure gradient? Why is it still 
    267             !           calculated in this way? An ocean model with a free surface should provide the gradient 
    268             !           of surface elevation directly... 
    269296 
    270297            ! SB On utilise maintenant le gradient de la pente de l'ocean 
     
    272299            !    zdsshx =  (ssh_io(ji+1,jj) - ssh_io(ji,jj))/e1u(ji,jj) 
    273300            !    zdsshy =  (ssh_io(ji,jj+1) - ssh_io(ji,jj))/e2v(ji,jj)   
     301 
    274302            zdsshx = 0.0 
    275303            zdsshy = 0.0  
     
    283311! 
    284312!------------------------------------------------------------------------------! 
    285 ! 3) Solution of the momentum equation 
     313! 3) Solution of the momentum equation, iterative procedure 
    286314!------------------------------------------------------------------------------! 
    287315! 
     
    319347         END DO       
    320348 
    321            DO jj = k_j1+1, k_jpj-1 
    322               DO ji = 2, jpim1 
     349         DO jj = k_j1+1, k_jpj-1 
     350            DO ji = 2, jpim1 
    323351 
    324352         !   
     
    327355         !- zds(:,:): shear on northeast corner of grid cells 
    328356                 ! 
    329                  !- IMPORTANT REMINDER: note that, the way these terms are coded, there are many repeated  
    330                  !                      calculations. Speed could be improved by regrouping terms. For 
     357                 !- IMPORTANT REMINDER: Dear Gurvan, note that, the way these terms are coded,  
     358                 !                      there are many repeated calculations.  
     359                 !                      Speed could be improved by regrouping terms. For 
    331360                 !                      the moment, however, the stress is on clarity of coding to avoid 
    332                  !                      bugs (mamm). 
    333                  !- ALSO: arrays zdd, zdt, zds and delta could be removed in the future to minimise memory demand. 
     361                 !                      bugs (Martin, for Miguel). 
     362                 ! 
     363                 !- ALSO: arrays zdd, zdt, zds and delta could  
     364                 !  be removed in the future to minimise memory demand. 
     365                 ! 
    334366                 !- MORE NOTES: Note that we are calculating deformation rates and stresses on the corners of 
    335367                 !              grid cells, exactly as in the B grid case. For simplicity, the indexation on 
     
    337369                 ! 
    338370                 ! 
    339                  !          (ji,jj) 
    340                  !             | 
    341                  !             | 
    342                  !  (ji-1,jj)  |  (ji,jj) 
    343                  !         ---------    
    344                  !        |         | 
    345                  !        | (ji,jj) |------(ji,jj) 
    346                  !        |         | 
    347                  !         ---------    
    348                  !(ji-1,jj-1)     (ji,jj-1) 
    349                  !  
    350  
    351371                 zdd(ji,jj) = ( e2u(ji,jj)*u_ice(ji,jj)                      & 
    352372                    &          -e2u(ji-1,jj)*u_ice(ji-1,jj)                  & 
     
    366386 
    367387                 ! 
    368                  ! SB modif because ocean has no slip boundary condition  
    369388                 zds(ji,jj) = ( ( u_ice(ji,jj+1)/e1u(ji,jj+1)                & 
    370389                    &            -u_ice(ji,jj)/e1u(ji,jj)                    & 
     
    379398 
    380399  
    381                  ! SB modif because need to compute zddc and zdtc correctly  
    382400                 v_ice1(ji,jj)  = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)   & 
    383401                    &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj)) & 
     
    406424                    &         / area(ji,jj) 
    407425 
    408 ! Old lines 
    409 !                deltat(ji,jj) = SQRT( zdd(ji,jj)*zdd(ji,jj) + &  
    410 !    &                                 ( zdt(ji,jj)*zdt(ji,jj) + zdst*zdst ) * usecc2 &  
    411 !    &                               ) + creepl 
    412 ! New lines 
    413 ! Regularisation of dP/dx 
    414426                 delta = SQRT( zdd(ji,jj)*zdd(ji,jj) +                        &  
    415427     &                       ( zdt(ji,jj)*zdt(ji,jj) + zdst*zdst ) * usecc2 )   
    416428                 deltat(ji,jj) = MAX( SQRT(zdd(ji,jj)**2 +                    & 
    417429                                 (zdt(ji,jj)**2 + zdst**2)*usecc2), creepl ) 
    418 ! End of new lines 
    419430 
    420431                 !-Calculate stress tensor components zs1 and zs2  
    421432                 !-at centre of grid cells (see section 3.5 of CICE user's guide). 
    422 ! Old lines 
    423 !                zs1(ji,jj) = ( zs1(ji,jj)       & 
    424 !                   &          - dtotel*((1.0-alphaevp)*zs1(ji,jj)+(1.0-zdd(ji,jj)/deltat(ji,jj))*zpresh(ji,jj)))       & 
    425 !                   &        /(1.0+alphaevp*dtotel) 
    426 ! New lines 
    427433                 zs1(ji,jj) = ( zs1(ji,jj) & 
    428434                    &          - dtotel*( ( 1.0 - alphaevp) * zs1(ji,jj) +    & 
    429                     &            ( delta / deltat(ji,jj) - zdd(ji,jj) / deltat(ji,jj) ) * zpresh(ji,jj) ) ) &        
     435                    &            ( delta / deltat(ji,jj) - zdd(ji,jj) / deltat(ji,jj) ) & 
     436                                 * zpresh(ji,jj) ) )                          &        
    430437                    &        / ( 1.0 + alphaevp * dtotel ) 
    431 ! End of new lines 
    432  
    433                  zs2(ji,jj) = ( zs2(ji,jj)                                                                              & 
    434                     &          - dtotel*((1.0-alphaevp)*ecc2*zs2(ji,jj)-zdt(ji,jj)/deltat(ji,jj)*zpresh(ji,jj)))        & 
    435                     &        /(1.0+alphaevp*ecc2*dtotel) 
     438 
     439                 zs2(ji,jj) = ( zs2(ji,jj)   & 
     440                    &          - dtotel*((1.0-alphaevp)*ecc2*zs2(ji,jj) -  & 
     441                                 zdt(ji,jj)/deltat(ji,jj)*zpresh(ji,jj)) ) & 
     442                    &        / ( 1.0 + alphaevp*ecc2*dtotel ) 
    436443 
    437444              END DO 
     
    443450           DO jj = k_j1+1, k_jpj-1 
    444451              DO ji = 2, jpim1 
    445  
    446452                 !- Calculate Delta on corners 
    447                   
    448453                 zddc  =      ( ( v_ice1(ji,jj+1)/e1u(ji,jj+1)                & 
    449454                    &            -v_ice1(ji,jj)/e1u(ji,jj)                    & 
     
    455460                    &        / ( e1f(ji,jj) * e2f(ji,jj) ) 
    456461 
    457  
    458462                 zdtc  =      (-( v_ice1(ji,jj+1)/e1u(ji,jj+1)                & 
    459463                    &            -v_ice1(ji,jj)/e1u(ji,jj)                    & 
     
    465469                    &        / ( e1f(ji,jj) * e2f(ji,jj) ) 
    466470 
    467                  deltac(ji,jj) = sqrt(zddc**2+(zdtc**2+zds(ji,jj)**2)*usecc2) + creepl 
     471                 deltac(ji,jj) = SQRT(zddc**2+(zdtc**2+zds(ji,jj)**2)*usecc2) + creepl 
    468472 
    469473                 !-Calculate stress tensor component zs12 at corners (see section 3.5 of CICE user's guide). 
    470  
    471                  zs12(ji,jj) = ( zs12(ji,jj)                                                                            & 
    472                     &           -dtotel*((1.0-alphaevp)*ecc2*zs12(ji,jj)-zds(ji,jj)/(2.0*deltac(ji,jj))*zpreshc(ji,jj)))& 
    473                     &         /(1.0+alphaevp*ecc2*dtotel) 
    474  
    475               END DO 
    476            END DO 
     474                 zs12(ji,jj) = ( zs12(ji,jj)      & 
     475                    &        - dtotel*( (1.0-alphaevp)*ecc2*zs12(ji,jj) - zds(ji,jj) / & 
     476                    &          ( 2.0*deltac(ji,jj) ) * zpreshc(ji,jj))) & 
     477                    &         / ( 1.0 + alphaevp*ecc2*dtotel ) 
     478 
     479              END DO ! ji 
     480           END DO ! jj 
    477481 
    478482           CALL lbc_lnk( zs12(:,:), 'F', 1. ) 
     
    481485           DO jj = k_j1+1, k_jpj-1 
    482486              DO ji = 2, jpim1 
    483  
    484      ! 
    485      !- contribution of zs1, zs2 and zs12 to zf1 
    486      ! 
    487      !          (ji,jj) 
    488      !             | 
    489      !             | 
    490      !  (ji-1,jj)  |  (ji,jj) 
    491      !         ---------    
    492      !        |         | 
    493      !        | (ji,jj) |------(ji,jj) 
    494      !        |         | 
    495      !         ---------    
    496      !(ji-1,jj-1)     (ji,jj-1) 
    497      !  
    498  
    499                 zf1(ji,jj) = 0.5*( (zs1(ji+1,jj)-zs1(ji,jj))*e2u(ji,jj)                                         & 
    500                    &              +(zs2(ji+1,jj)*e2t(ji+1,jj)**2-zs2(ji,jj)*e2t(ji,jj)**2)/e2u(ji,jj)           & 
    501                    &              +2.0*(zs12(ji,jj)*e1f(ji,jj)**2-zs12(ji,jj-1)*e1f(ji,jj-1)**2)/e1u(ji,jj)     & 
    502                    &             )                                                                              & 
    503                    &            /(e1u(ji,jj)*e2u(ji,jj)) 
    504  
    505      !  
    506      !contribution of zs1, zs2 and zs12 to zf2 
    507      ! 
    508      !          (ji,jj) 
    509      !             | 
    510      !             | 
    511      !  (ji-1,jj)  |  (ji,jj) 
    512      !         ---------    
    513      !        |         | 
    514      !        | (ji,jj) |------(ji,jj) 
    515      !        |         | 
    516      !         ---------    
    517      !(ji-1,jj-1)     (ji,jj-1) 
    518      ! 
    519  
    520                 zf2(ji,jj) = 0.5*( (zs1(ji,jj+1)-zs1(ji,jj))*e1v(ji,jj)                                         & 
    521                    &              -(zs2(ji,jj+1)*e1t(ji,jj+1)**2-zs2(ji,jj)*e1t(ji,jj)**2)/e1v(ji,jj)           & 
    522                    &              +2.0*(zs12(ji,jj)*e2f(ji,jj)**2-zs12(ji-1,jj)*e2f(ji-1,jj)**2)/e2v(ji,jj)     & 
    523                    &             )                                                                              & 
    524                    &            /(e1v(ji,jj)*e2v(ji,jj)) 
    525  
     487                !- contribution of zs1, zs2 and zs12 to zf1 
     488                zf1(ji,jj) = 0.5*( (zs1(ji+1,jj)-zs1(ji,jj))*e2u(ji,jj) & 
     489                   &              +(zs2(ji+1,jj)*e2t(ji+1,jj)**2-zs2(ji,jj)*e2t(ji,jj)**2)/e2u(ji,jj) & 
     490                   &              +2.0*(zs12(ji,jj)*e1f(ji,jj)**2-zs12(ji,jj-1)*e1f(ji,jj-1)**2)/e1u(ji,jj) & 
     491                   &             ) / ( e1u(ji,jj)*e2u(ji,jj) ) 
     492                ! contribution of zs1, zs2 and zs12 to zf2 
     493                zf2(ji,jj) = 0.5*( (zs1(ji,jj+1)-zs1(ji,jj))*e1v(ji,jj) & 
     494                   &              -(zs2(ji,jj+1)*e1t(ji,jj+1)**2 - zs2(ji,jj)*e1t(ji,jj)**2)/e1v(ji,jj) & 
     495                   &              + 2.0*(zs12(ji,jj)*e2f(ji,jj)**2 -    & 
     496                                    zs12(ji-1,jj)*e2f(ji-1,jj)**2)/e2v(ji,jj) & 
     497                   &             ) / ( e1v(ji,jj)*e2v(ji,jj) ) 
    526498              END DO 
    527499           END DO 
     
    531503         ! Both the Coriolis term and the ice-ocean drag are solved semi-implicitly. 
    532504         ! 
    533            IF (mod(iter,2).eq.0) THEN  
     505           IF (MOD(iter,2).eq.0) THEN  
    534506 
    535507              DO jj = k_j1+1, k_jpj-1 
    536508                 DO ji = 2, jpim1 
    537          ! 
    538          !          (ji,jj) 
    539          !             | 
    540          !             | 
    541          !  (ji-1,jj)  |  (ji,jj) 
    542          !         ---------    
    543          !        |         | 
    544          !        | (ji,jj) |------(ji,jj) 
    545          !        |         | 
    546          !         ---------    
    547          !(ji-1,jj-1)     (ji,jj-1) 
    548          ! 
    549                     zmask        = (1.0-max(rzero,sign(rone,-zmass1(ji,jj))))*tmu(ji,jj) 
     509                    zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass1(ji,jj))))*tmu(ji,jj) 
    550510                    zsang        = SIGN ( 1.0 , fcor(ji,jj) ) * sangvg 
    551511                    z0           = zmass1(ji,jj)/dtevp 
     
    555515                      &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   & 
    556516                      &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj) 
    557                     za           = rhoco*sqrt((u_ice(ji,jj)-u_oce1(ji,jj))**2+(zv_ice1-v_oce1(ji,jj))**2)*(1.0-zfrld1(ji,jj)) 
    558                     zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj)) 
     517                    za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + & 
     518                                              (zv_ice1-v_oce1(ji,jj))**2) * (1.0-zfrld1(ji,jj)) 
     519                    zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + & 
     520                                   za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj)) 
    559521                    zcca         = z0+za*cangvg 
    560522                    zccb         = zcorl1(ji,jj)+za*zsang 
    561523                    u_ice(ji,jj) = (zr+zccb*zv_ice1)/(zcca+epsd)*zmask  
    562 !                   u_ice(ji,jj) = MAX( -1.0 , MIN( u_ice(ji,jj), 1.0 ) ) 
    563524 
    564525                 END DO 
     
    569530              DO jj = k_j1+1, k_jpj-1 
    570531                 DO ji = 2, jpim1 
    571          ! 
    572          !          (ji,jj) 
    573          !             | 
    574          !             | 
    575          !  (ji-1,jj)  |  (ji,jj) 
    576          !         ---------    
    577          !        |         | 
    578          !        | (ji,jj) |------(ji,jj) 
    579          !        |         | 
    580          !         ---------    
    581          !(ji-1,jj-1)     (ji,jj-1) 
    582          ! 
     532 
    583533                    zmask        = (1.0-max(rzero,sign(rone,-zmass2(ji,jj))))*tmv(ji,jj) 
    584534                    zsang        = sign(1.0,fcor(ji,jj))*sangvg 
     
    588538                &                 + (u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj))   & 
    589539                &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj) 
    590                     za           = rhoco*sqrt((zu_ice2-u_oce2(ji,jj))**2+(v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj)) 
    591                     zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj)) 
     540                    za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + &  
     541                                   (v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj)) 
     542                    zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + & 
     543                                   za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj)) 
    592544                    zcca         = z0+za*cangvg 
    593545                    zccb         = zcorl2(ji,jj)+za*zsang 
    594546                    v_ice(ji,jj) = (zr-zccb*zu_ice2)/(zcca+epsd)*zmask 
    595 !                   v_ice(ji,jj) = MAX( -1.0 , MIN( v_ice(ji,jj), 1.0 ) ) 
    596547 
    597548                 END DO 
     
    600551              CALL lbc_lnk( v_ice(:,:), 'V', -1. ) 
    601552 
    602            ELSE  
     553         ELSE  
    603554              DO jj = k_j1+1, k_jpj-1 
    604555                 DO ji = 2, jpim1 
    605          ! 
    606          !          (ji,jj) 
    607          !             | 
    608          !             | 
    609          !  (ji-1,jj)  |  (ji,jj) 
    610          !         ---------    
    611          !        |         | 
    612          !        | (ji,jj) |------(ji,jj) 
    613          !        |         | 
    614          !         ---------    
    615          !(ji-1,jj-1)     (ji,jj-1) 
    616          ! 
    617556                    zmask        = (1.0-max(rzero,sign(rone,-zmass2(ji,jj))))*tmv(ji,jj) 
    618557                    zsang        = sign(1.0,fcor(ji,jj))*sangvg 
     
    623562                       &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)    
    624563 
    625                     za           = rhoco*sqrt((zu_ice2-u_oce2(ji,jj))**2+(v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj)) 
    626                     zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj)) 
     564                    za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + & 
     565                                   (v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj)) 
     566                    zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + & 
     567                                   za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj)) 
    627568                    zcca         = z0+za*cangvg 
    628569                    zccb         = zcorl2(ji,jj)+za*zsang 
    629570                    v_ice(ji,jj) = (zr-zccb*zu_ice2)/(zcca+epsd)*zmask 
    630 !                   v_ice(ji,jj) = MAX( -1.0 , MIN( v_ice(ji,jj), 1.0 ) ) 
    631571 
    632572                 END DO 
     
    637577              DO jj = k_j1+1, k_jpj-1 
    638578                 DO ji = 2, jpim1 
    639          ! 
    640          !          (ji,jj) 
    641          !             | 
    642          !             | 
    643          !  (ji-1,jj)  |  (ji,jj) 
    644          !         ---------    
    645          !        |         | 
    646          !        | (ji,jj) |------(ji,jj) 
    647          !        |         | 
    648          !         ---------    
    649          ! (ji-1,jj-1)     (ji,jj-1) 
    650          ! 
    651  
    652                     zmask        = (1.0-max(rzero,sign(rone,-zmass1(ji,jj))))*tmu(ji,jj) 
    653                     zsang        = sign(1.0,fcor(ji,jj))*sangvg 
     579                    zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass1(ji,jj))))*tmu(ji,jj) 
     580                    zsang        = SIGN(1.0,fcor(ji,jj))*sangvg 
    654581                    z0           = zmass1(ji,jj)/dtevp 
    655582                    ! SB modif because ocean has no slip boundary condition 
     
    658585                       &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj) 
    659586     
    660                     za           = rhoco*sqrt((u_ice(ji,jj)-u_oce1(ji,jj))**2+(zv_ice1-v_oce1(ji,jj))**2)*(1.0-zfrld1(ji,jj)) 
    661                     zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj)) 
     587                    za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + & 
     588                                   (zv_ice1-v_oce1(ji,jj))**2)*(1.0-zfrld1(ji,jj)) 
     589                    zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + & 
     590                                   za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj)) 
    662591                    zcca         = z0+za*cangvg 
    663592                    zccb         = zcorl1(ji,jj)+za*zsang 
    664593                    u_ice(ji,jj) = (zr+zccb*zv_ice1)/(zcca+epsd)*zmask  
    665 !                   u_ice(ji,jj) = MAX( -1.0 , MIN( u_ice(ji,jj), 1.0 ) ) 
    666  
    667                  END DO 
    668               END DO 
     594                 END DO ! ji 
     595              END DO ! jj 
    669596 
    670597              CALL lbc_lnk( u_ice(:,:), 'U', -1. ) 
    671598 
    672            ENDIF 
    673  
    674            !---  Convergence test. 
    675            DO jj = k_j1+1 , k_jpj-1 
    676               zresr(:,jj) = MAX( ABS( u_ice(:,jj) - zu_ice(:,jj) ) ,           & 
    677                             ABS( v_ice(:,jj) - zv_ice(:,jj) ) ) 
    678            END DO 
    679            zresm = MAXVAL( zresr( 1:jpi , k_j1+1:k_jpj-1 ) ) 
    680  
    681            !------------------------------------------- 
    682            ! Compute dynamical inputs of the itd model 
    683            !------------------------------------------- 
    684            ! Mean over all iterations 
    685  
    686       !    IF ( stress_mean_swi .EQ. 1 ) THEN 
    687       !       DO jj = k_j1+1, k_jpj-1 
    688       !          DO ji = 2, jpim1 
    689       !             divu_i(ji,jj) = divu_i(ji,jj) + zdd(ji,jj) / nevp 
    690       !             delta_i(ji,jj) = delta_i(ji,jj) + deltat (ji,jj) / nevp  
    691       !             shear_i(ji,jj) = shear_i(ji,jj) + zds (ji,jj) / nevp  
    692       !          END DO 
    693       !       END DO 
    694       !    ENDIF 
     599      ENDIF  
     600 
     601      !---  Convergence test. 
     602      DO jj = k_j1+1 , k_jpj-1 
     603         zresr(:,jj) = MAX( ABS( u_ice(:,jj) - zu_ice(:,jj) ) ,           & 
     604                       ABS( v_ice(:,jj) - zv_ice(:,jj) ) ) 
     605      END DO 
     606      zresm = MAXVAL( zresr( 1:jpi , k_j1+1:k_jpj-1 ) ) 
    695607 
    696608      !                                                   ! ==================== ! 
     
    698610      !                                                   ! ==================== ! 
    699611 
    700       !------------------------- 
    701       ! Prevent high velocities 
    702       !------------------------- 
     612! 
     613!------------------------------------------------------------------------------! 
     614! 4) Prevent ice velocities when the ice is thin 
     615!------------------------------------------------------------------------------! 
     616! 
    703617      ! If the ice thickness is below 1cm then ice velocity should equal the 
    704       ! ocean velocity 
     618      ! ocean velocity,  
     619      ! This prevents high velocity when ice is thin 
    705620      DO jj = k_j1+1, k_jpj-1 
    706621         DO ji = 2, jpim1 
     
    713628         END DO 
    714629      END DO 
    715  
     630! 
     631!------------------------------------------------------------------------------! 
     632! 5) Compute stress rain invariants and store strain tensor 
     633!------------------------------------------------------------------------------! 
     634! 
     635      ! Compute delta, shear and div, inputs for mechanical redistribution  
    716636      DO jj = k_j1+1, k_jpj-1 
    717637         DO ji = 2, jpim1 
    718             ! Recompute stress tensor invariants 
    719638            !- zdd(:,:), zdt(:,:): divergence and tension at centre  
    720             !  of grid cells 
    721639            !- zds(:,:): shear on northeast corner of grid cells 
    722  
    723640            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) )  
    724641            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 ) 
     
    782699      END DO !ji 
    783700 
    784       ! dynamical invariants 
     701! MV This should be removed as it is the same as previous lines 
     702!     ! dynamical invariants 
    785703!     IF ( stress_mean_swi .EQ. 0 ) THEN 
     704! the following should not be necessary 
    786705         DO jj = k_j1+1, k_jpj-1 
    787706            DO ji = 2, jpim1 
     
    797716      CALL lbc_lnk( shear_i(:,:), 'F', 1. ) 
    798717 
    799       IF(ln_ctl) THEN 
    800          WRITE(charout,FMT="('lim_rhg  : res =',D23.16, ' iter =',I4)") zresm, jter 
    801          CALL prt_ctl_info(charout) 
    802          CALL prt_ctl(tab2d_1=u_ice, clinfo1=' lim_rhg  : u_ice :', tab2d_2=v_ice, clinfo2=' v_ice :') 
    803       ENDIF 
    804  
    805       ! Stress tensor 
     718 
     719      ! Store the stress tensor for next time step 
     720      ! this accelerates convergence and improves stability 
    806721      IF ( stress_mean_swi .EQ. 1 ) THEN 
    807722         DO jj = k_j1+1, k_jpj-1 
     
    814729      ENDIF 
    815730 
    816       !Ice internal stresses 
     731      ! Lateral boundary condition 
    817732      CALL lbc_lnk( stress1_i(:,:), 'T', 1. ) 
    818733      CALL lbc_lnk( stress2_i(:,:), 'T', 1. ) 
    819734      CALL lbc_lnk( stress12_i(:,:), 'F', 1. ) 
    820735  
    821       !------------------------ 
    822       ! Write charge ellipse 
    823       !------------------------ 
    824  
     736! 
     737!------------------------------------------------------------------------------! 
     738! 6) Control prints of residual and charge ellipse 
     739!------------------------------------------------------------------------------! 
     740! 
     741      ! print the residual for convergence 
     742      IF(ln_ctl) THEN 
     743         WRITE(charout,FMT="('lim_rhg  : res =',D23.16, ' iter =',I4)") zresm, iter 
     744         CALL prt_ctl_info(charout) 
     745         CALL prt_ctl(tab2d_1=u_ice, clinfo1=' lim_rhg  : u_ice :', tab2d_2=v_ice, clinfo2=' v_ice :') 
     746      ENDIF 
     747 
     748      ! print charge ellipse 
     749      ! This can be desactivated once the user is sure that the stress state 
     750      ! lie on the charge ellipse. See Bouillon et al. 08 for more details 
    825751      IF(ln_ctl) THEN 
    826752         CALL prt_ctl_info('lim_rhg  : numit  :',ivar1=numit) 
Note: See TracChangeset for help on using the changeset viewer.