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