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.
limrhg.F90 in branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90 @ 3773

Last change on this file since 3773 was 3558, checked in by rblod, 12 years ago

Fix issues when using key_nosignedzeo, see ticket #996

  • Property svn:keywords set to Id
File size: 37.9 KB
Line 
1MODULE limrhg
2   !!======================================================================
3   !!                     ***  MODULE  limrhg  ***
4   !!   Ice rheology : sea ice rheology
5   !!======================================================================
6   !! History :   -   !  2007-03  (M.A. Morales Maqueda, S. Bouillon) Original code
7   !!            3.0  !  2008-03  (M. Vancoppenolle) LIM3
8   !!             -   !  2008-11  (M. Vancoppenolle, S. Bouillon, Y. Aksenov) add surface tilt in ice rheolohy
9   !!            3.3  !  2009-05  (G.Garric) addition of the lim2_evp cas
10   !!            4.0  !  2011-01  (A Porter)  dynamical allocation
11   !!----------------------------------------------------------------------
12#if defined key_lim3 || (  defined key_lim2 && ! defined key_lim2_vp )
13   !!----------------------------------------------------------------------
14   !!   'key_lim3'               OR                     LIM-3 sea-ice model
15   !!   'key_lim2' AND NOT 'key_lim2_vp'            EVP LIM-2 sea-ice model
16   !!----------------------------------------------------------------------
17   !!   lim_rhg   : computes ice velocities
18   !!----------------------------------------------------------------------
19   USE phycst           ! Physical constant
20   USE par_oce          ! Ocean parameters
21   USE dom_oce          ! Ocean domain
22   USE sbc_oce          ! Surface boundary condition: ocean fields
23   USE sbc_ice          ! Surface boundary condition: ice fields
24   USE lbclnk           ! Lateral Boundary Condition / MPP link
25   USE lib_mpp          ! MPP library
26   USE wrk_nemo         ! work arrays
27   USE in_out_manager   ! I/O manager
28   USE prtctl           ! Print control
29   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
30#if defined key_lim3
31   USE ice              ! LIM-3: ice variables
32   USE dom_ice          ! LIM-3: ice domain
33   USE limitd_me        ! LIM-3:
34#else
35   USE ice_2            ! LIM2: ice variables
36   USE dom_ice_2        ! LIM2: ice domain
37#endif
38
39   IMPLICIT NONE
40   PRIVATE
41
42   PUBLIC   lim_rhg        ! routine called by lim_dyn (or lim_dyn_2)
43
44   REAL(wp) ::   rzero   = 0._wp   ! constant values
45   REAL(wp) ::   rone    = 1._wp   ! constant values
46     
47   !! * Substitutions
48#  include "vectopt_loop_substitute.h90"
49   !!----------------------------------------------------------------------
50   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
51   !! $Id$
52   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
53   !!----------------------------------------------------------------------
54CONTAINS
55
56   SUBROUTINE lim_rhg( k_j1, k_jpj )
57      !!-------------------------------------------------------------------
58      !!                 ***  SUBROUTINE lim_rhg  ***
59      !!                          EVP-C-grid
60      !!
61      !! ** purpose : determines sea ice drift from wind stress, ice-ocean
62      !!  stress and sea-surface slope. Ice-ice interaction is described by
63      !!  a non-linear elasto-viscous-plastic (EVP) law including shear
64      !!  strength and a bulk rheology (Hunke and Dukowicz, 2002).   
65      !!
66      !!  The points in the C-grid look like this, dear reader
67      !!
68      !!                              (ji,jj)
69      !!                                 |
70      !!                                 |
71      !!                      (ji-1,jj)  |  (ji,jj)
72      !!                             ---------   
73      !!                            |         |
74      !!                            | (ji,jj) |------(ji,jj)
75      !!                            |         |
76      !!                             ---------   
77      !!                     (ji-1,jj-1)     (ji,jj-1)
78      !!
79      !! ** Inputs  : - wind forcing (stress), oceanic currents
80      !!                ice total volume (vt_i) per unit area
81      !!                snow total volume (vt_s) per unit area
82      !!
83      !! ** Action  : - compute u_ice, v_ice : the components of the
84      !!                sea-ice velocity vector
85      !!              - compute delta_i, shear_i, divu_i, which are inputs
86      !!                of the ice thickness distribution
87      !!
88      !! ** Steps   : 1) Compute ice snow mass, ice strength
89      !!              2) Compute wind, oceanic stresses, mass terms and
90      !!                 coriolis terms of the momentum equation
91      !!              3) Solve the momentum equation (iterative procedure)
92      !!              4) Prevent high velocities if the ice is thin
93      !!              5) Recompute invariants of the strain rate tensor
94      !!                 which are inputs of the ITD, store stress
95      !!                 for the next time step
96      !!              6) Control prints of residual (convergence)
97      !!                 and charge ellipse.
98      !!                 The user should make sure that the parameters
99      !!                 nevp, telast and creepl maintain stress state
100      !!                 on the charge ellipse for plastic flow
101      !!                 e.g. in the Canadian Archipelago
102      !!
103      !! References : Hunke and Dukowicz, JPO97
104      !!              Bouillon et al., Ocean Modelling 2009
105      !!              Vancoppenolle et al., Ocean Modelling 2008
106      !!-------------------------------------------------------------------
107      INTEGER, INTENT(in) ::   k_j1    ! southern j-index for ice computation
108      INTEGER, INTENT(in) ::   k_jpj   ! northern j-index for ice computation
109      !!
110      INTEGER ::   ji, jj   ! dummy loop indices
111      INTEGER ::   jter     ! local integers
112      CHARACTER (len=50) ::   charout
113      REAL(wp) ::   zt11, zt12, zt21, zt22, ztagnx, ztagny, delta                         !
114      REAL(wp) ::   za, zstms, zsang, zmask   ! local scalars
115
116      REAL(wp) ::   dtevp              ! time step for subcycling
117      REAL(wp) ::   dtotel, ecc2       ! square of yield ellipse eccenticity
118      REAL(wp) ::   z0, zr, zcca, zccb ! temporary scalars
119      REAL(wp) ::   zu_ice2, zv_ice1   !
120      REAL(wp) ::   zddc, zdtc, zdst   ! delta on corners and on centre
121      REAL(wp) ::   zdsshx, zdsshy     ! term for the gradient of ocean surface
122      REAL(wp) ::   sigma1, sigma2     ! internal ice stress
123
124      REAL(wp) ::   zresm         ! Maximal error on ice velocity
125      REAL(wp) ::   zindb         ! ice (1) or not (0)     
126      REAL(wp) ::   zdummy        ! dummy argument
127
128      REAL(wp), POINTER, DIMENSION(:,:) ::   zpresh           ! temporary array for ice strength
129      REAL(wp), POINTER, DIMENSION(:,:) ::   zpreshc          ! Ice strength on grid cell corners (zpreshc)
130      REAL(wp), POINTER, DIMENSION(:,:) ::   zfrld1, zfrld2   ! lead fraction on U/V points
131      REAL(wp), POINTER, DIMENSION(:,:) ::   zmass1, zmass2   ! ice/snow mass on U/V points
132      REAL(wp), POINTER, DIMENSION(:,:) ::   zcorl1, zcorl2   ! coriolis parameter on U/V points
133      REAL(wp), POINTER, DIMENSION(:,:) ::   za1ct , za2ct    ! temporary arrays
134      REAL(wp), POINTER, DIMENSION(:,:) ::   zc1              ! ice mass
135      REAL(wp), POINTER, DIMENSION(:,:) ::   zusw             ! temporary weight for ice strength computation
136      REAL(wp), POINTER, DIMENSION(:,:) ::   u_oce1, v_oce1   ! ocean u/v component on U points                           
137      REAL(wp), POINTER, DIMENSION(:,:) ::   u_oce2, v_oce2   ! ocean u/v component on V points
138      REAL(wp), POINTER, DIMENSION(:,:) ::   u_ice2, v_ice1   ! ice u/v component on V/U point
139      REAL(wp), POINTER, DIMENSION(:,:) ::   zf1   , zf2      ! arrays for internal stresses
140     
141      REAL(wp), POINTER, DIMENSION(:,:) ::   zdd   , zdt      ! Divergence and tension at centre of grid cells
142      REAL(wp), POINTER, DIMENSION(:,:) ::   zds              ! Shear on northeast corner of grid cells
143      REAL(wp), POINTER, DIMENSION(:,:) ::   deltat, deltac   ! Delta at centre and corners of grid cells
144      REAL(wp), POINTER, DIMENSION(:,:) ::   zs1   , zs2      ! Diagonal stress tensor components zs1 and zs2
145      REAL(wp), POINTER, DIMENSION(:,:) ::   zs12             ! Non-diagonal stress tensor component zs12
146      REAL(wp), POINTER, DIMENSION(:,:) ::   zu_ice, zv_ice, zresr   ! Local error on velocity
147     
148      !!-------------------------------------------------------------------
149
150      CALL wrk_alloc( jpi,jpj, zpresh, zfrld1, zmass1, zcorl1, za1ct , zpreshc, zfrld2, zmass2, zcorl2, za2ct )
151      CALL wrk_alloc( jpi,jpj, zc1   , u_oce1, u_oce2, u_ice2, zusw  , v_oce1 , v_oce2, v_ice1                )
152      CALL wrk_alloc( jpi,jpj, zf1   , deltat, zu_ice, zf2   , deltac, zv_ice , zdd   , zdt    , zds          )
153      CALL wrk_alloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr                         )
154
155#if  defined key_lim2 && ! defined key_lim2_vp
156# if defined key_agrif
157     USE ice_2, vt_s => hsnm
158     USE ice_2, vt_i => hicm
159# else
160     vt_s => hsnm
161     vt_i => hicm
162# endif
163     at_i(:,:) = 1. - frld(:,:)
164#endif
165      !
166      !------------------------------------------------------------------------------!
167      ! 1) Ice-Snow mass (zc1), ice strength (zpresh)                                !
168      !------------------------------------------------------------------------------!
169      !
170      ! Put every vector to 0
171      zpresh (:,:) = 0._wp   ;   zc1   (:,:) = 0._wp
172      zpreshc(:,:) = 0._wp
173      u_ice2 (:,:) = 0._wp   ;   v_ice1(:,:) = 0._wp
174      zdd    (:,:) = 0._wp   ;   zdt   (:,:) = 0._wp   ;   zds(:,:) = 0._wp
175
176#if defined key_lim3
177      CALL lim_itd_me_icestrength( ridge_scheme_swi )      ! LIM-3: Ice strength on T-points
178#endif
179
180!CDIR NOVERRCHK
181      DO jj = k_j1 , k_jpj       ! Ice mass and temp variables
182!CDIR NOVERRCHK
183         DO ji = 1 , jpi
184            zc1(ji,jj)    = tms(ji,jj) * ( rhosn * vt_s(ji,jj) + rhoic * vt_i(ji,jj) )
185#if defined key_lim3
186            zpresh(ji,jj) = tms(ji,jj) *  strength(ji,jj) * 0.5_wp
187#endif
188#if defined key_lim2
189            zpresh(ji,jj) = tms(ji,jj) *  pstar * vt_i(ji,jj) * EXP( -c_rhg * (1. - at_i(ji,jj) ) )
190#endif
191            ! tmi = 1 where there is ice or on land
192            tmi(ji,jj)    = 1._wp - ( 1._wp - MAX( 0._wp , SIGN ( 1._wp , vt_i(ji,jj) - epsd ) ) ) * tms(ji,jj)
193         END DO
194      END DO
195
196      ! Ice strength on grid cell corners (zpreshc)
197      ! needed for calculation of shear stress
198!CDIR NOVERRCHK
199      DO jj = k_j1+1, k_jpj-1
200!CDIR NOVERRCHK
201         DO ji = 2, jpim1 !RB caution no fs_ (ji+1,jj+1)
202            zstms          =  tms(ji+1,jj+1) * wght(ji+1,jj+1,2,2) + &
203               &              tms(ji,jj+1)   * wght(ji+1,jj+1,1,2) + &
204               &              tms(ji+1,jj)   * wght(ji+1,jj+1,2,1) + &
205               &              tms(ji,jj)     * wght(ji+1,jj+1,1,1)
206            zusw(ji,jj)    = 1.0 / MAX( zstms, epsd )
207            zpreshc(ji,jj) = (  zpresh(ji+1,jj+1) * wght(ji+1,jj+1,2,2) + &
208               &                zpresh(ji,jj+1)   * wght(ji+1,jj+1,1,2) + &
209               &                zpresh(ji+1,jj)   * wght(ji+1,jj+1,2,1) + & 
210               &                zpresh(ji,jj)     * wght(ji+1,jj+1,1,1)   &
211               &             ) * zusw(ji,jj)
212         END DO
213      END DO
214
215      CALL lbc_lnk( zpreshc(:,:), 'F', 1. )
216      !
217      !------------------------------------------------------------------------------!
218      ! 2) Wind / ocean stress, mass terms, coriolis terms
219      !------------------------------------------------------------------------------!
220      !
221      !  Wind stress, coriolis and mass terms on the sides of the squares       
222      !  zfrld1: lead fraction on U-points                                     
223      !  zfrld2: lead fraction on V-points                                     
224      !  zmass1: ice/snow mass on U-points                                   
225      !  zmass2: ice/snow mass on V-points                                   
226      !  zcorl1: Coriolis parameter on U-points                             
227      !  zcorl2: Coriolis parameter on V-points                           
228      !  (ztagnx,ztagny): wind stress on U/V points                       
229      !  u_oce1: ocean u component on u points                           
230      !  v_oce1: ocean v component on u points                         
231      !  u_oce2: ocean u component on v points                         
232      !  v_oce2: ocean v component on v points                       
233
234      DO jj = k_j1+1, k_jpj-1
235         DO ji = fs_2, fs_jpim1
236
237            zt11 = tms(ji  ,jj) * e1t(ji  ,jj)
238            zt12 = tms(ji+1,jj) * e1t(ji+1,jj)
239            zt21 = tms(ji,jj  ) * e2t(ji,jj  )
240            zt22 = tms(ji,jj+1) * e2t(ji,jj+1)
241
242            ! Leads area.
243            zfrld1(ji,jj) = ( zt12 * ( 1.0 - at_i(ji,jj) ) + zt11 * ( 1.0 - at_i(ji+1,jj) ) ) / ( zt11 + zt12 + epsd )
244            zfrld2(ji,jj) = ( zt22 * ( 1.0 - at_i(ji,jj) ) + zt21 * ( 1.0 - at_i(ji,jj+1) ) ) / ( zt21 + zt22 + epsd )
245
246            ! Mass, coriolis coeff. and currents
247            zmass1(ji,jj) = ( zt12*zc1(ji,jj) + zt11*zc1(ji+1,jj) ) / (zt11+zt12+epsd)
248            zmass2(ji,jj) = ( zt22*zc1(ji,jj) + zt21*zc1(ji,jj+1) ) / (zt21+zt22+epsd)
249            zcorl1(ji,jj) = zmass1(ji,jj) * ( e1t(ji+1,jj)*fcor(ji,jj) + e1t(ji,jj)*fcor(ji+1,jj) )   &
250               &                          / ( e1t(ji,jj) + e1t(ji+1,jj) + epsd )
251            zcorl2(ji,jj) = zmass2(ji,jj) * ( e2t(ji,jj+1)*fcor(ji,jj) + e2t(ji,jj)*fcor(ji,jj+1) )   &
252               &                          / ( e2t(ji,jj+1) + e2t(ji,jj) + epsd )
253            !
254            u_oce1(ji,jj)  = u_oce(ji,jj)
255            v_oce2(ji,jj)  = v_oce(ji,jj)
256
257            ! Ocean has no slip boundary condition
258            v_oce1(ji,jj)  = 0.5*( (v_oce(ji,jj)+v_oce(ji,jj-1))*e1t(ji,jj)    &
259               &                 +(v_oce(ji+1,jj)+v_oce(ji+1,jj-1))*e1t(ji+1,jj)) &
260               &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj) 
261
262            u_oce2(ji,jj)  = 0.5*((u_oce(ji,jj)+u_oce(ji-1,jj))*e2t(ji,jj)     &
263               &                 +(u_oce(ji,jj+1)+u_oce(ji-1,jj+1))*e2t(ji,jj+1)) &
264               &                / (e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
265
266            ! Wind stress at U,V-point
267            ztagnx = ( 1. - zfrld1(ji,jj) ) * utau_ice(ji,jj)
268            ztagny = ( 1. - zfrld2(ji,jj) ) * vtau_ice(ji,jj)
269
270            ! Computation of the velocity field taking into account the ice internal interaction.
271            ! Terms that are independent of the velocity field.
272
273            ! SB On utilise maintenant le gradient de la pente de l'ocean
274            ! include it later
275
276            zdsshx =  ( ssh_m(ji+1,jj) - ssh_m(ji,jj) ) / e1u(ji,jj)
277            zdsshy =  ( ssh_m(ji,jj+1) - ssh_m(ji,jj) ) / e2v(ji,jj)
278
279            za1ct(ji,jj) = ztagnx - zmass1(ji,jj) * grav * zdsshx
280            za2ct(ji,jj) = ztagny - zmass2(ji,jj) * grav * zdsshy
281
282         END DO
283      END DO
284
285      !
286      !------------------------------------------------------------------------------!
287      ! 3) Solution of the momentum equation, iterative procedure
288      !------------------------------------------------------------------------------!
289      !
290      ! Time step for subcycling
291      dtevp  = rdt_ice / nevp
292      dtotel = dtevp / ( 2._wp * telast )
293
294      !-ecc2: square of yield ellipse eccenticrity (reminder: must become a namelist parameter)
295      ecc2 = ecc * ecc
296
297      !-Initialise stress tensor
298      zs1 (:,:) = stress1_i (:,:) 
299      zs2 (:,:) = stress2_i (:,:)
300      zs12(:,:) = stress12_i(:,:)
301
302      !                                               !----------------------!
303      DO jter = 1 , nevp                              !    loop over jter    !
304         !                                            !----------------------!       
305         DO jj = k_j1, k_jpj-1
306            zu_ice(:,jj) = u_ice(:,jj)    ! velocity at previous time step
307            zv_ice(:,jj) = v_ice(:,jj)
308         END DO
309
310         DO jj = k_j1+1, k_jpj-1
311            DO ji = fs_2, jpim1   !RB bug no vect opt due to tmi
312
313               
314               !- Divergence, tension and shear (Section a. Appendix B of Hunke & Dukowicz, 2002)
315               !- zdd(:,:), zdt(:,:): divergence and tension at centre of grid cells
316               !- zds(:,:): shear on northeast corner of grid cells
317               !
318               !- IMPORTANT REMINDER: Dear Gurvan, note that, the way these terms are coded,
319               !                      there are many repeated calculations.
320               !                      Speed could be improved by regrouping terms. For
321               !                      the moment, however, the stress is on clarity of coding to avoid
322               !                      bugs (Martin, for Miguel).
323               !
324               !- ALSO: arrays zdd, zdt, zds and delta could
325               !  be removed in the future to minimise memory demand.
326               !
327               !- MORE NOTES: Note that we are calculating deformation rates and stresses on the corners of
328               !              grid cells, exactly as in the B grid case. For simplicity, the indexation on
329               !              the corners is the same as in the B grid.
330               !
331               !
332               zdd(ji,jj) = ( e2u(ji,jj)*u_ice(ji,jj)                      &
333                  &          -e2u(ji-1,jj)*u_ice(ji-1,jj)                  &
334                  &          +e1v(ji,jj)*v_ice(ji,jj)                      &
335                  &          -e1v(ji,jj-1)*v_ice(ji,jj-1)                  &
336                  &          )                                             &
337                  &         / area(ji,jj)
338
339               zdt(ji,jj) = ( ( u_ice(ji,jj)/e2u(ji,jj)                    &
340                  &            -u_ice(ji-1,jj)/e2u(ji-1,jj)                &
341                  &           )*e2t(ji,jj)*e2t(ji,jj)                      &
342                  &          -( v_ice(ji,jj)/e1v(ji,jj)                    &
343                  &            -v_ice(ji,jj-1)/e1v(ji,jj-1)                &
344                  &           )*e1t(ji,jj)*e1t(ji,jj)                      &
345                  &         )                                              &
346                  &        / area(ji,jj)
347
348               !
349               zds(ji,jj) = ( ( u_ice(ji,jj+1)/e1u(ji,jj+1)                &
350                  &            -u_ice(ji,jj)/e1u(ji,jj)                    &
351                  &           )*e1f(ji,jj)*e1f(ji,jj)                      &
352                  &          +( v_ice(ji+1,jj)/e2v(ji+1,jj)                &
353                  &            -v_ice(ji,jj)/e2v(ji,jj)                    &
354                  &           )*e2f(ji,jj)*e2f(ji,jj)                      &
355                  &         )                                              &
356                  &        / ( e1f(ji,jj) * e2f(ji,jj) ) * ( 2.0 - tmf(ji,jj) ) &
357                  &        * tmi(ji,jj) * tmi(ji,jj+1)                     &
358                  &        * tmi(ji+1,jj) * tmi(ji+1,jj+1)
359
360
361               v_ice1(ji,jj)  = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)   &
362                  &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj)) &
363                  &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj) 
364
365               u_ice2(ji,jj)  = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)   &
366                  &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj)) &
367                  &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
368
369            END DO
370         END DO
371         CALL lbc_lnk( v_ice1, 'U', -1. )   ;   CALL lbc_lnk( u_ice2, 'V', -1. )      ! lateral boundary cond.
372
373!CDIR NOVERRCHK
374         DO jj = k_j1+1, k_jpj-1
375!CDIR NOVERRCHK
376            DO ji = fs_2, fs_jpim1
377
378               !- Calculate Delta at centre of grid cells
379               zdst       = (  e2u(ji  , jj) * v_ice1(ji  ,jj)          &
380                  &          - e2u(ji-1, jj) * v_ice1(ji-1,jj)          &
381                  &          + e1v(ji, jj  ) * u_ice2(ji,jj  )          &
382                  &          - e1v(ji, jj-1) * u_ice2(ji,jj-1)          &
383                  &          )                                          &
384                  &         / area(ji,jj)
385
386               delta = SQRT( zdd(ji,jj)*zdd(ji,jj) + ( zdt(ji,jj)*zdt(ji,jj) + zdst*zdst ) * usecc2 ) 
387               deltat(ji,jj) = MAX( SQRT(zdd(ji,jj)**2 + (zdt(ji,jj)**2 + zdst**2)*usecc2), creepl )
388
389               !-Calculate stress tensor components zs1 and zs2
390               !-at centre of grid cells (see section 3.5 of CICE user's guide).
391               zs1(ji,jj) = ( zs1(ji,jj) &
392                  &          - dtotel*( ( 1.0 - alphaevp) * zs1(ji,jj) +    &
393                  &            ( delta / deltat(ji,jj) - zdd(ji,jj) / deltat(ji,jj) ) &
394                  * zpresh(ji,jj) ) )                          &       
395                  &        / ( 1.0 + alphaevp * dtotel )
396
397               zs2(ji,jj) = ( zs2(ji,jj)   &
398                  &          - dtotel*((1.0-alphaevp)*ecc2*zs2(ji,jj) -  &
399                  zdt(ji,jj)/deltat(ji,jj)*zpresh(ji,jj)) ) &
400                  &        / ( 1.0 + alphaevp*ecc2*dtotel )
401
402            END DO
403         END DO
404
405         CALL lbc_lnk( zs1(:,:), 'T', 1. )
406         CALL lbc_lnk( zs2(:,:), 'T', 1. )
407
408!CDIR NOVERRCHK
409         DO jj = k_j1+1, k_jpj-1
410!CDIR NOVERRCHK
411            DO ji = fs_2, fs_jpim1
412               !- Calculate Delta on corners
413               zddc  =      ( ( v_ice1(ji,jj+1)/e1u(ji,jj+1)                &
414                  &            -v_ice1(ji,jj)/e1u(ji,jj)                    &
415                  &           )*e1f(ji,jj)*e1f(ji,jj)                       &
416                  &          +( u_ice2(ji+1,jj)/e2v(ji+1,jj)                &
417                  &            -u_ice2(ji,jj)/e2v(ji,jj)                    &
418                  &           )*e2f(ji,jj)*e2f(ji,jj)                       &
419                  &         )                                               &
420                  &        / ( e1f(ji,jj) * e2f(ji,jj) )
421
422               zdtc  =      (-( v_ice1(ji,jj+1)/e1u(ji,jj+1)                &
423                  &            -v_ice1(ji,jj)/e1u(ji,jj)                    &
424                  &           )*e1f(ji,jj)*e1f(ji,jj)                       &
425                  &          +( u_ice2(ji+1,jj)/e2v(ji+1,jj)                &
426                  &            -u_ice2(ji,jj)/e2v(ji,jj)                    &
427                  &           )*e2f(ji,jj)*e2f(ji,jj)                       &
428                  &         )                                               &
429                  &        / ( e1f(ji,jj) * e2f(ji,jj) )
430
431               deltac(ji,jj) = SQRT(zddc**2+(zdtc**2+zds(ji,jj)**2)*usecc2) + creepl
432
433               !-Calculate stress tensor component zs12 at corners (see section 3.5 of CICE user's guide).
434               zs12(ji,jj) = ( zs12(ji,jj)      &
435                  &        - dtotel*( (1.0-alphaevp)*ecc2*zs12(ji,jj) - zds(ji,jj) / &
436                  &          ( 2.0*deltac(ji,jj) ) * zpreshc(ji,jj))) &
437                  &         / ( 1.0 + alphaevp*ecc2*dtotel ) 
438
439            END DO ! ji
440         END DO ! jj
441
442         CALL lbc_lnk( zs12(:,:), 'F', 1. )
443
444         ! Ice internal stresses (Appendix C of Hunke and Dukowicz, 2002)
445         DO jj = k_j1+1, k_jpj-1
446            DO ji = fs_2, fs_jpim1
447               !- contribution of zs1, zs2 and zs12 to zf1
448               zf1(ji,jj) = 0.5*( (zs1(ji+1,jj)-zs1(ji,jj))*e2u(ji,jj) &
449                  &              +(zs2(ji+1,jj)*e2t(ji+1,jj)**2-zs2(ji,jj)*e2t(ji,jj)**2)/e2u(ji,jj) &
450                  &              +2.0*(zs12(ji,jj)*e1f(ji,jj)**2-zs12(ji,jj-1)*e1f(ji,jj-1)**2)/e1u(ji,jj) &
451                  &             ) / ( e1u(ji,jj)*e2u(ji,jj) )
452               ! contribution of zs1, zs2 and zs12 to zf2
453               zf2(ji,jj) = 0.5*( (zs1(ji,jj+1)-zs1(ji,jj))*e1v(ji,jj) &
454                  &              -(zs2(ji,jj+1)*e1t(ji,jj+1)**2 - zs2(ji,jj)*e1t(ji,jj)**2)/e1v(ji,jj) &
455                  &              + 2.0*(zs12(ji,jj)*e2f(ji,jj)**2 -    &
456                  zs12(ji-1,jj)*e2f(ji-1,jj)**2)/e2v(ji,jj) &
457                  &             ) / ( e1v(ji,jj)*e2v(ji,jj) )
458            END DO
459         END DO
460         !
461         ! Computation of ice velocity
462         !
463         ! Both the Coriolis term and the ice-ocean drag are solved semi-implicitly.
464         !
465         IF (MOD(jter,2).eq.0) THEN 
466
467!CDIR NOVERRCHK
468            DO jj = k_j1+1, k_jpj-1
469!CDIR NOVERRCHK
470               DO ji = fs_2, fs_jpim1
471                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass1(ji,jj))))*tmu(ji,jj)
472                  zsang        = SIGN ( 1.0 , fcor(ji,jj) ) * sangvg
473                  z0           = zmass1(ji,jj)/dtevp
474
475                  ! SB modif because ocean has no slip boundary condition
476                  zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji,jj)         &
477                     &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji+1,jj))   &
478                     &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
479                  za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + &
480                     (zv_ice1-v_oce1(ji,jj))**2) * (1.0-zfrld1(ji,jj))
481                  zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + &
482                     za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj))
483                  zcca         = z0+za*cangvg
484                  zccb         = zcorl1(ji,jj)+za*zsang
485                  u_ice(ji,jj) = (zr+zccb*zv_ice1)/(zcca+epsd)*zmask 
486
487               END DO
488            END DO
489
490            CALL lbc_lnk( u_ice(:,:), 'U', -1. )
491
492!CDIR NOVERRCHK
493            DO jj = k_j1+1, k_jpj-1
494!CDIR NOVERRCHK
495               DO ji = fs_2, fs_jpim1
496
497                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass2(ji,jj))))*tmv(ji,jj)
498                  zsang        = SIGN(1.0,fcor(ji,jj))*sangvg
499                  z0           = zmass2(ji,jj)/dtevp
500                  ! SB modif because ocean has no slip boundary condition
501                  zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj)     &
502                     &                 + (u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj+1))   &
503                     &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
504                  za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + & 
505                     (v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj))
506                  zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + &
507                     za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj))
508                  zcca         = z0+za*cangvg
509                  zccb         = zcorl2(ji,jj)+za*zsang
510                  v_ice(ji,jj) = (zr-zccb*zu_ice2)/(zcca+epsd)*zmask
511
512               END DO
513            END DO
514
515            CALL lbc_lnk( v_ice(:,:), 'V', -1. )
516
517         ELSE 
518!CDIR NOVERRCHK
519            DO jj = k_j1+1, k_jpj-1
520!CDIR NOVERRCHK
521               DO ji = fs_2, fs_jpim1
522                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass2(ji,jj))))*tmv(ji,jj)
523                  zsang        = SIGN(1.0,fcor(ji,jj))*sangvg
524                  z0           = zmass2(ji,jj)/dtevp
525                  ! SB modif because ocean has no slip boundary condition
526                  zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj)      &
527                     &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj+1))   &
528                     &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)   
529
530                  za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + &
531                     (v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj))
532                  zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + &
533                     za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj))
534                  zcca         = z0+za*cangvg
535                  zccb         = zcorl2(ji,jj)+za*zsang
536                  v_ice(ji,jj) = (zr-zccb*zu_ice2)/(zcca+epsd)*zmask
537
538               END DO
539            END DO
540
541            CALL lbc_lnk( v_ice(:,:), 'V', -1. )
542
543!CDIR NOVERRCHK
544            DO jj = k_j1+1, k_jpj-1
545!CDIR NOVERRCHK
546               DO ji = fs_2, fs_jpim1
547                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass1(ji,jj))))*tmu(ji,jj)
548                  zsang        = SIGN(1.0,fcor(ji,jj))*sangvg
549                  z0           = zmass1(ji,jj)/dtevp
550                  ! SB modif because ocean has no slip boundary condition
551                  ! GG Bug
552                  !                   zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)      &
553                  !                      &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   &
554                  !                      &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
555                  zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji,jj)      &
556                     &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji+1,jj))   &
557                     &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
558
559                  za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + &
560                     (zv_ice1-v_oce1(ji,jj))**2)*(1.0-zfrld1(ji,jj))
561                  zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + &
562                     za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj))
563                  zcca         = z0+za*cangvg
564                  zccb         = zcorl1(ji,jj)+za*zsang
565                  u_ice(ji,jj) = (zr+zccb*zv_ice1)/(zcca+epsd)*zmask 
566               END DO ! ji
567            END DO ! jj
568
569            CALL lbc_lnk( u_ice(:,:), 'U', -1. )
570
571         ENDIF
572
573         IF(ln_ctl) THEN
574            !---  Convergence test.
575            DO jj = k_j1+1 , k_jpj-1
576               zresr(:,jj) = MAX( ABS( u_ice(:,jj) - zu_ice(:,jj) ) ,           &
577                  ABS( v_ice(:,jj) - zv_ice(:,jj) ) )
578            END DO
579            zresm = MAXVAL( zresr( 1:jpi , k_j1+1:k_jpj-1 ) )
580            IF( lk_mpp )   CALL mpp_max( zresm )   ! max over the global domain
581         ENDIF
582
583         !                                                   ! ==================== !
584      END DO                                              !  end loop over jter  !
585      !                                                   ! ==================== !
586
587      !
588      !------------------------------------------------------------------------------!
589      ! 4) Prevent ice velocities when the ice is thin
590      !------------------------------------------------------------------------------!
591      !
592      ! If the ice thickness is below 1cm then ice velocity should equal the
593      ! ocean velocity,
594      ! This prevents high velocity when ice is thin
595!CDIR NOVERRCHK
596      DO jj = k_j1+1, k_jpj-1
597!CDIR NOVERRCHK
598         DO ji = fs_2, fs_jpim1
599            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) ) 
600            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
601            IF ( zdummy .LE. 5.0e-2 ) THEN
602               u_ice(ji,jj) = u_oce(ji,jj)
603               v_ice(ji,jj) = v_oce(ji,jj)
604            ENDIF ! zdummy
605         END DO
606      END DO
607
608      CALL lbc_lnk( u_ice(:,:), 'U', -1. ) 
609      CALL lbc_lnk( v_ice(:,:), 'V', -1. ) 
610
611      DO jj = k_j1+1, k_jpj-1 
612         DO ji = fs_2, fs_jpim1
613            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) ) 
614            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
615            IF ( zdummy .LE. 5.0e-2 ) THEN
616               v_ice1(ji,jj)  = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)   &
617                  &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj)) &
618                  &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
619
620               u_ice2(ji,jj)  = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)   &
621                  &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj)) &
622                  &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
623            ENDIF ! zdummy
624         END DO
625      END DO
626
627      CALL lbc_lnk( u_ice2(:,:), 'V', -1. ) 
628      CALL lbc_lnk( v_ice1(:,:), 'U', -1. )
629
630      ! Recompute delta, shear and div, inputs for mechanical redistribution
631!CDIR NOVERRCHK
632      DO jj = k_j1+1, k_jpj-1
633!CDIR NOVERRCHK
634         DO ji = fs_2, jpim1   !RB bug no vect opt due to tmi
635            !- zdd(:,:), zdt(:,:): divergence and tension at centre
636            !- zds(:,:): shear on northeast corner of grid cells
637            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) ) 
638            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
639
640            IF ( zdummy .LE. 5.0e-2 ) THEN
641
642               zdd(ji,jj) = ( e2u(ji,jj)*u_ice(ji,jj)                      &
643                  &          -e2u(ji-1,jj)*u_ice(ji-1,jj)                  &
644                  &          +e1v(ji,jj)*v_ice(ji,jj)                      &
645                  &          -e1v(ji,jj-1)*v_ice(ji,jj-1)                  &
646                  &         )                                              &
647                  &         / area(ji,jj)
648
649               zdt(ji,jj) = ( ( u_ice(ji,jj)/e2u(ji,jj)                    &
650                  &            -u_ice(ji-1,jj)/e2u(ji-1,jj)                &
651                  &           )*e2t(ji,jj)*e2t(ji,jj)                      &
652                  &          -( v_ice(ji,jj)/e1v(ji,jj)                    &
653                  &            -v_ice(ji,jj-1)/e1v(ji,jj-1)                &
654                  &           )*e1t(ji,jj)*e1t(ji,jj)                      &
655                  &         )                                              &
656                  &        / area(ji,jj)
657               !
658               ! SB modif because ocean has no slip boundary condition
659               zds(ji,jj) = ( ( u_ice(ji,jj+1) / e1u(ji,jj+1)              &
660                  &           - u_ice(ji,jj)   / e1u(ji,jj) )              &
661                  &           * e1f(ji,jj) * e1f(ji,jj)                    &
662                  &          + ( v_ice(ji+1,jj) / e2v(ji+1,jj)             &
663                  &            - v_ice(ji,jj)  / e2v(ji,jj) )              &
664                  &           * e2f(ji,jj) * e2f(ji,jj) )                  &
665                  &        / ( e1f(ji,jj) * e2f(ji,jj) ) * ( 2.0 - tmf(ji,jj) ) &
666                  &        * tmi(ji,jj) * tmi(ji,jj+1)                     &
667                  &        * tmi(ji+1,jj) * tmi(ji+1,jj+1)
668
669               zdst       = (  e2u( ji  , jj   ) * v_ice1(ji,jj)          &
670                  &          - e2u( ji-1, jj   ) * v_ice1(ji-1,jj)         &
671                  &          + e1v( ji  , jj   ) * u_ice2(ji,jj)           &
672                  &          - e1v( ji  , jj-1 ) * u_ice2(ji,jj-1)         & 
673                  &          )                                             &
674                  &         / area(ji,jj)
675
676               deltat(ji,jj) = SQRT( zdd(ji,jj)*zdd(ji,jj) + & 
677                  &                          ( zdt(ji,jj)*zdt(ji,jj) + zdst*zdst ) * usecc2 & 
678                  &                          ) + creepl
679
680            ENDIF ! zdummy
681
682         END DO !jj
683      END DO !ji
684      !
685      !------------------------------------------------------------------------------!
686      ! 5) Store stress tensor and its invariants
687      !------------------------------------------------------------------------------!
688      !
689      ! * Invariants of the stress tensor are required for limitd_me
690      ! accelerates convergence and improves stability
691      DO jj = k_j1+1, k_jpj-1
692         DO ji = fs_2, fs_jpim1
693            divu_i (ji,jj) = zdd   (ji,jj)
694            delta_i(ji,jj) = deltat(ji,jj)
695            shear_i(ji,jj) = zds   (ji,jj)
696         END DO
697      END DO
698
699      ! Lateral boundary condition
700      CALL lbc_lnk( divu_i (:,:), 'T', 1. )
701      CALL lbc_lnk( delta_i(:,:), 'T', 1. )
702      CALL lbc_lnk( shear_i(:,:), 'F', 1. )
703
704      ! * Store the stress tensor for the next time step
705      stress1_i (:,:) = zs1 (:,:)
706      stress2_i (:,:) = zs2 (:,:)
707      stress12_i(:,:) = zs12(:,:)
708
709      !
710      !------------------------------------------------------------------------------!
711      ! 6) Control prints of residual and charge ellipse
712      !------------------------------------------------------------------------------!
713      !
714      ! print the residual for convergence
715      IF(ln_ctl) THEN
716         WRITE(charout,FMT="('lim_rhg  : res =',D23.16, ' iter =',I4)") zresm, jter
717         CALL prt_ctl_info(charout)
718         CALL prt_ctl(tab2d_1=u_ice, clinfo1=' lim_rhg  : u_ice :', tab2d_2=v_ice, clinfo2=' v_ice :')
719      ENDIF
720
721      ! print charge ellipse
722      ! This can be desactivated once the user is sure that the stress state
723      ! lie on the charge ellipse. See Bouillon et al. 08 for more details
724      IF(ln_ctl) THEN
725         CALL prt_ctl_info('lim_rhg  : numit  :',ivar1=numit)
726         CALL prt_ctl_info('lim_rhg  : nwrite :',ivar1=nwrite)
727         CALL prt_ctl_info('lim_rhg  : MOD    :',ivar1=MOD(numit,nwrite))
728         IF( MOD(numit,nwrite) .EQ. 0 ) THEN
729            WRITE(charout,FMT="('lim_rhg  :', I4, I6, I1, I1, A10)") 1000, numit, 0, 0, ' ch. ell. '
730            CALL prt_ctl_info(charout)
731            DO jj = k_j1+1, k_jpj-1
732               DO ji = 2, jpim1
733                  IF (zpresh(ji,jj) .GT. 1.0) THEN
734                     sigma1 = ( zs1(ji,jj) + (zs2(ji,jj)**2 + 4*zs12(ji,jj)**2 )**0.5 ) / ( 2*zpresh(ji,jj) ) 
735                     sigma2 = ( zs1(ji,jj) - (zs2(ji,jj)**2 + 4*zs12(ji,jj)**2 )**0.5 ) / ( 2*zpresh(ji,jj) )
736                     WRITE(charout,FMT="('lim_rhg  :', I4, I4, D23.16, D23.16, D23.16, D23.16, A10)")
737                     CALL prt_ctl_info(charout)
738                  ENDIF
739               END DO
740            END DO
741            WRITE(charout,FMT="('lim_rhg  :', I4, I6, I1, I1, A10)") 2000, numit, 0, 0, ' ch. ell. '
742            CALL prt_ctl_info(charout)
743         ENDIF
744      ENDIF
745      !
746      CALL wrk_dealloc( jpi,jpj, zpresh, zfrld1, zmass1, zcorl1, za1ct , zpreshc, zfrld2, zmass2, zcorl2, za2ct )
747      CALL wrk_dealloc( jpi,jpj, zc1   , u_oce1, u_oce2, u_ice2, zusw  , v_oce1 , v_oce2, v_ice1                )
748      CALL wrk_dealloc( jpi,jpj, zf1   , deltat, zu_ice, zf2   , deltac, zv_ice , zdd   , zdt    , zds          )
749      CALL wrk_dealloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr                         )
750
751   END SUBROUTINE lim_rhg
752
753#else
754   !!----------------------------------------------------------------------
755   !!   Default option          Dummy module           NO LIM sea-ice model
756   !!----------------------------------------------------------------------
757CONTAINS
758   SUBROUTINE lim_rhg( k1 , k2 )         ! Dummy routine
759      WRITE(*,*) 'lim_rhg: You should not have seen this print! error?', k1, k2
760   END SUBROUTINE lim_rhg
761#endif
762
763   !!==============================================================================
764END MODULE limrhg
Note: See TracBrowser for help on using the repository browser.