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

Changeset 9166


Ignore:
Timestamp:
2017-12-22T16:45:51+01:00 (7 years ago)
Author:
jchanut
Message:

NESTING TOOLS:
Fixes to account for user defined number of ghostcells - still set to 1 to be consistent with NEMO
Set child grid bathymetry near boundaries to nearest neighbor interpolation from parent
Update Coarse grid bathymetry so that each cell volume matches child grid average

Location:
branches/2017/dev_merge_2017/NEMOGCM/TOOLS/NESTING/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_merge_2017/NEMOGCM/TOOLS/NESTING/src/agrif_connect_topo.f90

    r9149 r9166  
    5757    indx = 2 + CEILING(irafx/2.0) + diff       
    5858    indy = 2 + CEILING(irafy/2.0) + diff 
    59     bornex = nbghostcellsfine + CEILING(irafx/2.0) + diff - irafx 
    60     borney = nbghostcellsfine + CEILING(irafy/2.0) + diff - irafy 
    61     bornex2 = nxfin - (nbghostcellsfine-1) + irafx - CEILING(irafx/2.0)  
    62     borney2 = nyfin - (nbghostcellsfine-1) + irafy - CEILING(irafy/2.0)  
     59    bornex = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff - irafx 
     60    borney = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff - irafy 
     61    bornex2 = nxfin - (nbghostcellsfine) + irafx - CEILING(irafx/2.0)  
     62    borney2 = nyfin - (nbghostcellsfine) + irafy - CEILING(irafy/2.0)  
    6363    !     
    6464    ALLOCATE(bathy_fin_constant(bornex-FLOOR(irafx/2.0):bornex2+FLOOR(irafx/2.0), & 
     
    902902          ipt = imin + 3 - 1 + (ji - ideb) / irafx 
    903903          ! 
    904           IF( G0%Bathy_meter(ipt,jpt) .LE. 0. .AND.                      & 
    905                MAXVAL(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2, & 
    906                jj-irafy/2+diff:jj+irafy/2)).GT. 0.  ) THEN 
    907              G0%Bathy_meter(ipt,jpt) = zmin 
     904!          IF( G0%Bathy_meter(ipt,jpt) .LE. 0. .AND.                      & 
     905!               MAXVAL(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2, & 
     906!               jj-irafy/2+diff:jj+irafy/2)).GT. 0.  ) THEN 
     907!             G0%Bathy_meter(ipt,jpt) = zmin 
     908             G0%Bathy_meter(ipt,jpt) =&  
     909             SUM(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2, & 
     910                                 jj-irafy/2+diff:jj+irafy/2))& 
     911                /irafx/irafy             
     912             IF(G0%Bathy_meter(ipt,jpt).GT.0.) THEN 
     913                 G0%Bathy_meter(ipt,jpt) = MAX( G0%Bathy_meter(ipt,jpt),zmin)    
     914             ENDIF 
    908915             ! 
    909916             compt = compt + 1 
    910917             ! 
    911           ENDIF 
     918!          ENDIF 
    912919          ! 
    913920       ENDDO 
  • branches/2017/dev_merge_2017/NEMOGCM/TOOLS/NESTING/src/agrif_create_bathy.f90

    r9149 r9166  
    173173     CALL init_constant_bathy(G0%bathy_meter,bathy_fin_constant) 
    174174     ! 
    175      boundary = connectionsize*irafx + nbghostcellsfine  
     175     boundary = connectionsize*irafx + nbghostcellsfine + 1  
    176176     ! 
    177177     ! connection carried out by copying parent grid values for the fine points 
     
    459459        CALL Check_interp(G0,gdepw_ps_interp)      ! interpolation in connection zone (3 coarse grid cells) 
    460460        ! 
    461         boundary = connectionsize*irafx + nbghostcellsfine                      
     461        boundary = connectionsize*irafx + nbghostcellsfine + 1                      
    462462        G1%gdepw_ps(1:boundary,:) = gdepw_ps_interp(1:boundary,:) 
    463463        G1%gdepw_ps(:,1:boundary) = gdepw_ps_interp(:,1:boundary) 
     
    531531           ! Smoothing to connect the connection zone (3 + nb_connection_pts coarse grid cells) and the interior domain 
    532532           ! 
    533            boundary = (connectionsize+nb_connection_pts)*irafx + nbghostcellsfine  
     533           boundary = (connectionsize+nb_connection_pts)*irafx + nbghostcellsfine + 1  
    534534           CALL smooth_topo(G1%gdepw_ps(boundary:nxfin-boundary+1,boundary:nyfin-boundary+1),nbiter) 
    535535           G1%bathy_meter = G1%gdepw_ps                          
     
    611611     CALL init_constant_bathy(G0%bathy_meter,bathy_fin_constant) 
    612612     ! 
    613      boundary = connectionsize*irafx + nbghostcellsfine    
     613     boundary = connectionsize*irafx + nbghostcellsfine + 1    
    614614     !              
    615615     G1%bathy_meter(1:boundary,:) = bathy_fin_constant(1:boundary,:) 
  • branches/2017/dev_merge_2017/NEMOGCM/TOOLS/NESTING/src/agrif_interpolation.f90

    r2455 r9166  
    103103 
    104104    IF (typevar .EQ. 'F') THEN 
    105        ptx = 2 
    106        pty = 2 
     105       ptx = 1 + nbghostcellsfine  
     106       pty = 1 + nbghostcellsfine  
    107107       decalxc = 0. 
    108108       decalyc = 0. 
     
    110110       decalyf = 0. 
    111111    ELSEIF (typevar .EQ. 'T') THEN 
    112        ptx = 3 
    113        pty = 3 
     112       ptx = 2 + nbghostcellsfine  
     113       pty = 2 + nbghostcellsfine  
    114114       decalxc = dxc/2. 
    115115       decalyc = dyc/2. 
     
    117117       decalyf = dyf/2. 
    118118    ELSEIF (typevar .EQ. 'U') THEN 
    119        ptx = 2 
    120        pty = 3 
     119       ptx = 1 + nbghostcellsfine  
     120       pty = 2 + nbghostcellsfine  
    121121       decalxc = 0. 
    122122       decalyc = dyc/2. 
     
    124124       decalyf = dyf/2. 
    125125    ELSEIF (typevar .EQ. 'V') THEN 
    126        ptx = 3 
    127        pty = 2 
     126       ptx = 2 + nbghostcellsfine  
     127       pty = 1 + nbghostcellsfine  
    128128       decalxc = dxc/2. 
    129129       decalyc = 0. 
  • branches/2017/dev_merge_2017/NEMOGCM/TOOLS/NESTING/src/agrif_partial_steps.f90

    r9149 r9166  
    352352    IF ( MOD(irafx,2) .EQ. 0 ) diff = 1 
    353353    !        
    354     bornex = nbghostcellsfine + CEILING(irafx/2.0) + diff - irafx 
    355     borney = nbghostcellsfine + CEILING(irafy/2.0) + diff - irafy 
    356     bornex2 = nxfin - (nbghostcellsfine-1) - irafx - CEILING(irafx/2.0)  
    357     borney2 = nyfin - (nbghostcellsfine-1) - irafy - CEILING(irafy/2.0)                       
     354    bornex = nbghostcellsfine + 1 + CEILING(irafx/2.0) + diff - irafx 
     355    borney = nbghostcellsfine + 1 + CEILING(irafy/2.0) + diff - irafy 
     356    bornex2 = nxfin - nbghostcellsfine - irafx - CEILING(irafx/2.0)  
     357    borney2 = nyfin - nbghostcellsfine - irafy - CEILING(irafy/2.0)                       
    358358    ! 
    359359    ! 
     
    361361    ! 
    362362 
    363     CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,3+connectionsize*irafx-1, & 
     363    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,2+nbghostcellsfine+connectionsize*irafx-1, & 
    364364         1,nyfin) 
    365365 
     
    368368    ! 
    369369 
    370     CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,nxfin-2-(connectionsize*irafx-1),nxfin, & 
     370    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,nxfin-1-nbghostcellsfine-(connectionsize*irafx-1),nxfin, & 
    371371         1,nyfin) 
    372372 
     
    376376 
    377377    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,nxfin, & 
    378          nyfin-2-(connectionsize*irafy-1),nyfin ) 
     378         nyfin-1 - nbghostcellsfine -(connectionsize*irafy-1),nyfin ) 
    379379 
    380380    ! 
     
    382382    ! 
    383383    CALL correct_level( gdepwchild,ParentGrid,gdepw,e3t,1,nxfin, & 
    384          1,3+connectionsize*irafy-1 ) 
     384         1,2+nbghostcellsfine+connectionsize*irafy-1 ) 
    385385 
    386386    !        
     
    430430    dyfin = 1./irafy 
    431431 
    432     ptx = 3 
    433     pty = 3 
     432    ptx = 1 + nbghostcellsfine + 1 
     433    pty = 1 + nbghostcellsfine + 1 
    434434 
    435435    xmin = (imin-1) * 1 
     
    526526          DO ii = i-FLOOR(irafx/2.0)+diff,i+FLOOR(irafx/2.0) 
    527527             x = ii-i - xdiff/2. 
    528              val = parentgrid%gdepw_ps(ipt,jpt)+slopex * x 
     528!!             val = parentgrid%gdepw_ps(ipt,jpt)+slopex * x 
    529529!! chanut: uncomment this to get nearest neighbor interpolation 
    530 !!             val = parentgrid%gdepw_ps(ipt,jpt)           
     530             val = parentgrid%gdepw_ps(ipt,jpt)           
    531531             gdepwtemp(ii,j) = val 
    532532             IF (gdepwtemp(ii,j) < mindepth) THEN 
     
    585585          DO jj = j-FLOOR(irafy/2.0)+diff,j+FLOOR(irafy/2.0) 
    586586             y = jj-j - xdiff/2. 
    587              val = gdepwtemp(i,j) + slopey*y 
     587!!             val = gdepwtemp(i,j) + slopey*y 
    588588!! chanut: uncomment this to get nearest neighbor interpolation 
    589 !!             val = gdepwtemp(i,j) 
     589             val = gdepwtemp(i,j) 
    590590             gdepwtemp(i,jj) = val      
    591591          ENDDO 
  • branches/2017/dev_merge_2017/NEMOGCM/TOOLS/NESTING/src/agrif_types.f90

    r9149 r9166  
    4242  INTEGER irafx,irafy 
    4343  INTEGER nxfin,nyfin 
    44   INTEGER, PARAMETER :: nbghostcellsfine = 2 
     44  INTEGER, PARAMETER :: nbghostcellsfine = 1  
    4545  INTEGER, PARAMETER :: nbghostcellscoarse = 1 
    4646  !       
     
    176176       jmax = jmax + jpjzoom - 1 
    177177       ! 
    178        nxfin = (imax-imin)*irafx+nbghostcellsfine*2 
    179        nyfin = (jmax-jmin)*irafy+nbghostcellsfine*2 
     178       nxfin = (imax-imin)*irafx+2*nbghostcellsfine+2 
     179       nyfin = (jmax-jmin)*irafy+2*nbghostcellsfine+2 
    180180       ! 
    181181    ELSE 
Note: See TracChangeset for help on using the changeset viewer.