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.
mpp_lnk_generic.h90 in NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC – NEMO

source: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_lnk_generic.h90 @ 12719

Last change on this file since 12719 was 12719, checked in by francesca, 4 years ago

extra-halo management with positive arrays indices - ticket #2366

  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-fortran
File size: 20.4 KB
Line 
1#if defined MULTI
2#   define NAT_IN(k)                cd_nat(k)   
3#   define SGN_IN(k)                psgn(k)
4#   define F_SIZE(ptab)             kfld
5#   define OPT_K(k)                 ,ipf
6#   if defined DIM_2d
7#      define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D)                , INTENT(inout) ::   ptab(f)
8#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
9#      define K_SIZE(ptab)             1
10#      define L_SIZE(ptab)             1
11#   endif
12#   if defined DIM_3d
13#      define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D)                , INTENT(inout) ::   ptab(f)
14#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
15#      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
16#      define L_SIZE(ptab)             1
17#   endif
18#   if defined DIM_4d
19#      define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D)                , INTENT(inout) ::   ptab(f)
20#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
21#      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
22#      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
23#   endif
24#else
25#   define ARRAY_TYPE(i,j,k,l,f)    REAL(wp)                    , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f)
26#   define NAT_IN(k)                cd_nat
27#   define SGN_IN(k)                psgn
28#   define F_SIZE(ptab)             1
29#   define OPT_K(k)                 
30#   if defined DIM_2d
31#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j)
32#      define K_SIZE(ptab)          1
33#      define L_SIZE(ptab)          1
34#   endif
35#   if defined DIM_3d
36#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k)
37#      define K_SIZE(ptab)          SIZE(ptab,3)
38#      define L_SIZE(ptab)          1
39#   endif
40#   if defined DIM_4d
41#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k,l)
42#      define K_SIZE(ptab)          SIZE(ptab,3)
43#      define L_SIZE(ptab)          SIZE(ptab,4)
44#   endif
45#endif
46
47#if defined MULTI
48   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, lsend, lrecv )
49      INTEGER             , INTENT(in   ) ::   kfld        ! number of pt3d arrays
50#else
51   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn      , kfillmode, pfillval, lsend, lrecv )
52#endif
53      ARRAY_TYPE(:,:,:,:,:)                                        ! array or pointer of arrays on which the boundary condition is applied
54      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine
55      CHARACTER(len=1)              , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
56      REAL(wp)                      , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
57      INTEGER ,             OPTIONAL, INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
58      REAL(wp),             OPTIONAL, INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
59      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc
60      !
61      INTEGER  ::    ji,  jj,  jk,  jl,  jf      ! dummy loop indices
62      INTEGER  ::   ipi, ipj, ipk, ipl, ipf      ! dimension of the input array
63      INTEGER  ::   isize, ishift, ishift2       ! local integers
64      INTEGER  ::   ireq_we, ireq_ea, ireq_so, ireq_no     ! mpi_request id
65      INTEGER  ::   ierr
66      INTEGER  ::   ifill_we, ifill_ea, ifill_so, ifill_no
67      REAL(wp) ::   zland
68      INTEGER , DIMENSION(MPI_STATUS_SIZE)        ::   istat          ! for mpi_isend
69      REAL(wp), DIMENSION(:,:,:,:,:), ALLOCATABLE ::   zsnd_we, zrcv_we, zsnd_ea, zrcv_ea   ! east -west  & west - east  halos
70      REAL(wp), DIMENSION(:,:,:,:,:), ALLOCATABLE ::   zsnd_so, zrcv_so, zsnd_no, zrcv_no   ! north-south & south-north  halos
71      LOGICAL  ::   llsend_we, llsend_ea, llsend_no, llsend_so       ! communication send
72      LOGICAL  ::   llrecv_we, llrecv_ea, llrecv_no, llrecv_so       ! communication receive
73      LOGICAL  ::   lldo_nfd                                     ! do north pole folding
74      !!----------------------------------------------------------------------
75      !
76      ! ----------------------------------------- !
77      !     0. local variables initialization     !
78      ! ----------------------------------------- !
79      !
80      ipk = K_SIZE(ptab)   ! 3rd dimension
81      ipl = L_SIZE(ptab)   ! 4th    -
82      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
83      !
84      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
85      !
86      IF     ( PRESENT(lsend) .AND. PRESENT(lrecv) ) THEN
87         llsend_we = lsend(1)   ;   llsend_ea = lsend(2)   ;   llsend_so = lsend(3)   ;   llsend_no = lsend(4)
88         llrecv_we = lrecv(1)   ;   llrecv_ea = lrecv(2)   ;   llrecv_so = lrecv(3)   ;   llrecv_no = lrecv(4)
89      ELSE IF( PRESENT(lsend) .OR.  PRESENT(lrecv) ) THEN
90         WRITE(ctmp1,*) ' E R R O R : Routine ', cdname, '  is calling lbc_lnk with only one of the two arguments lsend or lrecv'
91         WRITE(ctmp2,*) ' ========== '
92         CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
93      ELSE   ! send and receive with every neighbour
94         llsend_we = nbondi ==  1 .OR. nbondi == 0   ! keep for compatibility, should be defined in mppini
95         llsend_ea = nbondi == -1 .OR. nbondi == 0   ! keep for compatibility, should be defined in mppini
96         llsend_so = nbondj ==  1 .OR. nbondj == 0   ! keep for compatibility, should be defined in mppini
97         llsend_no = nbondj == -1 .OR. nbondj == 0   ! keep for compatibility, should be defined in mppini
98         llrecv_we = llsend_we   ;   llrecv_ea = llsend_ea   ;   llrecv_so = llsend_so   ;   llrecv_no = llsend_no
99      END IF
100         
101         
102      lldo_nfd = npolj /= 0                      ! keep for compatibility, should be defined in mppini
103
104      zland = 0._wp                                     ! land filling value: zero by default
105      IF( PRESENT( pfillval ) )   zland = pfillval      ! set land value
106
107      ! define the method we will use to fill the halos in each direction
108      IF(              llrecv_we ) THEN   ;   ifill_we = jpfillmpi
109      ELSEIF(           l_Iperio ) THEN   ;   ifill_we = jpfillperio
110      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_we = kfillmode
111      ELSE                                ;   ifill_we = jpfillcst
112      END IF
113      !
114      IF(              llrecv_ea ) THEN   ;   ifill_ea = jpfillmpi
115      ELSEIF(           l_Iperio ) THEN   ;   ifill_ea = jpfillperio
116      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_ea = kfillmode
117      ELSE                                ;   ifill_ea = jpfillcst
118      END IF
119      !
120      IF(              llrecv_so ) THEN   ;   ifill_so = jpfillmpi
121      ELSEIF(           l_Jperio ) THEN   ;   ifill_so = jpfillperio
122      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_so = kfillmode
123      ELSE                                ;   ifill_so = jpfillcst
124      END IF
125      !
126      IF(              llrecv_no ) THEN   ;   ifill_no = jpfillmpi
127      ELSEIF(           l_Jperio ) THEN   ;   ifill_no = jpfillperio
128      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_no = kfillmode
129      ELSE                                ;   ifill_no = jpfillcst
130      END IF
131      !
132#if defined PRINT_CAUTION
133      !
134      ! ================================================================================== !
135      ! CAUTION: semi-column notation is often impossible because of the cpp preprocessing !
136      ! ================================================================================== !
137      !
138#endif
139      !
140      ! -------------------------------------------------- !
141      !     1. Do east and west MPI exchange if needed     !
142      ! -------------------------------------------------- !
143      !
144      ! Must exchange the whole column (from 1 to jpj) to get the corners if we have no south/north neighbourg
145      isize = nn_hls * jpj * ipk * ipl * ipf     
146      !
147      ! Allocate local temporary arrays to be sent/received. Fill arrays to be sent
148      IF( llsend_we )   ALLOCATE( zsnd_we(nn_hls,jpj,ipk,ipl,ipf) )
149      IF( llsend_ea )   ALLOCATE( zsnd_ea(nn_hls,jpj,ipk,ipl,ipf) )
150      IF( llrecv_we )   ALLOCATE( zrcv_we(nn_hls,jpj,ipk,ipl,ipf) )
151      IF( llrecv_ea )   ALLOCATE( zrcv_ea(nn_hls,jpj,ipk,ipl,ipf) )
152      !
153      IF( llsend_we ) THEN   ! copy western side of the inner mpi domain in local temporary array to be sent by MPI
154         ishift = nn_hls
155         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
156            zsnd_we(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! nn_hls + 1 -> 2*nn_hls
157         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
158      ENDIF
159      !
160      IF(llsend_ea  ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
161         ishift = jpi - 2 * nn_hls
162         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
163            zsnd_ea(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! jpi - 2*nn_hls + 1 -> jpi - nn_hls
164         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
165      ENDIF
166      !
167      IF( ln_timing ) CALL tic_tac(.TRUE.)
168      !
169      ! non-blocking send of the western/eastern side using local temporary arrays
170      IF( llsend_we )   CALL mppsend( 1, zsnd_we(1,1,1,1,1), isize, nowe, ireq_we )
171      IF( llsend_ea )   CALL mppsend( 2, zsnd_ea(1,1,1,1,1), isize, noea, ireq_ea )
172      ! blocking receive of the western/eastern halo in local temporary arrays
173      IF( llrecv_we )   CALL mpprecv( 2, zrcv_we(1,1,1,1,1), isize, nowe )
174      IF( llrecv_ea )   CALL mpprecv( 1, zrcv_ea(1,1,1,1,1), isize, noea )
175      !
176      IF( ln_timing ) CALL tic_tac(.FALSE.)
177      !
178      !
179      ! ----------------------------------- !
180      !     2. Fill east and west halos     !
181      ! ----------------------------------- !
182      !
183      ! 2.1 fill weastern halo
184      ! ----------------------
185      ! ishift = 0                         ! fill halo from ji = 1 to nn_hls
186      SELECT CASE ( ifill_we )
187      CASE ( jpfillnothing )               ! no filling
188      CASE ( jpfillmpi   )                 ! use data received by MPI
189         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
190            ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_we(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
191         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
192      CASE ( jpfillperio )                 ! use east-weast periodicity
193         ishift2 = jpi - 2 * nn_hls
194         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
195            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
196         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
197      CASE ( jpfillcopy  )                 ! filling with inner domain values
198         DO jf = 1, ipf                               ! number of arrays to be treated
199            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
200               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
201                  ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
202               END DO   ;   END DO   ;   END DO   ;   END DO
203            ENDIF
204         END DO
205      CASE ( jpfillcst   )                 ! filling with constant value
206         DO jf = 1, ipf                               ! number of arrays to be treated
207            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
208               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
209                  ARRAY_IN(ji,jj,jk,jl,jf) = zland
210               END DO;   END DO   ;   END DO   ;   END DO
211            ENDIF
212         END DO
213      END SELECT
214      !
215      ! 2.2 fill eastern halo
216      ! ---------------------
217      ishift = jpi - nn_hls                ! fill halo from ji = jpi-nn_hls+1 to jpi
218      SELECT CASE ( ifill_ea )
219      CASE ( jpfillnothing )               ! no filling
220      CASE ( jpfillmpi   )                 ! use data received by MPI
221         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
222            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv_ea(ji,jj,jk,jl,jf)   ! jpi - nn_hls + 1 -> jpi
223         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
224      CASE ( jpfillperio )                 ! use east-weast periodicity
225         ishift2 = nn_hls
226         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
227            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
228         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
229      CASE ( jpfillcopy  )                 ! filling with inner domain values
230         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
231            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
232         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
233      CASE ( jpfillcst   )                 ! filling with constant value
234         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
235            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
236         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
237      END SELECT
238      !
239      ! ------------------------------- !
240      !     3. north fold treatment     !
241      ! ------------------------------- !
242      !
243      ! do it before south directions so concerned processes can do it without waiting for the comm with the sourthern neighbor
244      !
245      IF( lldo_nfd .AND. ifill_no /= jpfillnothing ) THEN
246         !
247         SELECT CASE ( jpni )
248         CASE ( 1 )     ;   CALL lbc_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) )   ! only 1 northern proc, no mpp
249         CASE DEFAULT   ;   CALL mpp_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) )   ! for all northern procs.
250         END SELECT
251         !
252         ifill_no = jpfillnothing  ! force to do nothing for the northern halo as we just done the north pole folding
253         !
254      ENDIF
255      !
256      ! ---------------------------------------------------- !
257      !     4. Do north and south MPI exchange if needed     !
258      ! ---------------------------------------------------- !
259      !
260      IF( llsend_so )   ALLOCATE( zsnd_so(jpi,nn_hls,ipk,ipl,ipf) )
261      IF( llsend_no )   ALLOCATE( zsnd_no(jpi,nn_hls,ipk,ipl,ipf) )
262      IF( llrecv_so )   ALLOCATE( zrcv_so(jpi,nn_hls,ipk,ipl,ipf) )
263      IF( llrecv_no )   ALLOCATE( zrcv_no(jpi,nn_hls,ipk,ipl,ipf) )
264      !
265      isize = jpi * nn_hls * ipk * ipl * ipf     
266
267      ! allocate local temporary arrays to be sent/received. Fill arrays to be sent
268      IF( llsend_so ) THEN   ! copy sourhern side of the inner mpi domain in local temporary array to be sent by MPI
269         ishift = nn_hls
270         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
271            zsnd_so(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! nn_hls+1 -> 2*nn_hls
272         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
273      ENDIF
274      !
275      IF( llsend_no ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
276         ishift = jpj - 2 * nn_hls
277         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
278            zsnd_no(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! jpj-2*nn_hls+1 -> jpj-nn_hls
279         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
280      ENDIF
281      !
282      IF( ln_timing ) CALL tic_tac(.TRUE.)
283      !
284      ! non-blocking send of the southern/northern side
285      IF( llsend_so )   CALL mppsend( 3, zsnd_so(1,1,1,1,1), isize, noso, ireq_so )
286      IF( llsend_no )   CALL mppsend( 4, zsnd_no(1,1,1,1,1), isize, nono, ireq_no )
287      ! blocking receive of the southern/northern halo
288      IF( llrecv_so )   CALL mpprecv( 4, zrcv_so(1,1,1,1,1), isize, noso )
289      IF( llrecv_no )   CALL mpprecv( 3, zrcv_no(1,1,1,1,1), isize, nono )
290      !
291      IF( ln_timing ) CALL tic_tac(.FALSE.)
292      !
293      ! ------------------------------------- !
294      !     5. Fill south and north halos     !
295      ! ------------------------------------- !
296      !
297      ! 5.1 fill southern halo
298      ! ----------------------
299      ! ishift = 0                         ! fill halo from jj = 1 to nn_hls
300      SELECT CASE ( ifill_so )
301      CASE ( jpfillnothing )               ! no filling
302      CASE ( jpfillmpi   )                 ! use data received by MPI
303         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
304            ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_so(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
305         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
306      CASE ( jpfillperio )                 ! use north-south periodicity
307         ishift2 = jpj - 2 * nn_hls
308         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
309            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
310         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
311      CASE ( jpfillcopy  )                 ! filling with inner domain values
312         DO jf = 1, ipf                               ! number of arrays to be treated
313            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
314               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
315                  ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
316               END DO   ;   END DO   ;   END DO   ;   END DO
317            ENDIF
318         END DO
319      CASE ( jpfillcst   )                 ! filling with constant value
320         DO jf = 1, ipf                               ! number of arrays to be treated
321            IF( .NOT. NAT_IN(jf) == 'F' ) THEN        ! do nothing for F point
322               DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi 
323                  ARRAY_IN(ji,jj,jk,jl,jf) = zland
324               END DO;   END DO   ;   END DO   ;   END DO
325            ENDIF
326         END DO
327      END SELECT
328      !
329      ! 5.2 fill northern halo
330      ! ----------------------
331      ishift = jpj - nn_hls                ! fill halo from jj = jpj-nn_hls+1 to jpj
332      SELECT CASE ( ifill_no )
333      CASE ( jpfillnothing )               ! no filling
334      CASE ( jpfillmpi   )                 ! use data received by MPI
335         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
336            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv_no(ji,jj,jk,jl,jf)   ! jpj-nn_hls+1 -> jpj
337         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
338      CASE ( jpfillperio )                 ! use north-south periodicity
339         ishift2 = nn_hls
340         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
341            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
342         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
343      CASE ( jpfillcopy  )                 ! filling with inner domain values
344         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
345            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
346         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
347      CASE ( jpfillcst   )                 ! filling with constant value
348         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
349            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
350         END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
351      END SELECT
352      !
353      ! -------------------------------------------- !
354      !     6. deallocate local temporary arrays     !
355      ! -------------------------------------------- !
356      !
357      IF( llsend_we ) THEN
358         CALL mpi_wait(ireq_we, istat, ierr )
359         DEALLOCATE( zsnd_we )
360      ENDIF
361      IF( llsend_ea )  THEN
362         CALL mpi_wait(ireq_ea, istat, ierr )
363         DEALLOCATE( zsnd_ea )
364      ENDIF
365      IF( llsend_so ) THEN
366         CALL mpi_wait(ireq_so, istat, ierr )
367         DEALLOCATE( zsnd_so )
368      ENDIF
369      IF( llsend_no ) THEN
370         CALL mpi_wait(ireq_no, istat, ierr )
371         DEALLOCATE( zsnd_no )
372      ENDIF
373      !
374      IF( llrecv_we )   DEALLOCATE( zrcv_we )
375      IF( llrecv_ea )   DEALLOCATE( zrcv_ea )
376      IF( llrecv_so )   DEALLOCATE( zrcv_so )
377      IF( llrecv_no )   DEALLOCATE( zrcv_no )
378      !
379   END SUBROUTINE ROUTINE_LNK
380
381#undef ARRAY_TYPE
382#undef NAT_IN
383#undef SGN_IN
384#undef ARRAY_IN
385#undef K_SIZE
386#undef L_SIZE
387#undef F_SIZE
388#undef OPT_K
Note: See TracBrowser for help on using the repository browser.