Changeset 9749


Ignore:
Timestamp:
2018-06-06T12:00:04+02:00 (2 years ago)
Author:
jchanut
Message:

NESTING tool: correct parent bathymetry update in case of nghost > 1. Output update zone in updated bathymetry file.

Location:
utils/tools/NESTING/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • utils/tools/NESTING/src/agrif_connect_topo.f90

    r9694 r9749  
    5555    IF(MOD(rho,2) .EQ. 0) diff = 1 
    5656    ! 
    57     indx = 2 + CEILING(irafx/2.0) + diff       
    58     indy = 2 + CEILING(irafy/2.0) + diff 
     57    indx = 1 + nbghostcellsfine + CEILING(irafx/2.0) + diff       
     58    indy = 1 + nbghostcellsfine + CEILING(irafy/2.0) + diff 
    5959    bornex = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff - irafx 
    6060    borney = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff - irafy 
     
    6767    DO j = borney,borney2,irafy 
    6868 
    69        jpt = jmin + 3 - 1 + (j-indy)/irafy 
     69       jpt = jmin + 1 + nbghostcellsfine + (j-indy)/irafy 
    7070       IF(j<=1) jpt = jmin + 1 
    7171 
    7272       DO i = bornex,bornex2,irafx 
    7373 
    74           ipt = imin + 3 - 1 + (i-indx)/irafx 
     74          ipt = imin + 1 + nbghostcellsfine + (i-indx)/irafx 
    7575          IF(i<=1) ipt = imin + 1 
    7676          !        
     
    786786 
    787787    TYPE(coordinates) :: G0,G1 
    788     INTEGER :: ji,jj,jk,ipt,jpt,diff,indx,indy,bornex,borney,bornex2,borney2 
    789     ! 
    790     INTEGER :: ideb,jdeb,ifin,jfin 
     788    INTEGER :: ii,jj,jk,ipt,jpt,diff,indx,indy,bornex,borney,bornex2,borney2 
     789    ! 
    791790    REAL*8 :: za2,za1,za0,zsur,zacr,zkth,zacr2,zkth2,zmin 
    792791    INTEGER :: i,j 
     
    886885    diff = 0 
    887886    IF(MOD(rho,2) .EQ. 0) diff = 1 
    888  
    889     ideb = 3 + (irafx - 1)/2 
    890     jdeb = 3 + (irafy - 1)/2 
    891  
    892     jfin = nyfin - 2 - (irafy)/2 
    893     ifin = nxfin - 2 - (irafx)/2 
    894     ! 
    895     WRITE(*,*) '---------------------------------' 
    896     WRITE(*,*) 'Parent grid bathymetry update ...' 
    897     compt = 0 
    898     ! 
    899     DO jj = jdeb,jfin,irafy 
    900        jpt = jmin + 3 - 1 + (jj - jdeb) / irafy 
    901        DO ji = ideb,ifin,irafx 
    902           ipt = imin + 3 - 1 + (ji - ideb) / irafx 
    903           ! 
    904           G0%Bathy_meter(ipt,jpt) = SUM(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2,jj-irafy/2+diff:jj+irafy/2))/(irafx*irafy) 
     887    ! 
     888    indx = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff       
     889    indy = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff 
     890    bornex = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff 
     891    borney = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff 
     892    bornex2 = nxfin - (nbghostcellsfine) - CEILING(irafx/2.0)  
     893    borney2 = nyfin - (nbghostcellsfine) - CEILING(irafy/2.0)  
     894    ! 
     895    DO j = borney,borney2,irafy 
     896 
     897       jpt = jmin + 1 + nbghostcellsfine + (j-indy)/irafy 
     898       IF(j<=1) jpt = jmin + 1 
     899 
     900       DO i = bornex,bornex2,irafx 
     901 
     902          ipt = imin + 1 + nbghostcellsfine + (i-indx)/irafx 
     903          IF(i<=1) ipt = imin + 1 
     904          IF ((i==bornex).AND.(j==borney)) print *, 'Coarse grid Corner', ipt,jpt 
     905          !    
     906          G0%Bathy_meter(ipt,jpt) = 0. 
     907          compt = 0  
     908          DO jj = j-FLOOR(irafy/2.0),j+FLOOR(irafy/2.0)-diff 
     909             DO ii = i-FLOOR(irafx/2.0),i+FLOOR(irafx/2.0)-diff 
     910                G0%Bathy_meter(ipt,jpt) = G0%Bathy_meter(ipt,jpt) + G1%Bathy_meter(ii,jj) 
     911                compt = compt + 1 
     912             END DO 
     913          END DO 
     914          G0%Bathy_meter(ipt,jpt) = G0%Bathy_meter(ipt,jpt) / FLOAT(compt) 
    905915          IF(G0%Bathy_meter(ipt,jpt).GT.0.)   G0%Bathy_meter(ipt,jpt) = MAX(G0%Bathy_meter(ipt,jpt),zmin) 
    906916          ! 
    907           compt = compt + 1 
    908           ! 
    909        ENDDO 
    910     ENDDO 
     917          G0%wgt(ipt,jpt) = 1. ! Flag for output 
     918       END DO 
     919    END DO 
     920 
    911921    ! 
    912922    WRITE(*,*) ' Number of coarse grid points updated = ',compt 
  • utils/tools/NESTING/src/agrif_create_bathy.f90

    r9694 r9749  
    463463             ALLOCATE(G1%wgt(SIZE(G1%bathy_meter,1),SIZE(G1%bathy_meter,2))) 
    464464        G1%wgt(:,:) = 0. 
     465        IF ((.NOT.ASSOCIATED(G0%wgt)).AND.bathy_update) THEN  
     466             ALLOCATE(G0%wgt(SIZE(G0%nav_lat,1),SIZE(G0%nav_lat,2))) 
     467             G0%wgt(:,:) = 0. 
     468        ENDIF 
    465469 
    466470        DO jj=1,nyfin 
     
    623627        CALL get_partial_steps(G1)                 ! compute gdepw_ps for G1 
    624628 
    625         IF(bathy_update) CALL Update_Parent_Bathy( G0,G1 )                   
     629        IF(bathy_update) CALL Update_Parent_Bathy( G0,G1 )  
    626630        ! 
    627631        CALL set_child_name(parent_bathy_meter,child_ps) 
Note: See TracChangeset for help on using the changeset viewer.