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 @ 14899

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

Asynchronous communications now works in time splitting with nncomm == 3 (newpt2pt communication) and yiels identical results but is not compatible with other schemes. Under investigation...

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