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