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 12719 for NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90 – NEMO

Ignore:
Timestamp:
2020-04-08T17:45:31+02:00 (4 years ago)
Author:
francesca
Message:

extra-halo management with positive arrays indices - ticket #2366

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/OCE/LBC/mpp_nfd_generic.h90

    r12586 r12719  
    4848   SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn, kfld ) 
    4949      !!---------------------------------------------------------------------- 
    50       ARRAY_TYPE(1-nn_hls+1:,1-nn_hls+1:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied 
     50      ARRAY_TYPE(:,:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied 
    5151      CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points 
    5252      REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary 
     
    8080         ALLOCATE(ipj_s(ipf)) 
    8181 
    82          ijpj      = 2 + nn_hls - 1           ! Max 2nd dimension of message transfers (last two j-line only) 
    83          ipj_s(:) = 1 + nn_hls - 1           ! Real 2nd dimension of message transfers (depending on perf requirement) 
     82         ijpj     = 2 + nn_hls -1           ! Max 2nd dimension of message transfers (last two j-line only) 
     83         ipj_s(:) = 1 + nn_hls -1           ! Real 2nd dimension of message transfers (depending on perf requirement) 
    8484                                 ! by default, only one line is exchanged 
    8585 
     
    9898         IF ( l_full_nf_update .OR.                          &    ! if coupling fields 
    9999              ( ncom_stp == nit000 .AND. .NOT. ln_rstart ) ) &    ! at first time step, if not restart 
    100             ipj_s(:) = 2 + nn_hls - 1  
     100            ipj_s(:) = 2 + nn_hls -1 
    101101 
    102102         ! Index of modifying lines in input 
     
    110110               ! 
    111111               CASE ( 'T' , 'W' ,'U' )                            ! T-, U-, W-point 
    112                      DO ji = 1, nn_hls+1 
    113                   jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1 
    114                ENDDO 
     112                  DO ji = 1, nn_hls+1 
     113                     jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1 
     114                  ENDDO 
    115115               CASE ( 'V' , 'F' )                                 ! V-, F-point 
    116                DO ji = 1, nn_hls+1 
    117                   jj_s(jf,ji) = nlcj - 2*nn_hls +ji - 2 
    118                ENDDO 
     116                  DO ji = 1, nn_hls+1 
     117                     jj_s(jf,ji) = nlcj - 2*nn_hls +ji - 2 
     118                  ENDDO 
    119119               END SELECT 
    120120            ! 
     
    123123               ! 
    124124               CASE ( 'T' , 'W' ,'U' )                            ! T-, U-, W-point 
    125                DO ji = 1, nn_hls 
    126                   jj_s(jf,ji) = nlcj - 2*nn_hls + ji      
    127                ENDDO 
    128                ipj_s(jf) = nn_hls                  ! need only one line anyway 
     125                  DO ji = 1, nn_hls 
     126                     jj_s(jf,ji) = nlcj - 2*nn_hls + ji 
     127                  ENDDO 
     128                  ipj_s(jf) = nn_hls                  ! need only one line anyway 
    129129               CASE ( 'V' , 'F' )                                 ! V-, F-point 
    130                DO ji = 1, nn_hls+1 
    131                   jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1 
    132                ENDDO 
     130                  DO ji = 1, nn_hls+1 
     131                     jj_s(jf,ji) = nlcj - 2*nn_hls +ji -1 
     132                  ENDDO 
    133133               END SELECT 
    134134            ! 
     
    139139         ipf_j = sum (ipj_s(:))      ! Total number of lines to be exchanged 
    140140         ! 
    141          ALLOCATE( znorthloc(1-nn_hls+1:jpimax,ipf_j,ipk,ipl,1) ) 
     141         ALLOCATE( znorthloc(jpimax,ipf_j,ipk,ipl,1) ) 
    142142         ! 
    143143         js = 0 
     
    147147               DO jl = 1, ipl 
    148148                  DO jk = 1, ipk 
    149                      znorthloc(1-nn_hls+1:jpi,js,jk,jl,1) = ARRAY_IN(1-nn_hls+1:jpi,jj_s(jf,jj),jk,jl,jf) 
     149                     znorthloc(1:jpi,js,jk,jl,1) = ARRAY_IN(1:jpi,jj_s(jf,jj),jk,jl,jf) 
    150150                  END DO 
    151151               END DO 
     
    153153         END DO 
    154154         ! 
    155          ibuffsize = (jpimax + nn_hls -1) * ipf_j * ipk * ipl 
    156          ! 
    157          ALLOCATE( zfoldwk(1-nn_hls+1:jpimax,ipf_j,ipk,ipl,1) ) 
    158          ALLOCATE( ztabr(1-nn_hls+1:(jpi+nn_hls-1)*jpmaxngh-nn_hls+1,ijpj,ipk,ipl,ipf) )  
     155         ibuffsize = jpimax * ipf_j * ipk * ipl 
     156         ! 
     157         ALLOCATE( zfoldwk(jpimax,ipf_j,ipk,ipl,1) ) 
     158         ALLOCATE( ztabr(jpimax*jpmaxngh,ijpj,ipk,ipl,ipf) )  
    159159         ! when some processors of the north fold are suppressed,  
    160160         ! values of ztab* arrays corresponding to these suppressed domain won't be defined  
     
    177177               iilb = nimppt(iproc+1) 
    178178               ilci = nlcit (iproc+1) 
    179                ildi = nldit (iproc+1) 
    180                ilei = nleit (iproc+1) 
    181                IF( iilb            ==      1 )   ildi = 1      ! e-w boundary already done -> force to take 1st column 
    182                IF( iilb + ilci - 1 == jpiglo )   ilei = ilci   ! e-w boundary already done -> force to take last column 
     179               ildi = nldit (iproc+1) + nn_hls-1 
     180               ilei = nleit (iproc+1) + nn_hls-1 
     181               IF( iilb            ==      1 )   ildi = nn_hls   ! e-w boundary already done -> force to take 1st column 
     182               IF( iilb + ilci - 1 == jpiglo )   ilei = nlei+1   ! e-w boundary already done -> force to take last column 
    183183               iilb = nfiimpp(isendto(jr),jpnj) - nfiimpp(isendto(1),jpnj) 
    184184            ENDIF 
     
    191191                     DO jk = 1, ipk 
    192192                        DO ji = ildi, ilei 
    193                            ztabr(iilb+ji,jj,jk,jl,jf) = zfoldwk(ji,js,jk,jl,1) 
     193                           ztabr(iilb-nn_hls+1+ji,jj,jk,jl,jf) = zfoldwk(ji,js,jk,jl,1) 
    194194                        END DO 
    195195                     END DO 
     
    201201                     DO jk = 1, ipk 
    202202                        DO ji = ildi, ilei 
    203                            ztabr(iilb+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj_s(jf,jj),jk,jl,jf) 
     203                           ztabr(iilb-nn_hls+1+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj_s(jf,jj),jk,jl,jf) 
    204204                        END DO 
    205205                     END DO 
Note: See TracChangeset for help on using the changeset viewer.