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

source: NEMO/branches/2019/fix_ticket2238_solution2/src/OCE/LBC/lbclnk.F90 @ 10679

Last change on this file since 10679 was 10679, checked in by mathiot, 5 years ago

branch for solution 2 of ticket #2238

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