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/NERC/dev_r3874_FASTNEt/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/NERC/dev_r3874_FASTNEt/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90 @ 6736

Last change on this file since 6736 was 6736, checked in by jamesharle, 8 years ago

FASTNEt code modifications

  • Property svn:keywords set to Id
File size: 38.0 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   !!            3.4  !  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 3.4 , 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, zzdst   ! 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(:,:) ::   zdst             ! Shear on centre of grid cells
144      REAL(wp), POINTER, DIMENSION(:,:) ::   deltat, deltac   ! Delta at centre and corners of grid cells
145      REAL(wp), POINTER, DIMENSION(:,:) ::   zs1   , zs2      ! Diagonal stress tensor components zs1 and zs2
146      REAL(wp), POINTER, DIMENSION(:,:) ::   zs12             ! Non-diagonal stress tensor component zs12
147      REAL(wp), POINTER, DIMENSION(:,:) ::   zu_ice, zv_ice, zresr   ! Local error on velocity
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  , zdst  )
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               zzdst      = (  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) + zzdst*zzdst ) * usecc2 ) 
387               deltat(ji,jj) = MAX( SQRT(zdd(ji,jj)**2 + (zdt(ji,jj)**2 + zzdst**2)*usecc2), creepl )
388!!gm faster to replace the line above with simply:
389!!                deltat(ji,jj) = MAX( delta, creepl )
390!!gm end
391
392               !-Calculate stress tensor components zs1 and zs2
393               !-at centre of grid cells (see section 3.5 of CICE user's guide).
394               zs1(ji,jj) = ( zs1(ji,jj) &
395                  &          - dtotel*( ( 1.0 - alphaevp) * zs1(ji,jj) +    &
396                  &            ( delta / deltat(ji,jj) - zdd(ji,jj) / deltat(ji,jj) ) &
397                  * zpresh(ji,jj) ) )                          &       
398                  &        / ( 1.0 + alphaevp * dtotel )
399
400               zs2(ji,jj) = ( zs2(ji,jj)   &
401                  &          - dtotel*((1.0-alphaevp)*ecc2*zs2(ji,jj) -  &
402                  zdt(ji,jj)/deltat(ji,jj)*zpresh(ji,jj)) ) &
403                  &        / ( 1.0 + alphaevp*ecc2*dtotel )
404
405            END DO
406         END DO
407
408         CALL lbc_lnk( zs1(:,:), 'T', 1. )
409         CALL lbc_lnk( zs2(:,:), 'T', 1. )
410
411!CDIR NOVERRCHK
412         DO jj = k_j1+1, k_jpj-1
413!CDIR NOVERRCHK
414            DO ji = fs_2, fs_jpim1
415               !- Calculate Delta on corners
416               zddc  =      ( ( v_ice1(ji,jj+1)/e1u(ji,jj+1)                &
417                  &            -v_ice1(ji,jj)/e1u(ji,jj)                    &
418                  &           )*e1f(ji,jj)*e1f(ji,jj)                       &
419                  &          +( u_ice2(ji+1,jj)/e2v(ji+1,jj)                &
420                  &            -u_ice2(ji,jj)/e2v(ji,jj)                    &
421                  &           )*e2f(ji,jj)*e2f(ji,jj)                       &
422                  &         )                                               &
423                  &        / ( e1f(ji,jj) * e2f(ji,jj) )
424
425               zdtc  =      (-( v_ice1(ji,jj+1)/e1u(ji,jj+1)                &
426                  &            -v_ice1(ji,jj)/e1u(ji,jj)                    &
427                  &           )*e1f(ji,jj)*e1f(ji,jj)                       &
428                  &          +( u_ice2(ji+1,jj)/e2v(ji+1,jj)                &
429                  &            -u_ice2(ji,jj)/e2v(ji,jj)                    &
430                  &           )*e2f(ji,jj)*e2f(ji,jj)                       &
431                  &         )                                               &
432                  &        / ( e1f(ji,jj) * e2f(ji,jj) )
433
434               deltac(ji,jj) = SQRT(zddc**2+(zdtc**2+zds(ji,jj)**2)*usecc2) + creepl
435
436               !-Calculate stress tensor component zs12 at corners (see section 3.5 of CICE user's guide).
437               zs12(ji,jj) = ( zs12(ji,jj)      &
438                  &        - dtotel*( (1.0-alphaevp)*ecc2*zs12(ji,jj) - zds(ji,jj) / &
439                  &          ( 2.0*deltac(ji,jj) ) * zpreshc(ji,jj))) &
440                  &         / ( 1.0 + alphaevp*ecc2*dtotel ) 
441
442            END DO ! ji
443         END DO ! jj
444
445         CALL lbc_lnk( zs12(:,:), 'F', 1. )
446
447         ! Ice internal stresses (Appendix C of Hunke and Dukowicz, 2002)
448         DO jj = k_j1+1, k_jpj-1
449            DO ji = fs_2, fs_jpim1
450               !- contribution of zs1, zs2 and zs12 to zf1
451               zf1(ji,jj) = 0.5*( (zs1(ji+1,jj)-zs1(ji,jj))*e2u(ji,jj) &
452                  &              +(zs2(ji+1,jj)*e2t(ji+1,jj)**2-zs2(ji,jj)*e2t(ji,jj)**2)/e2u(ji,jj) &
453                  &              +2.0*(zs12(ji,jj)*e1f(ji,jj)**2-zs12(ji,jj-1)*e1f(ji,jj-1)**2)/e1u(ji,jj) &
454                  &             ) / ( e1u(ji,jj)*e2u(ji,jj) )
455               ! contribution of zs1, zs2 and zs12 to zf2
456               zf2(ji,jj) = 0.5*( (zs1(ji,jj+1)-zs1(ji,jj))*e1v(ji,jj) &
457                  &              -(zs2(ji,jj+1)*e1t(ji,jj+1)**2 - zs2(ji,jj)*e1t(ji,jj)**2)/e1v(ji,jj) &
458                  &              + 2.0*(zs12(ji,jj)*e2f(ji,jj)**2 -    &
459                  zs12(ji-1,jj)*e2f(ji-1,jj)**2)/e2v(ji,jj) &
460                  &             ) / ( e1v(ji,jj)*e2v(ji,jj) )
461            END DO
462         END DO
463         !
464         ! Computation of ice velocity
465         !
466         ! Both the Coriolis term and the ice-ocean drag are solved semi-implicitly.
467         !
468         IF (MOD(jter,2).eq.0) THEN 
469
470!CDIR NOVERRCHK
471            DO jj = k_j1+1, k_jpj-1
472!CDIR NOVERRCHK
473               DO ji = fs_2, fs_jpim1
474                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass1(ji,jj))))*tmu(ji,jj)
475                  zsang        = SIGN ( 1.0 , fcor(ji,jj) ) * sangvg
476                  z0           = zmass1(ji,jj)/dtevp
477
478                  ! SB modif because ocean has no slip boundary condition
479                  zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji,jj)         &
480                     &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji+1,jj))   &
481                     &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
482                  za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + &
483                     (zv_ice1-v_oce1(ji,jj))**2) * (1.0-zfrld1(ji,jj))
484                  zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + &
485                     za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj))
486                  zcca         = z0+za*cangvg
487                  zccb         = zcorl1(ji,jj)+za*zsang
488                  u_ice(ji,jj) = (zr+zccb*zv_ice1)/(zcca+epsd)*zmask 
489
490               END DO
491            END DO
492
493            CALL lbc_lnk( u_ice(:,:), 'U', -1. )
494
495!CDIR NOVERRCHK
496            DO jj = k_j1+1, k_jpj-1
497!CDIR NOVERRCHK
498               DO ji = fs_2, fs_jpim1
499
500                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass2(ji,jj))))*tmv(ji,jj)
501                  zsang        = SIGN(1.0,fcor(ji,jj))*sangvg
502                  z0           = zmass2(ji,jj)/dtevp
503                  ! SB modif because ocean has no slip boundary condition
504                  zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj)     &
505                     &                 + (u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj+1))   &
506                     &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
507                  za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + & 
508                     (v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj))
509                  zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + &
510                     za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj))
511                  zcca         = z0+za*cangvg
512                  zccb         = zcorl2(ji,jj)+za*zsang
513                  v_ice(ji,jj) = (zr-zccb*zu_ice2)/(zcca+epsd)*zmask
514
515               END DO
516            END DO
517
518            CALL lbc_lnk( v_ice(:,:), 'V', -1. )
519
520         ELSE 
521!CDIR NOVERRCHK
522            DO jj = k_j1+1, k_jpj-1
523!CDIR NOVERRCHK
524               DO ji = fs_2, fs_jpim1
525                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass2(ji,jj))))*tmv(ji,jj)
526                  zsang        = SIGN(1.0,fcor(ji,jj))*sangvg
527                  z0           = zmass2(ji,jj)/dtevp
528                  ! SB modif because ocean has no slip boundary condition
529                  zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj)      &
530                     &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj+1))   &
531                     &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)   
532
533                  za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + &
534                     (v_ice(ji,jj)-v_oce2(ji,jj))**2)*(1.0-zfrld2(ji,jj))
535                  zr           = z0*v_ice(ji,jj) + zf2(ji,jj) + &
536                     za2ct(ji,jj) + za*(cangvg*v_oce2(ji,jj)+zsang*u_oce2(ji,jj))
537                  zcca         = z0+za*cangvg
538                  zccb         = zcorl2(ji,jj)+za*zsang
539                  v_ice(ji,jj) = (zr-zccb*zu_ice2)/(zcca+epsd)*zmask
540
541               END DO
542            END DO
543
544            CALL lbc_lnk( v_ice(:,:), 'V', -1. )
545
546!CDIR NOVERRCHK
547            DO jj = k_j1+1, k_jpj-1
548!CDIR NOVERRCHK
549               DO ji = fs_2, fs_jpim1
550                  zmask        = (1.0-MAX(rzero,SIGN(rone,-zmass1(ji,jj))))*tmu(ji,jj)
551                  zsang        = SIGN(1.0,fcor(ji,jj))*sangvg
552                  z0           = zmass1(ji,jj)/dtevp
553                  ! SB modif because ocean has no slip boundary condition
554                  ! GG Bug
555                  !                   zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)      &
556                  !                      &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   &
557                  !                      &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
558                  zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji,jj)      &
559                     &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji+1,jj))   &
560                     &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
561
562                  za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + &
563                     (zv_ice1-v_oce1(ji,jj))**2)*(1.0-zfrld1(ji,jj))
564                  zr           = z0*u_ice(ji,jj) + zf1(ji,jj) + za1ct(ji,jj) + &
565                     za*(cangvg*u_oce1(ji,jj)-zsang*v_oce1(ji,jj))
566                  zcca         = z0+za*cangvg
567                  zccb         = zcorl1(ji,jj)+za*zsang
568                  u_ice(ji,jj) = (zr+zccb*zv_ice1)/(zcca+epsd)*zmask 
569               END DO ! ji
570            END DO ! jj
571
572            CALL lbc_lnk( u_ice(:,:), 'U', -1. )
573
574         ENDIF
575
576         IF(ln_ctl) THEN
577            !---  Convergence test.
578            DO jj = k_j1+1 , k_jpj-1
579               zresr(:,jj) = MAX( ABS( u_ice(:,jj) - zu_ice(:,jj) ) ,           &
580                  ABS( v_ice(:,jj) - zv_ice(:,jj) ) )
581            END DO
582            zresm = MAXVAL( zresr( 1:jpi , k_j1+1:k_jpj-1 ) )
583            IF( lk_mpp )   CALL mpp_max( zresm )   ! max over the global domain
584         ENDIF
585
586         !                                                   ! ==================== !
587      END DO                                              !  end loop over jter  !
588      !                                                   ! ==================== !
589
590      !
591      !------------------------------------------------------------------------------!
592      ! 4) Prevent ice velocities when the ice is thin
593      !------------------------------------------------------------------------------!
594      !
595      ! If the ice thickness is below 1cm then ice velocity should equal the
596      ! ocean velocity,
597      ! This prevents high velocity when ice is thin
598!CDIR NOVERRCHK
599      DO jj = k_j1+1, k_jpj-1
600!CDIR NOVERRCHK
601         DO ji = fs_2, fs_jpim1
602            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) ) 
603            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
604            IF ( zdummy .LE. 5.0e-2 ) THEN
605               u_ice(ji,jj) = u_oce(ji,jj)
606               v_ice(ji,jj) = v_oce(ji,jj)
607            ENDIF ! zdummy
608         END DO
609      END DO
610
611      CALL lbc_lnk( u_ice(:,:), 'U', -1. ) 
612      CALL lbc_lnk( v_ice(:,:), 'V', -1. ) 
613
614      DO jj = k_j1+1, k_jpj-1 
615         DO ji = fs_2, fs_jpim1
616            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) ) 
617            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
618            IF ( zdummy .LE. 5.0e-2 ) THEN
619               v_ice1(ji,jj)  = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)   &
620                  &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj)) &
621                  &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
622
623               u_ice2(ji,jj)  = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)   &
624                  &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj)) &
625                  &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
626            ENDIF ! zdummy
627         END DO
628      END DO
629
630      CALL lbc_lnk( u_ice2(:,:), 'V', -1. ) 
631      CALL lbc_lnk( v_ice1(:,:), 'U', -1. )
632
633      ! Recompute delta, shear and div, inputs for mechanical redistribution
634!CDIR NOVERRCHK
635      DO jj = k_j1+1, k_jpj-1
636!CDIR NOVERRCHK
637         DO ji = fs_2, jpim1   !RB bug no vect opt due to tmi
638            !- zdd(:,:), zdt(:,:): divergence and tension at centre
639            !- zds(:,:): shear on northeast corner of grid cells
640            zindb  = MAX( 0.0, SIGN( 1.0, at_i(ji,jj) - 1.0e-6 ) ) 
641            zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
642
643            IF ( zdummy .LE. 5.0e-2 ) THEN
644
645               zdd(ji,jj) = ( e2u(ji,jj)*u_ice(ji,jj)                      &
646                  &          -e2u(ji-1,jj)*u_ice(ji-1,jj)                  &
647                  &          +e1v(ji,jj)*v_ice(ji,jj)                      &
648                  &          -e1v(ji,jj-1)*v_ice(ji,jj-1)                  &
649                  &         )                                              &
650                  &         / area(ji,jj)
651
652               zdt(ji,jj) = ( ( u_ice(ji,jj)/e2u(ji,jj)                    &
653                  &            -u_ice(ji-1,jj)/e2u(ji-1,jj)                &
654                  &           )*e2t(ji,jj)*e2t(ji,jj)                      &
655                  &          -( v_ice(ji,jj)/e1v(ji,jj)                    &
656                  &            -v_ice(ji,jj-1)/e1v(ji,jj-1)                &
657                  &           )*e1t(ji,jj)*e1t(ji,jj)                      &
658                  &         )                                              &
659                  &        / area(ji,jj)
660               !
661               ! SB modif because ocean has no slip boundary condition
662               zds(ji,jj) = ( ( u_ice(ji,jj+1) / e1u(ji,jj+1)              &
663                  &           - u_ice(ji,jj)   / e1u(ji,jj) )              &
664                  &           * e1f(ji,jj) * e1f(ji,jj)                    &
665                  &          + ( v_ice(ji+1,jj) / e2v(ji+1,jj)             &
666                  &            - v_ice(ji,jj)  / e2v(ji,jj) )              &
667                  &           * e2f(ji,jj) * e2f(ji,jj) )                  &
668                  &        / ( e1f(ji,jj) * e2f(ji,jj) ) * ( 2.0 - tmf(ji,jj) ) &
669                  &        * tmi(ji,jj) * tmi(ji,jj+1)                     &
670                  &        * tmi(ji+1,jj) * tmi(ji+1,jj+1)
671
672               zdst(ji,jj) = (  e2u( ji  , jj   ) * v_ice1(ji  ,jj  )    &
673                  &           - e2u( ji-1, jj   ) * v_ice1(ji-1,jj  )    &
674                  &           + e1v( ji  , jj   ) * u_ice2(ji  ,jj  )    &
675                  &           - e1v( ji  , jj-1 ) * u_ice2(ji  ,jj-1)  ) / area(ji,jj)
676
677               deltat(ji,jj) = SQRT(    zdd(ji,jj)*zdd(ji,jj)   & 
678                  &                 + ( zdt(ji,jj)*zdt(ji,jj) + zdst(ji,jj)*zdst(ji,jj) ) * usecc2 & 
679                  &                          ) + creepl
680
681            ENDIF ! zdummy
682
683         END DO !jj
684      END DO !ji
685      !
686      !------------------------------------------------------------------------------!
687      ! 5) Store stress tensor and its invariants
688      !------------------------------------------------------------------------------!
689      !
690      ! * Invariants of the stress tensor are required for limitd_me
691      !   (accelerates convergence and improves stability)
692      DO jj = k_j1+1, k_jpj-1
693         DO ji = fs_2, fs_jpim1
694            divu_i (ji,jj) = zdd   (ji,jj)
695            delta_i(ji,jj) = deltat(ji,jj)
696            shear_i(ji,jj) = SQRT( zdt(ji,jj) * zdt(ji,jj) + zdst(ji,jj) * zdst(ji,jj) )
697         END DO
698      END DO
699      CALL lbc_lnk( divu_i (:,:), 'T', 1. )      ! Lateral boundary condition
700      CALL lbc_lnk( delta_i(:,:), 'T', 1. )
701      CALL lbc_lnk( shear_i(:,:), 'T', 1. )
702
703      ! * Store the stress tensor for the next time step
704      stress1_i (:,:) = zs1 (:,:)
705      stress2_i (:,:) = zs2 (:,:)
706      stress12_i(:,:) = zs12(:,:)
707
708      !
709      !------------------------------------------------------------------------------!
710      ! 6) Control prints of residual and charge ellipse
711      !------------------------------------------------------------------------------!
712      !
713      ! print the residual for convergence
714      IF(ln_ctl) THEN
715         WRITE(charout,FMT="('lim_rhg  : res =',D23.16, ' iter =',I4)") zresm, jter
716         CALL prt_ctl_info(charout)
717         CALL prt_ctl(tab2d_1=u_ice, clinfo1=' lim_rhg  : u_ice :', tab2d_2=v_ice, clinfo2=' v_ice :')
718      ENDIF
719
720      ! print charge ellipse
721      ! This can be desactivated once the user is sure that the stress state
722      ! lie on the charge ellipse. See Bouillon et al. 08 for more details
723      IF(ln_ctl) THEN
724         CALL prt_ctl_info('lim_rhg  : numit  :',ivar1=numit)
725         CALL prt_ctl_info('lim_rhg  : nwrite :',ivar1=nwrite)
726         CALL prt_ctl_info('lim_rhg  : MOD    :',ivar1=MOD(numit,nwrite))
727         IF( MOD(numit,nwrite) .EQ. 0 ) THEN
728            WRITE(charout,FMT="('lim_rhg  :', I4, I6, I1, I1, A10)") 1000, numit, 0, 0, ' ch. ell. '
729            CALL prt_ctl_info(charout)
730            DO jj = k_j1+1, k_jpj-1
731               DO ji = 2, jpim1
732                  IF (zpresh(ji,jj) .GT. 1.0) THEN
733                     sigma1 = ( zs1(ji,jj) + (zs2(ji,jj)**2 + 4*zs12(ji,jj)**2 )**0.5 ) / ( 2*zpresh(ji,jj) ) 
734                     sigma2 = ( zs1(ji,jj) - (zs2(ji,jj)**2 + 4*zs12(ji,jj)**2 )**0.5 ) / ( 2*zpresh(ji,jj) )
735                     WRITE(charout,FMT="('lim_rhg  :', I4, I4, D23.16, D23.16, D23.16, D23.16, A10)")
736                     CALL prt_ctl_info(charout)
737                  ENDIF
738               END DO
739            END DO
740            WRITE(charout,FMT="('lim_rhg  :', I4, I6, I1, I1, A10)") 2000, numit, 0, 0, ' ch. ell. '
741            CALL prt_ctl_info(charout)
742         ENDIF
743      ENDIF
744      !
745      CALL wrk_dealloc( jpi,jpj, zpresh, zfrld1, zmass1, zcorl1, za1ct , zpreshc, zfrld2, zmass2, zcorl2, za2ct )
746      CALL wrk_dealloc( jpi,jpj, zc1   , u_oce1, u_oce2, u_ice2, zusw  , v_oce1 , v_oce2, v_ice1                )
747      CALL wrk_dealloc( jpi,jpj, zf1   , deltat, zu_ice, zf2   , deltac, zv_ice , zdd   , zdt    , zds  , zdst  )
748      CALL wrk_dealloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr                         )
749
750   END SUBROUTINE lim_rhg
751
752#else
753   !!----------------------------------------------------------------------
754   !!   Default option          Dummy module           NO LIM sea-ice model
755   !!----------------------------------------------------------------------
756CONTAINS
757   SUBROUTINE lim_rhg( k1 , k2 )         ! Dummy routine
758      WRITE(*,*) 'lim_rhg: You should not have seen this print! error?', k1, k2
759   END SUBROUTINE lim_rhg
760#endif
761
762   !!==============================================================================
763END MODULE limrhg
Note: See TracBrowser for help on using the repository browser.