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 11868 for NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_user.F90 – NEMO

Ignore:
Timestamp:
2019-11-06T16:43:51+01:00 (4 years ago)
Author:
jchanut
Message:

#2222, 1) Correct sponge mainly for using AGRIF in 2DV domains, 2) Add check of bathymetry consistency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_user.F90

    r11827 r11868  
    126126      CALL Agrif_Bc_variable(mbkt_id,calledweight=1.,procname=interpmbkt) 
    127127      ! 
     128      ! Assume step wise change of bathymetry near interface 
     129      ! TODO: Switch to linear interpolation of bathymetry in the s-coordinate case 
     130      !       and no refinement 
    128131      DO jj = 1, jpjm1 
    129132         DO ji = 1, jpim1 
     
    140143      mbku_parent(:,:) = MAX( NINT( zk(:,:) ), 1 ) 
    141144      zk(:,:) = REAL( mbkv_parent(:,:), wp )   ;   CALL lbc_lnk( 'Agrif_InitValues_cont', zk, 'V', 1. ) 
    142       mbkv_parent(:,:) = MAX( NINT( zk(:,:) ), 1 )       
     145      mbkv_parent(:,:) = MAX( NINT( zk(:,:) ), 1 )    
    143146#endif 
    144147 
     
    238241         ENDIF 
    239242 
    240          ! check if masks and bathymetries match 
    241          IF(ln_chk_bathy) THEN 
    242             ! 
    243             IF(lwp) WRITE(numout,*) 'AGRIF: Check Bathymetry and masks near bdys. Level: ', Agrif_Level() 
    244             ! 
    245             kindic_agr = 0 
    246             ! check if umask agree with parent along western and eastern boundaries: 
    247             CALL Agrif_Bc_variable(umsk_id,calledweight=1.,procname=interpumsk) 
    248             ! check if vmask agree with parent along northern and southern boundaries: 
    249             CALL Agrif_Bc_variable(vmsk_id,calledweight=1.,procname=interpvmsk) 
    250             ! check if tmask and vertical scale factors agree with parent over first two coarse grid points: 
    251             CALL Agrif_Bc_variable(e3t_id,calledweight=1.,procname=interpe3t) 
    252             ! 
    253             CALL mpp_sum( 'agrif_user', kindic_agr ) 
    254             IF( kindic_agr /= 0 ) THEN 
    255                CALL ctl_stop('Child Bathymetry is not correct near boundaries.') 
    256             ELSE 
    257                IF(lwp) WRITE(numout,*) 'Child Bathymetry is ok near boundaries.' 
    258             END IF 
    259          ENDIF 
    260  
    261 #if defined key_vertical 
    262     IF ( Agrif_Parent(jpk).GT.jpk ) THEN 
    263        CALL ctl_stop( ' With key_vertical, child grids must have jpk greater or equal to the parent value' ) 
    264          ENDIF 
    265 #endif 
     243      ENDIF 
     244 
     245      ! check if masks and bathymetries match 
     246      IF(ln_chk_bathy) THEN 
    266247         ! 
    267       ENDIF 
     248         IF(lwp) WRITE(numout,*) ' ' 
     249         IF(lwp) WRITE(numout,*) 'AGRIF: Check Bathymetry and masks near bdys. Level: ', Agrif_Level() 
     250         ! 
     251         kindic_agr = 0 
     252# if ! defined key_vertical 
     253         ! 
     254         ! check if umask agree with parent along western and eastern boundaries: 
     255         CALL Agrif_Bc_variable(umsk_id,calledweight=1.,procname=interpumsk) 
     256         ! check if vmask agree with parent along northern and southern boundaries: 
     257         CALL Agrif_Bc_variable(vmsk_id,calledweight=1.,procname=interpvmsk) 
     258         ! check if tmask and vertical scale factors agree with parent over first two coarse grid points: 
     259         CALL Agrif_Bc_variable(e3t_id,calledweight=1.,procname=interpe3t) 
     260         ! 
     261# else 
     262         ! 
     263         ! In case of vertical interpolation, check only that total depths agree between child and parent: 
     264         DO ji = 1, jpi 
     265            DO jj = 1, jpj 
     266               IF ((mbkt_parent(ji,jj)/=0).AND.(ht0_parent(ji,jj)/=ht_0(ji,jj))) kindic_agr = kindic_agr + 1 
     267               IF ((mbku_parent(ji,jj)/=0).AND.(hu0_parent(ji,jj)/=hu_0(ji,jj))) kindic_agr = kindic_agr + 1 
     268               IF ((mbkv_parent(ji,jj)/=0).AND.(hv0_parent(ji,jj)/=hv_0(ji,jj))) kindic_agr = kindic_agr + 1 
     269            END DO 
     270         END DO 
     271# endif 
     272         CALL mpp_sum( 'agrif_user', kindic_agr ) 
     273         IF( kindic_agr /= 0 ) THEN 
     274            CALL ctl_stop('==> Child Bathymetry is NOT correct near boundaries.') 
     275         ELSE 
     276            IF(lwp) WRITE(numout,*) '==> Child Bathymetry is ok near boundaries.' 
     277            IF(lwp) WRITE(numout,*) ' ' 
     278         END IF   
     279         !     
     280      ENDIF 
     281 
     282# if defined key_vertical 
     283      ! Additional constrain that should be removed someday: 
     284      IF ( Agrif_Parent(jpk).GT.jpk ) THEN 
     285    CALL ctl_stop( ' With key_vertical, child grids must have jpk greater or equal to the parent value' ) 
     286      ENDIF 
     287# endif 
    268288      !  
    269289   END SUBROUTINE Agrif_InitValues_cont 
     
    379399      ! 3. Location of interpolation 
    380400      !----------------------------- 
    381       CALL Agrif_Set_bc(       tsn_id, (/0,ind1-1/) ) 
    382       CALL Agrif_Set_bc( un_interp_id, (/0,ind1-1/) ) 
     401      CALL Agrif_Set_bc(       tsn_id, (/0,ind1-1/) ) ! if west,  rhox=3 and nbghost=3: columns 2 to 4 
     402      CALL Agrif_Set_bc( un_interp_id, (/0,ind1-1/) )  
    383403      CALL Agrif_Set_bc( vn_interp_id, (/0,ind1-1/) ) 
    384404 
    385       CALL Agrif_Set_bc( tsn_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) )  ! if west and rhox=3 and sponge=2 and ghost=1: columns 2 to 9  
    386       CALL Agrif_Set_bc(  un_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) ) 
    387       CALL Agrif_Set_bc(  vn_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) ) 
     405      CALL Agrif_Set_bc( tsn_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) )  ! if west,  rhox=3, nn_sponge_len=2  
     406      CALL Agrif_Set_bc(  un_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) )  ! and nbghost=3:  
     407      CALL Agrif_Set_bc(  vn_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) )  ! columns 4 to 11 
    388408 
    389409      CALL Agrif_Set_bc(        sshn_id, (/0,ind1-1/) ) 
     
    393413      CALL Agrif_Set_bc( vb2b_interp_id, (/0,ind1-1/) ) 
    394414 
    395       CALL Agrif_Set_bc(  e3t_id, (/-nn_sponge_len*Agrif_irhox(),ind1-1/) )   ! if west and rhox=3 and ghost=1: column 2 to 6  
    396       CALL Agrif_Set_bc( umsk_id, (/0,0/) ) 
    397       CALL Agrif_Set_bc( vmsk_id, (/0,0/) ) 
    398 # if defined key_vertical 
     415      CALL Agrif_Set_bc(  e3t_id, (/-nn_sponge_len*Agrif_irhox(),ind1-1/) )     ! if west,  rhox=3, nn_sponge_len=2 
     416      CALL Agrif_Set_bc( umsk_id, (/0,0/) )                                     ! and nbghost=3: 
     417      CALL Agrif_Set_bc( vmsk_id, (/0,0/) )                                     ! columns 2 to 10 
     418# if defined key_vertical  
    399419      ! extend the interpolation zone by 1 more point than necessary: 
    400420      CALL Agrif_Set_bc(  mbkt_id, (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 
Note: See TracChangeset for help on using the changeset viewer.