1 | MODULE lbclnk |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE lbclnk *** |
---|
4 | !! NEMO : lateral boundary conditions |
---|
5 | !!===================================================================== |
---|
6 | !! History : OPA ! 1997-06 (G. Madec) Original code |
---|
7 | !! NEMO 1.0 ! 2002-09 (G. Madec) F90: Free form and module |
---|
8 | !! 3.2 ! 2009-03 (R. Benshila) External north fold treatment |
---|
9 | !! 3.5 ! 2012 (S.Mocavero, I. Epicoco) optimization of BDY comm. via lbc_bdy_lnk and lbc_obc_lnk |
---|
10 | !! 3.4 ! 2012-12 (R. Bourdalle-Badie, G. Reffray) add a C1D case |
---|
11 | !! 3.6 ! 2015-06 (O. Tintó and M. Castrillo) add lbc_lnk_multi |
---|
12 | !! 4.0 ! 2017-03 (G. Madec) automatique allocation of array size (use with any 3rd dim size) |
---|
13 | !! - ! 2017-04 (G. Madec) remove duplicated routines (lbc_lnk_2d_9, lbc_lnk_2d_multiple, lbc_lnk_3d_gather) |
---|
14 | !! - ! 2017-05 (G. Madec) create generic.h90 files to generate all lbc and north fold routines |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | #if defined key_mpp_mpi |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | !! 'key_mpp_mpi' MPI massively parallel processing library |
---|
19 | !!---------------------------------------------------------------------- |
---|
20 | !! define the generic interfaces of lib_mpp routines |
---|
21 | !!---------------------------------------------------------------------- |
---|
22 | !! lbc_lnk : generic interface for mpp_lnk_3d and mpp_lnk_2d routines defined in lib_mpp |
---|
23 | !! lbc_bdy_lnk : generic interface for mpp_lnk_bdy_2d and mpp_lnk_bdy_3d routines defined in lib_mpp |
---|
24 | !!---------------------------------------------------------------------- |
---|
25 | USE par_oce ! ocean dynamics and tracers |
---|
26 | USE lib_mpp ! distributed memory computing library |
---|
27 | USE lbcnfd ! north fold |
---|
28 | |
---|
29 | INTERFACE lbc_lnk |
---|
30 | MODULE PROCEDURE mpp_lnk_2d , mpp_lnk_3d , mpp_lnk_4d |
---|
31 | END INTERFACE |
---|
32 | INTERFACE lbc_lnk_ptr |
---|
33 | MODULE PROCEDURE mpp_lnk_2d_ptr , mpp_lnk_3d_ptr , mpp_lnk_4d_ptr |
---|
34 | END INTERFACE |
---|
35 | INTERFACE lbc_lnk_multi |
---|
36 | MODULE PROCEDURE lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi |
---|
37 | END INTERFACE |
---|
38 | ! |
---|
39 | INTERFACE lbc_bdy_lnk |
---|
40 | MODULE PROCEDURE mpp_lnk_bdy_2d, mpp_lnk_bdy_3d, mpp_lnk_bdy_4d |
---|
41 | END INTERFACE |
---|
42 | ! |
---|
43 | INTERFACE lbc_lnk_icb |
---|
44 | MODULE PROCEDURE mpp_lnk_2d_icb |
---|
45 | END INTERFACE |
---|
46 | |
---|
47 | PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions |
---|
48 | PUBLIC lbc_lnk_multi ! modified ocean/ice lateral boundary conditions |
---|
49 | PUBLIC lbc_bdy_lnk ! ocean lateral BDY boundary conditions |
---|
50 | PUBLIC lbc_lnk_icb ! iceberg lateral boundary conditions |
---|
51 | |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
54 | !! $Id: lbclnk.F90 10425 2018-12-19 21:54:16Z smasson $ |
---|
55 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | CONTAINS |
---|
58 | |
---|
59 | #else |
---|
60 | !!---------------------------------------------------------------------- |
---|
61 | !! Default option shared memory computing |
---|
62 | !!---------------------------------------------------------------------- |
---|
63 | !! routines setting the appropriate values |
---|
64 | !! on first and last row and column of the global domain |
---|
65 | !!---------------------------------------------------------------------- |
---|
66 | !! lbc_lnk_sum_3d: compute sum over the halos on a 3D variable on ocean mesh |
---|
67 | !! lbc_lnk_sum_3d: compute sum over the halos on a 2D variable on ocean mesh |
---|
68 | !! lbc_lnk : generic interface for lbc_lnk_3d and lbc_lnk_2d |
---|
69 | !! lbc_lnk_3d : set the lateral boundary condition on a 3D variable on ocean mesh |
---|
70 | !! lbc_lnk_2d : set the lateral boundary condition on a 2D variable on ocean mesh |
---|
71 | !! lbc_bdy_lnk : set the lateral BDY boundary condition |
---|
72 | !!---------------------------------------------------------------------- |
---|
73 | USE dom_oce ! ocean space and time domain |
---|
74 | USE in_out_manager ! I/O manager |
---|
75 | USE lbcnfd ! north fold |
---|
76 | |
---|
77 | IMPLICIT NONE |
---|
78 | PRIVATE |
---|
79 | |
---|
80 | INTERFACE lbc_lnk |
---|
81 | MODULE PROCEDURE lbc_lnk_2d , lbc_lnk_3d , lbc_lnk_4d |
---|
82 | END INTERFACE |
---|
83 | INTERFACE lbc_lnk_ptr |
---|
84 | MODULE PROCEDURE lbc_lnk_2d_ptr , lbc_lnk_3d_ptr , lbc_lnk_4d_ptr |
---|
85 | END INTERFACE |
---|
86 | INTERFACE lbc_lnk_multi |
---|
87 | MODULE PROCEDURE lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi |
---|
88 | END INTERFACE |
---|
89 | ! |
---|
90 | INTERFACE lbc_bdy_lnk |
---|
91 | MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d, lbc_bdy_lnk_4d |
---|
92 | END INTERFACE |
---|
93 | ! |
---|
94 | INTERFACE lbc_lnk_icb |
---|
95 | MODULE PROCEDURE lbc_lnk_2d_icb |
---|
96 | END INTERFACE |
---|
97 | |
---|
98 | PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions |
---|
99 | PUBLIC lbc_lnk_multi ! modified ocean/ice lateral boundary conditions |
---|
100 | PUBLIC lbc_bdy_lnk ! ocean lateral BDY boundary conditions |
---|
101 | PUBLIC lbc_lnk_icb ! iceberg lateral boundary conditions |
---|
102 | |
---|
103 | !!---------------------------------------------------------------------- |
---|
104 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
105 | !! $Id: lbclnk.F90 10425 2018-12-19 21:54:16Z smasson $ |
---|
106 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
107 | !!---------------------------------------------------------------------- |
---|
108 | CONTAINS |
---|
109 | |
---|
110 | !!====================================================================== |
---|
111 | !! Default option 3D shared memory computing |
---|
112 | !!====================================================================== |
---|
113 | !! routines setting land point, or east-west cyclic, |
---|
114 | !! or north-south cyclic, or north fold values |
---|
115 | !! on first and last row and column of the global domain |
---|
116 | !!---------------------------------------------------------------------- |
---|
117 | |
---|
118 | !!---------------------------------------------------------------------- |
---|
119 | !! *** routine lbc_lnk_(2,3,4)d *** |
---|
120 | !! |
---|
121 | !! * Argument : dummy argument use in lbc_lnk_... routines |
---|
122 | !! ptab : array or pointer of arrays on which the boundary condition is applied |
---|
123 | !! cd_nat : nature of array grid-points |
---|
124 | !! psgn : sign used across the north fold boundary |
---|
125 | !! kfld : optional, number of pt3d arrays |
---|
126 | !! cd_mpp : optional, fill the overlap area only |
---|
127 | !! pval : optional, background value (used at closed boundaries) |
---|
128 | !!---------------------------------------------------------------------- |
---|
129 | ! |
---|
130 | ! !== 2D array and array of 2D pointer ==! |
---|
131 | ! |
---|
132 | # define DIM_2d |
---|
133 | # define ROUTINE_LNK lbc_lnk_2d |
---|
134 | # include "lbc_lnk_generic.h90" |
---|
135 | # undef ROUTINE_LNK |
---|
136 | # define MULTI |
---|
137 | # define ROUTINE_LNK lbc_lnk_2d_ptr |
---|
138 | # include "lbc_lnk_generic.h90" |
---|
139 | # undef ROUTINE_LNK |
---|
140 | # undef MULTI |
---|
141 | # undef DIM_2d |
---|
142 | ! |
---|
143 | ! !== 3D array and array of 3D pointer ==! |
---|
144 | ! |
---|
145 | # define DIM_3d |
---|
146 | # define ROUTINE_LNK lbc_lnk_3d |
---|
147 | # include "lbc_lnk_generic.h90" |
---|
148 | # undef ROUTINE_LNK |
---|
149 | # define MULTI |
---|
150 | # define ROUTINE_LNK lbc_lnk_3d_ptr |
---|
151 | # include "lbc_lnk_generic.h90" |
---|
152 | # undef ROUTINE_LNK |
---|
153 | # undef MULTI |
---|
154 | # undef DIM_3d |
---|
155 | ! |
---|
156 | ! !== 4D array and array of 4D pointer ==! |
---|
157 | ! |
---|
158 | # define DIM_4d |
---|
159 | # define ROUTINE_LNK lbc_lnk_4d |
---|
160 | # include "lbc_lnk_generic.h90" |
---|
161 | # undef ROUTINE_LNK |
---|
162 | # define MULTI |
---|
163 | # define ROUTINE_LNK lbc_lnk_4d_ptr |
---|
164 | # include "lbc_lnk_generic.h90" |
---|
165 | # undef ROUTINE_LNK |
---|
166 | # undef MULTI |
---|
167 | # undef DIM_4d |
---|
168 | |
---|
169 | !!====================================================================== |
---|
170 | !! identical routines in both C1D and shared memory computing |
---|
171 | !!====================================================================== |
---|
172 | |
---|
173 | !!---------------------------------------------------------------------- |
---|
174 | !! *** routine lbc_bdy_lnk_(2,3,4)d *** |
---|
175 | !! |
---|
176 | !! wrapper rountine to 'lbc_lnk_3d'. This wrapper is used |
---|
177 | !! to maintain the same interface with regards to the mpp case |
---|
178 | !!---------------------------------------------------------------------- |
---|
179 | |
---|
180 | SUBROUTINE lbc_bdy_lnk_4d( cdname, pt4d, cd_type, psgn, ib_bdy ) |
---|
181 | !!---------------------------------------------------------------------- |
---|
182 | CHARACTER(len=*) , INTENT(in ) :: cdname ! name of the calling subroutine |
---|
183 | REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) :: pt4d ! 3D array on which the lbc is applied |
---|
184 | CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points |
---|
185 | REAL(wp) , INTENT(in ) :: psgn ! sign used across north fold |
---|
186 | INTEGER , INTENT(in ) :: ib_bdy ! BDY boundary set |
---|
187 | !!---------------------------------------------------------------------- |
---|
188 | CALL lbc_lnk_4d( cdname, pt4d, cd_type, psgn) |
---|
189 | END SUBROUTINE lbc_bdy_lnk_4d |
---|
190 | |
---|
191 | SUBROUTINE lbc_bdy_lnk_3d( cdname, pt3d, cd_type, psgn, ib_bdy ) |
---|
192 | !!---------------------------------------------------------------------- |
---|
193 | CHARACTER(len=*) , INTENT(in ) :: cdname ! name of the calling subroutine |
---|
194 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: pt3d ! 3D array on which the lbc is applied |
---|
195 | CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points |
---|
196 | REAL(wp) , INTENT(in ) :: psgn ! sign used across north fold |
---|
197 | INTEGER , INTENT(in ) :: ib_bdy ! BDY boundary set |
---|
198 | !!---------------------------------------------------------------------- |
---|
199 | CALL lbc_lnk_3d( cdname, pt3d, cd_type, psgn) |
---|
200 | END SUBROUTINE lbc_bdy_lnk_3d |
---|
201 | |
---|
202 | |
---|
203 | SUBROUTINE lbc_bdy_lnk_2d( cdname, pt2d, cd_type, psgn, ib_bdy ) |
---|
204 | !!---------------------------------------------------------------------- |
---|
205 | CHARACTER(len=*) , INTENT(in ) :: cdname ! name of the calling subroutine |
---|
206 | REAL(wp), DIMENSION(:,:), INTENT(inout) :: pt2d ! 3D array on which the lbc is applied |
---|
207 | CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points |
---|
208 | REAL(wp) , INTENT(in ) :: psgn ! sign used across north fold |
---|
209 | INTEGER , INTENT(in ) :: ib_bdy ! BDY boundary set |
---|
210 | !!---------------------------------------------------------------------- |
---|
211 | CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn) |
---|
212 | END SUBROUTINE lbc_bdy_lnk_2d |
---|
213 | |
---|
214 | |
---|
215 | !!gm This routine should be removed with an optional halos size added in argument of generic routines |
---|
216 | |
---|
217 | SUBROUTINE lbc_lnk_2d_icb( cdname, pt2d, cd_type, psgn, ki, kj ) |
---|
218 | !!---------------------------------------------------------------------- |
---|
219 | CHARACTER(len=*) , INTENT(in ) :: cdname ! name of the calling subroutine |
---|
220 | REAL(wp), DIMENSION(:,:), INTENT(inout) :: pt2d ! 2D array on which the lbc is applied |
---|
221 | CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points |
---|
222 | REAL(wp) , INTENT(in ) :: psgn ! sign used across north fold |
---|
223 | INTEGER , INTENT(in ) :: ki, kj ! sizes of extra halo (not needed in non-mpp) |
---|
224 | !!---------------------------------------------------------------------- |
---|
225 | CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn ) |
---|
226 | END SUBROUTINE lbc_lnk_2d_icb |
---|
227 | !!gm end |
---|
228 | |
---|
229 | #endif |
---|
230 | |
---|
231 | !!====================================================================== |
---|
232 | !! identical routines in both distributed and shared memory computing |
---|
233 | !!====================================================================== |
---|
234 | |
---|
235 | !!---------------------------------------------------------------------- |
---|
236 | !! *** load_ptr_(2,3,4)d *** |
---|
237 | !! |
---|
238 | !! * Dummy Argument : |
---|
239 | !! in ==> ptab ! array to be loaded (2D, 3D or 4D) |
---|
240 | !! cd_nat ! nature of pt2d array grid-points |
---|
241 | !! psgn ! sign used across the north fold boundary |
---|
242 | !! inout <=> ptab_ptr ! array of 2D, 3D or 4D pointers |
---|
243 | !! cdna_ptr ! nature of ptab array grid-points |
---|
244 | !! psgn_ptr ! sign used across the north fold boundary |
---|
245 | !! kfld ! number of elements that has been attributed |
---|
246 | !!---------------------------------------------------------------------- |
---|
247 | |
---|
248 | !!---------------------------------------------------------------------- |
---|
249 | !! *** lbc_lnk_(2,3,4)d_multi *** |
---|
250 | !! *** load_ptr_(2,3,4)d *** |
---|
251 | !! |
---|
252 | !! * Argument : dummy argument use in lbc_lnk_multi_... routines |
---|
253 | !! |
---|
254 | !!---------------------------------------------------------------------- |
---|
255 | |
---|
256 | # define DIM_2d |
---|
257 | # define ROUTINE_MULTI lbc_lnk_2d_multi |
---|
258 | # define ROUTINE_LOAD load_ptr_2d |
---|
259 | # include "lbc_lnk_multi_generic.h90" |
---|
260 | # undef ROUTINE_MULTI |
---|
261 | # undef ROUTINE_LOAD |
---|
262 | # undef DIM_2d |
---|
263 | |
---|
264 | |
---|
265 | # define DIM_3d |
---|
266 | # define ROUTINE_MULTI lbc_lnk_3d_multi |
---|
267 | # define ROUTINE_LOAD load_ptr_3d |
---|
268 | # include "lbc_lnk_multi_generic.h90" |
---|
269 | # undef ROUTINE_MULTI |
---|
270 | # undef ROUTINE_LOAD |
---|
271 | # undef DIM_3d |
---|
272 | |
---|
273 | |
---|
274 | # define DIM_4d |
---|
275 | # define ROUTINE_MULTI lbc_lnk_4d_multi |
---|
276 | # define ROUTINE_LOAD load_ptr_4d |
---|
277 | # include "lbc_lnk_multi_generic.h90" |
---|
278 | # undef ROUTINE_MULTI |
---|
279 | # undef ROUTINE_LOAD |
---|
280 | # undef DIM_4d |
---|
281 | |
---|
282 | !!====================================================================== |
---|
283 | END MODULE lbclnk |
---|
284 | |
---|