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

source: branches/2015/dev_r5044_CNRS_LIM3CLEAN/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90 @ 5064

Last change on this file since 5064 was 5064, checked in by clem, 9 years ago

LIM3 now includes specific physics to run with only 1 sea ice category (i.e. LIM2 type)

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