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 14789 for NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/src/OCE/LBC/mpp_nfd_generic.h90 – NEMO

Ignore:
Timestamp:
2021-05-05T13:18:04+02:00 (3 years ago)
Author:
mcastril
Message:

[2021/HPC-11_mcastril_HPDAonline_DiagGPU] Update externals

Location:
NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev_r12970_AGRIF_CMEMS      ext/AGRIF 
         5^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
         8^/vendors/PPR@HEAD            ext/PPR 
        89 
        910# SETTE 
        10 ^/utils/CI/sette@13559        sette 
         11^/utils/CI/sette@14244        sette 
  • NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/src/OCE/LBC/mpp_nfd_generic.h90

    r13438 r14789  
    1 #if defined MULTI 
    2 #   define NAT_IN(k)                cd_nat(k)    
    3 #   define SGN_IN(k)                psgn(k) 
    4 #   define F_SIZE(ptab)             kfld 
    5 #   define LBC_ARG                  (jf) 
    6 #   if defined DIM_2d 
    7 #      if defined SINGLE_PRECISION 
    8 #         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_sp)     , INTENT(inout) ::   ptab(f) 
    9 #      else 
    10 #         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_dp)     , INTENT(inout) ::   ptab(f) 
    11 #      endif 
    12 #      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j) 
    13 #      define K_SIZE(ptab)             1 
    14 #      define L_SIZE(ptab)             1 
    15 #   endif 
    16 #   if defined DIM_3d 
    17 #      if defined SINGLE_PRECISION 
    18 #         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_sp)     , INTENT(inout) ::   ptab(f) 
    19 #      else 
    20 #         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_dp)     , INTENT(inout) ::   ptab(f) 
    21 #      endif 
    22 #      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k) 
    23 #      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3) 
    24 #      define L_SIZE(ptab)             1 
    25 #   endif 
    26 #   if defined DIM_4d 
    27 #      if defined SINGLE_PRECISION 
    28 #         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_sp)     , INTENT(inout) ::   ptab(f) 
    29 #      else 
    30 #         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_dp)     , INTENT(inout) ::   ptab(f) 
    31 #      endif 
    32 #      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l) 
    33 #      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3) 
    34 #      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4) 
    35 #   endif 
    36 #else 
    37 !                          !==  IN: ptab is an array  ==! 
    38 #   if defined SINGLE_PRECISION 
    39 #      define ARRAY_TYPE(i,j,k,l,f)    REAL(sp)         , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f) 
    40 #   else 
    41 #      define ARRAY_TYPE(i,j,k,l,f)    REAL(dp)         , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f) 
    42 #   endif 
    43 #   define NAT_IN(k)                cd_nat 
    44 #   define SGN_IN(k)                psgn 
    45 #   define F_SIZE(ptab)             1 
    46 #   define LBC_ARG 
    47 #   if defined DIM_2d 
    48 #      define ARRAY_IN(i,j,k,l,f)   ptab(i,j) 
    49 #      define K_SIZE(ptab)          1 
    50 #      define L_SIZE(ptab)          1 
    51 #   endif 
    52 #   if defined DIM_3d 
    53 #      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k) 
    54 #      define K_SIZE(ptab)          SIZE(ptab,3) 
    55 #      define L_SIZE(ptab)          1 
    56 #   endif 
    57 #   if defined DIM_4d 
    58 #      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k,l) 
    59 #      define K_SIZE(ptab)          SIZE(ptab,3) 
    60 #      define L_SIZE(ptab)          SIZE(ptab,4) 
    61 #   endif 
    62 #endif 
    631 
    64 # if defined SINGLE_PRECISION 
    65 #    define PRECISION sp 
    66 #    define SENDROUTINE mppsend_sp 
    67 #    define RECVROUTINE mpprecv_sp 
    68 #    define MPI_TYPE MPI_REAL 
    69 #    define HUGEVAL(x)   HUGE(x/**/_sp) 
    70 # else 
    71 #    define PRECISION dp 
    72 #    define SENDROUTINE mppsend_dp 
    73 #    define RECVROUTINE mpprecv_dp 
    74 #    define MPI_TYPE MPI_DOUBLE_PRECISION 
    75 #    define HUGEVAL(x)   HUGE(x/**/_dp) 
    76 # endif 
    77  
    78    SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn, kfillmode, pfillval, kfld ) 
    79       !!---------------------------------------------------------------------- 
    80       ARRAY_TYPE(:,:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied 
    81       CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points 
    82       REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary 
    83       INTEGER          , INTENT(in   ) ::   kfillmode   ! filling method for halo over land  
    84       REAL(wp)         , INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries) 
    85       INTEGER, OPTIONAL, INTENT(in   ) ::   kfld        ! number of pt3d arrays 
     2   SUBROUTINE mpp_nfd_/**/PRECISION( ptab, cd_nat, psgn, kfillmode, pfillval, khls, kfld ) 
     3      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c. 
     4      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points 
     5      REAL(PRECISION),  DIMENSION(:), INTENT(in   ) ::   psgn        ! sign used across the north fold boundary 
     6      INTEGER                       , INTENT(in   ) ::   kfillmode   ! filling method for halo over land  
     7      REAL(PRECISION)               , INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries) 
     8      INTEGER                       , INTENT(in   ) ::   khls        ! halo size, default = nn_hls 
     9      INTEGER                       , INTENT(in   ) ::   kfld        ! number of pt3d arrays 
    8610      ! 
    8711      LOGICAL  ::   ll_add_line 
     
    9519      INTEGER, DIMENSION (jpmaxngh)       ::   ml_req_nf   ! for mpi_isend when avoiding mpi_allgather 
    9620      INTEGER                             ::   ml_err      ! for mpi_isend when avoiding mpi_allgather 
    97       INTEGER, DIMENSION(MPI_STATUS_SIZE) ::   ml_stat     ! for mpi_isend when avoiding mpi_allgather 
    9821      !                                                    ! Workspace for message transfers avoiding mpi_allgather 
    9922      INTEGER                             ::   ipj_b       ! sum of lines for all multi fields 
     
    10326      INTEGER , DIMENSION(:)          , ALLOCATABLE ::   ipj_s ! number of sent lines 
    10427      REAL(PRECISION), DIMENSION(:,:,:,:)    , ALLOCATABLE ::   ztabb, ztabr, ztabw  ! buffer, receive and work arrays 
    105       REAL(PRECISION), DIMENSION(:,:,:,:,:)  , ALLOCATABLE ::   ztabglo, znorthloc 
     28      REAL(PRECISION), DIMENSION(:,:,:,:,:)  , ALLOCATABLE ::   znorthloc 
    10629      REAL(PRECISION), DIMENSION(:,:,:,:,:,:), ALLOCATABLE ::   znorthglo 
     30      TYPE(PTR_4D_/**/PRECISION), DIMENSION(:), ALLOCATABLE ::   ztabglo        ! array or pointer of arrays on which apply the b.c. 
    10731      !!---------------------------------------------------------------------- 
    10832      ! 
    109       ipk = K_SIZE(ptab)   ! 3rd dimension 
    110       ipl = L_SIZE(ptab)   ! 4th    - 
    111       ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers) 
     33      ipk = SIZE(ptab(1)%pt4d,3) 
     34      ipl = SIZE(ptab(1)%pt4d,4) 
     35      ipf = kfld 
    11236      ! 
    113       IF( l_north_nogather ) THEN      !==  no allgather exchanges  ==! 
     37      IF( ln_nnogather ) THEN      !==  no allgather exchanges  ==! 
    11438 
    11539         !   ---   define number of exchanged lines   --- 
     
    11842         ! 
    11943         ! However, some other points are duplicated in the north pole folding: 
    120          !  - jperio=[34], grid=T : half of the last line (jpiglo/2+2:jpiglo-nn_hls) 
    121          !  - jperio=[34], grid=U : half of the last line (jpiglo/2+1:jpiglo-nn_hls) 
    122          !  - jperio=[34], grid=V : all the last line nn_hls+1 and (nn_hls+2:jpiglo-nn_hls) 
    123          !  - jperio=[34], grid=F : all the last line (nn_hls+1:jpiglo-nn_hls) 
    124          !  - jperio=[56], grid=T : 2 points of the last line (jpiglo/2+1 and jpglo-nn_hls) 
    125          !  - jperio=[56], grid=U : no points are duplicated 
    126          !  - jperio=[56], grid=V : half of the last line (jpiglo/2+1:jpiglo-nn_hls) 
    127          !  - jperio=[56], grid=F : half of the last line (jpiglo/2+1:jpiglo-nn_hls-1) 
     44         !  - c_NFtype='T', grid=T : half of the last line (jpiglo/2+2:jpiglo-nn_hls) 
     45         !  - c_NFtype='T', grid=U : half of the last line (jpiglo/2+1:jpiglo-nn_hls) 
     46         !  - c_NFtype='T', grid=V : all the last line nn_hls+1 and (nn_hls+2:jpiglo-nn_hls) 
     47         !  - c_NFtype='T', grid=F : all the last line (nn_hls+1:jpiglo-nn_hls) 
     48         !  - c_NFtype='F', grid=T : 2 points of the last line (jpiglo/2+1 and jpglo-nn_hls) 
     49         !  - c_NFtype='F', grid=U : no points are duplicated 
     50         !  - c_NFtype='F', grid=V : half of the last line (jpiglo/2+1:jpiglo-nn_hls) 
     51         !  - c_NFtype='F', grid=F : half of the last line (jpiglo/2+1:jpiglo-nn_hls-1) 
    12852         ! The order of the calculations may differ for these duplicated points (as, for example jj+1 becomes jj-1) 
    12953         ! This explain why these duplicated points may have different values even if they are at the exact same location. 
     
    14165         IF( ll_add_line ) THEN 
    14266            DO jf = 1, ipf                      ! Loop over the number of arrays to be processed 
    143                ipj_s(jf) = nn_hls + COUNT( (/ npolj == 3 .OR. npolj == 4 .OR. NAT_IN(jf) == 'V' .OR. NAT_IN(jf) == 'F' /) )  
     67               ipj_s(jf) = khls + COUNT( (/ c_NFtype == 'T' .OR. cd_nat(jf) == 'V' .OR. cd_nat(jf) == 'F' /) )  
    14468            END DO 
    14569         ELSE 
    146             ipj_s(:) = nn_hls 
     70            ipj_s(:) = khls 
    14771         ENDIF 
    14872          
     
    15579         DO jf = 1, ipf                      ! Loop over the number of arrays to be processed 
    15680            ! 
    157             SELECT CASE ( npolj ) 
    158             CASE ( 3, 4 )                       ! *  North fold  T-point pivot 
    159                SELECT CASE ( NAT_IN(jf) ) 
     81            IF( c_NFtype == 'T' ) THEN          ! *  North fold  T-point pivot 
     82               SELECT CASE ( cd_nat(jf) ) 
    16083               CASE ( 'T', 'W', 'U' )   ;   i012 = 1   ! T-, U-, W-point 
    16184               CASE ( 'V', 'F'      )   ;   i012 = 2   ! V-, F-point 
    16285               END SELECT 
    163             CASE ( 5, 6 )                       ! *  North fold  F-point pivot 
    164                SELECT CASE ( NAT_IN(jf) ) 
     86            ENDIF 
     87            IF( c_NFtype == 'F' ) THEN          ! *  North fold  F-point pivot 
     88               SELECT CASE ( cd_nat(jf) ) 
    16589               CASE ( 'T', 'W', 'U' )   ;   i012 = 0   ! T-, U-, W-point 
    16690               CASE ( 'V', 'F'      )   ;   i012 = 1   ! V-, F-point 
    16791               END SELECT 
    168             END SELECT 
     92            ENDIF 
    16993               ! 
    17094            DO jj = 1, ipj_s(jf) 
    17195               ij1 = ij1 + 1 
    17296               jj_b(jj,jf) = ij1 
    173                jj_s(jj,jf) = jpj - 2*nn_hls + jj - i012 
     97               jj_s(jj,jf) = jpj - 2*khls + jj - i012 
    17498            END DO 
    17599            ! 
     
    184108               ij2 = jj_s(jj,jf) 
    185109               DO ji = 1, jpi 
    186                   ztabb(ji,ij1,jk,jl) = ARRAY_IN(ji,ij2,jk,jl,jf) 
     110                  ztabb(ji,ij1,jk,jl) = ptab(jf)%pt4d(ji,ij2,jk,jl) 
    187111               END DO 
    188112               DO ji = jpi+1, jpimax 
    189                   ztabb(ji,ij1,jk,jl) = HUGEVAL(0.)   ! avoid sending uninitialized values (make sure we don't use it) 
     113                  ztabb(ji,ij1,jk,jl) = HUGE(0._/**/PRECISION)   ! avoid sending uninitialized values (make sure we don't use it) 
    190114               END DO 
    191115            END DO 
     
    199123            iproc = nfproc(isendto(jr)) 
    200124            IF( iproc /= narea-1 .AND. iproc /= -1 ) THEN 
    201                CALL SENDROUTINE( 5, ztabb, ibuffsize, iproc, ml_req_nf(jr) ) 
     125#if ! defined key_mpi_off 
     126               CALL MPI_ISEND( ztabb, ibuffsize, MPI_TYPE, iproc, 5, mpi_comm_oce, ml_req_nf(jr), ierr ) 
     127#endif 
    202128            ENDIF 
    203129         END DO 
     
    212138            ipi   = nfjpi (ipni) 
    213139            ! 
    214             IF( ipni ==   1  ) THEN   ;   iis0 =   1            ! domain  left side: as e-w comm already done -> from 1st column 
    215             ELSE                      ;   iis0 =   1 + nn_hls   ! default: -> from inner domain  
    216             ENDIF 
    217             IF( ipni == jpni ) THEN   ;   iie0 = ipi            ! domain right side: as e-w comm already done -> until last column 
    218             ELSE                      ;   iie0 = ipi - nn_hls   ! default: -> until inner domain  
     140            IF( ipni ==   1  ) THEN   ;   iis0 =   1          ! domain  left side: as e-w comm already done -> from 1st column 
     141            ELSE                      ;   iis0 =   1 + khls   ! default: -> from inner domain  
     142            ENDIF 
     143            IF( ipni == jpni ) THEN   ;   iie0 = ipi          ! domain right side: as e-w comm already done -> until last column 
     144            ELSE                      ;   iie0 = ipi - khls   ! default: -> until inner domain  
    219145            ENDIF 
    220146            impp = nfimpp(ipni) - nfimpp(isendto(1)) 
     
    230156                        ij2 = jj_s(jj,jf) 
    231157                        DO ji = iis0, iie0 
    232                            ztabr(impp+ji,ij1,jk,jl) = ARRAY_IN(Nis0,ij2,jk,jl,jf)   ! chose to take the 1st iner domain point 
     158                           ztabr(impp+ji,ij1,jk,jl) = ptab(jf)%pt4d(Nis0,ij2,jk,jl)   ! chose to take the 1st iner domain point 
    233159                        END DO 
    234160                     END DO 
     
    251177                     ij2 = jj_s(jj,jf) 
    252178                     DO ji = iis0, iie0 
    253                         ztabr(impp+ji,ij1,jk,jl) = ARRAY_IN(ji,ij2,jk,jl,jf) 
     179                        ztabr(impp+ji,ij1,jk,jl) = ptab(jf)%pt4d(ji,ij2,jk,jl) 
    254180                     END DO 
    255181                  END DO 
     
    258184            ELSE                               ! get data from a neighbour trough communication 
    259185               !   
    260                CALL RECVROUTINE(5, ztabw, ibuffsize, iproc) 
     186#if ! defined key_mpi_off 
     187               CALL MPI_RECV( ztabw, ibuffsize, MPI_TYPE, iproc, 5, mpi_comm_oce, MPI_STATUS_IGNORE, ierr ) 
     188#endif 
    261189               DO jl = 1, ipl   ;   DO jk = 1, ipk 
    262190                  DO jj = 1, ipj_b 
     
    278206            ij1 = jj_b(       1 ,jf) 
    279207            ij2 = jj_b(ipj_s(jf),jf) 
    280             CALL lbc_nfd_nogather( ARRAY_IN(:,:,:,:,jf), ztabr(:,ij1:ij2,:,:), cd_nat LBC_ARG, psgn LBC_ARG ) 
     208            CALL lbc_nfd_nogather( ptab(jf)%pt4d(:,:,:,:), ztabr(:,ij1:ij2,:,:), cd_nat(jf), psgn(jf), khls ) 
    281209         END DO 
    282210         ! 
     
    286214            iproc = nfproc(isendto(jr)) 
    287215            IF( iproc /= narea-1 .AND. iproc /= -1 ) THEN 
    288                CALL mpi_wait( ml_req_nf(jr), ml_stat, ml_err )   ! put the wait at the very end just before the deallocate 
     216               CALL mpi_wait( ml_req_nf(jr), MPI_STATUS_IGNORE, ml_err )   ! put the wait at the very end just before the deallocate 
    289217            ENDIF 
    290218         END DO 
     
    294222         ! 
    295223         ! how many lines do we exchange at max? -> ipj    (no further optimizations in this case...) 
    296          ipj =      nn_hls + 2 
     224         ipj =      khls + 2 
    297225         ! how many lines do we     need at max? -> ipj2   (no further optimizations in this case...) 
    298          ipj2 = 2 * nn_hls + 2 
    299          ! 
    300          i0max = jpimax - 2 * nn_hls 
     226         ipj2 = 2 * khls + 2 
     227         ! 
     228         i0max = jpimax - 2 * khls 
    301229         ibuffsize = i0max * ipj * ipk * ipl * ipf 
    302230         ALLOCATE( znorthloc(i0max,ipj,ipk,ipl,ipf), znorthglo(i0max,ipj,ipk,ipl,ipf,ndim_rank_north) ) 
     
    307235               DO ji = 1, Ni_0 
    308236                  ii2 = Nis0 - 1 + ji                       ! inner domain: Nis0 to Nie0 
    309                   znorthloc(ji,jj,jk,jl,jf) = ARRAY_IN(ii2,ij2,jk,jl,jf) 
     237                  znorthloc(ji,jj,jk,jl,jf) = ptab(jf)%pt4d(ii2,ij2,jk,jl) 
    310238               END DO 
    311239               DO ji = Ni_0+1, i0max 
    312                   znorthloc(ji,jj,jk,jl,jf) = HUGEVAL(0.)   ! avoid sending uninitialized values (make sure we don't use it) 
     240                  znorthloc(ji,jj,jk,jl,jf) = HUGE(0._/**/PRECISION)   ! avoid sending uninitialized values (make sure we don't use it) 
    313241               END DO 
    314242            END DO 
     
    317245         ! start waiting time measurement 
    318246         IF( ln_timing ) CALL tic_tac(.TRUE.) 
    319 #if defined key_mpp_mpi 
     247#if ! defined key_mpi_off 
    320248         CALL MPI_ALLGATHER( znorthloc, ibuffsize, MPI_TYPE, znorthglo, ibuffsize, MPI_TYPE, ncomm_north, ierr ) 
    321249#endif 
     
    323251         IF( ln_timing ) CALL tic_tac(.FALSE.) 
    324252         DEALLOCATE( znorthloc ) 
    325          ALLOCATE( ztabglo(jpiglo,ipj2,ipk,ipl,ipf) ) 
    326          ! 
    327          ! need to fill only the first ipj lines of ztabglo as lbc_nfd don't use the last nn_hls lines 
     253         ALLOCATE( ztabglo(ipf) ) 
     254         DO jf = 1, ipf 
     255            ALLOCATE( ztabglo(jf)%pt4d(jpiglo,ipj2,ipk,ipl) ) 
     256         END DO 
     257         ! 
     258         ! need to fill only the first ipj lines of ztabglo as lbc_nfd don't use the last khls lines 
    328259         ijnr = 0 
    329260         DO jr = 1, jpni                                                        ! recover the global north array 
    330261            iproc = nfproc(jr) 
    331262            impp  = nfimpp(jr) 
    332             ipi   = nfjpi( jr) - 2 * nn_hls                       ! corresponds to Ni_0 but for subdomain iproc 
     263            ipi   = nfjpi( jr) - 2 * khls                       ! corresponds to Ni_0 but for subdomain iproc 
    333264            IF( iproc == -1 ) THEN   ! No neighbour (land proc that was suppressed) 
    334265              ! 
     
    340271                        ij2 = jpj - ipj2 + jj                    ! the first ipj lines of the last ipj2 lines 
    341272                        DO ji = 1, ipi 
    342                            ii1 = impp + nn_hls + ji - 1          ! corresponds to mig(nn_hls + ji) but for subdomain iproc 
    343                            ztabglo(ii1,jj,jk,jl,jf) = ARRAY_IN(Nis0,ij2,jk,jl,jf)   ! chose to take the 1st iner domain point 
     273                           ii1 = impp + khls + ji - 1            ! corresponds to mig(khls + ji) but for subdomain iproc 
     274                           ztabglo(jf)%pt4d(ii1,jj,jk,jl) = ptab(jf)%pt4d(Nis0,ij2,jk,jl) ! chose to take the 1st inner domain point 
    344275                        END DO 
    345276                     END DO 
     
    349280                     DO jj = 1, ipj 
    350281                        DO ji = 1, ipi 
    351                            ii1 = impp + nn_hls + ji - 1          ! corresponds to mig(nn_hls + ji) but for subdomain iproc 
    352                            ztabglo(ii1,jj,jk,jl,jf) = pfillval 
     282                           ii1 = impp + khls + ji - 1            ! corresponds to mig(khls + ji) but for subdomain iproc 
     283                           ztabglo(jf)%pt4d(ii1,jj,jk,jl) = pfillval 
    353284                        END DO 
    354285                     END DO 
     
    361292                  DO jj = 1, ipj 
    362293                     DO ji = 1, ipi 
    363                         ii1 = impp + nn_hls + ji - 1             ! corresponds to mig(nn_hls + ji) but for subdomain iproc 
    364                         ztabglo(ii1,jj,jk,jl,jf) = znorthglo(ji,jj,jk,jl,jf,ijnr) 
     294                        ii1 = impp + khls + ji - 1               ! corresponds to mig(khls + ji) but for subdomain iproc 
     295                        ztabglo(jf)%pt4d(ii1,jj,jk,jl) = znorthglo(ji,jj,jk,jl,jf,ijnr) 
    365296                     END DO 
    366297                  END DO 
     
    372303         ! 
    373304         DO jf = 1, ipf 
    374             CALL lbc_nfd( ztabglo(:,:,:,:,jf), cd_nat LBC_ARG, psgn LBC_ARG )   ! North fold boundary condition 
     305            CALL lbc_nfd( ztabglo(jf:jf), cd_nat(jf:jf), psgn(jf:jf), khls, 1 )   ! North fold boundary condition 
    375306            DO jl = 1, ipl   ;   DO jk = 1, ipk                  ! e-w periodicity 
    376                DO jj = 1, nn_hls + 1 
    377                   ij1 = ipj2 - (nn_hls + 1) + jj                 ! need only the last nn_hls + 1 lines until ipj2 
    378                   ztabglo(              1:nn_hls,ij1,jk,jl,jf) = ztabglo(jpiglo-2*nn_hls+1:jpiglo-nn_hls,ij1,jk,jl,jf) 
    379                   ztabglo(jpiglo-nn_hls+1:jpiglo,ij1,jk,jl,jf) = ztabglo(         nn_hls+1:     2*nn_hls,ij1,jk,jl,jf) 
     307               DO jj = 1, khls + 1 
     308                  ij1 = ipj2 - (khls + 1) + jj                   ! need only the last khls + 1 lines until ipj2 
     309                  ztabglo(jf)%pt4d(            1:  khls,ij1,jk,jl) = ztabglo(jf)%pt4d(jpiglo-2*khls+1:jpiglo-khls,ij1,jk,jl) 
     310                  ztabglo(jf)%pt4d(jpiglo-khls+1:jpiglo,ij1,jk,jl) = ztabglo(jf)%pt4d(         khls+1:     2*khls,ij1,jk,jl) 
    380311               END DO 
    381312            END DO   ;   END DO 
     
    383314         ! 
    384315         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk               ! Scatter back to ARRAY_IN 
    385             DO jj = 1, nn_hls + 1 
    386                ij1 = jpj  - (nn_hls + 1) + jj   ! last nn_hls + 1 lines until jpj 
    387                ij2 = ipj2 - (nn_hls + 1) + jj   ! last nn_hls + 1 lines until ipj2 
     316            DO jj = 1, khls + 1 
     317               ij1 = jpj  - (khls + 1) + jj   ! last khls + 1 lines until jpj 
     318               ij2 = ipj2 - (khls + 1) + jj   ! last khls + 1 lines until ipj2 
    388319               DO ji= 1, jpi 
    389320                  ii2 = mig(ji) 
    390                   ARRAY_IN(ji,ij1,jk,jl,jf) = ztabglo(ii2,ij2,jk,jl,jf) 
     321                  ptab(jf)%pt4d(ji,ij1,jk,jl) = ztabglo(jf)%pt4d(ii2,ij2,jk,jl) 
    391322               END DO 
    392323            END DO 
    393324         END DO   ;   END DO   ;   END DO 
    394325         ! 
     326         DO jf = 1, ipf 
     327            DEALLOCATE( ztabglo(jf)%pt4d ) 
     328         END DO 
    395329         DEALLOCATE( ztabglo ) 
    396330         ! 
    397331      ENDIF   ! l_north_nogather 
    398332      ! 
    399    END SUBROUTINE ROUTINE_NFD 
     333   END SUBROUTINE mpp_nfd_/**/PRECISION 
    400334 
    401 #undef PRECISION 
    402 #undef MPI_TYPE 
    403 #undef SENDROUTINE 
    404 #undef RECVROUTINE 
    405 #undef ARRAY_TYPE 
    406 #undef NAT_IN 
    407 #undef SGN_IN 
    408 #undef ARRAY_IN 
    409 #undef K_SIZE 
    410 #undef L_SIZE 
    411 #undef F_SIZE 
    412 #undef LBC_ARG 
    413 #undef HUGEVAL 
Note: See TracChangeset for help on using the changeset viewer.