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 14688 – NEMO

Changeset 14688


Ignore:
Timestamp:
2021-04-09T19:03:15+02:00 (3 years ago)
Author:
jchanut
Message:

Last round of changes following r14674, r14675 and r14687 (AGRIF new grid positionning), #2638

Location:
NEMO/branches/2021/dev_r14608_AGRIF_domcfg
Files:
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/cfgs/AGRIF_DEMO/EXPREF/AGRIF_FixedGrids.in

    r13286 r14688  
    112 
    2 41 81 49 91 1 1 1 
    3 121 152 110 143 4 4 4 
     245 85 53 95 1 1 1 
     3125 156 114 147 4 4 4 
    440 
    551 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/src/NST/agrif_oce_interp.F90

    r14641 r14688  
    216216      IF( lk_west ) THEN 
    217217         ibdy1 = nn_hls + 2                  ! halo + land + 1 
    218          ibdy2 = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhox()   ! halo + land + nbghostcells 
     218         ibdy2 = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhox()   ! halo + land + nbghostcells 
    219219         ! 
    220220         IF( .NOT.ln_dynspg_ts ) THEN  ! Store transport 
     
    265265      ! --- East --- ! 
    266266      IF( lk_east) THEN 
    267          ibdy1 = jpiglo - ( nn_hls + nbghostcells + 1) - nn_shift_bar*Agrif_Rhox()     
     267         ibdy1 = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()     
    268268         ibdy2 = jpiglo - ( nn_hls + 2 )                  
    269269         ! 
     
    293293         END DO 
    294294         ! 
    295          ibdy1 = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()  
     295         ibdy1 = jpiglo - ( nn_hls + nbghostcells - 1 ) - nn_shift_bar*Agrif_Rhox()  
    296296         ibdy2 = jpiglo - ( nn_hls + 1 )      
    297297         ! 
     
    326326      IF( lk_south ) THEN 
    327327         jbdy1 = nn_hls + 2                  
    328          jbdy2 = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhoy()    
     328         jbdy2 = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhoy()    
    329329         ! 
    330330         IF( .NOT.ln_dynspg_ts ) THEN 
     
    375375      ! --- North --- ! 
    376376      IF( lk_north ) THEN 
    377          jbdy1 = jpjglo - ( nn_hls + nbghostcells + 1) - nn_shift_bar*Agrif_Rhoy()  
     377         jbdy1 = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()  
    378378         jbdy2 = jpjglo - ( nn_hls + 2 ) 
    379379         ! 
     
    403403         END DO 
    404404         ! 
    405          jbdy1 = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()   
     405         jbdy1 = jpjglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhoy()   
    406406         jbdy2 = jpjglo - ( nn_hls + 1 ) 
    407407         ! 
     
    451451      IF( lk_west ) THEN 
    452452         istart = nn_hls + 2                              ! halo + land + 1 
    453          iend   = nn_hls + 1 + nbghostcells  + nn_shift_bar*Agrif_Rhox()              ! halo + land + nbghostcells 
     453         iend   = nn_hls + nbghostcells  + nn_shift_bar*Agrif_Rhox()              ! halo + land + nbghostcells 
    454454         DO ji = mi0(istart), mi1(iend) 
    455455            DO jj=1,jpj 
     
    462462      !--- East ---! 
    463463      IF( lk_east ) THEN 
    464          istart = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()  
     464         istart = jpiglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhox()  
    465465         iend   = jpiglo - ( nn_hls + 1 )                 
    466466         DO ji = mi0(istart), mi1(iend) 
     
    470470            END DO 
    471471         END DO 
    472          istart = jpiglo - ( nn_hls + nbghostcells + 1) - nn_shift_bar*Agrif_Rhox()  
     472         istart = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()  
    473473         iend   = jpiglo - ( nn_hls + 2 )                 
    474474         DO ji = mi0(istart), mi1(iend) 
     
    482482      IF( lk_south ) THEN 
    483483         jstart = nn_hls + 2                               
    484          jend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhoy()            
     484         jend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhoy()            
    485485         DO jj = mj0(jstart), mj1(jend) 
    486486 
     
    494494      !--- North ---! 
    495495      IF( lk_north ) THEN 
    496          jstart = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()      
     496         jstart = jpjglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhoy()      
    497497         jend   = jpjglo - ( nn_hls + 1 )                 
    498498         DO jj = mj0(jstart), mj1(jend) 
     
    501501            END DO 
    502502         END DO 
    503          jstart = jpjglo - ( nn_hls + nbghostcells + 1) - nn_shift_bar*Agrif_Rhoy()  
     503         jstart = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()  
    504504         jend   = jpjglo - ( nn_hls + 2 )                 
    505505         DO jj = mj0(jstart), mj1(jend) 
     
    529529      IF( lk_west ) THEN 
    530530         istart = nn_hls + 2                               
    531          iend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhox()  
     531         iend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhox()  
    532532         DO ji = mi0(istart), mi1(iend) 
    533533            DO jj=1,jpj 
     
    540540      !--- East ---! 
    541541      IF( lk_east ) THEN 
    542          istart = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox() 
     542         istart = jpiglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhox() 
    543543         iend   = jpiglo - ( nn_hls + 1 )                  
    544544         DO ji = mi0(istart), mi1(iend) 
     
    547547            END DO 
    548548         END DO 
    549          istart = jpiglo - ( nn_hls + nbghostcells + 1) - nn_shift_bar*Agrif_Rhox()  
     549         istart = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()  
    550550         iend   = jpiglo - ( nn_hls + 2 )                  
    551551         DO ji = mi0(istart), mi1(iend) 
     
    559559      IF( lk_south ) THEN 
    560560         jstart = nn_hls + 2                               
    561          jend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhoy()  
     561         jend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhoy()  
    562562         DO jj = mj0(jstart), mj1(jend) 
    563563            DO ji=1,jpi 
     
    570570      !--- North ---! 
    571571      IF( lk_north ) THEN 
    572          jstart = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()  
     572         jstart = jpjglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhoy()  
    573573         jend   = jpjglo - ( nn_hls + 1 )                 
    574574         DO jj = mj0(jstart), mj1(jend) 
     
    577577            END DO 
    578578         END DO 
    579          jstart = jpjglo - ( nn_hls + nbghostcells + 1) - nn_shift_bar*Agrif_Rhoy()  
     579         jstart = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()  
    580580         jend   = jpjglo - ( nn_hls + 2 )                
    581581         DO jj = mj0(jstart), mj1(jend) 
     
    672672      IF(lk_west) THEN 
    673673         istart = nn_hls + 2                                                          ! halo + land + 1 
    674          iend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhox()               ! halo + land + nbghostcells 
     674         iend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhox()               ! halo + land + nbghostcells 
    675675         DO ji = mi0(istart), mi1(iend) 
    676676            DO jj = 1, jpj 
     
    682682      ! --- East --- ! 
    683683      IF(lk_east) THEN 
    684          istart = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()       ! halo + land + nbghostcells - 1 
     684         istart = jpiglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhox()       ! halo + land + nbghostcells - 1 
    685685         iend   = jpiglo - ( nn_hls + 1 )                                              ! halo + land + 1            - 1 
    686686         DO ji = mi0(istart), mi1(iend) 
     
    694694      IF(lk_south) THEN 
    695695         jstart = nn_hls + 2                                                          ! halo + land + 1 
    696          jend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhoy()               ! halo + land + nbghostcells 
     696         jend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhoy()               ! halo + land + nbghostcells 
    697697         DO jj = mj0(jstart), mj1(jend) 
    698698            DO ji = 1, jpi 
     
    704704      ! --- North --- ! 
    705705      IF(lk_north) THEN 
    706          jstart = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()     ! halo + land + nbghostcells - 1 
     706         jstart = jpjglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhoy()     ! halo + land + nbghostcells - 1 
    707707         jend   = jpjglo - ( nn_hls + 1 )                                            ! halo + land + 1            - 1 
    708708         DO jj = mj0(jstart), mj1(jend) 
     
    731731      IF(lk_west) THEN 
    732732         istart = nn_hls + 2                                                        ! halo + land + 1 
    733          iend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhox()             ! halo + land + nbghostcells 
     733         iend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhox()             ! halo + land + nbghostcells 
    734734         DO ji = mi0(istart), mi1(iend) 
    735735            DO jj = 1, jpj 
     
    741741      ! --- East --- ! 
    742742      IF(lk_east) THEN 
    743          istart = jpiglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhox()    ! halo + land + nbghostcells - 1 
     743         istart = jpiglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhox()    ! halo + land + nbghostcells - 1 
    744744         iend   = jpiglo - ( nn_hls + 1 )                                           ! halo + land + 1            - 1 
    745745         DO ji = mi0(istart), mi1(iend) 
     
    753753      IF(lk_south) THEN 
    754754         jstart = nn_hls + 2                                                        ! halo + land + 1 
    755          jend   = nn_hls + 1 + nbghostcells + nn_shift_bar*Agrif_Rhoy()             ! halo + land + nbghostcells 
     755         jend   = nn_hls + nbghostcells + nn_shift_bar*Agrif_Rhoy()             ! halo + land + nbghostcells 
    756756         DO jj = mj0(jstart), mj1(jend) 
    757757            DO ji = 1, jpi 
     
    763763      ! --- North --- ! 
    764764      IF(lk_north) THEN 
    765          jstart = jpjglo - ( nn_hls + nbghostcells ) - nn_shift_bar*Agrif_Rhoy()    ! halo + land + nbghostcells - 1 
     765         jstart = jpjglo - ( nn_hls + nbghostcells -1 ) - nn_shift_bar*Agrif_Rhoy()    ! halo + land + nbghostcells - 1 
    766766         jend   = jpjglo - ( nn_hls + 1 )                                           ! halo + land + 1            - 1 
    767767         DO jj = mj0(jstart), mj1(jend) 
     
    14181418            DO jj=j1,j2 
    14191419               IF (utint_stage(ji,jj)==0) THEN  
    1420                   zx = 2._wp*MOD(ABS(mig0(ji)-nbghostcells-1), INT(Agrif_Rhox()))/zrhox - 1._wp   
     1420                  zx = 2._wp*MOD(ABS(mig0(ji)-nbghostcells), INT(Agrif_Rhox()))/zrhox - 1._wp   
    14211421                  ubdy(ji,jj) = ubdy(ji,jj) + 0.25_wp*(1._wp-zx*zx) * ptab(ji,jj) &  
    14221422                              &         / zrhoy *r1_e2u(ji,jj) * umask(ji,jj,1)  
     
    15221522            DO jj=j1,j2 
    15231523               IF (vtint_stage(ji,jj)==0) THEN  
    1524                   zy = 2._wp*MOD(ABS(mjg0(jj)-nbghostcells-1), INT(Agrif_Rhoy()))/zrhoy - 1._wp   
     1524                  zy = 2._wp*MOD(ABS(mjg0(jj)-nbghostcells), INT(Agrif_Rhoy()))/zrhoy - 1._wp   
    15251525                  vbdy(ji,jj) = vbdy(ji,jj) + 0.25_wp*(1._wp-zy*zy) * ptab(ji,jj) &  
    15261526                              &         / zrhox * r1_e1v(ji,jj) * vmask(ji,jj,1)  
     
    17681768      IF(lk_west) THEN 
    17691769         ispon  = nn_sponge_len * Agrif_irhox() 
    1770          istart = nn_hls + 1                                  ! halo + land + 1 
    1771          iend   = nn_hls + 1 + nbghostcells + ispon           ! halo + land + nbghostcells + sponge 
    1772          jstart = nn_hls + 1  
    1773          jend   = jpjglo - nn_hls  
     1770         istart = nn_hls + 2                                  ! halo + land + 1 
     1771         iend   = nn_hls + nbghostcells + ispon           ! halo + land + nbghostcells + sponge 
     1772         jstart = nn_hls + 2  
     1773         jend   = jpjglo - nn_hls - 1  
    17741774         DO ji = mi0(istart), mi1(iend) 
    17751775            DO jj = mj0(jstart), mj1(jend) 
     
    18051805      IF(lk_east) THEN 
    18061806         ispon  = nn_sponge_len * Agrif_irhox()  
    1807          istart = jpiglo - ( nn_hls + nbghostcells + ispon )  ! halo + land + nbghostcells + sponge - 1 
    1808          iend   = jpiglo - nn_hls                             ! halo + land + 1                     - 1 
    1809          jstart = nn_hls + 1  
    1810          jend   = jpjglo - nn_hls  
     1807         istart = jpiglo - ( nn_hls + nbghostcells + ispon -1 )  ! halo + land + nbghostcells + sponge - 1 
     1808         iend   = jpiglo - nn_hls - 1                            ! halo + land + 1                     - 1 
     1809         jstart = nn_hls + 2  
     1810         jend   = jpjglo - nn_hls - 1 
    18111811         DO ji = mi0(istart), mi1(iend) 
    18121812            DO jj = mj0(jstart), mj1(jend) 
     
    18421842      IF(lk_south) THEN 
    18431843         ispon  = nn_sponge_len * Agrif_irhoy()   
    1844          jstart = nn_hls + 1                                 ! halo + land + 1 
    1845          jend   = nn_hls + 1 + nbghostcells + ispon          ! halo + land + nbghostcells + sponge 
    1846          istart = nn_hls + 1  
    1847          iend   = jpiglo - nn_hls  
     1844         jstart = nn_hls + 2                                 ! halo + land + 1 
     1845         jend   = nn_hls + nbghostcells + ispon          ! halo + land + nbghostcells + sponge 
     1846         istart = nn_hls + 2  
     1847         iend   = jpiglo - nn_hls - 1  
    18481848         DO jj = mj0(jstart), mj1(jend) 
    18491849            DO ji = mi0(istart), mi1(iend) 
     
    18791879      IF(lk_north) THEN 
    18801880         ispon  = nn_sponge_len * Agrif_irhoy()  
    1881          jstart = jpjglo - ( nn_hls + nbghostcells + ispon)  ! halo + land + nbghostcells +sponge - 1 
    1882          jend   = jpjglo - nn_hls                            ! halo + land + 1            - 1 
    1883          istart = nn_hls + 1  
    1884          iend   = jpiglo - nn_hls  
     1881         jstart = jpjglo - ( nn_hls + nbghostcells + ispon - 1)  ! halo + land + nbghostcells +sponge - 1 
     1882         jend   = jpjglo - nn_hls - 1                            ! halo + land + 1            - 1 
     1883         istart = nn_hls + 2  
     1884         iend   = jpiglo - nn_hls - 1  
    18851885         DO jj = mj0(jstart), mj1(jend) 
    18861886            DO ji = mi0(istart), mi1(iend) 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/src/NST/agrif_oce_sponge.F90

    r14433 r14688  
    150150      ztabramp(:,:) = 0._wp 
    151151 
    152       IF( lk_west ) THEN                             ! --- West --- ! 
    153          ind1 = nn_hls + 1 + nbghostcells               ! halo + land + nbghostcells 
    154          ind2 = nn_hls + 1 + nbghostcells + ispongearea  
     152      IF( lk_west ) THEN                            ! --- West --- ! 
     153         ind1 = nn_hls + nbghostcells               ! halo + nbghostcells 
     154         ind2 = nn_hls + nbghostcells + ispongearea  
    155155         DO ji = mi0(ind1), mi1(ind2)    
    156156            DO jj = 1, jpj                
     
    160160         ! ghost cells: 
    161161         ind1 = 1 
    162          ind2 = nn_hls + 1 + nbghostcells               ! halo + land + nbghostcells 
     162         ind2 = nn_hls +  nbghostcells              ! halo + nbghostcells 
    163163         DO ji = mi0(ind1), mi1(ind2)    
    164164            DO jj = 1, jpj                
     
    168168      ENDIF 
    169169      IF( lk_east ) THEN                             ! --- East --- ! 
    170          ind1 = jpiglo - ( nn_hls + nbghostcells ) - ispongearea - 1 
    171          ind2 = jpiglo - ( nn_hls + nbghostcells ) - 1    ! halo + land + nbghostcells - 1 
     170         ind1 = jpiglo - ( nn_hls + nbghostcells -1 ) - ispongearea - 1 
     171         ind2 = jpiglo - ( nn_hls + nbghostcells -1 ) - 1    ! halo + land + nbghostcells - 1 
    172172         DO ji = mi0(ind1), mi1(ind2) 
    173173            DO jj = 1, jpj 
     
    176176         END DO 
    177177         ! ghost cells: 
    178          ind1 = jpiglo - ( nn_hls + nbghostcells ) - 1    ! halo + land + nbghostcells - 1 
     178         ind1 = jpiglo - ( nn_hls + nbghostcells -1 ) - 1    ! halo + land + nbghostcells - 1 
    179179         ind2 = jpiglo - 1 
    180180         DO ji = mi0(ind1), mi1(ind2) 
     
    185185      ENDIF       
    186186      IF( lk_south ) THEN                            ! --- South --- ! 
    187          ind1 = nn_hls + 1 + nbghostcells                 ! halo + land + nbghostcells 
    188          ind2 = nn_hls + 1 + nbghostcells + jspongearea  
     187         ind1 = nn_hls + nbghostcells - 1            ! halo + nbghostcells 
     188         ind2 = nn_hls + nbghostcells - 1 + jspongearea  
    189189         DO jj = mj0(ind1), mj1(ind2)  
    190190            DO ji = 1, jpi 
     
    194194         ! ghost cells: 
    195195         ind1 = 1 
    196          ind2 = nn_hls + 1 + nbghostcells                 ! halo + land + nbghostcells 
     196         ind2 = nn_hls + nbghostcells                ! halo + nbghostcells 
    197197         DO jj = mj0(ind1), mj1(ind2)  
    198198            DO ji = 1, jpi 
     
    202202      ENDIF 
    203203      IF( lk_north ) THEN                            ! --- North --- ! 
    204          ind1 = jpjglo - ( nn_hls + nbghostcells ) - jspongearea - 1 
    205          ind2 = jpjglo - ( nn_hls + nbghostcells ) - 1    ! halo + land + nbghostcells - 1 
     204         ind1 = jpjglo - ( nn_hls + nbghostcells -1 ) - jspongearea - 1 
     205         ind2 = jpjglo - ( nn_hls + nbghostcells -1 ) - 1    ! halo + nbghostcells - 1 
    206206         DO jj = mj0(ind1), mj1(ind2) 
    207207            DO ji = 1, jpi 
     
    210210         END DO 
    211211         ! ghost cells: 
    212          ind1 = jpjglo - ( nn_hls + nbghostcells )      ! halo + land + nbghostcells - 1 
     212         ind1 = jpjglo - ( nn_hls + nbghostcells -1 )      ! halo + land + nbghostcells - 1 
    213213         ind2 = jpjglo 
    214214         DO jj = mj0(ind1), mj1(ind2) 
     
    284284 
    285285      IF( lk_west ) THEN                             ! --- West --- ! 
    286          ind1 = nn_hls + 1 + nbghostcells + ishift 
    287          ind2 = nn_hls + 1 + nbghostcells + ishift + ispongearea  
     286         ind1 = nn_hls + nbghostcells + ishift 
     287         ind2 = nn_hls + nbghostcells + ishift + ispongearea  
    288288         DO ji = mi0(ind1), mi1(ind2)    
    289289            DO jj = 1, jpj                
     
    293293         ! ghost cells: 
    294294         ind1 = 1 
    295          ind2 = nn_hls + 1 + nbghostcells + ishift               ! halo + land + nbghostcells 
     295         ind2 = nn_hls + nbghostcells + ishift               ! halo + nbghostcells 
    296296         DO ji = mi0(ind1), mi1(ind2)    
    297297            DO jj = 1, jpj                
     
    301301      ENDIF 
    302302      IF( lk_east ) THEN                             ! --- East --- ! 
    303          ind1 = jpiglo - ( nn_hls + nbghostcells + ishift) - ispongearea - 1 
    304          ind2 = jpiglo - ( nn_hls + nbghostcells + ishift) - 1    ! halo + land + nbghostcells - 1 
     303         ind1 = jpiglo - ( nn_hls + nbghostcells -1  + ishift) - ispongearea - 1 
     304         ind2 = jpiglo - ( nn_hls + nbghostcells -1  + ishift) - 1    ! halo + nbghostcells - 1 
    305305         DO ji = mi0(ind1), mi1(ind2) 
    306306            DO jj = 1, jpj 
     
    309309         END DO 
    310310         ! ghost cells: 
    311          ind1 = jpiglo - ( nn_hls + nbghostcells + ishift) - 1    ! halo + land + nbghostcells - 1 
     311         ind1 = jpiglo - ( nn_hls + nbghostcells -1 + ishift) - 1    ! halo + nbghostcells - 1 
    312312         ind2 = jpiglo - 1 
    313313         DO ji = mi0(ind1), mi1(ind2) 
     
    318318      ENDIF       
    319319      IF( lk_south ) THEN                            ! --- South --- ! 
    320          ind1 = nn_hls + 1 + nbghostcells + jshift                ! halo + land + nbghostcells 
    321          ind2 = nn_hls + 1 + nbghostcells + jshift + jspongearea  
     320         ind1 = nn_hls + nbghostcells + jshift                ! halo + nbghostcells 
     321         ind2 = nn_hls + nbghostcells + jshift + jspongearea  
    322322         DO jj = mj0(ind1), mj1(ind2)  
    323323            DO ji = 1, jpi 
     
    327327         ! ghost cells: 
    328328         ind1 = 1 
    329          ind2 = nn_hls + 1 + nbghostcells + jshift                ! halo + land + nbghostcells 
     329         ind2 = nn_hls + nbghostcells + jshift                ! halo + land + nbghostcells 
    330330         DO jj = mj0(ind1), mj1(ind2)  
    331331            DO ji = 1, jpi 
     
    335335      ENDIF 
    336336      IF( lk_north ) THEN                            ! --- North --- ! 
    337          ind1 = jpjglo - ( nn_hls + nbghostcells + jshift) - jspongearea - 1 
    338          ind2 = jpjglo - ( nn_hls + nbghostcells + jshift) - 1    ! halo + land + nbghostcells - 1 
     337         ind1 = jpjglo - ( nn_hls + nbghostcells -1 + jshift) - jspongearea - 1 
     338         ind2 = jpjglo - ( nn_hls + nbghostcells -1 + jshift) - 1    ! halo + land + nbghostcells - 1 
    339339         DO jj = mj0(ind1), mj1(ind2) 
    340340            DO ji = 1, jpi 
     
    343343         END DO 
    344344         ! ghost cells: 
    345          ind1 = jpjglo - ( nn_hls + nbghostcells + jshift)      ! halo + land + nbghostcells - 1 
     345         ind1 = jpjglo - ( nn_hls + nbghostcells -1 + jshift)      ! halo + land + nbghostcells - 1 
    346346         ind2 = jpjglo 
    347347         DO jj = mj0(ind1), mj1(ind2) 
     
    741741 
    742742         jmax = j2-1 
    743          ind1 = jpjglo - ( nn_hls + nbghostcells + 2 )   ! North 
     743         ind1 = jpjglo - ( nn_hls + nbghostcells + 1 )   ! North 
    744744         DO jj = mj0(ind1), mj1(ind1)                  
    745745            jmax = MIN(jmax,jj) 
     
    905905 
    906906         imax = i2 - 1 
    907          ind1 = jpiglo - ( nn_hls + nbghostcells + 2 )   ! East 
     907         ind1 = jpiglo - ( nn_hls + nbghostcells + 1 )   ! East 
    908908         DO ji = mi0(ind1), mi1(ind1)                 
    909909            imax = MIN(imax,ji) 
     
    10051005 
    10061006         jmax = j2-1 
    1007          ind1 = jpjglo - ( nn_hls + nbghostcells + 2 )   ! North 
     1007         ind1 = jpjglo - ( nn_hls + nbghostcells + 1 )   ! North 
    10081008         DO jj = mj0(ind1), mj1(ind1)                  
    10091009            jmax = MIN(jmax,jj) 
     
    10721072 
    10731073         imax = i2 - 1 
    1074          ind1 = jpiglo - ( nn_hls + nbghostcells + 2 )   ! East 
     1074         ind1 = jpiglo - ( nn_hls + nbghostcells + 1 )   ! East 
    10751075         DO ji = mi0(ind1), mi1(ind1)                 
    10761076            imax = MIN(imax,ji) 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/src/OCE/par_oce.F90

    r14433 r14688  
    4747   ! global domain size for AGRIF     !!! * total AGRIF computational domain * 
    4848   INTEGER, PUBLIC            ::   nbug_in_agrif_conv_do_not_remove_or_modify = 1 - 1 
    49    INTEGER, PUBLIC, PARAMETER ::   nbghostcells = 3   !: number of ghost cells: default value 
     49   INTEGER, PUBLIC, PARAMETER ::   nbghostcells = 4   !: number of ghost cells: default value 
    5050   INTEGER, PUBLIC            ::   nbghostcells_x     !: number of ghost cells in i-direction 
    5151   INTEGER, PUBLIC            ::   nbghostcells_y_s   !: number of ghost cells in j-direction at south 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/DOME/EXPREF/AGRIF_FixedGrids.in

    r14216 r14688  
    111 
    2 278 358 88 162 2 2 2    
     2282 362 92 170 2 2 2    
    330 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/DOME/MY_SRC/usrdef_hgr.F90

    r14254 r14688  
    2323   IMPLICIT NONE 
    2424   PRIVATE 
     25 
     26   REAL(wp) :: roffsetx, roffsety ! Offset in km to first f-point 
    2527 
    2628   PUBLIC   usr_def_hgr   ! called by domhgr.F90 
     
    6466      ! 
    6567      INTEGER  ::   ji, jj     ! dummy loop indices 
    66       REAL(wp) ::   zphi0, zlam0  
    6768      REAL(wp) ::   zti, ztj   ! local scalars 
    6869      !!------------------------------------------------------------------------------- 
     
    7778      ! Position coordinates (in kilometers) 
    7879      !                          ========== 
    79       zlam0 = -REAL( 0.5 + 1700._wp * 1.e3 / rn_dx) 
    80       zphi0 = -REAL( 0.5 +  800._wp * 1.e3 / rn_dy) 
     80      ! Offsets in km of the first south west f-point:  
     81      roffsetx = -1700._wp 
     82      roffsety =  -800._wp  
    8183#if defined key_agrif 
    82       IF( .NOT.Agrif_Root() ) THEN  
    83          zlam0 = - REAL( 0.5 + 1700._wp * 1.e3 / rn_dx + nbghostcells) & 
    84                & + REAL((nbghostcells + Agrif_Ix() - 1)*Agrif_irhox())   
    85          zphi0 = - REAL( 0.5 +  800._wp * 1.e3 / rn_dy + nbghostcells) & 
    86                & + REAL((nbghostcells + Agrif_Iy() - 1)*Agrif_irhoy())   
    87       ENDIF  
     84      IF( .NOT.Agrif_Root() ) THEN 
     85         ! deduce offset from parent: 
     86         roffsetx = Agrif_Parent(roffsetx) & 
     87              & + (-(nbghostcells_x   - 1) + (Agrif_Parent(nbghostcells_x  ) & 
     88              & + Agrif_Ix()-2)*Agrif_Rhox()) * 1.e-3 * rn_dx 
     89         roffsety = Agrif_Parent(roffsety) & 
     90              & + (-(nbghostcells_y_s - 1) + (Agrif_Parent(nbghostcells_y_s) & 
     91              & + Agrif_Iy()-2)*Agrif_Rhoy()) * 1.e-3 * rn_dy 
     92      ENDIF 
    8893#endif 
    8994          
    90       DO_2D( 1, 1, 1, 1 ) 
    91          zti = REAL( mig0_oldcmp(ji) - 1, wp )   ! start at i=0 in the global grid without halos 
    92          ztj = REAL( mjg0_oldcmp(jj) - 1, wp )   ! start at j=0 in the global grid without halos 
     95      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     96         zti = REAL( mig0(ji) - 1, wp )   ! start at i=0 in the global grid without halos 
     97         ztj = REAL( mjg0(jj) - 1, wp )   ! start at j=0 in the global grid without halos 
    9398          
    94          plamt(ji,jj) = rn_dx * 1.e-3 * ( zlam0 + zti ) 
    95          plamu(ji,jj) = rn_dx * 1.e-3 * ( zlam0 + zti + 0.5_wp ) 
     99         plamt(ji,jj) = roffsetx + rn_dx * 1.e-3 * ( zti - 0.5_wp ) 
     100         plamu(ji,jj) = roffsetx + rn_dx * 1.e-3 *   zti  
    96101         plamv(ji,jj) = plamt(ji,jj)  
    97102         plamf(ji,jj) = plamu(ji,jj)  
    98103          
    99          pphit(ji,jj) = rn_dy * 1.e-3 * ( zphi0 + ztj ) 
    100          pphiv(ji,jj) = rn_dy * 1.e-3 * ( zphi0 + ztj + 0.5_wp ) 
     104         pphit(ji,jj) = roffsety + rn_dy * 1.e-3 * ( ztj - 0.5_wp ) 
     105         pphiv(ji,jj) = roffsety + rn_dy * 1.e-3 *   ztj 
    101106         pphiu(ji,jj) = pphit(ji,jj)  
    102107         pphif(ji,jj) = pphiv(ji,jj)  
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/DOME/MY_SRC/usrdef_nam.F90

    r14433 r14688  
    6060      ! 
    6161      INTEGER ::   ios          ! Local integer 
     62      INTEGER ::   ighost_w, ighost_e, ighost_s, ighost_n 
    6263      REAL(wp)::   zlx, zly, zh ! Local scalars 
    6364      !! 
     
    7475         rn_dx = Agrif_Parent(rn_dx)/Agrif_Rhox() 
    7576         rn_dy = Agrif_Parent(rn_dy)/Agrif_Rhoy() 
    76          rn_dz = Agrif_Parent(rn_dz) 
    7777         rn_f0 = Agrif_Parent(rn_f0) 
    7878      ENDIF 
     
    8484      kk_cfg = nINT( rn_dx ) 
    8585      ! 
     86#if defined key_agrif  
    8687      IF( Agrif_Root() ) THEN       ! Global Domain size:  DOME  global domain is  2000 km x 850 Km x 3600 m 
     88#endif 
    8789         kpi = NINT( 2000.e3  / rn_dx ) + 2   
    8890         kpj = NINT(  850.e3  / rn_dy ) + 2 + 1  
     91#if defined key_agrif  
    8992      ELSE                          ! Global Domain size: add nbghostcells + 1 "land" point on each side 
    90          kpi  = nbcellsx + 2 * ( nbghostcells + 1 ) 
    91          kpj  = nbcellsy + 2 * ( nbghostcells + 1 ) 
    92 !!$         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2 
    93 !!$         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n + 2 
     93         ! At this stage, child ghosts have not been set 
     94         ighost_w = nbghostcells 
     95         ighost_e = nbghostcells 
     96         ighost_s = nbghostcells 
     97         ighost_n = nbghostcells 
     98 
     99         IF  ( Agrif_Ix() == 1 ) ighost_w = 0 
     100         IF  ( Agrif_Ix() + nbcellsx/AGRIF_Irhox() == Agrif_Parent(Ni0glo)+1 ) ighost_e = 0 
     101         IF  ( Agrif_Iy() == 1 ) ighost_s = 0 
     102         IF  ( Agrif_Iy() + nbcellsy/AGRIF_Irhoy() == Agrif_Parent(Nj0glo)+1 ) ighost_n = 0 
     103         kpi  = nbcellsx + ighost_w + ighost_e 
     104         kpj  = nbcellsy + ighost_s + ighost_n 
     105!! JC: number of ghosts are unknown at this stage ! 
     106!!$         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x    
     107!!$         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n  
    94108      ENDIF 
     109#endif 
    95110      kpk = NINT( 3600._wp / rn_dz ) + 1 
    96111      ! 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/DOME/MY_SRC/usrdef_zgr.F90

    r14433 r14688  
    193193            pe3w (ji,jj,ik  ) = pdept(ji,jj,ik  ) - pdept(ji,jj,ik-1)            ! st caution ik > 1 
    194194         END_2D          
    195          !                                   ! bottom scale factors and depth at  U-, V-, UW and VW-points 
    196          !                                   ! usually Computed as the minimum of neighbooring scale factors 
    197          pe3u (:,:,:) = pe3t(:,:,:)          ! HERE DOME configuration :  
    198          pe3v (:,:,:) = pe3t(:,:,:)          !    e3 increases with i-index and identical with j-index 
    199          pe3f (:,:,:) = pe3t(:,:,:)          !    so e3 minimum of (i,i+1) points is (i) point 
    200          pe3uw(:,:,:) = pe3w(:,:,:)          !    in j-direction e3v=e3t and e3f=e3v 
    201          pe3vw(:,:,:) = pe3w(:,:,:)          !    ==>>  no need of lbc_lnk calls 
     195         ! 
     196         DO_3D( 0, 0, 0, 0, 1, jpk )  
     197               pe3u (ji,jj,jk) = MIN( pe3t(ji,jj,jk), pe3t(ji+1,jj,jk) ) 
     198               pe3v (ji,jj,jk) = MIN( pe3t(ji,jj,jk), pe3t(ji,jj+1,jk) ) 
     199               pe3uw(ji,jj,jk) = MIN( pe3w(ji,jj,jk), pe3w(ji+1,jj,jk) ) 
     200               pe3vw(ji,jj,jk) = MIN( pe3w(ji,jj,jk), pe3w(ji,jj+1,jk) ) 
     201         END_3D  
     202         ! 
     203         CALL lbc_lnk('usrdef_zgr', pe3u , 'U', 1._wp, pe3uw, 'U', 1._wp )    
     204         CALL lbc_lnk('usrdef_zgr', pe3v , 'V', 1._wp, pe3vw, 'V', 1._wp )  
     205         ! 
     206         DO jk = 1, jpk                  
     207            WHERE( pe3u (:,:,jk) == 0._wp )   pe3u (:,:,jk) = pe3t_1d(jk) 
     208            WHERE( pe3v (:,:,jk) == 0._wp )   pe3v (:,:,jk) = pe3t_1d(jk) 
     209            WHERE( pe3uw(:,:,jk) == 0._wp )   pe3uw(:,:,jk) = pe3w_1d(jk) 
     210            WHERE( pe3vw(:,:,jk) == 0._wp )   pe3vw(:,:,jk) = pe3w_1d(jk) 
     211         END DO 
     212 
     213         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     214               pe3f(ji,jj,jk) = MIN( pe3v(ji,jj,jk), pe3v(ji+1,jj,jk) ) 
     215         END_3D 
     216         CALL lbc_lnk('usrdef_zgr', pe3f, 'F', 1._wp )       
    202217         !       
    203218      ENDIF 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/ICE_AGRIF/EXPREF/AGRIF_FixedGrids.in

    r14673 r14688  
    111 
    2 34 63 34 63 3 3 3 
     235 64 35 64 3 3 3 
    330 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/ICE_AGRIF/MY_SRC/usrdef_hgr.F90

    r14673 r14688  
    2323   IMPLICIT NONE 
    2424   PRIVATE 
     25 
     26   REAL(wp) :: roffsetx, roffsety ! Offset in km to first f-point 
    2527 
    2628   PUBLIC   usr_def_hgr   ! called by domhgr.F90 
     
    5052      !!                without Coriolis force (f=0) 
    5153      !! 
    52       !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)  
     54      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in kms)  
    5355      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane) 
    5456      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters) 
     
    6567      ! 
    6668      INTEGER  ::   ji, jj     ! dummy loop indices 
    67       REAL(wp) ::   zphi0, zlam0, zbeta, zf0 
     69      REAL(wp) ::   zbeta, zf0 
    6870      REAL(wp) ::   zti, ztj   ! local scalars 
    6971      !!------------------------------------------------------------------------------- 
     
    7476      IF(lwp) WRITE(numout,*) '          f-plane with irregular grid-spacing (+- 10%)' 
    7577      IF(lwp) WRITE(numout,*) '          the max is given by rn_dx and rn_dy'  
     78      ! 
     79      ! 
     80      ! Position coordinates (in kilometers) 
     81      !                          ========== 
     82      ! Offset is given at first f-point, i.e. at (i,j) = (nn_hls+1, nn_hls+1) 
     83      ! Here we assume the grid is centred around a T-point at the middle of 
     84      ! of the domain (hence domain size is odd) 
     85      roffsetx = (-REAL(Ni0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dx 
     86      roffsety = (-REAL(Nj0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dy 
     87#if defined key_agrif 
     88      IF( .NOT.Agrif_Root() ) THEN 
     89         ! deduce offset from parent: 
     90         roffsetx = Agrif_Parent(roffsetx) & 
     91            & + (-(nbghostcells_x   - 1) + (Agrif_Parent(nbghostcells_x  ) & 
     92            & + Agrif_Ix()-2)*Agrif_Rhox()) * 1.e-3 * rn_dx 
     93         roffsety = Agrif_Parent(roffsety) & 
     94            & + (-(nbghostcells_y_s - 1) + (Agrif_Parent(nbghostcells_y_s) & 
     95            & + Agrif_Iy()-2)*Agrif_Rhoy()) * 1.e-3 * rn_dy 
     96      ENDIF 
     97#endif 
     98      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     99         zti = REAL( mig0(ji)-1, wp )  ! start at i=0 in the global grid without halos 
     100         ztj = REAL( mjg0(jj)-1, wp )  ! start at j=0 in the global grid without halos 
    76101 
    77       !                          ========== 
    78 #if defined key_agrif  
    79       IF( Agrif_Root() ) THEN 
    80 #endif 
    81          zlam0 = -REAL(Ni0glo-1, wp) * 0.5 * 1.e-3 * rn_dx 
    82          zphi0 = -REAL(Nj0glo-1, wp) * 0.5 * 1.e-3 * rn_dy 
    83 #if defined key_agrif  
    84       ELSE 
    85          ! ! let lower left longitude and latitude from parent 
    86 !clem         zlam0  = Agrif_Parent(zlam0) + (Agrif_ix())*Agrif_Parent(rn_dx) * 1.e-5 
    87 !clem         zphi0  = Agrif_Parent(zphi0) + (Agrif_iy())*Agrif_Parent(rn_dy) * 1.e-5 
    88          zlam0 = ( 0.5_wp - REAL(Agrif_Parent(Ni0glo)-1, wp) * 0.5 ) * 1.e-3 * Agrif_irhox() * rn_dx  & 
    89             &  + ( Agrif_Ix() + Agrif_Parent(nbghostcells_x  ) - 1 ) * Agrif_irhox() * rn_dx * 1.e-3 - ( 0.5_wp + nbghostcells_x   ) * rn_dx * 1.e-3 
    90          zphi0 = ( 0.5_wp - REAL(Agrif_Parent(Nj0glo)-1, wp) * 0.5 ) * 1.e-3 * Agrif_irhoy() * rn_dy  & 
    91             &  + ( Agrif_Iy() + Agrif_Parent(nbghostcells_y_s) - 1 ) * Agrif_irhoy() * rn_dy * 1.e-3 - ( 0.5_wp + nbghostcells_y_s ) * rn_dy * 1.e-3 
    92       ENDIF 
    93 #endif          
     102         plamt(ji,jj) = roffsetx + rn_dx * 1.e-3 * ( zti - 0.5_wp ) 
     103         plamu(ji,jj) = roffsetx + rn_dx * 1.e-3 *   zti 
     104         plamv(ji,jj) = plamt(ji,jj) 
     105         plamf(ji,jj) = plamu(ji,jj) 
    94106 
    95       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    96          zti = REAL( mig0(ji)-1, wp ) ! start at i=0. in the global grid without halos 
    97          ztj = REAL( mjg0(jj)-1, wp ) ! start at j=0. in the global grid without halos 
    98            
    99          plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 *   zti 
    100          plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * ( zti + 0.5_wp ) 
    101          plamv(ji,jj) = plamt(ji,jj)  
    102          plamf(ji,jj) = plamu(ji,jj)  
    103           
    104          pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 *   ztj 
    105          pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * ( ztj + 0.5_wp ) 
    106          pphiu(ji,jj) = pphit(ji,jj)  
    107          pphif(ji,jj) = pphiv(ji,jj)  
     107         pphit(ji,jj) = roffsety + rn_dy * 1.e-3 * ( ztj - 0.5_wp ) 
     108         pphiv(ji,jj) = roffsety + rn_dy * 1.e-3 *   ztj 
     109         pphiu(ji,jj) = pphit(ji,jj) 
     110         pphif(ji,jj) = pphiv(ji,jj) 
    108111      END_2D 
    109           
    110          ! Horizontal scale factors (in meters) 
    111          !                              ====== 
     112      ! 
     113      ! Horizontal scale factors (in meters) 
     114      !                              ====== 
    112115!! ==> EITHER 1) variable scale factors 
    113116!! clem: This can be used with a 1proc simulation but I think it breaks repro when >1procs are used       
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90

    r14433 r14688  
    8888         kpj = NINT( 300.e3 / rn_dy ) - 3 
    8989      ELSE                           ! Global Domain size: add nbghostcells + 1 "land" point on each side 
    90          kpi  = nbcellsx + 2 * ( nbghostcells + 1 ) 
    91          kpj  = nbcellsy + 2 * ( nbghostcells + 1 ) 
     90         kpi  = nbcellsx + 2 * nbghostcells 
     91         kpj  = nbcellsy + 2 * nbghostcells 
     92!! JC: number of ghosts unknown at this tage 
    9293!!$         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2 
    9394!!$         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n + 2 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/OVERFLOW/EXPREF/AGRIF/AGRIF_FixedGrids.in

    r14568 r14688  
    111 
    2 10 41 1 4 1 1 1  
     211 42 1 6 1 1 1  
    330 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/VORTEX/EXPREF/AGRIF_FixedGrids.in

    r14656 r14688  
    111 
    2 22 41 22 41 3 3 3  
     223 42 23 42 3 3 3  
    330 
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/VORTEX/MY_SRC/usrdef_hgr.F90

    r14656 r14688  
    2323   IMPLICIT NONE 
    2424   PRIVATE 
     25 
     26   REAL(wp) :: roffsetx, roffsety ! Offset in km to first f-point 
    2527 
    2628   PUBLIC   usr_def_hgr   ! called by domhgr.F90 
     
    6466      ! 
    6567      INTEGER  ::   ji, jj     ! dummy loop indices 
    66       REAL(wp) ::   zphi0, zlam0, zbeta, zf0 
     68      REAL(wp) ::   zbeta, zf0 
    6769      REAL(wp) ::   zti, ztj   ! local scalars 
    6870      !!------------------------------------------------------------------------------- 
     
    7779      ! Position coordinates (in kilometers) 
    7880      !                          ========== 
    79 #if defined key_agrif  
    80       IF( Agrif_Root() ) THEN 
    81 #endif 
    82          zlam0 = -REAL(Ni0glo-1, wp) * 0.5 * 1.e-3 * rn_dx 
    83          zphi0 = -REAL(Nj0glo-1, wp) * 0.5 * 1.e-3 * rn_dy 
     81      ! offset is given at first f-point, i.e. at (i,j) = (nn_hls+1, nn_hls+1) 
     82      ! Here we assume the grid is centred around a T-point at the middle of 
     83      ! of the domain (hence domain size is odd)  
     84      roffsetx = (-REAL(Ni0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dx 
     85      roffsety = (-REAL(Nj0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dy 
    8486#if defined key_agrif 
    85       ELSE 
    86          ! ! let lower left longitude and latitude from parent 
    87          zlam0 = (  0.5_wp - REAL(Agrif_Parent(Ni0glo)-1, wp) * 0.5 ) * 1.e-3 * Agrif_irhox() * rn_dx  & 
    88             &  + ( Agrif_Ix() + Agrif_Parent(nbghostcells_x  ) - 1 ) * Agrif_irhox() * rn_dx * 1.e-3 - ( 0.5_wp + nbghostcells_x   ) * rn_dx * 1.e-3 
    89          zphi0 = (  0.5_wp - REAL(Agrif_Parent(Nj0glo)-1, wp) * 0.5 ) * 1.e-3 * Agrif_irhoy() * rn_dy  & 
    90             &  + ( Agrif_Iy() + Agrif_Parent(nbghostcells_y_s) - 1 ) * Agrif_irhoy() * rn_dy * 1.e-3 - ( 0.5_wp + nbghostcells_y_s ) * rn_dy * 1.e-3 
    91       ENDIF  
    92 #endif 
    93           
     87      IF( .NOT.Agrif_Root() ) THEN 
     88         ! deduce offset from parent: 
     89         roffsetx = Agrif_Parent(roffsetx) & 
     90                  & + (-(nbghostcells_x   - 1) + (Agrif_Parent(nbghostcells_x  ) + Agrif_Ix()-2)*Agrif_Rhox()) * 1.e-3 * rn_dx 
     91         roffsety = Agrif_Parent(roffsety) & 
     92                  & + (-(nbghostcells_y_s - 1) + (Agrif_Parent(nbghostcells_y_s) + Agrif_Iy()-2)*Agrif_Rhoy()) * 1.e-3 * rn_dy 
     93      ENDIF 
     94#endif          
    9495      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    9596         zti = REAL( mig0(ji)-1, wp )  ! start at i=0 in the global grid without halos 
    9697         ztj = REAL( mjg0(jj)-1, wp )  ! start at j=0 in the global grid without halos 
    9798          
    98          plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 *   zti 
    99          plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * ( zti + 0.5_wp ) 
     99         plamt(ji,jj) = roffsetx + rn_dx * 1.e-3 * ( zti - 0.5_wp ) 
     100         plamu(ji,jj) = roffsetx + rn_dx * 1.e-3 *   zti  
    100101         plamv(ji,jj) = plamt(ji,jj)  
    101102         plamf(ji,jj) = plamu(ji,jj)  
    102103          
    103          pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 *   ztj 
    104          pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * ( ztj + 0.5_wp ) 
     104         pphit(ji,jj) = roffsety + rn_dy * 1.e-3 * ( ztj - 0.5_wp ) 
     105         pphiv(ji,jj) = roffsety + rn_dy * 1.e-3 *   ztj  
    105106         pphiu(ji,jj) = pphit(ji,jj)  
    106107         pphif(ji,jj) = pphiv(ji,jj)  
  • NEMO/branches/2021/dev_r14608_AGRIF_domcfg/tests/VORTEX/MY_SRC/usrdef_nam.F90

    r14433 r14688  
    6060      ! 
    6161      INTEGER ::   ios          ! Local integer 
     62      INTEGER :: ighost_n, ighost_s, ighost_w, ighost_e 
    6263      REAL(wp)::   zlx, zly, zh ! Local scalars 
    6364      !! 
     
    8384      kk_cfg = nINT( rn_dx ) 
    8485      ! 
     86#if defined key_agrif  
    8587      IF( Agrif_Root() ) THEN       ! Global Domain size:  VORTEX global domain is  1800 km x 1800 Km x 5000 m 
     88#endif 
    8689         kpi = NINT( 1800.e3  / rn_dx ) + 3   
    8790         kpj = NINT( 1800.e3  / rn_dy ) + 3  
     91#if defined key_agrif  
    8892      ELSE                          ! Global Domain size: add nbghostcells + 1 "land" point on each side 
    89          kpi  = nbcellsx + 2 * ( nbghostcells + 1 ) 
    90          kpj  = nbcellsy + 2 * ( nbghostcells + 1 ) 
    91 !!$         kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2 
    92 !!$         kpj  = nbcellsy + nbghostcells_y_s + nbghostcells_y_n + 2 
     93         ! At this stage, child ghosts have not been set 
     94         ighost_w = nbghostcells 
     95         ighost_e = nbghostcells 
     96         ighost_s = nbghostcells 
     97         ighost_n = nbghostcells 
     98 
     99         IF  ( Agrif_Ix() == 1 ) ighost_w = 0  
     100         IF  ( Agrif_Ix() + nbcellsx/AGRIF_Irhox() == Agrif_Parent(Ni0glo)+1 ) ighost_e = 0  
     101         IF  ( Agrif_Iy() == 1 ) ighost_s = 0  
     102         IF  ( Agrif_Iy() + nbcellsy/AGRIF_Irhoy() == Agrif_Parent(Nj0glo)+1 ) ighost_n = 0  
     103!         kpi  = nbcellsx + 2 * ( nbghostcells + 1 ) 
     104!         kpj  = nbcellsy + 2 * ( nbghostcells + 1 ) 
     105         kpi  = nbcellsx + ighost_w + ighost_e  
     106         kpj  = nbcellsy + ighost_s + ighost_n 
    93107      ENDIF 
     108#endif 
    94109      kpk = NINT( 5000._wp / rn_dz ) + 1 
    95110      ! 
Note: See TracChangeset for help on using the changeset viewer.