New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
lbclnk.F90 in NEMO/branches/2021/dev_r14447_HPC-07_Irrmann_try_new_pt2pt/src/OCE/LBC – NEMO

source: NEMO/branches/2021/dev_r14447_HPC-07_Irrmann_try_new_pt2pt/src/OCE/LBC/lbclnk.F90

Last change on this file was 15072, checked in by girrmann, 3 years ago

add structure for new RMA communications, small asynchronous communications debugging

  • Property svn:keywords set to Id
File size: 10.4 KB
Line 
1MODULE 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_async
58      MODULE PROCEDURE   lbc_lnk_async_sp, lbc_lnk_async_dp
59   END INTERFACE lbc_lnk_async
60
61   INTERFACE lbc_lnk_RMA
62      MODULE PROCEDURE   lbc_lnk_RMA_sp, lbc_lnk_RMA_dp
63   END INTERFACE lbc_lnk_RMA
64   !
65   INTERFACE lbc_lnk_icb
66      MODULE PROCEDURE mpp_lnk_2d_icb_dp, mpp_lnk_2d_icb_sp
67   END INTERFACE
68
69   PUBLIC   lbc_lnk            ! ocean/ice lateral boundary conditions
70   PUBLIC   lbc_lnk_icb        ! iceberg lateral boundary conditions
71
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
76   INTEGER,  DIMENSION(8)              ::   nreq_p2p                 ! request id for MPI_Isend in point-2-point communication
77
78   !! * Substitutions
79   !!#  include "do_loop_substitute.h90"
80   !!----------------------------------------------------------------------
81   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
82   !! $Id$
83   !! Software governed by the CeCILL license (see ./LICENSE)
84   !!----------------------------------------------------------------------
85CONTAINS
86
87   !!----------------------------------------------------------------------
88   !!                   ***   lbc_lnk_call_[234]d_[sd]p   ***
89   !!
90   !!   * Dummy Argument :
91   !!       in    ==>   cdname     ! name of the calling subroutine (for monitoring)
92   !!                   ptab       ! array to be loaded (2D, 3D or 4D)
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
99   !!----------------------------------------------------------------------
100   !
101   !!----------------------------------------------------------------------
102   !!
103   !!                  ***   lbc_lnk_call_[234]d_[sd]p   ***
104   !!                  ***     load_ptr_[234]d_[sd]p     ***
105   !!
106   !!----------------------------------------------------------------------
107   !!
108   !!   ----   SINGLE PRECISION VERSIONS
109   !!
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
121   !!
122   !!   ----   DOUBLE PRECISION VERSIONS
123   !!
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
135   !
136   !!----------------------------------------------------------------------
137   !!                   ***  lbc_lnk_pt2pt_[sd]p  ***
138   !!                  ***  lbc_lnk_neicoll_[sd]p  ***
139   !!                 ***  lbc_lnk_newpt2pt_[sd]p   ***
140   !!
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
144   !!                cd_nat    :   nature of array grid-points
145   !!                psgn      :   sign used across the north fold boundary
146   !!                kfld      :   number of pt3d arrays
147   !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables)
148   !!                pfillval  :   optional, background value (used with jpfillcopy)
149   !!----------------------------------------------------------------------
150   !!
151   !!   ----   SINGLE PRECISION VERSIONS
152   !!
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"
158#  include "lbc_lnk_newpt2pt_generic.h90"
159#  include "lbc_lnk_oldpt2pt_generic.h90"
160#  include "lbc_lnk_neicoll_generic.h90"
161#  undef BUFFSND
162#  undef BUFFRCV
163#  define BUFFSND buffsnd_async_sp
164#  define BUFFRCV buffrcv_async_sp
165#  include "lbc_lnk_pt2pt_async.h90"
166#  include "lbc_lnk_pt2pt_RMA.h90"
167#  undef BUFFSND
168#  undef BUFFRCV
169#  include "lbc_lnk_persistent.h90"
170#  undef MPI_TYPE
171#undef PRECISION
172   !!
173   !!   ----   DOUBLE PRECISION VERSIONS
174   !!
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"
180#  include "lbc_lnk_newpt2pt_generic.h90"
181#  include "lbc_lnk_oldpt2pt_generic.h90"
182#  include "lbc_lnk_neicoll_generic.h90"
183#  undef BUFFSND
184#  undef BUFFRCV
185#  define BUFFSND buffsnd_async_dp
186#  define BUFFRCV buffrcv_async_dp
187#  include "lbc_lnk_pt2pt_async.h90"
188#  include "lbc_lnk_pt2pt_RMA.h90"
189#  undef BUFFSND
190#  undef BUFFRCV
191#  include "lbc_lnk_persistent.h90"
192#  undef MPI_TYPE
193#undef PRECISION
194
195   !!======================================================================
196     !!---------------------------------------------------------------------
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      !!
211      !!----------------------------------------------------------------------
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
220
221
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
234      !!                    mpinei : number of neighboring domains (starting at 0, -1 if no neighbourg)
235      !!----------------------------------------------------------------------
236
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
245
246END MODULE lbclnk
Note: See TracBrowser for help on using the repository browser.