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/trunk/src/OCE/LBC – NEMO

source: NEMO/trunk/src/OCE/LBC/lbclnk.F90 @ 14433

Last change on this file since 14433 was 14433, checked in by smasson, 3 years ago

trunk: merge dev_r14312_MPI_Interface into the trunk, #2598

  • Property svn:keywords set to Id
File size: 8.9 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_neicoll
42      MODULE PROCEDURE   lbc_lnk_neicoll_sp ,lbc_lnk_neicoll_dp
43   END INTERFACE
44   !
45   INTERFACE lbc_lnk_icb
46      MODULE PROCEDURE mpp_lnk_2d_icb_dp, mpp_lnk_2d_icb_sp
47   END INTERFACE
48
49   PUBLIC   lbc_lnk            ! ocean/ice lateral boundary conditions
50   PUBLIC   lbc_lnk_icb        ! iceberg lateral boundary conditions
51
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   
56   !! * Substitutions
57   !!#  include "do_loop_substitute.h90"
58   !!----------------------------------------------------------------------
59   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
60   !! $Id$
61   !! Software governed by the CeCILL license (see ./LICENSE)
62   !!----------------------------------------------------------------------
63CONTAINS
64
65   !!----------------------------------------------------------------------
66   !!                   ***   lbc_lnk_call_[234]d_[sd]p   ***
67   !!
68   !!   * Dummy Argument :
69   !!       in    ==>   cdname     ! name of the calling subroutine (for monitoring)
70   !!                   ptab       ! array to be loaded (2D, 3D or 4D)
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
77   !!----------------------------------------------------------------------
78   !
79   !!----------------------------------------------------------------------
80   !!
81   !!                  ***   lbc_lnk_call_[234]d_[sd]p   ***
82   !!                  ***     load_ptr_[234]d_[sd]p     ***
83   !!
84   !!----------------------------------------------------------------------
85   !!
86   !!   ----   SINGLE PRECISION VERSIONS
87   !!
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
99   !!
100   !!   ----   DOUBLE PRECISION VERSIONS
101   !!
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
113   !
114   !!----------------------------------------------------------------------
115   !!                   ***  lbc_lnk_pt2pt_[sd]p  ***
116   !!                  ***  lbc_lnk_neicoll_[sd]p  ***
117   !!
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
121   !!                cd_nat    :   nature of array grid-points
122   !!                psgn      :   sign used across the north fold boundary
123   !!                kfld      :   number of pt3d arrays
124   !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables)
125   !!                pfillval  :   optional, background value (used with jpfillcopy)
126   !!----------------------------------------------------------------------
127   !!
128   !!   ----   SINGLE PRECISION VERSIONS
129   !!
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
140   !!
141   !!   ----   DOUBLE PRECISION VERSIONS
142   !!
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
153
154   !!======================================================================
155     !!---------------------------------------------------------------------
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      !!
170      !!----------------------------------------------------------------------
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
179
180
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
193      !!                    mpinei : number of neighboring domains (starting at 0, -1 if no neighbourg)
194      !!----------------------------------------------------------------------
195
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
204
205END MODULE lbclnk
Note: See TracBrowser for help on using the repository browser.