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 @ 3414

Last change on this file since 3414 was 3414, checked in by acc, 12 years ago

Branch: dev_r3385_NOCS04_HAMF; #665. Stage 3 of 2012 development: First working version with (optionally) active embedding. Still some stability questions when running the LIM2-EVP, ORCA2 test-case with full embedding. Works with reduced (halved) timestep. Still investigating.

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