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 12253 for utils/tools/NESTING/src/agrif_readwrite.f90 – NEMO

Ignore:
Timestamp:
2019-12-16T10:59:22+01:00 (4 years ago)
Author:
clem
Message:

1) resolve some conflicts when using partial steps or not. 2) Make sure grids remain identical when they should. 3) in case of a double zoom, it is no more necessary to have the bilinear interpolation option when updating the 1st parent grid. Btw, I know these comments are unclear but it is very difficult to explain...

File:
1 edited

Legend:

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

    r11231 r12253  
    241241    CALL write_ncdf_var('nav_lon'        ,dimnames,name,Grid%nav_lon    ,'float') 
    242242    CALL write_ncdf_var('nav_lat'        ,dimnames,name,Grid%nav_lat    ,'float') 
    243     CALL write_ncdf_var(parent_level_name,dimnames,name,Grid%bathy_level,'float') 
     243    CALL write_ncdf_var(parent_level_name,dimnames,name,NINT(Grid%bathy_level),'integer') 
    244244    ! 
    245245    CALL copy_ncdf_att('nav_lon'        ,TRIM(parent_bathy_level),name,MINVAL(Grid%nav_lon),MAXVAL(Grid%nav_lon)) 
     
    548548        ln_zps = 1 
    549549        ln_zco = 0 
    550         CALL zgr_zps( nx, ny, gdept_1d, gdepw_1d, e3t_1d, e3w_1d, zbathy, &        ! input 
    551         &             mbathy, e3t_0, e3u_0, e3v_0, e3f_0, e3w_0, e3uw_0, e3vw_0 )  ! output 
    552550     ELSE 
    553551        ln_zps = 0 
    554552        ln_zco = 1 
    555553     ENDIF 
     554 
     555     CALL zgr_zps( nx, ny, gdept_1d, gdepw_1d, e3t_1d, e3w_1d, zbathy, &        ! input 
     556        &          mbathy, e3t_0, e3u_0, e3v_0, e3f_0, e3w_0, e3uw_0, e3vw_0 )  ! output 
    556557 
    557558     ! top/bottom levels 
     
    869870      END WHERE 
    870871 
    871       ! Compute mbathy for ocean points (i.e. the number of ocean levels) 
    872       ! find the number of ocean levels such that the last level thickness 
    873       ! is larger than the minimum of e3zps_min and e3zps_rat * e3t_1d (where 
    874       ! e3t_1d is the reference level thickness 
    875       DO jk = N-1, 1, -1 
    876          zdepth = gdepw_1d(jk) + MIN( e3zps_min, e3t_1d(jk)*e3zps_rat ) 
    877          WHERE( 0. < zbathy(:,:) .AND. zbathy(:,:) <= zdepth )   mbathy(:,:) = jk-1 
    878       END DO 
    879  
     872      IF( partial_steps ) THEN 
     873         ! Compute mbathy for ocean points (i.e. the number of ocean levels) 
     874         ! find the number of ocean levels such that the last level thickness 
     875         ! is larger than the minimum of e3zps_min and e3zps_rat * e3t_1d (where 
     876         ! e3t_1d is the reference level thickness 
     877         DO jk = N-1, 1, -1 
     878            zdepth = gdepw_1d(jk) + MIN( e3zps_min, e3t_1d(jk)*e3zps_rat ) 
     879            WHERE( 0. < zbathy(:,:) .AND. zbathy(:,:) <= zdepth )   mbathy(:,:) = jk-1 
     880         END DO 
     881      ELSE 
     882         DO jk = 1, N 
     883            WHERE( 0. < zbathy(:,:) .AND. zbathy(:,:) >= gdepw_1d(jk) )   mbathy(:,:) = jk-1 
     884         END DO         
     885      ENDIF 
     886       
    880887      ! Scale factors and depth at T- and W-points 
    881888      DO jk = 1, N                        ! intitialization to the reference z-coordinate 
     
    890897      !!      IF ( ln_isfcav == 1 ) CALL zgr_isf 
    891898      ! 
    892       ! Scale factors and depth at T- and W-points 
    893 !      IF ( ln_isfcav == 0 ) THEN 
     899      IF( partial_steps ) THEN 
     900         ! Scale factors and depth at T- and W-points 
     901         ! IF ( ln_isfcav == 0 ) THEN 
    894902         DO jj = 1, ny 
    895903            DO ji = 1, nx 
     
    913921                     ELSE                                        ;   gdepw_0(ji,jj,ik+1) = gdepw_1d(ik+1) 
    914922                     ENDIF 
    915    !gm Bug?  check the gdepw_1d 
     923                     !gm Bug?  check the gdepw_1d 
    916924                     !       ... on ik 
    917925                     gdept_0(ji,jj,ik) = gdepw_1d(ik) + ( gdepw_0(ji,jj,ik+1) - gdepw_1d(ik) )   & 
     
    931939         END DO 
    932940         ! 
    933 !         DO jj = 1, ny 
    934 !            DO ji = 1, nx 
    935 !               ik = mbathy(ji,jj) 
    936 !               IF( ik > 0 ) THEN               ! ocean point only 
    937 !                  e3tp (ji,jj) = e3t_0(ji,jj,ik) 
    938 !                  e3wp (ji,jj) = e3w_0(ji,jj,ik) 
    939 !               ENDIF 
    940 !            END DO 
    941 !         END DO 
    942 !      END IF 
     941         ! DO jj = 1, ny 
     942         !    DO ji = 1, nx 
     943         !       ik = mbathy(ji,jj) 
     944         !       IF( ik > 0 ) THEN               ! ocean point only 
     945         !          e3tp (ji,jj) = e3t_0(ji,jj,ik) 
     946         !          e3wp (ji,jj) = e3w_0(ji,jj,ik) 
     947         !       ENDIF 
     948         !    END DO 
     949         ! END DO 
     950         ! END IF 
     951      ENDIF 
    943952      ! 
    944953      ! Scale factors and depth at U-, V-, UW and VW-points 
Note: See TracChangeset for help on using the changeset viewer.