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