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

source: branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90 @ 3524

Last change on this file since 3524 was 3524, checked in by gm, 11 years ago

Branch: dev_r3385_NOCS04_HAMF; #665. add USE lib_fortran when SIGN is used (TOP,OPA,LIM2&3) ; salt flux names start with sfx_ in LIM3

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