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.
bdyice.F90 in NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY – NEMO

source: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdyice.F90 @ 11191

Last change on this file since 11191 was 11191, checked in by girrmann, 5 years ago

dev_r10984_HPC-13 : bdy treatment can now handel a rim 0 and a rim 1, results are unchanged when only rim 1 is provided, see #2288 and #2285

  • Property svn:keywords set to Id
File size: 23.7 KB
Line 
1MODULE bdyice
2   !!======================================================================
3   !!                       ***  MODULE  bdyice  ***
4   !! Unstructured Open Boundary Cond. :  Open boundary conditions for sea-ice (SI3)
5   !!======================================================================
6   !!  History :  3.3  !  2010-09 (D. Storkey)  Original code
7   !!             3.4  !  2012-01 (C. Rousset)  add new sea ice model
8   !!             4.0  !  2018    (C. Rousset)  SI3 compatibility
9   !!----------------------------------------------------------------------
10#if defined key_si3
11   !!----------------------------------------------------------------------
12   !!   'key_si3'                                          SI3 sea ice model
13   !!----------------------------------------------------------------------
14   !!   bdy_ice        : Application of open boundaries to ice
15   !!   bdy_ice_frs    : Application of Flow Relaxation Scheme
16   !!----------------------------------------------------------------------
17   USE oce             ! ocean dynamics and tracers variables
18   USE ice             ! sea-ice: variables
19   USE icevar          ! sea-ice: operations
20   USE icecor          ! sea-ice: corrections
21   USE icectl          ! sea-ice: control prints
22   USE phycst          ! physical constant
23   USE eosbn2          ! equation of state
24   USE par_oce         ! ocean parameters
25   USE dom_oce         ! ocean space and time domain variables
26   USE sbc_oce         ! Surface boundary condition: ocean fields
27   USE bdy_oce         ! ocean open boundary conditions
28   !
29   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
30   USE in_out_manager  ! write to numout file
31   USE lib_mpp         ! distributed memory computing
32   USE lib_fortran     ! to use key_nosignedzero
33   USE timing          ! Timing
34
35   IMPLICIT NONE
36   PRIVATE
37
38   PUBLIC   bdy_ice     ! routine called in sbcmod
39   PUBLIC   bdy_ice_dyn ! routine called in icedyn_rhg_evp
40
41   !!----------------------------------------------------------------------
42   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
43   !! $Id$
44   !! Software governed by the CeCILL license (see ./LICENSE)
45   !!----------------------------------------------------------------------
46CONTAINS
47
48   SUBROUTINE bdy_ice( kt )
49      !!----------------------------------------------------------------------
50      !!                  ***  SUBROUTINE bdy_ice  ***
51      !!
52      !! ** Purpose : Apply open boundary conditions for sea ice
53      !!
54      !!----------------------------------------------------------------------
55      INTEGER, INTENT(in) ::   kt   ! Main time step counter
56      !
57      INTEGER ::   jbdy, ir                             ! BDY set index, rim index
58      INTEGER ::   ibeg, iend                           ! length of rim to be treated (rim 0 or rim 1)
59      LOGICAL ::   llrim0                               ! indicate if rim 0 is treated
60      LOGICAL, DIMENSION(4)  :: llsend1, llrecv1        ! indicate how communications are to be carried out
61      !!----------------------------------------------------------------------
62      ! controls
63      IF( ln_timing    )   CALL timing_start('bdy_ice_thd')                                                            ! timing
64      IF( ln_icediachk )   CALL ice_cons_hsm(0,'bdy_ice_thd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation
65      !
66      CALL ice_var_glo2eqv
67      !
68      DO ir = 1, 0, -1   ! treat rim 1 before rim 0
69         IF( ir == 0 ) THEN   ;   llrim0 = .TRUE.
70         ELSE                 ;   llrim0 = .FALSE.
71         END IF
72         DO jbdy = 1, nb_bdy
73            !
74            SELECT CASE( cn_ice(jbdy) )
75            CASE('none')   ;   CYCLE
76            CASE('frs' )   ;   CALL bdy_ice_frs( idx_bdy(jbdy), dta_bdy(jbdy), kt, jbdy, llrim0 )
77            CASE DEFAULT
78               CALL ctl_stop( 'bdy_ice : unrecognised option for open boundaries for ice fields' )
79            END SELECT
80            !
81         END DO
82         !
83         ! Update bdy points
84         llsend1(:) = .false.
85         llrecv1(:) = .false.
86         DO jbdy = 1, nb_bdy
87            IF( cn_ice(jbdy) == 'frs' ) THEN
88               llsend1(:) = llsend1(:) .OR. lsend_bdyint(jbdy,1,:,ir)   ! possibly every direction, T points
89               llrecv1(:) = llrecv1(:) .OR. lrecv_bdyint(jbdy,1,:,ir)   ! possibly every direction, T points
90            END IF
91         END DO   ! jbdy
92         IF( ANY(llsend1) .OR. ANY(llrecv1) ) THEN   ! if need to send/recv in at least one direction
93            ! exchange 3d arrays
94            CALL lbc_bdy_lnk_multi( 'bdyice', llsend1, llrecv1, a_i , 'T', 1., h_i , 'T', 1., h_s , 'T', 1. &
95                 &                                            , oa_i, 'T', 1., a_ip, 'T', 1., v_ip, 'T', 1. &
96                 &                                            , s_i , 'T', 1., t_su, 'T', 1., v_i , 'T', 1. &
97                 &                                            , v_s , 'T', 1., sv_i, 'T', 1.                )
98            ! exchange 4d arrays
99            CALL lbc_bdy_lnk_multi( 'bdyice', llsend1, llrecv1, t_s , 'T', 1., e_s , 'T', 1. )   ! third dimension = 1
100            CALL lbc_bdy_lnk_multi( 'bdyice', llsend1, llrecv1, t_i , 'T', 1., e_i , 'T', 1. )   ! third dimension = jpk
101         END IF
102      END DO   ! ir
103      !
104      CALL ice_cor( kt , 0 )      ! -- In case categories are out of bounds, do a remapping
105      !                           !    i.e. inputs have not the same ice thickness distribution (set by rn_himean)
106      !                           !         than the regional simulation
107      CALL ice_var_agg(1)
108      !
109      ! controls
110      IF( ln_icediachk )   CALL ice_cons_hsm(1,'bdy_ice_thd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation
111      IF( ln_icectl    )   CALL ice_prt     ( kt, iiceprt, jiceprt, 1, ' - ice thermo bdy - ' )                        ! prints
112      IF( ln_timing    )   CALL timing_stop ('bdy_ice_thd')                                                            ! timing
113      !
114   END SUBROUTINE bdy_ice
115
116
117   SUBROUTINE bdy_ice_frs( idx, dta, kt, jbdy, llrim0 )
118      !!------------------------------------------------------------------------------
119      !!                 ***  SUBROUTINE bdy_ice_frs  ***
120      !!                   
121      !! ** Purpose : Apply the Flow Relaxation Scheme for sea-ice fields
122      !!
123      !! Reference : Engedahl H., 1995: Use of the flow relaxation scheme in a three-
124      !!             dimensional baroclinic ocean model with realistic topography. Tellus, 365-382.
125      !!------------------------------------------------------------------------------
126      TYPE(OBC_INDEX), INTENT(in) ::   idx      ! OBC indices
127      TYPE(OBC_DATA),  INTENT(in) ::   dta      ! OBC external data
128      INTEGER,         INTENT(in) ::   kt       ! main time-step counter
129      INTEGER,         INTENT(in) ::   jbdy     ! BDY set index
130      LOGICAL,         INTENT(in) ::   llrim0   ! indicate if rim 0 is treated
131      !
132      INTEGER  ::   jpbound            ! 0 = incoming ice
133      !                                ! 1 = outgoing ice
134      INTEGER  ::   ibeg, iend         ! length of rim to be treated (rim 0 or rim 1)
135      INTEGER  ::   i_bdy, jgrd        ! dummy loop indices
136      INTEGER  ::   ji, jj, jk, jl, ib, jb
137      REAL(wp) ::   zwgt, zwgt1        ! local scalar
138      REAL(wp) ::   ztmelts, zdh
139      REAL(wp), POINTER  :: flagu, flagv              ! short cuts
140      !!------------------------------------------------------------------------------
141      !
142      jgrd = 1      ! Everything is at T-points here
143      IF( llrim0 ) THEN   ;   ibeg = 1                       ;   iend = idx%nblenrim0(jgrd)
144      ELSE                ;   ibeg = idx%nblenrim0(jgrd)+1   ;   iend = idx%nblenrim(jgrd)
145      END IF
146      !
147      DO jl = 1, jpl
148         DO i_bdy = ibeg, iend
149            ji    = idx%nbi(i_bdy,jgrd)
150            jj    = idx%nbj(i_bdy,jgrd)
151            zwgt  = idx%nbw(i_bdy,jgrd)
152            zwgt1 = 1.e0 - idx%nbw(i_bdy,jgrd)
153            a_i(ji,jj,jl) = ( a_i(ji,jj,jl) * zwgt1 + dta%a_i(i_bdy,jl) * zwgt ) * tmask(ji,jj,1)  ! Leads fraction
154            h_i(ji,jj,jl) = ( h_i(ji,jj,jl) * zwgt1 + dta%h_i(i_bdy,jl) * zwgt ) * tmask(ji,jj,1)  ! Ice depth
155            h_s(ji,jj,jl) = ( h_s(ji,jj,jl) * zwgt1 + dta%h_s(i_bdy,jl) * zwgt ) * tmask(ji,jj,1)  ! Snow depth
156
157            ! -----------------
158            ! Pathological case
159            ! -----------------
160            ! In case a) snow load would be in excess or b) ice is coming into a warmer environment that would lead to
161            ! very large transformation from snow to ice (see icethd_dh.F90)
162
163            ! Then, a) transfer the snow excess into the ice (different from icethd_dh)
164            zdh = MAX( 0._wp, ( rhos * h_s(ji,jj,jl) + ( rhoi - rau0 ) * h_i(ji,jj,jl) ) * r1_rau0 )
165            ! Or, b) transfer all the snow into ice (if incoming ice is likely to melt as it comes into a warmer environment)
166            !zdh = MAX( 0._wp, h_s(ji,jj,jl) * rhos / rhoi )
167
168            ! recompute h_i, h_s
169            h_i(ji,jj,jl) = MIN( hi_max(jl), h_i(ji,jj,jl) + zdh )
170            h_s(ji,jj,jl) = MAX( 0._wp, h_s(ji,jj,jl) - zdh * rhoi / rhos ) 
171
172         ENDDO
173      ENDDO
174
175      DO jl = 1, jpl
176         DO i_bdy = ibeg, iend
177            ji = idx%nbi(i_bdy,jgrd)
178            jj = idx%nbj(i_bdy,jgrd)
179            flagu => idx%flagu(i_bdy,jgrd)
180            flagv => idx%flagv(i_bdy,jgrd)
181            ! condition on ice thickness depends on the ice velocity
182            ! if velocity is outward (strictly), then ice thickness, volume... must be equal to adjacent values
183            jpbound = 0   ;   ib = ji   ;   jb = jj
184            !
185            IF( flagu ==  1. )   THEN
186               IF( ji+1 > jpi )   CYCLE
187               IF( u_ice(ji  ,jj  ) < 0. )   jpbound = 1 ; ib = ji+1
188            END IF
189            IF( flagu == -1. )   THEN
190               IF( ji-1 < 1   )   CYCLE
191               IF( u_ice(ji-1,jj  ) < 0. )   jpbound = 1 ; ib = ji-1
192            END IF
193            IF( flagv ==  1. )   THEN
194               IF( jj+1 > jpj )   CYCLE
195               IF( v_ice(ji  ,jj  ) < 0. )   jpbound = 1 ; jb = jj+1
196            END IF
197            IF( flagv == -1. )   THEN
198               IF( jj-1 < 1   )   CYCLE
199               IF( v_ice(ji  ,jj-1) < 0. )   jpbound = 1 ; jb = jj-1
200            END IF
201            !
202            IF( nn_ice_dta(jbdy) == 0 )   jpbound = 0 ; ib = ji ; jb = jj   ! case ice boundaries = initial conditions
203            !                                                               !      do not make state variables dependent on velocity
204            !
205            IF( a_i(ib,jb,jl) > 0._wp ) THEN   ! there is ice at the boundary
206               !
207               a_i(ji,jj,jl) = a_i(ib,jb,jl) ! concentration
208               h_i(ji,jj,jl) = h_i(ib,jb,jl) ! thickness ice
209               h_s(ji,jj,jl) = h_s(ib,jb,jl) ! thickness snw
210               !
211               SELECT CASE( jpbound )
212                  !
213               CASE( 0 )   ! velocity is inward
214                  !
215                  oa_i(ji,jj,  jl) = rn_ice_age(jbdy) * a_i(ji,jj,jl) ! age
216                  a_ip(ji,jj,  jl) = 0._wp                            ! pond concentration
217                  v_ip(ji,jj,  jl) = 0._wp                            ! pond volume
218                  t_su(ji,jj,  jl) = rn_ice_tem(jbdy)                 ! temperature surface
219                  t_s (ji,jj,:,jl) = rn_ice_tem(jbdy)                 ! temperature snw
220                  t_i (ji,jj,:,jl) = rn_ice_tem(jbdy)                 ! temperature ice
221                  s_i (ji,jj,  jl) = rn_ice_sal(jbdy)                 ! salinity
222                  sz_i(ji,jj,:,jl) = rn_ice_sal(jbdy)                 ! salinity profile
223                  !
224               CASE( 1 )   ! velocity is outward
225                  !
226                  oa_i(ji,jj,  jl) = oa_i(ib,jb,  jl) ! age
227                  a_ip(ji,jj,  jl) = a_ip(ib,jb,  jl) ! pond concentration
228                  v_ip(ji,jj,  jl) = v_ip(ib,jb,  jl) ! pond volume
229                  t_su(ji,jj,  jl) = t_su(ib,jb,  jl) ! temperature surface
230                  t_s (ji,jj,:,jl) = t_s (ib,jb,:,jl) ! temperature snw
231                  t_i (ji,jj,:,jl) = t_i (ib,jb,:,jl) ! temperature ice
232                  s_i (ji,jj,  jl) = s_i (ib,jb,  jl) ! salinity
233                  sz_i(ji,jj,:,jl) = sz_i(ib,jb,:,jl) ! salinity profile
234                  !
235               END SELECT
236               !
237               IF( nn_icesal == 1 ) THEN     ! if constant salinity
238                  s_i (ji,jj  ,jl) = rn_icesal
239                  sz_i(ji,jj,:,jl) = rn_icesal
240               ENDIF
241               !
242               ! global fields
243               v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl)                       ! volume ice
244               v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl)                       ! volume snw
245               sv_i(ji,jj,jl) = MIN( s_i(ji,jj,jl) , sss_m(ji,jj) ) * v_i(ji,jj,jl) ! salt content
246               DO jk = 1, nlay_s
247                  e_s(ji,jj,jk,jl) = rhos * ( rcpi * ( rt0 - t_s(ji,jj,jk,jl) ) + rLfus )   ! enthalpy in J/m3
248                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * v_s(ji,jj,jl) * r1_nlay_s           ! enthalpy in J/m2
249               END DO               
250               DO jk = 1, nlay_i
251                  ztmelts          = - rTmlt  * sz_i(ji,jj,jk,jl)             ! Melting temperature in C
252                  t_i(ji,jj,jk,jl) = MIN( t_i(ji,jj,jk,jl), ztmelts + rt0 )   ! Force t_i to be lower than melting point => likely conservation issue
253                  !
254                  e_i(ji,jj,jk,jl) = rhoi * ( rcpi  * ( ztmelts - ( t_i(ji,jj,jk,jl) - rt0 ) )           &   ! enthalpy in J/m3
255                     &                      + rLfus * ( 1._wp - ztmelts / ( t_i(ji,jj,jk,jl) - rt0 ) )   &
256                     &                      - rcp   *   ztmelts )                 
257                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * v_i(ji,jj,jl) * r1_nlay_i                            ! enthalpy in J/m2
258               END DO
259               !
260            ELSE   ! no ice at the boundary
261               !
262               a_i (ji,jj,  jl) = 0._wp
263               h_i (ji,jj,  jl) = 0._wp
264               h_s (ji,jj,  jl) = 0._wp
265               oa_i(ji,jj,  jl) = 0._wp
266               a_ip(ji,jj,  jl) = 0._wp
267               v_ip(ji,jj,  jl) = 0._wp
268               t_su(ji,jj,  jl) = rt0
269               t_s (ji,jj,:,jl) = rt0
270               t_i (ji,jj,:,jl) = rt0 
271               
272               IF( nn_icesal == 1 ) THEN     ! if constant salinity
273                  s_i (ji,jj  ,jl) = rn_icesal
274                  sz_i(ji,jj,:,jl) = rn_icesal
275               ELSE                          ! if variable salinity
276                  s_i (ji,jj,jl)   = rn_simin
277                  sz_i(ji,jj,:,jl) = rn_simin
278               ENDIF
279               !
280               ! global fields
281               v_i (ji,jj,  jl) = 0._wp
282               v_s (ji,jj,  jl) = 0._wp
283               sv_i(ji,jj,  jl) = 0._wp
284               e_s (ji,jj,:,jl) = 0._wp
285               e_i (ji,jj,:,jl) = 0._wp
286
287            ENDIF
288                       
289         END DO
290         !
291      END DO ! jl
292      !     
293   END SUBROUTINE bdy_ice_frs
294
295
296   SUBROUTINE bdy_ice_dyn( cd_type )
297      !!------------------------------------------------------------------------------
298      !!                 ***  SUBROUTINE bdy_ice_dyn  ***
299      !!                   
300      !! ** Purpose : Apply dynamics boundary conditions for sea-ice.
301      !!
302      !! ** Method :  if this adjacent grid point is not ice free, then u_ice and v_ice take its value
303      !!              if                          is     ice free, then u_ice and v_ice are unchanged by BDY
304      !!                                                           they keep values calculated in rheology
305      !!
306      !!------------------------------------------------------------------------------
307      CHARACTER(len=1), INTENT(in)  ::   cd_type   ! nature of velocity grid-points
308      !
309      INTEGER  ::   i_bdy, jgrd       ! dummy loop indices
310      INTEGER  ::   ji, jj            ! local scalar
311      INTEGER  ::   jbdy, ir     ! BDY set index, rim index
312      INTEGER  ::   ibeg, iend   ! length of rim to be treated (rim 0 or rim 1)
313      REAL(wp) ::   zmsk1, zmsk2, zflag
314      LOGICAL, DIMENSION(4) :: llsend2, llrecv2, llsend3, llrecv3  ! indicate how communications are to be carried out
315      !!------------------------------------------------------------------------------
316      IF( ln_timing )   CALL timing_start('bdy_ice_dyn')
317      !
318      DO ir = 1, 0, -1
319         DO jbdy = 1, nb_bdy
320            !
321            SELECT CASE( cn_ice(jbdy) )
322               !
323            CASE('none')
324               CYCLE
325               !
326            CASE('frs')
327               !
328               IF( nn_ice_dta(jbdy) == 0 ) CYCLE            ! case ice boundaries = initial conditions
329               !                                            !      do not change ice velocity (it is only computed by rheology)
330               SELECT CASE ( cd_type )
331                  !     
332               CASE ( 'U' ) 
333                  jgrd = 2      ! u velocity
334                  IF( ir == 0 ) THEN   ;   ibeg = 1                                 ;   iend = idx_bdy(jbdy)%nblenrim0(jgrd)
335                  ELSE                 ;   ibeg = idx_bdy(jbdy)%nblenrim0(jgrd)+1   ;   iend = idx_bdy(jbdy)%nblenrim(jgrd)
336                  END IF
337                  DO i_bdy = ibeg, iend
338                     ji    = idx_bdy(jbdy)%nbi(i_bdy,jgrd)
339                     jj    = idx_bdy(jbdy)%nbj(i_bdy,jgrd)
340                     zflag = idx_bdy(jbdy)%flagu(i_bdy,jgrd)
341                     !     i-1  i   i    |  !        i  i i+1 |  !          i  i i+1 |
342                     !      >  ice  >    |  !        o  > ice |  !          o  >  o  |     
343                     ! => set at u_ice(i-1) !  => set to O       !  => unchanged
344                     IF( zflag == -1. .AND. ji > 1 .AND. ji < jpi )   THEN 
345                        IF    ( vt_i(ji  ,jj) > 0. )   THEN   ;   u_ice(ji,jj) = u_ice(ji-1,jj) 
346                        ELSEIF( vt_i(ji+1,jj) > 0. )   THEN   ;   u_ice(ji,jj) = 0._wp
347                        END IF
348                     END IF
349                     ! |    i  i+1 i+1        !  |  i   i i+1        !  | i  i i+1
350                     ! |    >  ice  >         !  | ice  >  o         !  | o  >  o   
351                     ! => set at u_ice(i+1)   !     => set to O      !     =>  unchanged
352                     IF( zflag ==  1. .AND. ji+1 < jpi+1 )   THEN
353                        IF    ( vt_i(ji+1,jj) > 0. )   THEN   ;   u_ice(ji,jj) = u_ice(ji+1,jj)
354                        ELSEIF( vt_i(ji  ,jj) > 0. )   THEN   ;   u_ice(ji,jj) = 0._wp
355                        END IF
356                     END IF
357                     !
358                     IF( zflag ==  0. )   u_ice(ji,jj) = 0._wp   ! u_ice = 0  if north/south bdy 
359                     !
360                  END DO
361                  !
362               CASE ( 'V' )
363                  jgrd = 3      ! v velocity
364                  IF( ir == 0 ) THEN   ;   ibeg = 1                                 ;   iend = idx_bdy(jbdy)%nblenrim0(jgrd)
365                  ELSE                 ;   ibeg = idx_bdy(jbdy)%nblenrim0(jgrd)+1   ;   iend = idx_bdy(jbdy)%nblenrim(jgrd)
366                  END IF
367                  DO i_bdy = ibeg, iend
368                     ji    = idx_bdy(jbdy)%nbi(i_bdy,jgrd)
369                     jj    = idx_bdy(jbdy)%nbj(i_bdy,jgrd)
370                     zflag = idx_bdy(jbdy)%flagv(i_bdy,jgrd)
371                     !    ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨     !  ¨¨¨¨ïce¨¨¨(jj+1)¨¨     ! ¨¨¨¨¨¨ö¨¨¨¨(jj+1)       
372                     !       ^    (jj  )       !       ^    (jj  )       !       ^    (jj  )       
373                     !      ice   (jj  )       !       o    (jj  )       !       o    (jj  )       
374                     !       ^    (jj-1)       !                         !
375                     ! => set to u_ice(jj-1)   !  =>   set to 0          !   => unchanged       
376                     IF( zflag == -1. .AND. jj > 1 .AND. jj < jpj )   THEN                 
377                        IF    ( vt_i(ji,jj  ) > 0. )   THEN   ;   v_ice(ji,jj) = v_ice(ji,jj-1)
378                        ELSEIF( vt_i(ji,jj+1) > 0. )   THEN   ;   v_ice(ji,jj) = 0._wp
379                        END IF
380                     END IF
381                     !       ^    (jj+1)       !                         !             
382                     !      ice   (jj+1)       !       o    (jj+1)       !       o    (jj+1)       
383                     !       ^    (jj  )       !       ^    (jj  )       !       ^    (jj  )
384                     !   ________________      !  ____ice___(jj  )_      !  _____o____(jj  )
385                     ! => set to u_ice(jj+1)   !    => set to 0          !    => unchanged 
386                     IF( zflag ==  1. .AND. jj < jpj )   THEN             
387                        IF    ( vt_i(ji,jj+1) > 0. )   THEN   ;   v_ice(ji,jj) = v_ice(ji,jj+1)
388                        ELSEIF( vt_i(ji,jj  ) > 0. )   THEN   ;   v_ice(ji,jj) = 0._wp
389                        END IF
390                     END IF
391                     !
392                     IF( zflag ==  0. )   v_ice(ji,jj) = 0._wp   ! v_ice = 0  if west/east bdy 
393                     !
394                  END DO
395                  !
396               END SELECT
397               !
398            CASE DEFAULT
399               CALL ctl_stop( 'bdy_ice_dyn : unrecognised option for open boundaries for ice fields' )
400            END SELECT
401            !
402         END DO    ! jbdy
403         !
404         SELECT CASE ( cd_type )       
405         CASE ( 'U' ) 
406            llsend2(:) = .false.   ;   llrecv2(:) = .false.
407            DO jbdy = 1, nb_bdy
408               IF( cn_ice(jbdy) == 'frs' .AND. nn_ice_dta(jbdy) /= 0 ) THEN
409                  llsend2(:) = llsend2(:) .OR. lsend_bdyint(jbdy,2,:,ir)   ! possibly every direction, U points
410                  llsend2(1) = llsend2(1) .OR. lsend_bdyext(jbdy,2,1,ir)   ! neighbour might search point towards its west bdy
411                  llrecv2(:) = llrecv2(:) .OR. lrecv_bdyint(jbdy,2,:,ir)   ! possibly every direction, U points
412                  llrecv2(2) = llrecv2(2) .OR. lrecv_bdyext(jbdy,2,2,ir)   ! might search point towards east bdy
413               END IF
414            END DO
415            IF( ANY(llsend2) .OR. ANY(llrecv2) ) THEN   ! if need to send/recv in at least one direction
416               CALL lbc_bdy_lnk( 'bdyice', llsend2, llrecv2, u_ice, 'U', -1. )
417            END IF
418         CASE ( 'V' )
419            llsend3(:) = .false.   ;   llrecv3(:) = .false.
420            DO jbdy = 1, nb_bdy
421               IF( cn_ice(jbdy) == 'frs' .AND. nn_ice_dta(jbdy) /= 0 ) THEN
422                  llsend3(:) = llsend3(:) .OR. lsend_bdyint(jbdy,3,:,ir)   ! possibly every direction, V points
423                  llsend3(3) = llsend3(3) .OR. lsend_bdyext(jbdy,3,3,ir)   ! neighbour might search point towards its south bdy
424                  llrecv3(:) = llrecv3(:) .OR. lrecv_bdyint(jbdy,3,:,ir)   ! possibly every direction, V points
425                  llrecv3(4) = llrecv3(4) .OR. lrecv_bdyext(jbdy,3,4,ir)   ! might search point towards north bdy
426               END IF
427            END DO
428            IF( ANY(llsend3) .OR. ANY(llrecv3) ) THEN   ! if need to send/recv in at least one direction
429               CALL lbc_bdy_lnk( 'bdyice', llsend3, llrecv3, v_ice, 'V', -1. )
430            END IF
431         END SELECT
432      END DO   ! ir
433      !
434      IF( ln_timing )   CALL timing_stop('bdy_ice_dyn')
435      !
436    END SUBROUTINE bdy_ice_dyn
437
438#else
439   !!---------------------------------------------------------------------------------
440   !!   Default option                                                    Empty module
441   !!---------------------------------------------------------------------------------
442CONTAINS
443   SUBROUTINE bdy_ice( kt )      ! Empty routine
444      IMPLICIT NONE
445      INTEGER, INTENT( in ) :: kt
446      WRITE(*,*) 'bdy_ice: You should not have seen this print! error?', kt
447   END SUBROUTINE bdy_ice
448#endif
449
450   !!=================================================================================
451END MODULE bdyice
Note: See TracBrowser for help on using the repository browser.