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 10542 for NEMO/trunk – NEMO

Changeset 10542 for NEMO/trunk


Ignore:
Timestamp:
2019-01-17T16:57:40+01:00 (5 years ago)
Author:
smasson
Message:

trunk: improve NP folding balance, see #2214

Location:
NEMO/trunk/src/OCE/LBC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/LBC/mpp_bdy_generic.h90

    r10425 r10542  
    191191      END DO 
    192192 
    193       ! 3. North and south directions 
     193      ! 3. north fold treatment 
     194      ! ----------------------- 
     195      ! 
     196      ! do it before south directions so concerned processes can do it without waiting for the comm with the sourthern neighbor 
     197      IF( npolj /= 0) THEN 
     198         ! 
     199         SELECT CASE ( jpni ) 
     200         CASE ( 1 )     ;   CALL lbc_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) )   ! only 1 northern proc, no mpp 
     201         CASE DEFAULT   ;   CALL mpp_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) )   ! for all northern procs. 
     202         END SELECT 
     203         ! 
     204      ENDIF 
     205 
     206      ! 4. North and south directions 
    194207      ! ----------------------------- 
    195208      ! always closed : we play only with the neigbours 
     
    265278         END SELECT 
    266279      END DO 
    267  
    268       ! 4. north fold treatment 
    269       ! ----------------------- 
    270       ! 
    271       IF( npolj /= 0) THEN 
    272          ! 
    273          SELECT CASE ( jpni ) 
    274          CASE ( 1 )     ;   CALL lbc_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) )   ! only 1 northern proc, no mpp 
    275          CASE DEFAULT   ;   CALL mpp_nfd( ptab, NAT_IN(:), SGN_IN(:) OPT_K(:) )   ! for all northern procs. 
    276          END SELECT 
    277          ! 
    278       ENDIF 
    279280      ! 
    280281      DEALLOCATE( zt3ns, zt3sn, zt3ew, zt3we  ) 
  • NEMO/trunk/src/OCE/LBC/mpp_lnk_generic.h90

    r10425 r10542  
    214214      ! 
    215215      IF( nbondi /= 2 ) DEALLOCATE( zt3ew, zt3we ) 
    216  
    217       ! 3. North and south directions 
    218       ! ----------------------------- 
    219       ! always closed : we play only with the neigbours 
    220       ! 
    221       IF( ABS(nbondj) == 1 ) ALLOCATE( zt3ns(jpi,nn_hls,ipk,ipl,ipf,1), zt3sn(jpi,nn_hls,ipk,ipl,ipf,1) ) 
    222       IF(     nbondj  == 0 ) ALLOCATE( zt3ns(jpi,nn_hls,ipk,ipl,ipf,2), zt3sn(jpi,nn_hls,ipk,ipl,ipf,2) ) 
    223       ! 
    224       SELECT CASE ( nbondj ) 
    225       CASE ( -1 ) 
    226          ijhom = nlcj-nrecj 
    227          DO jf = 1, ipf 
    228             DO jl = 1, ipl 
    229                DO jk = 1, ipk 
    230                   DO jh = 1, nn_hls 
    231                      zt3sn(:,jh,jk,jl,jf,1) = ARRAY_IN(:,ijhom +jh,jk,jl,jf) 
    232                   END DO 
    233                END DO 
    234             END DO 
    235          END DO 
    236       CASE ( 0 ) 
    237          ijhom = nlcj-nrecj 
    238          DO jf = 1, ipf 
    239             DO jl = 1, ipl 
    240                DO jk = 1, ipk 
    241                   DO jh = 1, nn_hls 
    242                      zt3sn(:,jh,jk,jl,jf,1) = ARRAY_IN(:,ijhom +jh,jk,jl,jf) 
    243                      zt3ns(:,jh,jk,jl,jf,1) = ARRAY_IN(:,nn_hls+jh,jk,jl,jf) 
    244                   END DO 
    245                END DO 
    246             END DO 
    247          END DO 
    248       CASE ( 1 ) 
    249          ijhom = nlcj-nrecj 
    250          DO jf = 1, ipf 
    251             DO jl = 1, ipl 
    252                DO jk = 1, ipk 
    253                   DO jh = 1, nn_hls 
    254                      zt3ns(:,jh,jk,jl,jf,1) = ARRAY_IN(:,nn_hls+jh,jk,jl,jf) 
    255                   END DO 
    256                END DO 
    257             END DO 
    258          END DO 
    259       END SELECT 
    260       ! 
    261       !                           ! Migrations 
    262       imigr = nn_hls * jpi * ipk * ipl * ipf 
    263       ! 
    264       IF( ln_timing ) CALL tic_tac(.TRUE.) 
    265       !  
    266       SELECT CASE ( nbondj ) 
    267       CASE ( -1 ) 
    268          CALL mppsend( 4, zt3sn(1,1,1,1,1,1), imigr, nono, ml_req1 ) 
    269          CALL mpprecv( 3, zt3ns(1,1,1,1,1,1), imigr, nono ) 
    270          IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err ) 
    271       CASE ( 0 ) 
    272          CALL mppsend( 3, zt3ns(1,1,1,1,1,1), imigr, noso, ml_req1 ) 
    273          CALL mppsend( 4, zt3sn(1,1,1,1,1,1), imigr, nono, ml_req2 ) 
    274          CALL mpprecv( 3, zt3ns(1,1,1,1,1,2), imigr, nono ) 
    275          CALL mpprecv( 4, zt3sn(1,1,1,1,1,2), imigr, noso ) 
    276          IF(l_isend)   CALL mpi_wait(ml_req1, ml_stat, ml_err ) 
    277          IF(l_isend)   CALL mpi_wait(ml_req2, ml_stat, ml_err ) 
    278       CASE ( 1 ) 
    279          CALL mppsend( 3, zt3ns(1,1,1,1,1,1), imigr, noso, ml_req1 ) 
    280          CALL mpprecv( 4, zt3sn(1,1,1,1,1,1), imigr, noso ) 
    281          IF(l_isend)   CALL mpi_wait(ml_req1, ml_stat, ml_err ) 
    282       END SELECT 
    283       ! 
    284       IF( ln_timing ) CALL tic_tac(.FALSE.) 
    285       !                           ! Write Dirichlet lateral conditions 
    286       ijhom = nlcj-nn_hls 
    287       ! 
    288       SELECT CASE ( nbondj ) 
    289       CASE ( -1 ) 
    290          DO jf = 1, ipf 
    291             DO jl = 1, ipl 
    292                DO jk = 1, ipk 
    293                   DO jh = 1, nn_hls 
    294                      ARRAY_IN(:,ijhom+jh,jk,jl,jf) = zt3ns(:,jh,jk,jl,jf,1) 
    295                   END DO 
    296                END DO 
    297             END DO 
    298          END DO 
    299       CASE ( 0 ) 
    300          DO jf = 1, ipf 
    301             DO jl = 1, ipl 
    302                DO jk = 1, ipk 
    303                   DO jh = 1, nn_hls 
    304                      ARRAY_IN(:,      jh,jk,jl,jf) = zt3sn(:,jh,jk,jl,jf,2) 
    305                      ARRAY_IN(:,ijhom+jh,jk,jl,jf) = zt3ns(:,jh,jk,jl,jf,2) 
    306                   END DO 
    307                END DO 
    308             END DO 
    309          END DO 
    310       CASE ( 1 ) 
    311          DO jf = 1, ipf 
    312             DO jl = 1, ipl 
    313                DO jk = 1, ipk 
    314                   DO jh = 1, nn_hls 
    315                      ARRAY_IN(:,jh,jk,jl,jf) = zt3sn(:,jh,jk,jl,jf,1) 
    316                   END DO 
    317                END DO 
    318             END DO 
    319          END DO 
    320       END SELECT 
    321       ! 
    322       IF( nbondj /= 2 ) DEALLOCATE( zt3ns, zt3sn ) 
    323  
    324       ! 4. north fold treatment 
    325       ! ----------------------- 
    326       ! 
     216      ! 
     217      ! ------------------------------- ! 
     218      !     3. north fold treatment     ! 
     219      ! ------------------------------- ! 
     220      ! do it before south directions so concerned processes can do it without waiting for the comm with the sourthern neighbor 
    327221      IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN 
    328222         ! 
     
    333227         ! 
    334228      ENDIF 
     229      ! 
     230      ! ------------------------------- ! 
     231      !  4. North and south directions  ! 
     232      ! ------------------------------- ! 
     233      ! always closed : we play only with the neigbours 
     234      ! 
     235      IF( ABS(nbondj) == 1 ) ALLOCATE( zt3ns(jpi,nn_hls,ipk,ipl,ipf,1), zt3sn(jpi,nn_hls,ipk,ipl,ipf,1) ) 
     236      IF(     nbondj  == 0 ) ALLOCATE( zt3ns(jpi,nn_hls,ipk,ipl,ipf,2), zt3sn(jpi,nn_hls,ipk,ipl,ipf,2) ) 
     237      ! 
     238      SELECT CASE ( nbondj ) 
     239      CASE ( -1 ) 
     240         ijhom = nlcj-nrecj 
     241         DO jf = 1, ipf 
     242            DO jl = 1, ipl 
     243               DO jk = 1, ipk 
     244                  DO jh = 1, nn_hls 
     245                     zt3sn(:,jh,jk,jl,jf,1) = ARRAY_IN(:,ijhom +jh,jk,jl,jf) 
     246                  END DO 
     247               END DO 
     248            END DO 
     249         END DO 
     250      CASE ( 0 ) 
     251         ijhom = nlcj-nrecj 
     252         DO jf = 1, ipf 
     253            DO jl = 1, ipl 
     254               DO jk = 1, ipk 
     255                  DO jh = 1, nn_hls 
     256                     zt3sn(:,jh,jk,jl,jf,1) = ARRAY_IN(:,ijhom +jh,jk,jl,jf) 
     257                     zt3ns(:,jh,jk,jl,jf,1) = ARRAY_IN(:,nn_hls+jh,jk,jl,jf) 
     258                  END DO 
     259               END DO 
     260            END DO 
     261         END DO 
     262      CASE ( 1 ) 
     263         ijhom = nlcj-nrecj 
     264         DO jf = 1, ipf 
     265            DO jl = 1, ipl 
     266               DO jk = 1, ipk 
     267                  DO jh = 1, nn_hls 
     268                     zt3ns(:,jh,jk,jl,jf,1) = ARRAY_IN(:,nn_hls+jh,jk,jl,jf) 
     269                  END DO 
     270               END DO 
     271            END DO 
     272         END DO 
     273      END SELECT 
     274      ! 
     275      !                           ! Migrations 
     276      imigr = nn_hls * jpi * ipk * ipl * ipf 
     277      ! 
     278      IF( ln_timing ) CALL tic_tac(.TRUE.) 
     279      !  
     280      SELECT CASE ( nbondj ) 
     281      CASE ( -1 ) 
     282         CALL mppsend( 4, zt3sn(1,1,1,1,1,1), imigr, nono, ml_req1 ) 
     283         CALL mpprecv( 3, zt3ns(1,1,1,1,1,1), imigr, nono ) 
     284         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err ) 
     285      CASE ( 0 ) 
     286         CALL mppsend( 3, zt3ns(1,1,1,1,1,1), imigr, noso, ml_req1 ) 
     287         CALL mppsend( 4, zt3sn(1,1,1,1,1,1), imigr, nono, ml_req2 ) 
     288         CALL mpprecv( 3, zt3ns(1,1,1,1,1,2), imigr, nono ) 
     289         CALL mpprecv( 4, zt3sn(1,1,1,1,1,2), imigr, noso ) 
     290         IF(l_isend)   CALL mpi_wait(ml_req1, ml_stat, ml_err ) 
     291         IF(l_isend)   CALL mpi_wait(ml_req2, ml_stat, ml_err ) 
     292      CASE ( 1 ) 
     293         CALL mppsend( 3, zt3ns(1,1,1,1,1,1), imigr, noso, ml_req1 ) 
     294         CALL mpprecv( 4, zt3sn(1,1,1,1,1,1), imigr, noso ) 
     295         IF(l_isend)   CALL mpi_wait(ml_req1, ml_stat, ml_err ) 
     296      END SELECT 
     297      ! 
     298      IF( ln_timing ) CALL tic_tac(.FALSE.) 
     299      !                           ! Write Dirichlet lateral conditions 
     300      ijhom = nlcj-nn_hls 
     301      ! 
     302      SELECT CASE ( nbondj ) 
     303      CASE ( -1 ) 
     304         DO jf = 1, ipf 
     305            DO jl = 1, ipl 
     306               DO jk = 1, ipk 
     307                  DO jh = 1, nn_hls 
     308                     ARRAY_IN(:,ijhom+jh,jk,jl,jf) = zt3ns(:,jh,jk,jl,jf,1) 
     309                  END DO 
     310               END DO 
     311            END DO 
     312         END DO 
     313      CASE ( 0 ) 
     314         DO jf = 1, ipf 
     315            DO jl = 1, ipl 
     316               DO jk = 1, ipk 
     317                  DO jh = 1, nn_hls 
     318                     ARRAY_IN(:,      jh,jk,jl,jf) = zt3sn(:,jh,jk,jl,jf,2) 
     319                     ARRAY_IN(:,ijhom+jh,jk,jl,jf) = zt3ns(:,jh,jk,jl,jf,2) 
     320                  END DO 
     321               END DO 
     322            END DO 
     323         END DO 
     324      CASE ( 1 ) 
     325         DO jf = 1, ipf 
     326            DO jl = 1, ipl 
     327               DO jk = 1, ipk 
     328                  DO jh = 1, nn_hls 
     329                     ARRAY_IN(:,jh,jk,jl,jf) = zt3sn(:,jh,jk,jl,jf,1) 
     330                  END DO 
     331               END DO 
     332            END DO 
     333         END DO 
     334      END SELECT 
     335      ! 
     336      IF( nbondj /= 2 ) DEALLOCATE( zt3ns, zt3sn ) 
    335337      ! 
    336338   END SUBROUTINE ROUTINE_LNK 
  • NEMO/trunk/src/OCE/LBC/mppini.F90

    r10436 r10542  
    670670      ! 
    671671      INTEGER ::   ji, jj 
    672       INTEGER ::   iresti, irestj 
     672      INTEGER ::   iresti, irestj, irm, ijpjmin 
    673673      INTEGER ::   ireci, irecj 
    674674      !!---------------------------------------------------------------------- 
     
    705705      klci(1:iresti      ,:) = kimax 
    706706      klci(iresti+1:knbi ,:) = kimax-1 
    707       klcj(:,      1:irestj) = kjmax 
    708       klcj(:, irestj+1:knbj) = kjmax-1 
     707      IF( MINVAL(klci) < 3 ) THEN 
     708         WRITE(ctmp1,*) '   mpp_basic_decomposition: minimum value of jpi must be >= 3' 
     709         WRITE(ctmp2,*) '   We have ', MINVAL(klci) 
     710        CALL ctl_stop( 'STOP', ctmp1, ctmp2 ) 
     711      ENDIF 
     712      IF( jperio == 3 .OR. jperio == 4 .OR. jperio == 5 .OR. jperio == 6 ) THEN 
     713         ! minimize the size of the last row to compensate for the north pole folding coast 
     714         IF( jperio == 3 .OR. jperio == 4 )   ijpjmin = 5   ! V and F folding involves line jpj-3 that must not be south boundary 
     715         IF( jperio == 5 .OR. jperio == 6 )   ijpjmin = 4   ! V and F folding involves line jpj-2 that must not be south boundary 
     716         irm = knbj - irestj                                    ! total number of lines to be removed 
     717         klcj(:,            knbj) = MAX( ijpjmin, kjmax-irm )   ! we must have jpj >= ijpjmin in the last row 
     718         irm = irm - ( kjmax - klcj(1,knbj) )                   ! remaining number of lines to remove  
     719         irestj = knbj - 1 - irm                         
     720         klcj(:,        1:irestj) = kjmax 
     721         klcj(:, irestj+1:knbj-1) = kjmax-1 
     722      ELSE 
     723         ijpjmin = 3 
     724         klcj(:,      1:irestj) = kjmax 
     725         klcj(:, irestj+1:knbj) = kjmax-1 
     726      ENDIF 
     727      IF( MINVAL(klcj) < ijpjmin ) THEN 
     728         WRITE(ctmp1,*) '   mpp_basic_decomposition: minimum value of jpj must be >= ', ijpjmin 
     729         WRITE(ctmp2,*) '   We have ', MINVAL(klcj) 
     730         CALL ctl_stop( 'STOP', ctmp1, ctmp2 ) 
     731      ENDIF 
    709732#endif 
    710733 
Note: See TracChangeset for help on using the changeset viewer.