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.
limtrp_2.F90 in branches/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/LIM_SRC_2 – NEMO

source: branches/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/LIM_SRC_2/limtrp_2.F90 @ 7910

Last change on this file since 7910 was 7910, checked in by timgraham, 7 years ago

All wrk_alloc removed

  • Property svn:keywords set to Id
File size: 17.4 KB
Line 
1MODULE limtrp_2
2   !!======================================================================
3   !!                       ***  MODULE limtrp_2   ***
4   !! LIM 2.0 transport ice model : sea-ice advection/diffusion
5   !!======================================================================
6   !! History :  LIM  !  2000-01 (UCL)  Original code
7   !!            2.0  !  2001-05 (G. Madec, R. Hordoir) opa norm
8   !!             -   !  2004-01 (G. Madec, C. Ethe)  F90, mpp
9   !!            3.3  !  2009-05  (G. Garric, C. Bricaud) addition of the lim2_evp case
10   !!----------------------------------------------------------------------
11#if defined key_lim2
12   !!----------------------------------------------------------------------
13   !!   'key_lim2' :                                  LIM 2.0 sea-ice model
14   !!----------------------------------------------------------------------
15   !!   lim_trp_2      : advection/diffusion process of sea ice
16   !!   lim_trp_init_2 : initialization and namelist read
17   !!----------------------------------------------------------------------
18   USE phycst          ! physical constant
19   USE sbc_oce         ! ocean surface boundary condition
20   USE dom_oce         ! ocean domain
21   USE in_out_manager  ! I/O manager
22   USE dom_ice_2       ! LIM-2 domain
23   USE ice_2           ! LIM-2 variables
24   USE limistate_2     ! LIM-2 initial state
25   USE limadv_2        ! LIM-2 advection
26   USE limhdf_2        ! LIM-2 horizontal diffusion
27   USE lbclnk          ! lateral boundary conditions -- MPP exchanges
28   USE lib_mpp         ! MPP library
29# if defined key_agrif
30   USE agrif_lim2_interp ! nesting
31# endif
32   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   lim_trp_2   ! called by sbc_ice_lim_2
38
39   REAL(wp), PUBLIC ::   bound      !: boundary condit. (0.0 no-slip, 1.0 free-slip)
40
41   REAL(wp)  ::   epsi06 = 1.e-06   ! constant values
42   REAL(wp)  ::   epsi03 = 1.e-03 
43   REAL(wp)  ::   epsi16 = 1.e-16 
44   REAL(wp)  ::   rzero  = 0.e0   
45   REAL(wp)  ::   rone   = 1.e0
46
47   !! * Substitution
48#  include "vectopt_loop_substitute.h90"
49   !!----------------------------------------------------------------------
50   !! NEMO/LIM2 3.3 , UCL - NEMO Consortium (2010)
51   !! $Id$
52   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
53   !!----------------------------------------------------------------------
54
55CONTAINS
56
57   SUBROUTINE lim_trp_2( kt )
58      !!-------------------------------------------------------------------
59      !!                   ***  ROUTINE lim_trp_2 ***
60      !!                   
61      !! ** purpose : advection/diffusion process of sea ice
62      !!
63      !! ** method  : variables included in the process are scalar,   
64      !!     other values are considered as second order.
65      !!     For advection, a second order Prather scheme is used. 
66      !!
67      !! ** action :
68      !!---------------------------------------------------------------------
69      INTEGER, INTENT(in) ::   kt     ! number of iteration
70      !!
71      INTEGER  ::   ji, jj, jk   ! dummy loop indices
72      INTEGER  ::   initad       ! number of sub-timestep for the advection
73      REAL(wp) ::   zindb  , zindsn , zindic, zacrith   ! local scalars
74      REAL(wp) ::   zusvosn, zusvoic, zignm , zindhe    !   -      -
75      REAL(wp) ::   zvbord , zcfl   , zusnit            !   -      -
76      REAL(wp) ::   zrtt   , ztsn   , ztic1 , ztic2     !   -      -
77      REAL(wp), DIMENSION(jpi,jpj)  ::   zui_u , zvi_v , zsm             ! 2D workspace
78      REAL(wp), DIMENSION(jpi,jpj)  ::   zs0ice, zs0sn , zs0a            !  -      -
79      REAL(wp), DIMENSION(jpi,jpj)  ::   zs0c0 , zs0c1 , zs0c2 , zs0st   !  -      -
80      !---------------------------------------------------------------------
81
82
83      IF( kt == nit000  )   CALL lim_trp_init_2      ! Initialization (first time-step only)
84
85# if defined key_agrif
86      CALL agrif_trp_lim2_load      ! First interpolation
87# endif
88
89      zsm(:,:) = area(:,:)
90     
91      IF( ln_limdyn ) THEN
92         !-------------------------------------!
93         !   Advection of sea ice properties   !
94         !-------------------------------------!
95
96         ! ice velocities at ocean U- and V-points (zui_u,zvi_v)
97         ! ---------------------------------------
98         IF( lk_lim2_vp ) THEN      ! VP rheology : B-grid sea-ice dynamics (I-point ice velocity)
99            zvbord = 1._wp + ( 1._wp - bound )      ! zvbord=2 no-slip, =0 free slip boundary conditions       
100            DO jj = 1, jpjm1
101               DO ji = 1, jpim1   ! NO vector opt.
102                  zui_u(ji,jj) = ( u_ice(ji+1,jj) + u_ice(ji+1,jj+1) ) / ( MAX( tmu(ji+1,jj)+tmu(ji+1,jj+1), zvbord ) )
103                  zvi_v(ji,jj) = ( v_ice(ji,jj+1) + v_ice(ji+1,jj+1) ) / ( MAX( tmu(ji,jj+1)+tmu(ji+1,jj+1), zvbord ) )
104               END DO
105            END DO
106            CALL lbc_lnk( zui_u, 'U', -1. )   ;   CALL lbc_lnk( zvi_v, 'V', -1. )      ! Lateral boundary conditions
107            !
108         ELSE                       ! EVP rheology : C-grid sea-ice dynamics (u- & v-points ice velocity)
109            zui_u(:,:) = u_ice(:,:)      ! EVP rheology: ice (u,v) at u- and v-points
110            zvi_v(:,:) = v_ice(:,:)
111         ENDIF
112
113         ! CFL test for stability
114         ! ----------------------
115         zcfl  = 0._wp
116         zcfl  = MAX( zcfl, MAXVAL( ABS( zui_u(1:jpim1, :     ) ) * rdt_ice / e1u(1:jpim1, :     ) ) )
117         zcfl  = MAX( zcfl, MAXVAL( ABS( zvi_v( :     ,1:jpjm1) ) * rdt_ice / e2v( :     ,1:jpjm1) ) )
118         !
119         IF(lk_mpp)   CALL mpp_max( zcfl )
120         !
121         IF( zcfl > 0.5 .AND. lwp )   WRITE(numout,*) 'lim_trp_2 : violation of cfl criterion the ',nday,'th day, cfl = ', zcfl
122
123         ! content of properties
124         ! ---------------------
125         zs0sn (:,:) =  hsnm(:,:)              * area  (:,:)  ! Snow volume.
126         zs0ice(:,:) =  hicm(:,:)              * area  (:,:)  ! Ice volume.
127         zs0a  (:,:) =  ( 1.0 - frld(:,:) )    * area  (:,:)  ! Surface covered by ice.
128         zs0c0 (:,:) =  tbif(:,:,1) / rt0_snow * zs0sn (:,:)  ! Heat content of the snow layer.
129         zs0c1 (:,:) =  tbif(:,:,2) / rt0_ice  * zs0ice(:,:)  ! Heat content of the first ice layer.
130         zs0c2 (:,:) =  tbif(:,:,3) / rt0_ice  * zs0ice(:,:)  ! Heat content of the second ice layer.
131         zs0st (:,:) =  qstoif(:,:) / xlic     * zs0a  (:,:)  ! Heat reservoir for brine pockets.
132         
133 
134         ! Advection (Prather scheme)
135         ! ---------
136         initad = 1 + INT( MAX( rzero, SIGN( rone, zcfl-0.5 ) ) )   ! If ice drift field is too fast,         
137         zusnit = 1.0 / REAL( initad )                              ! split the ice time step in two
138         !
139         IF( MOD( ( kt - 1) / nn_fsbc , 2 ) == 0) THEN        !==  odd ice time step:  adv_x then adv_y  ==!
140            DO jk = 1, initad
141               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0ice, sxice, sxxice, syice, syyice, sxyice )
142               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0ice, sxice, sxxice, syice, syyice, sxyice )
143               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0sn , sxsn , sxxsn , sysn , syysn , sxysn  )
144               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0sn , sxsn , sxxsn , sysn , syysn , sxysn  )
145               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0a  , sxa  , sxxa  , sya  , syya  , sxya   )
146               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0a  , sxa  , sxxa  , sya  , syya  , sxya   )
147               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0c0 , sxc0 , sxxc0 , syc0 , syyc0 , sxyc0  )
148               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0c0 , sxc0 , sxxc0 , syc0 , syyc0 , sxyc0  )
149               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0c1 , sxc1 , sxxc1 , syc1 , syyc1 , sxyc1  )
150               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0c1 , sxc1 , sxxc1 , syc1 , syyc1 , sxyc1  )
151               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0c2 , sxc2 , sxxc2 , syc2 , syyc2 , sxyc2  )
152               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0c2 , sxc2 , sxxc2 , syc2 , syyc2 , sxyc2  )
153               CALL lim_adv_x_2( zusnit, zui_u, rone , zsm, zs0st , sxst , sxxst , syst , syyst , sxyst  )
154               CALL lim_adv_y_2( zusnit, zvi_v, rzero, zsm, zs0st , sxst , sxxst , syst , syyst , sxyst  )
155            END DO
156         ELSE                                                 !==  even ice time step:  adv_x then adv_y  ==!
157            DO jk = 1, initad
158               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0ice, sxice, sxxice, syice, syyice, sxyice )
159               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0ice, sxice, sxxice, syice, syyice, sxyice )
160               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0sn , sxsn , sxxsn , sysn , syysn , sxysn  )
161               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0sn , sxsn , sxxsn , sysn , syysn , sxysn  )
162               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0a  , sxa  , sxxa  , sya  , syya  , sxya   )
163               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0a  , sxa  , sxxa  , sya  , syya  , sxya   )
164               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0c0 , sxc0 , sxxc0 , syc0 , syyc0 , sxyc0  )
165               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0c0 , sxc0 , sxxc0 , syc0 , syyc0 , sxyc0  )
166               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0c1 , sxc1 , sxxc1 , syc1 , syyc1 , sxyc1  )
167               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0c1 , sxc1 , sxxc1 , syc1 , syyc1 , sxyc1  )
168               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0c2 , sxc2 , sxxc2 , syc2 , syyc2 , sxyc2  )
169               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0c2 , sxc2 , sxxc2 , syc2 , syyc2 , sxyc2  )
170               CALL lim_adv_y_2( zusnit, zvi_v, rone , zsm, zs0st , sxst , sxxst , syst , syyst , sxyst  )
171               CALL lim_adv_x_2( zusnit, zui_u, rzero, zsm, zs0st , sxst , sxxst , syst , syyst , sxyst  )
172            END DO
173         ENDIF
174                       
175         ! recover the properties from their contents
176         ! ------------------------------------------
177!!gm Define in limmsh one for all area = 1 /area  (CPU time saved !)
178         zs0ice(:,:) = zs0ice(:,:) / area(:,:)
179         zs0sn (:,:) = zs0sn (:,:) / area(:,:)
180         zs0a  (:,:) = zs0a  (:,:) / area(:,:)
181         zs0c0 (:,:) = zs0c0 (:,:) / area(:,:)
182         zs0c1 (:,:) = zs0c1 (:,:) / area(:,:)
183         zs0c2 (:,:) = zs0c2 (:,:) / area(:,:)
184         zs0st (:,:) = zs0st (:,:) / area(:,:)
185
186
187         !-------------------------------------!
188         !   Diffusion of sea ice properties   !
189         !-------------------------------------!
190
191         ! Masked eddy diffusivity coefficient at ocean U- and V-points
192         ! ------------------------------------------------------------
193         DO jj = 1, jpjm1          ! NB: has not to be defined on jpj line and jpi row
194            DO ji = 1 , fs_jpim1   ! vector opt.
195               pahu(ji,jj) = ( 1.0 - MAX( rzero, SIGN( rone, -zs0a(ji  ,jj) ) ) )   &
196                  &        * ( 1.0 - MAX( rzero, SIGN( rone, -zs0a(ji+1,jj) ) ) ) * ahiu(ji,jj)
197               pahv(ji,jj) = ( 1.0 - MAX( rzero, SIGN( rone, -zs0a(ji,jj  ) ) ) )   &
198                  &        * ( 1.0 - MAX( rzero, SIGN( rone,- zs0a(ji,jj+1) ) ) ) * ahiv(ji,jj)
199            END DO
200         END DO
201!!gm more readable coding: (and avoid an error in F90 with sign of zero)
202!        DO jj = 1, jpjm1          ! NB: has not to be defined on jpj line and jpi row
203!           DO ji = 1 , fs_jpim1   ! vector opt.
204!              IF( MIN( zs0a(ji,jj) , zs0a(ji+1,jj) ) == 0.e0 )   pahu(ji,jj) = 0._wp
205!              IF( MIN( zs0a(ji,jj) , zs0a(ji,jj+1) ) == 0.e0 )   pahv(ji,jj) = 0._wp
206!           END DO
207!        END DO
208!!gm end
209
210         ! diffusion
211         ! ---------
212         CALL lim_hdf_2( zs0ice )
213         CALL lim_hdf_2( zs0sn  )
214         CALL lim_hdf_2( zs0a   )
215         CALL lim_hdf_2( zs0c0  )
216         CALL lim_hdf_2( zs0c1  )
217         CALL lim_hdf_2( zs0c2  )
218         CALL lim_hdf_2( zs0st  )
219
220!!gm see comment this can be skipped
221         zs0ice(:,:) = MAX( rzero, zs0ice(:,:) * area(:,:) )    !!bug:  useless
222         zs0sn (:,:) = MAX( rzero, zs0sn (:,:) * area(:,:) )    !!bug:  cf /area  just below
223         zs0a  (:,:) = MAX( rzero, zs0a  (:,:) * area(:,:) )    !! caution: the suppression of the 2 changes
224         zs0c0 (:,:) = MAX( rzero, zs0c0 (:,:) * area(:,:) )    !! the last digit of the results
225         zs0c1 (:,:) = MAX( rzero, zs0c1 (:,:) * area(:,:) )
226         zs0c2 (:,:) = MAX( rzero, zs0c2 (:,:) * area(:,:) )
227         zs0st (:,:) = MAX( rzero, zs0st (:,:) * area(:,:) )
228
229
230         !-------------------------------------------------------------------!
231         !   Updating and limitation of sea ice properties after transport   !
232         !-------------------------------------------------------------------!
233         DO jj = 1, jpj
234            zindhe = MAX( 0._wp, SIGN( 1._wp, ff_t(1,jj) ) )              ! = 0 for SH, =1 for NH
235            DO ji = 1, jpi
236               !
237               ! Recover mean values over the grid squares.
238               zs0sn (ji,jj) = MAX( rzero, zs0sn (ji,jj)/area(ji,jj) )
239               zs0ice(ji,jj) = MAX( rzero, zs0ice(ji,jj)/area(ji,jj) )
240               zs0a  (ji,jj) = MAX( rzero, zs0a  (ji,jj)/area(ji,jj) )
241               zs0c0 (ji,jj) = MAX( rzero, zs0c0 (ji,jj)/area(ji,jj) )
242               zs0c1 (ji,jj) = MAX( rzero, zs0c1 (ji,jj)/area(ji,jj) )
243               zs0c2 (ji,jj) = MAX( rzero, zs0c2 (ji,jj)/area(ji,jj) )
244               zs0st (ji,jj) = MAX( rzero, zs0st (ji,jj)/area(ji,jj) )
245
246               ! Recover in situ values.
247               zindb         = MAX( rzero, SIGN( rone, zs0a(ji,jj) - epsi06 ) )
248               zacrith       = 1.0 - ( zindhe * acrit(1) + ( 1.0 - zindhe ) * acrit(2) )
249               zs0a (ji,jj)  = zindb * MIN( zs0a(ji,jj), zacrith )
250               hsnif(ji,jj)  = zindb * ( zs0sn(ji,jj) /MAX( zs0a(ji,jj), epsi16 ) )
251               hicif(ji,jj)  = zindb * ( zs0ice(ji,jj)/MAX( zs0a(ji,jj), epsi16 ) )
252               zindsn        = MAX( rzero, SIGN( rone, hsnif(ji,jj) - epsi06 ) )
253               zindic        = MAX( rzero, SIGN( rone, hicif(ji,jj) - epsi03 ) )
254               zindb         = MAX( zindsn, zindic )
255               zs0a (ji,jj)  = zindb * zs0a(ji,jj)
256               frld (ji,jj)  = 1.0 - zs0a(ji,jj)
257               hsnif(ji,jj)  = zindsn * hsnif(ji,jj)
258               hicif(ji,jj)  = zindic * hicif(ji,jj)
259               zusvosn       = 1.0/MAX( hsnif(ji,jj) * zs0a(ji,jj), epsi16 )
260               zusvoic       = 1.0/MAX( hicif(ji,jj) * zs0a(ji,jj), epsi16 )
261               zignm         = MAX( rzero,  SIGN( rone, hsndif - hsnif(ji,jj) ) )
262               zrtt          = 173.15 * rone 
263               ztsn          =          zignm   * tbif(ji,jj,1)  &
264                              + ( 1.0 - zignm ) * MIN( MAX( zrtt, rt0_snow * zusvosn * zs0c0(ji,jj)) , tfu(ji,jj) ) 
265               ztic1          = MIN( MAX( zrtt, rt0_ice * zusvoic * zs0c1(ji,jj) ) , tfu(ji,jj) )
266               ztic2          = MIN( MAX( zrtt, rt0_ice * zusvoic * zs0c2(ji,jj) ) , tfu(ji,jj) )
267 
268               tbif(ji,jj,1) = zindsn * ztsn  + ( 1.0 - zindsn ) * tfu(ji,jj)               
269               tbif(ji,jj,2) = zindic * ztic1 + ( 1.0 - zindic ) * tfu(ji,jj)
270               tbif(ji,jj,3) = zindic * ztic2 + ( 1.0 - zindic ) * tfu(ji,jj)
271               qstoif(ji,jj) = zindb  * xlic * zs0st(ji,jj) /  MAX( zs0a(ji,jj), epsi16 )
272            END DO
273         END DO
274         !
275      ENDIF
276      !
277# if defined key_agrif
278      CALL agrif_trp_lim2      ! Fill boundaries of the fine grid
279# endif
280      !
281      !
282   END SUBROUTINE lim_trp_2
283
284
285   SUBROUTINE lim_trp_init_2
286      !!-------------------------------------------------------------------
287      !!                  ***  ROUTINE lim_trp_init_2  ***
288      !!
289      !! ** Purpose :   initialization of ice advection parameters
290      !!
291      !! ** Method  :   Read the namicetrp namelist and check the parameter
292      !!              values called at the first timestep (nit000)
293      !!
294      !! ** input   :   Namelist namicetrp
295      !!-------------------------------------------------------------------
296      INTEGER  ::   ios                 ! Local integer output status for namelist read
297      NAMELIST/namicetrp/ bound
298      !!-------------------------------------------------------------------
299                   
300      REWIND( numnam_ice_ref )              ! Namelist namicetrp in reference namelist : Ice advection
301      READ  ( numnam_ice_ref, namicetrp, IOSTAT = ios, ERR = 901)
302901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicetrp in reference namelist', lwp )
303
304      REWIND( numnam_ice_cfg )              ! Namelist namicetrp in configuration namelist : Ice advection
305      READ  ( numnam_ice_cfg, namicetrp, IOSTAT = ios, ERR = 902 )
306902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicetrp in configuration namelist', lwp )
307      IF(lwm) WRITE ( numoni, namicetrp )
308
309      IF(lwp) THEN
310         WRITE(numout,*)
311         WRITE(numout,*) 'lim_trp_init_2 : Ice parameters for advection '
312         WRITE(numout,*) '~~~~~~~~~~~~~~'
313         WRITE(numout,*) '   boundary conditions (0. no-slip, 1. free-slip) bound  = ', bound
314      ENDIF
315      !
316   END SUBROUTINE lim_trp_init_2
317
318#else
319   !!----------------------------------------------------------------------
320   !!   Default option         Empty Module                No sea-ice model
321   !!----------------------------------------------------------------------
322CONTAINS
323   SUBROUTINE lim_trp_2        ! Empty routine
324   END SUBROUTINE lim_trp_2
325#endif
326
327   !!======================================================================
328END MODULE limtrp_2
Note: See TracBrowser for help on using the repository browser.