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.
Changeset 10727 for utils/tools_AGRIF_CMEMS_2020/DOMAINcfg/src/lbclnk.F90 – NEMO

Ignore:
Timestamp:
2019-02-27T17:02:02+01:00 (5 years ago)
Author:
rblod
Message:

new nesting tools (attempt) and brutal cleaning of DOMAINcfg, see ticket #2129

File:
1 moved

Legend:

Unmodified
Added
Removed
  • utils/tools_AGRIF_CMEMS_2020/DOMAINcfg/src/lbclnk.F90

    r10725 r10727  
    22   !!====================================================================== 
    33   !!                       ***  MODULE  lbclnk  *** 
    4    !! Ocean        : lateral boundary conditions 
     4   !! NEMO        : lateral boundary conditions 
    55   !!===================================================================== 
    66   !! History :  OPA  ! 1997-06  (G. Madec)  Original code 
    77   !!   NEMO     1.0  ! 2002-09  (G. Madec)  F90: Free form and module 
    88   !!            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 
     9   !!            3.5  ! 2012     (S.Mocavero, I. Epicoco)  optimization of BDY comm. via lbc_bdy_lnk and lbc_obc_lnk 
    1010   !!            3.4  ! 2012-12  (R. Bourdalle-Badie, G. Reffray)  add a C1D case   
    1111   !!            3.6  ! 2015-06  (O. Tintó and M. Castrillo)  add lbc_lnk_multi   
    12    !!---------------------------------------------------------------------- 
    13  
     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 
    1417   !!---------------------------------------------------------------------- 
    1518   !!   'key_mpp_mpi'             MPI massively parallel processing library 
    1619   !!---------------------------------------------------------------------- 
    17    !!   lbc_lnk      : generic interface for mpp_lnk_3d and mpp_lnk_2d routines defined in lib_mpp 
    18    !!   lbc_sum      : generic interface for mpp_lnk_sum_3d and mpp_lnk_sum_2d routines defined in lib_mpp 
    19    !!   lbc_lnk_e    : generic interface for mpp_lnk_2d_e routine defined in lib_mpp 
    20    !!   lbc_bdy_lnk  : generic interface for mpp_lnk_bdy_2d and mpp_lnk_bdy_3d routines defined in lib_mpp 
    21    !!---------------------------------------------------------------------- 
     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    
    2226   USE lib_mpp        ! distributed memory computing library 
    23  
     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 
    2435   INTERFACE lbc_lnk_multi 
    25       MODULE PROCEDURE mpp_lnk_2d_9, mpp_lnk_2d_multiple 
    26    END INTERFACE 
    27    ! 
    28    INTERFACE lbc_lnk 
    29       MODULE PROCEDURE mpp_lnk_3d_gather, mpp_lnk_3d, mpp_lnk_2d 
    30    END INTERFACE 
    31    ! 
    32    INTERFACE lbc_sum 
    33       MODULE PROCEDURE mpp_lnk_sum_3d, mpp_lnk_sum_2d 
     36      MODULE PROCEDURE   lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi 
    3437   END INTERFACE 
    3538   ! 
    3639   INTERFACE lbc_bdy_lnk 
    37       MODULE PROCEDURE mpp_lnk_bdy_2d, mpp_lnk_bdy_3d 
    38    END INTERFACE 
    39    ! 
    40    INTERFACE lbc_lnk_e 
    41       MODULE PROCEDURE mpp_lnk_2d_e 
     40      MODULE PROCEDURE mpp_lnk_bdy_2d, mpp_lnk_bdy_3d, mpp_lnk_bdy_4d 
    4241   END INTERFACE 
    4342   ! 
     
    4645   END INTERFACE 
    4746 
    48    PUBLIC   lbc_lnk       ! ocean lateral boundary conditions 
    49    PUBLIC   lbc_lnk_multi ! modified ocean lateral boundary conditions 
    50    PUBLIC   lbc_sum 
    51    PUBLIC   lbc_lnk_e     ! 
     47   PUBLIC   lbc_lnk       ! ocean/ice lateral boundary conditions 
     48   PUBLIC   lbc_lnk_multi ! modified ocean/ice lateral boundary conditions 
    5249   PUBLIC   lbc_bdy_lnk   ! ocean lateral BDY boundary conditions 
    53    PUBLIC   lbc_lnk_icb   ! 
     50   PUBLIC   lbc_lnk_icb   ! iceberg lateral boundary conditions 
    5451 
    5552   !!---------------------------------------------------------------------- 
    5653   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
    57    !! $Id: lbclnk.F90 6493 2016-04-22 13:52:52Z mathiot $ 
    58    !! Software governed by the CeCILL licence     (./LICENSE) 
    59    !!---------------------------------------------------------------------- 
     54   !! $Id: lbclnk.F90 10425 2018-12-19 21:54:16Z smasson $ 
     55   !! Software governed by the CeCILL license (see ./LICENSE) 
     56   !!---------------------------------------------------------------------- 
     57CONTAINS 
     58 
     59#else 
     60   !!---------------------------------------------------------------------- 
     61   !!   Default option                              shared memory computing 
     62   !!---------------------------------------------------------------------- 
     63   !!                routines setting the appropriate values 
     64   !!         on first and last row and column of the global domain 
     65   !!---------------------------------------------------------------------- 
     66   !!   lbc_lnk_sum_3d: compute sum over the halos on a 3D variable on ocean mesh 
     67   !!   lbc_lnk_sum_3d: compute sum over the halos on a 2D variable on ocean mesh 
     68   !!   lbc_lnk       : generic interface for lbc_lnk_3d and lbc_lnk_2d 
     69   !!   lbc_lnk_3d    : set the lateral boundary condition on a 3D variable on ocean mesh 
     70   !!   lbc_lnk_2d    : set the lateral boundary condition on a 2D variable on ocean mesh 
     71   !!   lbc_bdy_lnk   : set the lateral BDY boundary condition 
     72   !!---------------------------------------------------------------------- 
     73   USE oce            ! ocean dynamics and tracers    
     74   USE dom_oce        ! ocean space and time domain  
     75   USE in_out_manager ! I/O manager 
     76   USE lbcnfd         ! north fold 
     77 
     78   IMPLICIT NONE 
     79   PRIVATE 
     80 
     81   INTERFACE lbc_lnk 
     82      MODULE PROCEDURE   lbc_lnk_2d      , lbc_lnk_3d      , lbc_lnk_4d 
     83   END INTERFACE 
     84   INTERFACE lbc_lnk_ptr 
     85      MODULE PROCEDURE   lbc_lnk_2d_ptr  , lbc_lnk_3d_ptr  , lbc_lnk_4d_ptr 
     86   END INTERFACE 
     87   INTERFACE lbc_lnk_multi 
     88      MODULE PROCEDURE   lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi 
     89   END INTERFACE 
     90   ! 
     91   INTERFACE lbc_bdy_lnk 
     92      MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d, lbc_bdy_lnk_4d 
     93   END INTERFACE 
     94   ! 
     95   INTERFACE lbc_lnk_icb 
     96      MODULE PROCEDURE lbc_lnk_2d_icb 
     97   END INTERFACE 
     98    
     99   PUBLIC   lbc_lnk       ! ocean/ice  lateral boundary conditions 
     100   PUBLIC   lbc_lnk_multi ! modified ocean/ice lateral boundary conditions 
     101   PUBLIC   lbc_bdy_lnk   ! ocean lateral BDY boundary conditions 
     102   PUBLIC   lbc_lnk_icb   ! iceberg lateral boundary conditions 
     103    
     104   !!---------------------------------------------------------------------- 
     105   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     106   !! $Id: lbclnk.F90 10425 2018-12-19 21:54:16Z smasson $ 
     107   !! Software governed by the CeCILL license (see ./LICENSE) 
     108   !!---------------------------------------------------------------------- 
     109CONTAINS 
     110 
     111   !!====================================================================== 
     112   !!   Default option                           3D shared memory computing 
     113   !!====================================================================== 
     114   !!          routines setting land point, or east-west cyclic, 
     115   !!             or north-south cyclic, or north fold values 
     116   !!         on first and last row and column of the global domain 
     117   !!---------------------------------------------------------------------- 
     118 
     119   !!---------------------------------------------------------------------- 
     120   !!                   ***  routine lbc_lnk_(2,3,4)d  *** 
     121   !! 
     122   !!   * Argument : dummy argument use in lbc_lnk_... routines 
     123   !!                ptab   :   array or pointer of arrays on which the boundary condition is applied 
     124   !!                cd_nat :   nature of array grid-points 
     125   !!                psgn   :   sign used across the north fold boundary 
     126   !!                kfld   :   optional, number of pt3d arrays 
     127   !!                cd_mpp :   optional, fill the overlap area only 
     128   !!                pval   :   optional, background value (used at closed boundaries) 
     129   !!---------------------------------------------------------------------- 
     130   ! 
     131   !                       !==  2D array and array of 2D pointer  ==! 
     132   ! 
     133#  define DIM_2d 
     134#     define ROUTINE_LNK           lbc_lnk_2d 
     135#     include "lbc_lnk_generic.h90" 
     136#     undef ROUTINE_LNK 
     137#     define MULTI 
     138#     define ROUTINE_LNK           lbc_lnk_2d_ptr 
     139#     include "lbc_lnk_generic.h90" 
     140#     undef ROUTINE_LNK 
     141#     undef MULTI 
     142#  undef DIM_2d 
     143   ! 
     144   !                       !==  3D array and array of 3D pointer  ==! 
     145   ! 
     146#  define DIM_3d 
     147#     define ROUTINE_LNK           lbc_lnk_3d 
     148#     include "lbc_lnk_generic.h90" 
     149#     undef ROUTINE_LNK 
     150#     define MULTI 
     151#     define ROUTINE_LNK           lbc_lnk_3d_ptr 
     152#     include "lbc_lnk_generic.h90" 
     153#     undef ROUTINE_LNK 
     154#     undef MULTI 
     155#  undef DIM_3d 
     156   ! 
     157   !                       !==  4D array and array of 4D pointer  ==! 
     158   ! 
     159#  define DIM_4d 
     160#     define ROUTINE_LNK           lbc_lnk_4d 
     161#     include "lbc_lnk_generic.h90" 
     162#     undef ROUTINE_LNK 
     163#     define MULTI 
     164#     define ROUTINE_LNK           lbc_lnk_4d_ptr 
     165#     include "lbc_lnk_generic.h90" 
     166#     undef ROUTINE_LNK 
     167#     undef MULTI 
     168#  undef DIM_4d 
     169    
     170   !!====================================================================== 
     171   !!   identical routines in both C1D and shared memory computing 
     172   !!====================================================================== 
     173 
     174   !!---------------------------------------------------------------------- 
     175   !!                   ***  routine lbc_bdy_lnk_(2,3,4)d  *** 
     176   !! 
     177   !!   wrapper rountine to 'lbc_lnk_3d'. This wrapper is used 
     178   !!   to maintain the same interface with regards to the mpp case 
     179   !!---------------------------------------------------------------------- 
     180    
     181   SUBROUTINE lbc_bdy_lnk_4d( cdname, pt4d, cd_type, psgn, ib_bdy ) 
     182      !!---------------------------------------------------------------------- 
     183      CHARACTER(len=*)          , INTENT(in   ) ::   cdname      ! name of the calling subroutine 
     184      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt4d      ! 3D array on which the lbc is applied 
     185      CHARACTER(len=1)          , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points 
     186      REAL(wp)                  , INTENT(in   ) ::   psgn      ! sign used across north fold  
     187      INTEGER                   , INTENT(in   ) ::   ib_bdy    ! BDY boundary set 
     188      !!---------------------------------------------------------------------- 
     189      CALL lbc_lnk_4d( cdname, pt4d, cd_type, psgn) 
     190   END SUBROUTINE lbc_bdy_lnk_4d 
     191 
     192   SUBROUTINE lbc_bdy_lnk_3d( cdname, pt3d, cd_type, psgn, ib_bdy ) 
     193      !!---------------------------------------------------------------------- 
     194      CHARACTER(len=*)          , INTENT(in   ) ::   cdname      ! name of the calling subroutine 
     195      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pt3d      ! 3D array on which the lbc is applied 
     196      CHARACTER(len=1)          , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points 
     197      REAL(wp)                  , INTENT(in   ) ::   psgn      ! sign used across north fold  
     198      INTEGER                   , INTENT(in   ) ::   ib_bdy    ! BDY boundary set 
     199      !!---------------------------------------------------------------------- 
     200      CALL lbc_lnk_3d( cdname, pt3d, cd_type, psgn) 
     201   END SUBROUTINE lbc_bdy_lnk_3d 
     202 
     203 
     204   SUBROUTINE lbc_bdy_lnk_2d( cdname, pt2d, cd_type, psgn, ib_bdy ) 
     205      !!---------------------------------------------------------------------- 
     206      CHARACTER(len=*)        , INTENT(in   ) ::   cdname      ! name of the calling subroutine 
     207      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pt2d      ! 3D array on which the lbc is applied 
     208      CHARACTER(len=1)        , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points 
     209      REAL(wp)                , INTENT(in   ) ::   psgn      ! sign used across north fold  
     210      INTEGER                 , INTENT(in   ) ::   ib_bdy    ! BDY boundary set 
     211      !!---------------------------------------------------------------------- 
     212      CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn) 
     213   END SUBROUTINE lbc_bdy_lnk_2d 
     214 
     215 
     216!!gm  This routine should be removed with an optional halos size added in argument of generic routines 
     217 
     218   SUBROUTINE lbc_lnk_2d_icb( cdname, pt2d, cd_type, psgn, ki, kj ) 
     219      !!---------------------------------------------------------------------- 
     220      CHARACTER(len=*)        , INTENT(in   ) ::   cdname      ! name of the calling subroutine 
     221      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pt2d      ! 2D array on which the lbc is applied 
     222      CHARACTER(len=1)        , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points 
     223      REAL(wp)                , INTENT(in   ) ::   psgn      ! sign used across north fold  
     224      INTEGER                 , INTENT(in   ) ::   ki, kj    ! sizes of extra halo (not needed in non-mpp) 
     225      !!---------------------------------------------------------------------- 
     226      CALL lbc_lnk_2d( cdname, pt2d, cd_type, psgn ) 
     227   END SUBROUTINE lbc_lnk_2d_icb 
     228!!gm end 
     229 
     230#endif 
     231 
     232   !!====================================================================== 
     233   !!   identical routines in both distributed and shared memory computing 
     234   !!====================================================================== 
     235 
     236   !!---------------------------------------------------------------------- 
     237   !!                   ***   load_ptr_(2,3,4)d   *** 
     238   !! 
     239   !!   * Dummy Argument : 
     240   !!       in    ==>   ptab       ! array to be loaded (2D, 3D or 4D) 
     241   !!                   cd_nat     ! nature of pt2d array grid-points 
     242   !!                   psgn       ! sign used across the north fold boundary 
     243   !!       inout <=>   ptab_ptr   ! array of 2D, 3D or 4D pointers 
     244   !!                   cdna_ptr   ! nature of ptab array grid-points 
     245   !!                   psgn_ptr   ! sign used across the north fold boundary 
     246   !!                   kfld       ! number of elements that has been attributed 
     247   !!---------------------------------------------------------------------- 
     248 
     249   !!---------------------------------------------------------------------- 
     250   !!                  ***   lbc_lnk_(2,3,4)d_multi   *** 
     251   !!                     ***   load_ptr_(2,3,4)d   *** 
     252   !! 
     253   !!   * Argument : dummy argument use in lbc_lnk_multi_... routines 
     254   !! 
     255   !!---------------------------------------------------------------------- 
     256 
     257#  define DIM_2d 
     258#     define ROUTINE_MULTI          lbc_lnk_2d_multi 
     259#     define ROUTINE_LOAD           load_ptr_2d 
     260#     include "lbc_lnk_multi_generic.h90" 
     261#     undef ROUTINE_MULTI 
     262#     undef ROUTINE_LOAD 
     263#  undef DIM_2d 
     264 
     265 
     266#  define DIM_3d 
     267#     define ROUTINE_MULTI          lbc_lnk_3d_multi 
     268#     define ROUTINE_LOAD           load_ptr_3d 
     269#     include "lbc_lnk_multi_generic.h90" 
     270#     undef ROUTINE_MULTI 
     271#     undef ROUTINE_LOAD 
     272#  undef DIM_3d 
     273 
     274 
     275#  define DIM_4d 
     276#     define ROUTINE_MULTI          lbc_lnk_4d_multi 
     277#     define ROUTINE_LOAD           load_ptr_4d 
     278#     include "lbc_lnk_multi_generic.h90" 
     279#     undef ROUTINE_MULTI 
     280#     undef ROUTINE_LOAD 
     281#  undef DIM_4d 
    60282 
    61283   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.