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 | !! define the generic interfaces of lib_mpp routines |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | !! lbc_lnk : generic interface for mpp_lnk_3d and mpp_lnk_2d routines defined in lib_mpp |
---|
19 | !! lbc_bdy_lnk : generic interface for mpp_lnk_bdy_2d and mpp_lnk_bdy_3d routines defined in lib_mpp |
---|
20 | !!---------------------------------------------------------------------- |
---|
21 | USE dom_oce ! ocean space and time domain |
---|
22 | USE lib_mpp ! distributed memory computing library |
---|
23 | USE lbcnfd ! north fold |
---|
24 | USE in_out_manager ! I/O manager |
---|
25 | #if ! defined key_mpi_off |
---|
26 | USE MPI |
---|
27 | #endif |
---|
28 | |
---|
29 | IMPLICIT NONE |
---|
30 | PRIVATE |
---|
31 | |
---|
32 | INTERFACE lbc_lnk |
---|
33 | MODULE PROCEDURE lbc_lnk_call_2d_sp, lbc_lnk_call_3d_sp, lbc_lnk_call_4d_sp |
---|
34 | MODULE PROCEDURE lbc_lnk_call_2d_dp, lbc_lnk_call_3d_dp, lbc_lnk_call_4d_dp |
---|
35 | END INTERFACE |
---|
36 | |
---|
37 | INTERFACE lbc_lnk_pt2pt |
---|
38 | MODULE PROCEDURE lbc_lnk_pt2pt_sp, lbc_lnk_pt2pt_dp |
---|
39 | END INTERFACE |
---|
40 | |
---|
41 | INTERFACE lbc_lnk_newpt2pt |
---|
42 | MODULE PROCEDURE lbc_lnk_newpt2pt_sp, lbc_lnk_newpt2pt_dp |
---|
43 | END INTERFACE lbc_lnk_newpt2pt |
---|
44 | |
---|
45 | INTERFACE lbc_lnk_oldpt2pt |
---|
46 | MODULE PROCEDURE lbc_lnk_oldpt2pt_sp, lbc_lnk_oldpt2pt_dp |
---|
47 | END INTERFACE lbc_lnk_oldpt2pt |
---|
48 | |
---|
49 | INTERFACE lbc_lnk_neicoll |
---|
50 | MODULE PROCEDURE lbc_lnk_neicoll_sp ,lbc_lnk_neicoll_dp |
---|
51 | END INTERFACE |
---|
52 | |
---|
53 | INTERFACE lbc_lnk_persistent |
---|
54 | MODULE PROCEDURE lbc_lnk_persistent_sp, lbc_lnk_persistent_dp |
---|
55 | END INTERFACE lbc_lnk_persistent |
---|
56 | ! |
---|
57 | INTERFACE lbc_lnk_icb |
---|
58 | MODULE PROCEDURE mpp_lnk_2d_icb_dp, mpp_lnk_2d_icb_sp |
---|
59 | END INTERFACE |
---|
60 | |
---|
61 | PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions |
---|
62 | PUBLIC lbc_lnk_icb ! iceberg lateral boundary conditions |
---|
63 | |
---|
64 | REAL(dp), DIMENSION(:), ALLOCATABLE :: buffsnd_dp, buffrcv_dp ! MPI send/recv buffers |
---|
65 | REAL(sp), DIMENSION(:), ALLOCATABLE :: buffsnd_sp, buffrcv_sp ! |
---|
66 | INTEGER, DIMENSION(8) :: nreq_p2p ! request id for MPI_Isend in point-2-point communication |
---|
67 | |
---|
68 | !! * Substitutions |
---|
69 | !!# include "do_loop_substitute.h90" |
---|
70 | !!---------------------------------------------------------------------- |
---|
71 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
72 | !! $Id$ |
---|
73 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
74 | !!---------------------------------------------------------------------- |
---|
75 | CONTAINS |
---|
76 | |
---|
77 | !!---------------------------------------------------------------------- |
---|
78 | !! *** lbc_lnk_call_[234]d_[sd]p *** |
---|
79 | !! |
---|
80 | !! * Dummy Argument : |
---|
81 | !! in ==> cdname ! name of the calling subroutine (for monitoring) |
---|
82 | !! ptab ! array to be loaded (2D, 3D or 4D) |
---|
83 | !! cd_nat ! nature of pt2d array grid-points |
---|
84 | !! psgn ! sign used across the north fold boundary |
---|
85 | !! inout <=> ptab_ptr ! array of 2D, 3D or 4D pointers |
---|
86 | !! cdna_ptr ! nature of ptab array grid-points |
---|
87 | !! psgn_ptr ! sign used across the north fold boundary |
---|
88 | !! kfld ! number of elements that has been attributed |
---|
89 | !!---------------------------------------------------------------------- |
---|
90 | ! |
---|
91 | !!---------------------------------------------------------------------- |
---|
92 | !! |
---|
93 | !! *** lbc_lnk_call_[234]d_[sd]p *** |
---|
94 | !! *** load_ptr_[234]d_[sd]p *** |
---|
95 | !! |
---|
96 | !!---------------------------------------------------------------------- |
---|
97 | !! |
---|
98 | !! ---- SINGLE PRECISION VERSIONS |
---|
99 | !! |
---|
100 | #define PRECISION sp |
---|
101 | # define DIM_2d |
---|
102 | # include "lbc_lnk_call_generic.h90" |
---|
103 | # undef DIM_2d |
---|
104 | # define DIM_3d |
---|
105 | # include "lbc_lnk_call_generic.h90" |
---|
106 | # undef DIM_3d |
---|
107 | # define DIM_4d |
---|
108 | # include "lbc_lnk_call_generic.h90" |
---|
109 | # undef DIM_4d |
---|
110 | #undef PRECISION |
---|
111 | !! |
---|
112 | !! ---- DOUBLE PRECISION VERSIONS |
---|
113 | !! |
---|
114 | #define PRECISION dp |
---|
115 | # define DIM_2d |
---|
116 | # include "lbc_lnk_call_generic.h90" |
---|
117 | # undef DIM_2d |
---|
118 | # define DIM_3d |
---|
119 | # include "lbc_lnk_call_generic.h90" |
---|
120 | # undef DIM_3d |
---|
121 | # define DIM_4d |
---|
122 | # include "lbc_lnk_call_generic.h90" |
---|
123 | # undef DIM_4d |
---|
124 | #undef PRECISION |
---|
125 | ! |
---|
126 | !!---------------------------------------------------------------------- |
---|
127 | !! *** lbc_lnk_pt2pt_[sd]p *** |
---|
128 | !! *** lbc_lnk_neicoll_[sd]p *** |
---|
129 | !! *** lbc_lnk_newpt2pt_[sd]p *** |
---|
130 | !! |
---|
131 | !! * Argument : dummy argument use in lbc_lnk_... routines |
---|
132 | !! cdname : name of the calling subroutine (for monitoring) |
---|
133 | !! ptab : pointer of arrays on which the boundary condition is applied |
---|
134 | !! cd_nat : nature of array grid-points |
---|
135 | !! psgn : sign used across the north fold boundary |
---|
136 | !! kfld : number of pt3d arrays |
---|
137 | !! kfillmode : optional, method to be use to fill the halos (see jpfill* variables) |
---|
138 | !! pfillval : optional, background value (used with jpfillcopy) |
---|
139 | !!---------------------------------------------------------------------- |
---|
140 | !! |
---|
141 | !! ---- SINGLE PRECISION VERSIONS |
---|
142 | !! |
---|
143 | #define PRECISION sp |
---|
144 | # define MPI_TYPE MPI_REAL |
---|
145 | # define BUFFSND buffsnd_sp |
---|
146 | # define BUFFRCV buffrcv_sp |
---|
147 | # include "lbc_lnk_pt2pt_generic.h90" |
---|
148 | # include "lbc_lnk_newpt2pt_generic.h90" |
---|
149 | # include "lbc_lnk_oldpt2pt_generic.h90" |
---|
150 | # include "lbc_lnk_neicoll_generic.h90" |
---|
151 | # include "lbc_lnk_persistent.h90" |
---|
152 | # undef MPI_TYPE |
---|
153 | # undef BUFFSND |
---|
154 | # undef BUFFRCV |
---|
155 | #undef PRECISION |
---|
156 | !! |
---|
157 | !! ---- DOUBLE PRECISION VERSIONS |
---|
158 | !! |
---|
159 | #define PRECISION dp |
---|
160 | # define MPI_TYPE MPI_DOUBLE_PRECISION |
---|
161 | # define BUFFSND buffsnd_dp |
---|
162 | # define BUFFRCV buffrcv_dp |
---|
163 | # include "lbc_lnk_pt2pt_generic.h90" |
---|
164 | # include "lbc_lnk_newpt2pt_generic.h90" |
---|
165 | # include "lbc_lnk_oldpt2pt_generic.h90" |
---|
166 | # include "lbc_lnk_neicoll_generic.h90" |
---|
167 | # include "lbc_lnk_persistent.h90" |
---|
168 | # undef MPI_TYPE |
---|
169 | # undef BUFFSND |
---|
170 | # undef BUFFRCV |
---|
171 | #undef PRECISION |
---|
172 | |
---|
173 | !!====================================================================== |
---|
174 | !!--------------------------------------------------------------------- |
---|
175 | !! *** routine mpp_lbc_north_icb *** |
---|
176 | !! |
---|
177 | !! ** Purpose : Ensure proper north fold horizontal bondary condition |
---|
178 | !! in mpp configuration in case of jpn1 > 1 and for 2d |
---|
179 | !! array with outer extra halo |
---|
180 | !! |
---|
181 | !! ** Method : North fold condition and mpp with more than one proc |
---|
182 | !! in i-direction require a specific treatment. We gather |
---|
183 | !! the 4+kextj northern lines of the global domain on 1 |
---|
184 | !! processor and apply lbc north-fold on this sub array. |
---|
185 | !! Then we scatter the north fold array back to the processors. |
---|
186 | !! This routine accounts for an extra halo with icebergs |
---|
187 | !! and assumes ghost rows and columns have been suppressed. |
---|
188 | !! |
---|
189 | !!---------------------------------------------------------------------- |
---|
190 | # define SINGLE_PRECISION |
---|
191 | # define ROUTINE_LNK mpp_lbc_north_icb_sp |
---|
192 | # include "mpp_lbc_north_icb_generic.h90" |
---|
193 | # undef ROUTINE_LNK |
---|
194 | # undef SINGLE_PRECISION |
---|
195 | # define ROUTINE_LNK mpp_lbc_north_icb_dp |
---|
196 | # include "mpp_lbc_north_icb_generic.h90" |
---|
197 | # undef ROUTINE_LNK |
---|
198 | |
---|
199 | |
---|
200 | !!---------------------------------------------------------------------- |
---|
201 | !! *** routine mpp_lnk_2d_icb *** |
---|
202 | !! |
---|
203 | !! ** Purpose : Message passing management for 2d array (with extra halo for icebergs) |
---|
204 | !! This routine receives a (1-kexti:jpi+kexti,1-kexti:jpj+kextj) |
---|
205 | !! array (usually (0:jpi+1, 0:jpj+1)) from lbc_lnk_icb calls. |
---|
206 | !! |
---|
207 | !! ** Method : Use mppsend and mpprecv function for passing mask |
---|
208 | !! between processors following neighboring subdomains. |
---|
209 | !! domain parameters |
---|
210 | !! jpi : first dimension of the local subdomain |
---|
211 | !! jpj : second dimension of the local subdomain |
---|
212 | !! mpinei : number of neighboring domains (starting at 0, -1 if no neighbourg) |
---|
213 | !!---------------------------------------------------------------------- |
---|
214 | |
---|
215 | # define SINGLE_PRECISION |
---|
216 | # define ROUTINE_LNK mpp_lnk_2d_icb_sp |
---|
217 | # include "mpp_lnk_icb_generic.h90" |
---|
218 | # undef ROUTINE_LNK |
---|
219 | # undef SINGLE_PRECISION |
---|
220 | # define ROUTINE_LNK mpp_lnk_2d_icb_dp |
---|
221 | # include "mpp_lnk_icb_generic.h90" |
---|
222 | # undef ROUTINE_LNK |
---|
223 | |
---|
224 | END MODULE lbclnk |
---|