Changeset 75 for trunk


Ignore:
Timestamp:
06/18/13 18:06:22 (11 years ago)
Author:
smasson
Message:

bugfif to help agrif conv, see nemo ticket #1111 and #1112

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90

    r72 r75  
    163163 
    164164   ! Arrays used in mpp_lbc_north_3d() 
    165    REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE, SAVE   ::   ztab, znorthloc 
    166    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, SAVE   ::   znorthgloio 
    167    REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE, SAVE   ::   zfoldwk      ! Workspace for message transfers avoiding mpi_allgather 
     165   REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE, SAVE   ::   tab_3d, xnorthloc 
     166   REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE, SAVE   ::   xnorthgloio 
     167   REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE, SAVE   ::   xfoldwk      ! Workspace for message transfers avoiding mpi_allgather 
    168168 
    169169   ! Arrays used in mpp_lbc_north_2d() 
    170    REAL(wp), DIMENSION(:,:)  , ALLOCATABLE, SAVE    ::   ztab_2d, znorthloc_2d 
    171    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, SAVE    ::   znorthgloio_2d 
    172    REAL(wp), DIMENSION(:,:)  , ALLOCATABLE, SAVE    ::   zfoldwk_2d    ! Workspace for message transfers avoiding mpi_allgather 
     170   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE, SAVE    ::   tab_2d, xnorthloc_2d 
     171   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, SAVE    ::   xnorthgloio_2d 
     172   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE, SAVE    ::   xfoldwk_2d    ! Workspace for message transfers avoiding mpi_allgather 
    173173 
    174174   ! Arrays used in mpp_lbc_north_e() 
    175    REAL(wp), DIMENSION(:,:)  , ALLOCATABLE, SAVE    ::   ztab_e, znorthloc_e 
    176    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, SAVE    ::   znorthgloio_e 
     175   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE, SAVE    ::   tab_e, xnorthloc_e 
     176   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, SAVE    ::   xnorthgloio_e 
    177177 
    178178   ! North fold arrays used to minimise the use of allgather operations. Set in nemo_northcomms (nemogcm) so need to be public 
     
    213213         &      tr2we(1-jpr2dj:jpj+jpr2dj,jpreci+jpr2di,2) ,                                                     & 
    214214         ! 
    215          &      ztab(jpiglo,4,jpk) , znorthloc(jpi,4,jpk) , znorthgloio(jpi,4,jpk,jpni) ,                        & 
    216          &      zfoldwk(jpi,4,jpk) ,                                                                             & 
    217          ! 
    218          &      ztab_2d(jpiglo,4)  , znorthloc_2d(jpi,4)  , znorthgloio_2d(jpi,4,jpni)  ,                        & 
    219          &      zfoldwk_2d(jpi,4)  ,                                                                             & 
    220          ! 
    221          &      ztab_e(jpiglo,4+2*jpr2dj) , znorthloc_e(jpi,4+2*jpr2dj) , znorthgloio_e(jpi,4+2*jpr2dj,jpni) ,   & 
     215         &      tab_3d(jpiglo,4,jpk) , xnorthloc(jpi,4,jpk) , xnorthgloio(jpi,4,jpk,jpni) ,                        & 
     216         &      xfoldwk(jpi,4,jpk) ,                                                                             & 
     217         ! 
     218         &      tab_2d(jpiglo,4)  , xnorthloc_2d(jpi,4)  , xnorthgloio_2d(jpi,4,jpni)  ,                        & 
     219         &      xfoldwk_2d(jpi,4)  ,                                                                             & 
     220         ! 
     221         &      tab_e(jpiglo,4+2*jpr2dj) , xnorthloc_e(jpi,4+2*jpr2dj) , xnorthgloio_e(jpi,4+2*jpr2dj,jpni) ,   & 
    222222         ! 
    223223         &      STAT=lib_mpp_alloc ) 
     
    22342234      ityp = -1 
    22352235      ijpjm1 = 3 
    2236       ztab(:,:,:) = 0.e0 
    2237       ! 
    2238       DO jj = nlcj - ijpj +1, nlcj          ! put in znorthloc the last 4 jlines of pt3d 
     2236      tab_3d(:,:,:) = 0.e0 
     2237      ! 
     2238      DO jj = nlcj - ijpj +1, nlcj          ! put in xnorthloc the last 4 jlines of pt3d 
    22392239         ij = jj - nlcj + ijpj 
    2240          znorthloc(:,ij,:) = pt3d(:,jj,:) 
     2240         xnorthloc(:,ij,:) = pt3d(:,jj,:) 
    22412241      END DO 
    22422242      ! 
    2243       !                                     ! Build in procs of ncomm_north the znorthgloio 
     2243      !                                     ! Build in procs of ncomm_north the xnorthgloio 
    22442244      itaille = jpi * jpk * ijpj 
    22452245      IF ( l_north_nogather ) THEN 
     
    22512251            ij = jj - nlcj + ijpj 
    22522252            DO ji = 1, nlci 
    2253                ztab(ji+nimpp-1,ij,:) = pt3d(ji,jj,:) 
     2253               tab_3d(ji+nimpp-1,ij,:) = pt3d(ji,jj,:) 
    22542254            END DO 
    22552255         END DO 
     
    22762276 
    22772277            DO jr = 1,nsndto(ityp) 
    2278                CALL mppsend(5, znorthloc, itaille, isendto(jr,ityp), ml_req_nf(jr) ) 
     2278               CALL mppsend(5, xnorthloc, itaille, isendto(jr,ityp), ml_req_nf(jr) ) 
    22792279            END DO 
    22802280            DO jr = 1,nsndto(ityp) 
    2281                CALL mpprecv(5, zfoldwk, itaille, isendto(jr,ityp)) 
     2281               CALL mpprecv(5, xfoldwk, itaille, isendto(jr,ityp)) 
    22822282               iproc = isendto(jr,ityp) + 1 
    22832283               ildi = nldit (iproc) 
     
    22862286               DO jj = 1, ijpj 
    22872287                  DO ji = ildi, ilei 
    2288                      ztab(ji+iilb-1,jj,:) = zfoldwk(ji,jj,:) 
     2288                     tab_3d(ji+iilb-1,jj,:) = xfoldwk(ji,jj,:) 
    22892289                  END DO 
    22902290               END DO 
     
    23012301 
    23022302      IF ( ityp .lt. 0 ) THEN 
    2303          CALL MPI_ALLGATHER( znorthloc  , itaille, MPI_DOUBLE_PRECISION,                & 
    2304             &                znorthgloio, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
     2303         CALL MPI_ALLGATHER( xnorthloc  , itaille, MPI_DOUBLE_PRECISION,                & 
     2304            &                xnorthgloio, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
    23052305         ! 
    23062306         DO jr = 1, ndim_rank_north         ! recover the global north array 
     
    23112311            DO jj = 1, ijpj 
    23122312               DO ji = ildi, ilei 
    2313                   ztab(ji+iilb-1,jj,:) = znorthgloio(ji,jj,:,jr) 
     2313                  tab_3d(ji+iilb-1,jj,:) = xnorthgloio(ji,jj,:,jr) 
    23142314               END DO 
    23152315            END DO 
     
    23172317      ENDIF 
    23182318      ! 
    2319       ! The ztab array has been either: 
     2319      ! The tab_3d array has been either: 
    23202320      !  a. Fully populated by the mpi_allgather operation or 
    23212321      !  b. Had the active points for this domain and northern neighbours populated  
     
    23242324      ! this domain will be identical. 
    23252325      ! 
    2326       CALL lbc_nfd( ztab, cd_type, psgn )   ! North fold boundary condition 
     2326      CALL lbc_nfd( tab_3d, cd_type, psgn )   ! North fold boundary condition 
    23272327      ! 
    23282328      DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt3d 
    23292329         ij = jj - nlcj + ijpj 
    23302330         DO ji= 1, nlci 
    2331             pt3d(ji,jj,:) = ztab(ji+nimpp-1,ij,:) 
     2331            pt3d(ji,jj,:) = tab_3d(ji+nimpp-1,ij,:) 
    23322332         END DO 
    23332333      END DO 
     
    23662366      ityp = -1 
    23672367      ijpjm1 = 3 
    2368       ztab_2d(:,:) = 0.e0 
    2369       ! 
    2370       DO jj = nlcj-ijpj+1, nlcj             ! put in znorthloc_2d the last 4 jlines of pt2d 
     2368      tab_2d(:,:) = 0.e0 
     2369      ! 
     2370      DO jj = nlcj-ijpj+1, nlcj             ! put in xnorthloc_2d the last 4 jlines of pt2d 
    23712371         ij = jj - nlcj + ijpj 
    2372          znorthloc_2d(:,ij) = pt2d(:,jj) 
     2372         xnorthloc_2d(:,ij) = pt2d(:,jj) 
    23732373      END DO 
    23742374 
    2375       !                                     ! Build in procs of ncomm_north the znorthgloio_2d 
     2375      !                                     ! Build in procs of ncomm_north the xnorthgloio_2d 
    23762376      itaille = jpi * ijpj 
    23772377      IF ( l_north_nogather ) THEN 
     
    23832383            ij = jj - nlcj + ijpj 
    23842384            DO ji = 1, nlci 
    2385                ztab_2d(ji+nimpp-1,ij) = pt2d(ji,jj) 
     2385               tab_2d(ji+nimpp-1,ij) = pt2d(ji,jj) 
    23862386            END DO 
    23872387         END DO 
     
    24092409 
    24102410            DO jr = 1,nsndto(ityp) 
    2411                CALL mppsend(5, znorthloc_2d, itaille, isendto(jr,ityp), ml_req_nf(jr) ) 
     2411               CALL mppsend(5, xnorthloc_2d, itaille, isendto(jr,ityp), ml_req_nf(jr) ) 
    24122412            END DO 
    24132413            DO jr = 1,nsndto(ityp) 
    2414                CALL mpprecv(5, zfoldwk_2d, itaille, isendto(jr,ityp)) 
     2414               CALL mpprecv(5, xfoldwk_2d, itaille, isendto(jr,ityp)) 
    24152415               iproc = isendto(jr,ityp) + 1 
    24162416               ildi = nldit (iproc) 
     
    24192419               DO jj = 1, ijpj 
    24202420                  DO ji = ildi, ilei 
    2421                      ztab_2d(ji+iilb-1,jj) = zfoldwk_2d(ji,jj) 
     2421                     tab_2d(ji+iilb-1,jj) = xfoldwk_2d(ji,jj) 
    24222422                  END DO 
    24232423               END DO 
     
    24342434 
    24352435      IF ( ityp .lt. 0 ) THEN 
    2436          CALL MPI_ALLGATHER( znorthloc_2d  , itaille, MPI_DOUBLE_PRECISION,        & 
    2437             &                znorthgloio_2d, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
     2436         CALL MPI_ALLGATHER( xnorthloc_2d  , itaille, MPI_DOUBLE_PRECISION,        & 
     2437            &                xnorthgloio_2d, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
    24382438         ! 
    24392439         DO jr = 1, ndim_rank_north            ! recover the global north array 
     
    24442444            DO jj = 1, ijpj 
    24452445               DO ji = ildi, ilei 
    2446                   ztab_2d(ji+iilb-1,jj) = znorthgloio_2d(ji,jj,jr) 
     2446                  tab_2d(ji+iilb-1,jj) = xnorthgloio_2d(ji,jj,jr) 
    24472447               END DO 
    24482448            END DO 
     
    24572457      ! this domain will be identical. 
    24582458      ! 
    2459       CALL lbc_nfd( ztab_2d, cd_type, psgn )   ! North fold boundary condition 
     2459      CALL lbc_nfd( tab_2d, cd_type, psgn )   ! North fold boundary condition 
    24602460      ! 
    24612461      ! 
     
    24632463         ij = jj - nlcj + ijpj 
    24642464         DO ji = 1, nlci 
    2465             pt2d(ji,jj) = ztab_2d(ji+nimpp-1,ij) 
     2465            pt2d(ji,jj) = tab_2d(ji+nimpp-1,ij) 
    24662466         END DO 
    24672467      END DO 
     
    24962496      ! 
    24972497      ijpj=4 
    2498       ztab_e(:,:) = 0.e0 
     2498      tab_e(:,:) = 0.e0 
    24992499 
    25002500      ij=0 
    2501       ! put in znorthloc_e the last 4 jlines of pt2d 
     2501      ! put in xnorthloc_e the last 4 jlines of pt2d 
    25022502      DO jj = nlcj - ijpj + 1 - jpr2dj, nlcj +jpr2dj 
    25032503         ij = ij + 1 
    25042504         DO ji = 1, jpi 
    2505             znorthloc_e(ji,ij)=pt2d(ji,jj) 
     2505            xnorthloc_e(ji,ij)=pt2d(ji,jj) 
    25062506         END DO 
    25072507      END DO 
    25082508      ! 
    25092509      itaille = jpi * ( ijpj + 2 * jpr2dj ) 
    2510       CALL MPI_ALLGATHER( znorthloc_e(1,1)  , itaille, MPI_DOUBLE_PRECISION,    & 
    2511          &                znorthgloio_e(1,1,1), itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
     2510      CALL MPI_ALLGATHER( xnorthloc_e(1,1)  , itaille, MPI_DOUBLE_PRECISION,    & 
     2511         &                xnorthgloio_e(1,1,1), itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
    25122512      ! 
    25132513      DO jr = 1, ndim_rank_north            ! recover the global north array 
     
    25182518         DO jj = 1, ijpj+2*jpr2dj 
    25192519            DO ji = ildi, ilei 
    2520                ztab_e(ji+iilb-1,jj) = znorthgloio_e(ji,jj,jr) 
     2520               tab_e(ji+iilb-1,jj) = xnorthgloio_e(ji,jj,jr) 
    25212521            END DO 
    25222522         END DO 
     
    25262526      ! 2. North-Fold boundary conditions 
    25272527      ! ---------------------------------- 
    2528       CALL lbc_nfd( ztab_e(:,:), cd_type, psgn, pr2dj = jpr2dj ) 
     2528      CALL lbc_nfd( tab_e(:,:), cd_type, psgn, pr2dj = jpr2dj ) 
    25292529 
    25302530      ij = jpr2dj 
     
    25332533      ij  = ij +1  
    25342534         DO ji= 1, nlci 
    2535             pt2d(ji,jj) = ztab_e(ji+nimpp-1,ij) 
     2535            pt2d(ji,jj) = tab_e(ji+nimpp-1,ij) 
    25362536         END DO 
    25372537      END DO 
Note: See TracChangeset for help on using the changeset viewer.