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 784 for trunk/NEMO/OPA_SRC/SOL/solsor.F90 – NEMO

Ignore:
Timestamp:
2008-01-08T12:05:25+01:00 (16 years ago)
Author:
rblod
Message:

merge solsor and solsor_e, see ticket #45

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/SOL/solsor.F90

    r719 r784  
    4343      !!     as well as islands) while in the latter the boundary condition 
    4444      !!     specification is not required. 
    45       !! 
     45      !!       This routine provides a MPI optimization to the existing solsor 
     46      !!     by reducing the number of call to lbc. 
     47      !!  
    4648      !! ** Method  :   Successive-over-relaxation method using the red-black  
    4749      !!      technique. The former technique used was not compatible with  
    4850      !!      the north-fold boundary condition used in orca configurations. 
    49       !! 
     51      !!      Compared to the classical sol_sor, this routine provides a  
     52      !!      mpp optimization by reducing the number of calls to lnc_lnk 
     53      !!      The solution is computed on a larger area and the boudary 
     54      !!      conditions only when the inside domain is reached. 
     55      !!  
    5056      !! References : 
    5157      !!      Madec et al. 1988, Ocean Modelling, issue 78, 1-6. 
     58      !!      Beare and Stevens 1997 Ann. Geophysicae 15, 1369-1377 
    5259      !! 
    5360      !! History : 
     
    5865      !!        !  96-11  (A. Weaver)  correction to preconditioning 
    5966      !!   9.0  !  03-04  (C. Deltel, G. Madec)  Red-Black SOR in free form 
     67      !!   9.0  !  05-09  (R. Benshila, G. Madec)  MPI optimization 
    6068      !!---------------------------------------------------------------------- 
    6169      !! * Arguments 
     
    6674      !! * Local declarations 
    6775      INTEGER  ::   ji, jj, jn               ! dummy loop indices 
    68       INTEGER  ::   ishift 
     76      INTEGER  ::   ishift, icount 
    6977      REAL(wp) ::   ztmp, zres, zres2 
    7078 
    7179      INTEGER  ::   ijmppodd, ijmppeven 
     80      INTEGER  ::   ijpr2d 
    7281      !!---------------------------------------------------------------------- 
    7382       
    74       ijmppeven = MOD(nimpp+njmpp  ,2) 
    75       ijmppodd  = MOD(nimpp+njmpp+1,2) 
     83      ijmppeven = MOD(nimpp+njmpp+jpr2di+jpr2dj,2) 
     84      ijmppodd  = MOD(nimpp+njmpp+jpr2di+jpr2dj+1,2) 
     85      ijpr2d = MAX(jpr2di,jpr2dj) 
     86      icount = 0 
    7687      !                                                       ! ============== 
    7788      DO jn = 1, nmax                                         ! Iterative loop  
    7889         !                                                    ! ============== 
    7990 
    80          CALL lbc_lnk( gcx, c_solver_pt, 1. )   ! applied the lateral boundary conditions 
    81           
     91         ! applied the lateral boundary conditions 
     92         IF( MOD(icount,ijpr2d+1) == 0 ) CALL lbc_lnk_e( gcx, c_solver_pt, 1. )    
     93         
    8294         ! Residus 
    8395         ! ------- 
    8496 
    8597         ! Guess black update 
    86          DO jj = 2, jpjm1 
    87             ishift = MOD( jj-ijmppodd, 2 ) 
    88             DO ji = 2+ishift, jpim1, 2 
     98         DO jj = 2-jpr2dj, nlcj-1+jpr2dj 
     99            ishift = MOD( jj-ijmppodd-jpr2dj, 2 ) 
     100            DO ji = 2-jpr2di+ishift, nlci-1+jpr2di, 2 
    89101               ztmp =                  gcb(ji  ,jj  )   & 
    90102                  &   - gcp(ji,jj,1) * gcx(ji  ,jj-1)   & 
     
    99111            END DO 
    100112         END DO 
    101  
    102          CALL lbc_lnk( gcx, c_solver_pt, 1. )   ! applied the lateral boubary conditions 
     113         icount = icount + 1  
     114  
     115         ! applied the lateral boundary conditions 
     116         IF( MOD(icount,ijpr2d+1) == 0 ) CALL lbc_lnk_e( gcx, c_solver_pt, 1. )   
    103117 
    104118         ! Guess red update 
    105          DO jj = 2, jpjm1 
    106             ishift = MOD( jj-ijmppeven, 2 ) 
    107             DO ji = 2+ishift, jpim1, 2 
     119         DO jj = 2-jpr2dj, nlcj-1+jpr2dj 
     120            ishift = MOD( jj-ijmppeven-jpr2dj, 2 ) 
     121            DO ji = 2-jpr2di+ishift, nlci-1+jpr2di, 2 
    108122               ztmp =                  gcb(ji  ,jj  )   & 
    109123                  &   - gcp(ji,jj,1) * gcx(ji  ,jj-1)   & 
     
    118132            END DO 
    119133         END DO 
     134         icount = icount + 1 
    120135 
    121136         ! test of convergence 
     
    124139            SELECT CASE ( nsol_arp ) 
    125140            CASE ( 0 )                 ! absolute precision (maximum value of the residual) 
    126                zres2 = MAXVAL( gcr(2:jpim1,2:jpjm1) ) 
     141               zres2 = MAXVAL( gcr(2:nlci-1,2:nlcj-1) ) 
    127142               IF( lk_mpp )   CALL mpp_max( zres2 )   ! max over the global domain 
    128143               ! test of convergence 
     
    133148               ENDIF 
    134149            CASE ( 1 )                 ! relative precision 
    135                rnorme = SUM( gcr(2:jpim1,2:jpjm1) ) 
     150               rnorme = SUM( gcr(2:nlci-1,2:nlcj-1) ) 
    136151               IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain 
    137152               ! test of convergence 
     
    163178      !  ------------- 
    164179 
    165       CALL lbc_lnk( gcx, c_solver_pt, 1. )    ! boundary conditions 
     180      CALL lbc_lnk_e( gcx, c_solver_pt, 1. )    ! boundary conditions 
    166181 
    167182       
Note: See TracChangeset for help on using the changeset viewer.