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 ) |
---|
49 | INTEGER , INTENT(in ) :: kfld ! number of pt3d arrays |
---|
50 | #else |
---|
51 | SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn , kfillmode, pfillval ) |
---|
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 | ! |
---|
60 | INTEGER :: ji, jj, jk, jl, jf ! dummy loop indices |
---|
61 | INTEGER :: ipi, ipj, ipk, ipl, ipf ! dimension of the input array |
---|
62 | INTEGER :: isize, ishift, ishift2 ! local integers |
---|
63 | INTEGER :: ireq_we, ireq_ea, ireq_so, ireq_no ! mpi_request id |
---|
64 | INTEGER :: ierr |
---|
65 | INTEGER :: ifill_we, ifill_ea, ifill_so, ifill_no |
---|
66 | REAL(wp) :: zland |
---|
67 | INTEGER , DIMENSION(MPI_STATUS_SIZE) :: istat ! for mpi_isend |
---|
68 | REAL(wp), DIMENSION(:,:,:,:,:), ALLOCATABLE :: zsnd_we, zrcv_we, zsnd_ea, zrcv_ea ! east -west & west - east halos |
---|
69 | REAL(wp), DIMENSION(:,:,:,:,:), ALLOCATABLE :: zsnd_so, zrcv_so, zsnd_no, zrcv_no ! north-south & south-north halos |
---|
70 | LOGICAL :: llcom_we, llcom_ea, llcom_no, llcom_so ! communication done or not |
---|
71 | LOGICAL :: lldo_nfd ! do north pole folding |
---|
72 | !!---------------------------------------------------------------------- |
---|
73 | ! |
---|
74 | ! ----------------------------------------- ! |
---|
75 | ! 0. local variables initialization ! |
---|
76 | ! ----------------------------------------- ! |
---|
77 | ! |
---|
78 | ipk = K_SIZE(ptab) ! 3rd dimension |
---|
79 | ipl = L_SIZE(ptab) ! 4th - |
---|
80 | ipf = F_SIZE(ptab) ! 5th - use in "multi" case (array of pointers) |
---|
81 | ! |
---|
82 | IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. ) |
---|
83 | ! |
---|
84 | llcom_we = nbondi == 1 .OR. nbondi == 0 ! keep for compatibility, should be defined in mppini |
---|
85 | llcom_ea = nbondi == -1 .OR. nbondi == 0 ! keep for compatibility, should be defined in mppini |
---|
86 | llcom_so = nbondj == 1 .OR. nbondj == 0 ! keep for compatibility, should be defined in mppini |
---|
87 | llcom_no = nbondj == -1 .OR. nbondj == 0 ! keep for compatibility, should be defined in mppini |
---|
88 | |
---|
89 | lldo_nfd = npolj /= 0 ! keep for compatibility, should be defined in mppini |
---|
90 | |
---|
91 | zland = 0._wp ! land filling value: zero by default |
---|
92 | IF( PRESENT( pfillval ) ) zland = pfillval ! set land value |
---|
93 | |
---|
94 | ! define the method we will use to fill the halos in each direction |
---|
95 | IF( llcom_we ) THEN ; ifill_we = jpfillmpi |
---|
96 | ELSEIF( l_Iperio ) THEN ; ifill_we = jpfillperio |
---|
97 | ELSEIF( PRESENT(kfillmode) ) THEN ; ifill_we = kfillmode |
---|
98 | ELSE ; ifill_we = jpfillcst |
---|
99 | END IF |
---|
100 | ! |
---|
101 | IF( llcom_ea ) THEN ; ifill_ea = jpfillmpi |
---|
102 | ELSE ; ifill_ea = ifill_we |
---|
103 | END IF |
---|
104 | ! |
---|
105 | IF( llcom_so ) THEN ; ifill_so = jpfillmpi |
---|
106 | ELSEIF( l_Jperio ) THEN ; ifill_so = jpfillperio |
---|
107 | ELSEIF( PRESENT(kfillmode) ) THEN ; ifill_so = kfillmode |
---|
108 | ELSE ; ifill_so = jpfillcst |
---|
109 | END IF |
---|
110 | ! |
---|
111 | IF( llcom_no ) THEN ; ifill_no = jpfillmpi |
---|
112 | ELSE ; ifill_no = ifill_so ! warning will be potentially changed if lldo_nfd = T |
---|
113 | END IF |
---|
114 | ! |
---|
115 | #if defined PRINT_CAUTION |
---|
116 | ! |
---|
117 | ! ================================================================================== ! |
---|
118 | ! CAUTION: semi-column notation is often impossible because of the cpp preprocessing ! |
---|
119 | ! ================================================================================== ! |
---|
120 | ! |
---|
121 | #endif |
---|
122 | ! |
---|
123 | ! -------------------------------------------------- ! |
---|
124 | ! 1. Do east and west MPI exchange if needed ! |
---|
125 | ! -------------------------------------------------- ! |
---|
126 | ! |
---|
127 | ! these echanges are made for jj = nn_hls+1 to jpj-nn_hls |
---|
128 | isize = nn_hls * ( jpj - 2*nn_hls ) * ipk * ipl * ipf |
---|
129 | |
---|
130 | ! Allocate local temporary arrays to be sent/received. Fill arrays to be sent |
---|
131 | IF( ifill_we == jpfillmpi ) THEN ! copy western side of the inner mpi domain in local temporary array to be sent by MPI |
---|
132 | ! |
---|
133 | ALLOCATE( zsnd_we(nn_hls,jpj-2*nn_hls,ipk,ipl,ipf), zrcv_we(nn_hls,jpj-2*nn_hls,ipk,ipl,ipf) ) |
---|
134 | ishift = nn_hls |
---|
135 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
136 | zsnd_we(ji,jj-nn_hls,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf) ! nn_hls + 1 -> 2*nn_hls |
---|
137 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
138 | ENDIF |
---|
139 | ! |
---|
140 | IF( ifill_ea == jpfillmpi ) THEN ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI |
---|
141 | ! |
---|
142 | ALLOCATE( zsnd_ea(nn_hls,jpj-2*nn_hls,ipk,ipl,ipf), zrcv_ea(nn_hls,jpj-2*nn_hls,ipk,ipl,ipf) ) |
---|
143 | ishift = jpi - 2 * nn_hls |
---|
144 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
145 | zsnd_ea(ji,jj-nn_hls,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf) ! jpi - 2*nn_hls + 1 -> jpi - nn_hls |
---|
146 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
147 | ENDIF |
---|
148 | ! |
---|
149 | IF( ln_timing ) CALL tic_tac(.TRUE.) |
---|
150 | ! |
---|
151 | ! non-blocking send of the western/eastern side using local temporary arrays |
---|
152 | IF( ifill_we == jpfillmpi ) CALL mppsend( 1, zsnd_we(1,1,1,1,1), isize, nowe, ireq_we ) |
---|
153 | IF( ifill_ea == jpfillmpi ) CALL mppsend( 2, zsnd_ea(1,1,1,1,1), isize, noea, ireq_ea ) |
---|
154 | ! blocking receive of the western/eastern halo in local temporary arrays |
---|
155 | IF( ifill_we == jpfillmpi ) CALL mpprecv( 2, zrcv_we(1,1,1,1,1), isize, nowe ) |
---|
156 | IF( ifill_ea == jpfillmpi ) CALL mpprecv( 1, zrcv_ea(1,1,1,1,1), isize, noea ) |
---|
157 | ! |
---|
158 | IF( ln_timing ) CALL tic_tac(.FALSE.) |
---|
159 | ! |
---|
160 | ! |
---|
161 | ! ----------------------------------- ! |
---|
162 | ! 2. Fill east and west halos ! |
---|
163 | ! ----------------------------------- ! |
---|
164 | ! |
---|
165 | ! 2.1 fill weastern halo |
---|
166 | ! ---------------------- |
---|
167 | ! ishift = 0 ! fill halo from ji = 1 to nn_hls |
---|
168 | SELECT CASE ( ifill_we ) |
---|
169 | CASE ( jpfillnothing ) ! no filling |
---|
170 | CASE ( jpfillmpi ) ! use data received by MPI |
---|
171 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
172 | ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_we(ji,jj-nn_hls,jk,jl,jf) ! 1 -> nn_hls |
---|
173 | END DO; END DO ; END DO ; END DO ; END DO |
---|
174 | CASE ( jpfillperio ) ! use east-weast periodicity |
---|
175 | ishift2 = jpi - 2 * nn_hls |
---|
176 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
177 | ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf) |
---|
178 | END DO; END DO ; END DO ; END DO ; END DO |
---|
179 | CASE ( jpfillcopy ) ! filling with inner domain values |
---|
180 | DO jf = 1, ipf ! number of arrays to be treated |
---|
181 | IF( .NOT. NAT_IN(jf) == 'F' ) THEN ! do nothing for F point |
---|
182 | DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
183 | ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf) |
---|
184 | END DO ; END DO ; END DO ; END DO |
---|
185 | ENDIF |
---|
186 | END DO |
---|
187 | CASE ( jpfillcst ) ! filling with constant value |
---|
188 | DO jf = 1, ipf ! number of arrays to be treated |
---|
189 | IF( .NOT. NAT_IN(jf) == 'F' ) THEN ! do nothing for F point |
---|
190 | DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
191 | ARRAY_IN(ji,jj,jk,jl,jf) = zland |
---|
192 | END DO; END DO ; END DO ; END DO |
---|
193 | ENDIF |
---|
194 | END DO |
---|
195 | END SELECT |
---|
196 | ! |
---|
197 | ! 2.2 fill eastern halo |
---|
198 | ! --------------------- |
---|
199 | ishift = jpi - nn_hls ! fill halo from ji = jpi-nn_hls+1 to jpi |
---|
200 | SELECT CASE ( ifill_ea ) |
---|
201 | CASE ( jpfillnothing ) ! no filling |
---|
202 | CASE ( jpfillmpi ) ! use data received by MPI |
---|
203 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
204 | ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv_ea(ji,jj-nn_hls,jk,jl,jf) ! jpi - nn_hls + 1 -> jpi |
---|
205 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
206 | CASE ( jpfillperio ) ! use east-weast periodicity |
---|
207 | ishift2 = nn_hls |
---|
208 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
209 | ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf) |
---|
210 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
211 | CASE ( jpfillcopy ) ! filling with inner domain values |
---|
212 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
213 | ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf) |
---|
214 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
215 | CASE ( jpfillcst ) ! filling with constant value |
---|
216 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = nn_hls+1, jpj-nn_hls ; DO ji = 1, nn_hls |
---|
217 | ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland |
---|
218 | END DO; END DO ; END DO ; END DO ; END DO |
---|
219 | END SELECT |
---|
220 | ! |
---|
221 | ! ------------------------------- ! |
---|
222 | ! 3. north fold treatment ! |
---|
223 | ! ------------------------------- ! |
---|
224 | ! |
---|
225 | ! do it before south directions so concerned processes can do it without waiting for the comm with the sourthern neighbor |
---|
226 | ! |
---|
227 | IF( lldo_nfd .AND. ifill_no /= jpfillnothing ) THEN |
---|
228 | ! |
---|
229 | SELECT CASE ( jpni ) |
---|
230 | CASE ( 1 ) ; CALL lbc_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) ) ! only 1 northern proc, no mpp |
---|
231 | CASE DEFAULT ; CALL mpp_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) ) ! for all northern procs. |
---|
232 | END SELECT |
---|
233 | ! |
---|
234 | ifill_no = jpfillnothing ! force to do nothing for the northern halo as we just done the north pole folding |
---|
235 | ! |
---|
236 | ENDIF |
---|
237 | ! |
---|
238 | ! ---------------------------------------------------- ! |
---|
239 | ! 4. Do north and south MPI exchange if needed ! |
---|
240 | ! ---------------------------------------------------- ! |
---|
241 | ! |
---|
242 | isize = jpi * nn_hls * ipk * ipl * ipf |
---|
243 | |
---|
244 | ! allocate local temporary arrays to be sent/received. Fill arrays to be sent |
---|
245 | IF( ifill_so == jpfillmpi ) THEN ! copy sourhern side of the inner mpi domain in local temporary array to be sent by MPI |
---|
246 | ! |
---|
247 | ALLOCATE( zsnd_so(jpi,nn_hls,ipk,ipl,ipf), zrcv_so(jpi,nn_hls,ipk,ipl,ipf) ) |
---|
248 | ishift = nn_hls |
---|
249 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
250 | zsnd_so(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf) ! nn_hls+1 -> 2*nn_hls |
---|
251 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
252 | ENDIF |
---|
253 | ! |
---|
254 | IF( ifill_no == jpfillmpi ) THEN ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI |
---|
255 | ! |
---|
256 | ALLOCATE( zsnd_no(jpi,nn_hls,ipk,ipl,ipf), zrcv_no(jpi,nn_hls,ipk,ipl,ipf) ) |
---|
257 | ishift = jpj - 2 * nn_hls |
---|
258 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
259 | zsnd_no(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf) ! jpj-2*nn_hls+1 -> jpj-nn_hls |
---|
260 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
261 | ENDIF |
---|
262 | ! |
---|
263 | IF( ln_timing ) CALL tic_tac(.TRUE.) |
---|
264 | ! |
---|
265 | ! non-blocking send of the southern/northern side |
---|
266 | IF( ifill_so == jpfillmpi ) CALL mppsend( 3, zsnd_so(1,1,1,1,1), isize, noso, ireq_so ) |
---|
267 | IF( ifill_no == jpfillmpi ) CALL mppsend( 4, zsnd_no(1,1,1,1,1), isize, nono, ireq_no ) |
---|
268 | ! blocking receive of the southern/northern halo |
---|
269 | IF( ifill_so == jpfillmpi ) CALL mpprecv( 4, zrcv_so(1,1,1,1,1), isize, noso ) |
---|
270 | IF( ifill_no == jpfillmpi ) CALL mpprecv( 3, zrcv_no(1,1,1,1,1), isize, nono ) |
---|
271 | ! |
---|
272 | IF( ln_timing ) CALL tic_tac(.FALSE.) |
---|
273 | ! |
---|
274 | ! ------------------------------------- ! |
---|
275 | ! 5. Fill south and north halos ! |
---|
276 | ! ------------------------------------- ! |
---|
277 | ! |
---|
278 | ! 5.1 fill southern halo |
---|
279 | ! ---------------------- |
---|
280 | ! ishift = 0 ! fill halo from jj = 1 to nn_hls |
---|
281 | SELECT CASE ( ifill_so ) |
---|
282 | CASE ( jpfillnothing ) ! no filling |
---|
283 | CASE ( jpfillmpi ) ! use data received by MPI |
---|
284 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
285 | ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_so(ji,jj,jk,jl,jf) ! 1 -> nn_hls |
---|
286 | END DO; END DO ; END DO ; END DO ; END DO |
---|
287 | CASE ( jpfillperio ) ! use north-south periodicity |
---|
288 | ishift2 = jpj - 2 * nn_hls |
---|
289 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
290 | ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf) |
---|
291 | END DO; END DO ; END DO ; END DO ; END DO |
---|
292 | CASE ( jpfillcopy ) ! filling with inner domain values |
---|
293 | DO jf = 1, ipf ! number of arrays to be treated |
---|
294 | IF( .NOT. NAT_IN(jf) == 'F' ) THEN ! do nothing for F point |
---|
295 | DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
296 | ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf) |
---|
297 | END DO ; END DO ; END DO ; END DO |
---|
298 | ENDIF |
---|
299 | END DO |
---|
300 | CASE ( jpfillcst ) ! filling with constant value |
---|
301 | DO jf = 1, ipf ! number of arrays to be treated |
---|
302 | IF( .NOT. NAT_IN(jf) == 'F' ) THEN ! do nothing for F point |
---|
303 | 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) = zland |
---|
305 | END DO; END DO ; END DO ; END DO |
---|
306 | ENDIF |
---|
307 | END DO |
---|
308 | END SELECT |
---|
309 | ! |
---|
310 | ! 5.2 fill northern halo |
---|
311 | ! ---------------------- |
---|
312 | ishift = jpj - nn_hls ! fill halo from jj = jpj-nn_hls+1 to jpj |
---|
313 | SELECT CASE ( ifill_no ) |
---|
314 | CASE ( jpfillnothing ) ! no filling |
---|
315 | CASE ( jpfillmpi ) ! use data received by MPI |
---|
316 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
317 | ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv_no(ji,jj,jk,jl,jf) ! jpj-nn_hls+1 -> jpj |
---|
318 | END DO ; END DO ; END DO ; END DO ; END DO |
---|
319 | CASE ( jpfillperio ) ! use north-south periodicity |
---|
320 | ishift2 = nn_hls |
---|
321 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
322 | ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf) |
---|
323 | END DO; END DO ; END DO ; END DO ; END DO |
---|
324 | CASE ( jpfillcopy ) ! filling with inner domain values |
---|
325 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
326 | ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf) |
---|
327 | END DO; END DO ; END DO ; END DO ; END DO |
---|
328 | CASE ( jpfillcst ) ! filling with constant value |
---|
329 | DO jf = 1, ipf ; DO jl = 1, ipl ; DO jk = 1, ipk ; DO jj = 1, nn_hls ; DO ji = 1, jpi |
---|
330 | ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland |
---|
331 | END DO; END DO ; END DO ; END DO ; END DO |
---|
332 | END SELECT |
---|
333 | ! |
---|
334 | ! -------------------------------------------- ! |
---|
335 | ! 6. deallocate local temporary arrays ! |
---|
336 | ! -------------------------------------------- ! |
---|
337 | ! |
---|
338 | IF( ifill_we == jpfillmpi ) THEN |
---|
339 | CALL mpi_wait(ireq_we, istat, ierr ) |
---|
340 | DEALLOCATE( zsnd_we, zrcv_we ) |
---|
341 | ENDIF |
---|
342 | IF( ifill_ea == jpfillmpi ) THEN |
---|
343 | CALL mpi_wait(ireq_ea, istat, ierr ) |
---|
344 | DEALLOCATE( zsnd_ea, zrcv_ea ) |
---|
345 | ENDIF |
---|
346 | IF( ifill_so == jpfillmpi ) THEN |
---|
347 | CALL mpi_wait(ireq_so, istat, ierr ) |
---|
348 | DEALLOCATE( zsnd_so, zrcv_so ) |
---|
349 | ENDIF |
---|
350 | IF( ifill_no == jpfillmpi ) THEN |
---|
351 | CALL mpi_wait(ireq_no, istat, ierr ) |
---|
352 | DEALLOCATE( zsnd_no, zrcv_no ) |
---|
353 | ENDIF |
---|
354 | ! |
---|
355 | END SUBROUTINE ROUTINE_LNK |
---|
356 | |
---|
357 | #undef ARRAY_TYPE |
---|
358 | #undef NAT_IN |
---|
359 | #undef SGN_IN |
---|
360 | #undef ARRAY_IN |
---|
361 | #undef K_SIZE |
---|
362 | #undef L_SIZE |
---|
363 | #undef F_SIZE |
---|
364 | #undef OPT_K |
---|