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

Ignore:
Timestamp:
2004-02-17T09:06:15+01:00 (20 years ago)
Author:
opalod
Message:

CT : UPDATE001 : First major NEMO update

File:
1 edited

Legend:

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

    r3 r16  
    2222   !! * Routine accessibility 
    2323   PUBLIC sol_sor              ! ??? 
     24 
    2425   !!---------------------------------------------------------------------- 
    2526   !!   OPA 9.0 , LODYC-IPSL  (2003) 
     
    2829CONTAINS 
    2930       
    30    SUBROUTINE sol_sor( kt, kindic ) 
     31   SUBROUTINE sol_sor( kindic ) 
    3132      !!---------------------------------------------------------------------- 
    3233      !!                  ***  ROUTINE sol_sor  *** 
    3334      !!                  
    3435      !! ** Purpose :   Solve the ellipic equation for the barotropic stream  
    35       !!      function system (default option) or the transport divergence  
    36       !!      system (key_dynspg_fsc = T) using a successive-over-relaxation 
     36      !!      function system (lk_dynspg_rl=T) or the transport divergence  
     37      !!      system (lk_dynspg_fsc=T) using a successive-over-relaxation 
    3738      !!      method. 
    3839      !!       In the former case, the barotropic stream function trend has a 
     
    5960      !!---------------------------------------------------------------------- 
    6061      !! * Arguments 
    61       INTEGER, INTENT(  in   ) ::   kt       ! ocean time-step 
    6262      INTEGER, INTENT( inout ) ::   kindic   ! solver indicator, < 0 if the conver- 
    6363      !                                      ! gence is not reached: the model is 
     
    6767      !! * Local declarations 
    6868      INTEGER  ::   ji, jj, jn               ! dummy loop indices 
    69       REAL(wp) ::   zgwgt                    ! temporary scalar 
    7069      !!---------------------------------------------------------------------- 
    7170       
    72        
    73       ! Iterative loop  
    74       ! ============== 
    75        
    76       IF( kt == nit000 )  gccd(:,:) = sor * gcp(:,:,2) 
     71      !                                                       ! ============== 
     72      DO jn = 1, nmax                                         ! Iterative loop  
     73         !                                                    ! ============== 
    7774 
    78  
    79       DO jn = 1, nmax 
    80  
    81          !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
     75         CALL lbc_lnk( gcx, c_solver_pt, 1. )   ! applied the lateral boubary conditions 
    8276          
    83          ! boundary conditions (at each sor iteration) only cyclic b. c. are required 
    84 #if defined key_dynspg_fsc 
    85 # if defined key_mpp 
    86             ! Mpp: export boundary values to neighbouring processors 
    87             CALL lbc_lnk( gcx, 'S', 1. )   ! S=T with special staff ??? 
    88 # else 
    89             CALL lbc_lnk( gcx, 'T', 1. ) 
    90 # endif 
    91 #else 
    92 # if defined key_mpp 
    93             ! Mpp: export boundary values to neighbouring processors 
    94             CALL lbc_lnk( gcx, 'G', 1. )   ! G= F with special staff ??? 
    95 # else 
    96             CALL lbc_lnk( gcx, 'F', 1. ) 
    97 # endif 
    98 #endif 
    99           
    100          !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    101           
    102          ! 1. Residus 
    103          ! ---------- 
    104   
     77         ! Residus 
     78         ! ------- 
    10579         DO jj = 2, jpjm1 
    10680            DO ji = 2, jpim1 
    107                gcr(ji,jj) =  gcb(ji,jj  ) -             gcx(ji  ,jj  )   & 
    108                                           -gcp(ji,jj,1)*gcx(ji  ,jj-1)   & 
    109                                           -gcp(ji,jj,2)*gcx(ji-1,jj  )   & 
    110                                           -gcp(ji,jj,3)*gcx(ji+1,jj  )   & 
    111                                           -gcp(ji,jj,4)*gcx(ji  ,jj+1) 
     81               gcr(ji,jj) =  gcb(ji,jj  ) -                gcx(ji  ,jj  )   & 
     82                                          - gcp(ji,jj,1) * gcx(ji  ,jj-1)   & 
     83                                          - gcp(ji,jj,2) * gcx(ji-1,jj  )   & 
     84                                          - gcp(ji,jj,3) * gcx(ji+1,jj  )   & 
     85                                          - gcp(ji,jj,4) * gcx(ji  ,jj+1) 
    11286            END DO 
    11387         END DO 
     88         CALL lbc_lnk( gcr, c_solver_pt, 1. )   ! applied the lateral boubary conditions 
    11489 
    115          !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    116           
    117          ! 1.1 Boundary conditions (at each sor iteration) only cyclic b. c. are required 
    118 #if defined key_dynspg_fsc 
    119 #   if defined key_mpp 
    120             ! Mpp: export boundary values to neighbouring processors 
    121             CALL lbc_lnk( gcr, 'S', 1. ) 
    122 #   else 
    123             ! mono- or macro-tasking: W-point, >0, 2D array, no slab 
    124             CALL lbc_lnk( gcr, 'T', 1. ) 
    125 #   endif 
    126 #else 
    127 #   if defined key_mpp 
    128             ! Mpp: export boundary values to neighbouring processors 
    129             CALL lbc_lnk( gcr, 'G', 1. ) 
    130 #   else 
    131             ! mono- or macro-tasking: W-point, >0, 2D array, no slab 
    132             CALL lbc_lnk( gcr, 'F', 1. ) 
    133 #   endif 
    134 #endif 
    135  
    136          ! 1.2 Successive over relaxation 
    137           
     90         ! Successive over relaxation 
    13891         DO jj = 2, jpj 
    13992            DO ji = 1, jpi 
    140                gcr(ji,jj) = gcr(ji,jj) - sor*gcp(ji,jj,1)*gcr(ji,jj-1) 
     93               gcr(ji,jj) = gcr(ji,jj) - sor * gcp(ji,jj,1) * gcr(ji,jj-1) 
    14194            END DO 
    14295            DO ji = 2, jpi 
    143                gcr(ji,jj) = gcr(ji,jj) - sor*gcp(ji,jj,2)*gcr(ji-1,jj) 
     96               gcr(ji,jj) = gcr(ji,jj) - sor * gcp(ji,jj,2) * gcr(ji-1,jj) 
    14497            END DO 
    14598         END DO 
    14699          
    147          !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    148           
    149100         ! gcx guess 
    150           
    151101         DO jj = 2, jpjm1 
    152102            DO ji = 1, jpi 
    153                gcx(ji,jj)  = (gcx(ji,jj)+sor*gcr(ji,jj))*bmask(ji,jj) 
     103               gcx(ji,jj)  = ( gcx(ji,jj) + sor * gcr(ji,jj) ) * bmask(ji,jj) 
    154104            END DO 
    155105         END DO 
    156           
    157          !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    158           
    159          ! boundary conditions (at each sor iteration) only cyclic b. c. are required 
    160 #if defined key_dynspg_fsc 
    161 #   if defined key_mpp 
    162          ! Mpp: export boundary values to neighbouring processors 
    163          CALL lbc_lnk( gcx, 'S', 1. ) 
    164 #   else 
    165          ! mono- or macro-tasking: W-point, >0, 2D array, no slab 
    166          CALL lbc_lnk( gcx, 'T', 1. ) 
    167 #   endif 
    168 #else 
    169 #   if defined key_mpp 
    170          ! Mpp: export boundary values to neighbouring processors 
    171          CALL lbc_lnk( gcx, 'G', 1. ) 
    172 #   else 
    173          ! mono- or macro-tasking: W-point, >0, 2D array, no slab 
    174          CALL lbc_lnk( gcx, 'F', 1. ) 
    175 #   endif 
    176 #endif 
    177           
    178          ! maximal residu (old exit test on the maximum value of residus) 
    179          !  
    180          ! imax = isamax( jpi*jpj, gcr, 1 ) 
    181           
    182          ! avoid an out of bound in no bounds compilation 
    183           
    184          ! iimax1 = mod( imax, jpi ) 
    185          ! ijmax1 = int( float(imax) / float(jpi)) + 1 
    186          ! resmax = abs( gcr(iimax1,ijmax1) ) 
     106         CALL lbc_lnk( gcx, c_solver_pt, 1. ) 
    187107          
    188108         ! relative precision 
    189           
    190          rnorme = 0. 
    191          DO jj = 1, jpj 
    192             DO ji = 1, jpi 
    193                zgwgt = gcdmat(ji,jj) * gcr(ji,jj) 
    194                rnorme= rnorme + gcr(ji,jj)*zgwgt 
    195             END DO 
    196          END DO 
    197           
    198 #if defined key_mpp 
    199          ! mpp sum over all the global domain 
    200          CALL  mpp_sum( rnorme ) 
    201 #endif 
     109         rnorme = SUM( gcr(:,:) * gcdmat(:,:) * gcr(:,:) ) 
     110         IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain 
    202111          
    203112         ! test of convergence 
     
    216125         !**** 
    217126          
    218          !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    219           
    220127         ! indicator of non-convergence or explosion 
    221           
    222128         IF( jn == nmax .OR. SQRT(epsr)/eps > 1.e+20 ) kindic = -2 
    223129         IF( ncut == 999 ) GOTO 999 
    224130          
    225           
    226          ! END of iterative loop 
    227          ! ===================== 
    228           
    229       END DO 
    230        
     131         !                                                 ! ===================== 
     132      END DO                                               ! END of iterative loop 
     133      !                                                    ! ===================== 
    231134       
    232135999   CONTINUE 
    233136       
    234137       
    235       !  2. Output in gcx 
    236       !  ----------------- 
     138      !  Output in gcx 
     139      !  ------------- 
    237140       
    238       ! boundary conditions (est-ce necessaire? je ne crois pas!!!!) 
    239        
    240 #if defined key_dynspg_fsc 
    241 # if defined key_mpp 
    242       ! Mpp: export boundary values to neighbouring processors 
    243       CALL lbc_lnk( gcx, 'S', 1. ) 
    244 # else 
    245       IF( nperio /= 0 ) THEN 
    246          CALL lbc_lnk( gcx, 'T', 1. ) 
    247       ENDIF 
    248 # endif 
    249 #else 
    250 # if defined key_mpp 
    251       ! Mpp: export boundary values to neighbouring processors 
    252       CALL lbc_lnk( gcx, 'G', 1. ) 
    253 # else 
    254       IF( nperio /= 0 ) THEN 
    255          CALL lbc_lnk( gcx, 'F', 1. ) 
    256       ENDIF 
    257 # endif 
    258 #endif 
     141      CALL lbc_lnk( gcx, c_solver_pt, 1. )    ! boundary conditions (est-ce necessaire? je ne crois pas!!!!) 
    259142       
    260143   END SUBROUTINE sol_sor 
Note: See TracChangeset for help on using the changeset viewer.