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. |
---|
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 | !!---------------------------------------------------------------------- |
---|
24 | USE par_oce ! ocean dynamics and tracers |
---|
25 | USE lib_mpp ! distributed memory computing library |
---|
26 | USE lbcnfd ! north fold |
---|
27 | |
---|
28 | INTERFACE lbc_lnk |
---|
29 | MODULE PROCEDURE mpp_lnk_2d , mpp_lnk_3d , mpp_lnk_4d |
---|
30 | END INTERFACE |
---|
31 | INTERFACE lbc_lnk_ptr |
---|
32 | MODULE PROCEDURE mpp_lnk_2d_ptr , mpp_lnk_3d_ptr , mpp_lnk_4d_ptr |
---|
33 | END INTERFACE |
---|
34 | INTERFACE lbc_lnk_multi |
---|
35 | MODULE PROCEDURE lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi |
---|
36 | END INTERFACE |
---|
37 | ! |
---|
38 | INTERFACE lbc_lnk_icb |
---|
39 | MODULE PROCEDURE mpp_lnk_2d_icb |
---|
40 | END INTERFACE |
---|
41 | |
---|
42 | PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions |
---|
43 | PUBLIC lbc_lnk_multi ! modified ocean/ice lateral boundary conditions |
---|
44 | PUBLIC lbc_lnk_icb ! iceberg lateral boundary conditions |
---|
45 | |
---|
46 | !!---------------------------------------------------------------------- |
---|
47 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
48 | !! $Id: lbclnk.F90 10425 2018-12-19 21:54:16Z smasson $ |
---|
49 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
50 | !!---------------------------------------------------------------------- |
---|
51 | CONTAINS |
---|
52 | |
---|
53 | #else |
---|
54 | !!---------------------------------------------------------------------- |
---|
55 | !! Default option shared memory computing |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | !! routines setting the appropriate values |
---|
58 | !! on first and last row and column of the global domain |
---|
59 | !!---------------------------------------------------------------------- |
---|
60 | !! lbc_lnk_sum_3d: compute sum over the halos on a 3D variable on ocean mesh |
---|
61 | !! lbc_lnk_sum_3d: compute sum over the halos on a 2D variable on ocean mesh |
---|
62 | !! lbc_lnk : generic interface for lbc_lnk_3d and lbc_lnk_2d |
---|
63 | !! lbc_lnk_3d : set the lateral boundary condition on a 3D variable on ocean mesh |
---|
64 | !! lbc_lnk_2d : set the lateral boundary condition on a 2D variable on ocean mesh |
---|
65 | !!---------------------------------------------------------------------- |
---|
66 | USE dom_oce ! ocean space and time domain |
---|
67 | USE in_out_manager ! I/O manager |
---|
68 | USE lbcnfd ! north fold |
---|
69 | |
---|
70 | IMPLICIT NONE |
---|
71 | PRIVATE |
---|
72 | |
---|
73 | INTERFACE lbc_lnk |
---|
74 | MODULE PROCEDURE lbc_lnk_2d , lbc_lnk_3d , lbc_lnk_4d |
---|
75 | END INTERFACE |
---|
76 | INTERFACE lbc_lnk_ptr |
---|
77 | MODULE PROCEDURE lbc_lnk_2d_ptr , lbc_lnk_3d_ptr , lbc_lnk_4d_ptr |
---|
78 | END INTERFACE |
---|
79 | INTERFACE lbc_lnk_multi |
---|
80 | MODULE PROCEDURE lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi |
---|
81 | END INTERFACE |
---|
82 | ! |
---|
83 | INTERFACE lbc_lnk_icb |
---|
84 | MODULE PROCEDURE lbc_lnk_2d_icb |
---|
85 | END INTERFACE |
---|
86 | |
---|
87 | PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions |
---|
88 | PUBLIC lbc_lnk_multi ! modified ocean/ice lateral boundary conditions |
---|
89 | PUBLIC lbc_lnk_icb ! iceberg lateral boundary conditions |
---|
90 | |
---|
91 | !!---------------------------------------------------------------------- |
---|
92 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
93 | !! $Id: lbclnk.F90 10425 2018-12-19 21:54:16Z smasson $ |
---|
94 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
95 | !!---------------------------------------------------------------------- |
---|
96 | CONTAINS |
---|
97 | |
---|
98 | !!====================================================================== |
---|
99 | !! Default option 3D shared memory computing |
---|
100 | !!====================================================================== |
---|
101 | !! routines setting land point, or east-west cyclic, |
---|
102 | !! or north-south cyclic, or north fold values |
---|
103 | !! on first and last row and column of the global domain |
---|
104 | !!---------------------------------------------------------------------- |
---|
105 | |
---|
106 | !!---------------------------------------------------------------------- |
---|
107 | !! *** routine lbc_lnk_(2,3,4)d *** |
---|
108 | !! |
---|
109 | !! * Argument : dummy argument use in lbc_lnk_... routines |
---|
110 | !! ptab : array or pointer of arrays on which the boundary condition is applied |
---|
111 | !! cd_nat : nature of array grid-points |
---|
112 | !! psgn : sign used across the north fold boundary |
---|
113 | !! kfld : optional, number of pt3d arrays |
---|
114 | !! cd_mpp : optional, fill the overlap area only |
---|
115 | !! pval : optional, background value (used at closed boundaries) |
---|
116 | !!---------------------------------------------------------------------- |
---|
117 | ! |
---|
118 | ! !== 2D array and array of 2D pointer ==! |
---|
119 | ! |
---|
120 | # define DIM_2d |
---|
121 | # define ROUTINE_LNK lbc_lnk_2d |
---|
122 | # include "lbc_lnk_generic.h90" |
---|
123 | # undef ROUTINE_LNK |
---|
124 | # define MULTI |
---|
125 | # define ROUTINE_LNK lbc_lnk_2d_ptr |
---|
126 | # include "lbc_lnk_generic.h90" |
---|
127 | # undef ROUTINE_LNK |
---|
128 | # undef MULTI |
---|
129 | # undef DIM_2d |
---|
130 | ! |
---|
131 | ! !== 3D array and array of 3D pointer ==! |
---|
132 | ! |
---|
133 | # define DIM_3d |
---|
134 | # define ROUTINE_LNK lbc_lnk_3d |
---|
135 | # include "lbc_lnk_generic.h90" |
---|
136 | # undef ROUTINE_LNK |
---|
137 | # define MULTI |
---|
138 | # define ROUTINE_LNK lbc_lnk_3d_ptr |
---|
139 | # include "lbc_lnk_generic.h90" |
---|
140 | # undef ROUTINE_LNK |
---|
141 | # undef MULTI |
---|
142 | # undef DIM_3d |
---|
143 | ! |
---|
144 | ! !== 4D array and array of 4D pointer ==! |
---|
145 | ! |
---|
146 | # define DIM_4d |
---|
147 | # define ROUTINE_LNK lbc_lnk_4d |
---|
148 | # include "lbc_lnk_generic.h90" |
---|
149 | # undef ROUTINE_LNK |
---|
150 | # define MULTI |
---|
151 | # define ROUTINE_LNK lbc_lnk_4d_ptr |
---|
152 | # include "lbc_lnk_generic.h90" |
---|
153 | # undef ROUTINE_LNK |
---|
154 | # undef MULTI |
---|
155 | # undef DIM_4d |
---|
156 | |
---|
157 | !!====================================================================== |
---|
158 | !! identical routines in both C1D and shared memory computing |
---|
159 | !!====================================================================== |
---|
160 | |
---|
161 | !!---------------------------------------------------------------------- |
---|
162 | |
---|
163 | !!gm This routine should be removed with an optional halos size added in argument of generic routines |
---|
164 | |
---|
165 | SUBROUTINE lbc_lnk_2d_icb( cdname, pt2d, cd_type, psgn, ki, kj ) |
---|
166 | !!---------------------------------------------------------------------- |
---|
167 | CHARACTER(len=*) , INTENT(in ) :: cdname ! name of the calling subroutine |
---|
168 | REAL(wp), DIMENSION(:,:), INTENT(inout) :: pt2d ! 2D array on which the lbc is applied |
---|
169 | CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points |
---|
170 | REAL(wp) , INTENT(in ) :: psgn ! sign used across north fold |
---|
171 | INTEGER , INTENT(in ) :: ki, kj ! sizes of extra halo (not needed in non-mpp) |
---|
172 | !!---------------------------------------------------------------------- |
---|
173 | CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn ) |
---|
174 | END SUBROUTINE lbc_lnk_2d_icb |
---|
175 | !!gm end |
---|
176 | |
---|
177 | #endif |
---|
178 | |
---|
179 | !!====================================================================== |
---|
180 | !! identical routines in both distributed and shared memory computing |
---|
181 | !!====================================================================== |
---|
182 | |
---|
183 | !!---------------------------------------------------------------------- |
---|
184 | !! *** load_ptr_(2,3,4)d *** |
---|
185 | !! |
---|
186 | !! * Dummy Argument : |
---|
187 | !! in ==> ptab ! array to be loaded (2D, 3D or 4D) |
---|
188 | !! cd_nat ! nature of pt2d array grid-points |
---|
189 | !! psgn ! sign used across the north fold boundary |
---|
190 | !! inout <=> ptab_ptr ! array of 2D, 3D or 4D pointers |
---|
191 | !! cdna_ptr ! nature of ptab array grid-points |
---|
192 | !! psgn_ptr ! sign used across the north fold boundary |
---|
193 | !! kfld ! number of elements that has been attributed |
---|
194 | !!---------------------------------------------------------------------- |
---|
195 | |
---|
196 | !!---------------------------------------------------------------------- |
---|
197 | !! *** lbc_lnk_(2,3,4)d_multi *** |
---|
198 | !! *** load_ptr_(2,3,4)d *** |
---|
199 | !! |
---|
200 | !! * Argument : dummy argument use in lbc_lnk_multi_... routines |
---|
201 | !! |
---|
202 | !!---------------------------------------------------------------------- |
---|
203 | |
---|
204 | # define DIM_2d |
---|
205 | # define ROUTINE_MULTI lbc_lnk_2d_multi |
---|
206 | # define ROUTINE_LOAD load_ptr_2d |
---|
207 | # include "lbc_lnk_multi_generic.h90" |
---|
208 | # undef ROUTINE_MULTI |
---|
209 | # undef ROUTINE_LOAD |
---|
210 | # undef DIM_2d |
---|
211 | |
---|
212 | |
---|
213 | # define DIM_3d |
---|
214 | # define ROUTINE_MULTI lbc_lnk_3d_multi |
---|
215 | # define ROUTINE_LOAD load_ptr_3d |
---|
216 | # include "lbc_lnk_multi_generic.h90" |
---|
217 | # undef ROUTINE_MULTI |
---|
218 | # undef ROUTINE_LOAD |
---|
219 | # undef DIM_3d |
---|
220 | |
---|
221 | |
---|
222 | # define DIM_4d |
---|
223 | # define ROUTINE_MULTI lbc_lnk_4d_multi |
---|
224 | # define ROUTINE_LOAD load_ptr_4d |
---|
225 | # include "lbc_lnk_multi_generic.h90" |
---|
226 | # undef ROUTINE_MULTI |
---|
227 | # undef ROUTINE_LOAD |
---|
228 | # undef DIM_4d |
---|
229 | |
---|
230 | !!====================================================================== |
---|
231 | END MODULE lbclnk |
---|
232 | |
---|