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

Ignore:
Timestamp:
2019-10-21T12:26:39+02:00 (4 years ago)
Author:
jchanut
Message:

#2222: correct definition of parent vertical grid on the child domain to perform vertical interpolation at boundaries. Use additionnal parent depths and number of levels arrays interpolated on the child grid domain to do so.
Correction of vertical interpolation of viscosity remains to be done as well as duplication of changes for passive tracers.

File:
1 edited

Legend:

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

    r11590 r11741  
    9797      USE oce 
    9898      USE lib_mpp 
    99       ! 
    100       IMPLICIT NONE 
    101       ! 
     99      USE lbclnk 
     100      ! 
     101      IMPLICIT NONE 
     102      ! 
     103      INTEGER :: ji, jj 
    102104      LOGICAL :: check_namelist 
    103105      CHARACTER(len=15) :: cl_check1, cl_check2, cl_check3, cl_check4  
     106#if defined key_vertical 
     107      REAL(wp), DIMENSION(jpi,jpj) ::   zk   ! workspace 
     108#endif 
    104109      !!---------------------------------------------------------------------- 
    105110 
     
    110115      ! 2. First interpolations of potentially non zero fields 
    111116      !------------------------------------------------------- 
     117 
     118#if defined key_vertical 
     119      ! Build consistent parent bathymetry and number of levels 
     120      ! on the child grid  
     121      Agrif_UseSpecialValue = .FALSE. 
     122      ht0_parent(:,:) = 0._wp 
     123      mbkt_parent(:,:) = 0 
     124      ! 
     125      CALL Agrif_Bc_variable(ht0_id ,calledweight=1.,procname=interpht0 ) 
     126      CALL Agrif_Bc_variable(mbkt_id,calledweight=1.,procname=interpmbkt) 
     127      ! 
     128      DO jj = 1, jpjm1 
     129         DO ji = 1, jpim1 
     130            hu0_parent(ji,jj)  = MIN( ht0_parent(ji,jj), ht0_parent(ji+1,jj) )  
     131            hv0_parent(ji,jj)  = MIN( ht0_parent(ji,jj), ht0_parent(ji,jj+1) )  
     132            mbku_parent(ji,jj) = MIN(  mbkt_parent(ji+1,jj  ) , mbkt_parent(ji,jj)  ) 
     133            mbkv_parent(ji,jj) = MIN(  mbkt_parent(ji  ,jj+1) , mbkt_parent(ji,jj)  ) 
     134         END DO 
     135      END DO 
     136      ! 
     137      CALL lbc_lnk( 'Agrif_InitValues_cont', hu0_parent, 'U', 1. ) 
     138      CALL lbc_lnk( 'Agrif_InitValues_cont', hv0_parent, 'V', 1. ) 
     139      zk(:,:) = REAL( mbku_parent(:,:), wp )   ;   CALL lbc_lnk( 'Agrif_InitValues_cont', zk, 'U', 1. ) 
     140      mbku_parent(:,:) = MAX( NINT( zk(:,:) ), 1 ) 
     141      zk(:,:) = REAL( mbkv_parent(:,:), wp )   ;   CALL lbc_lnk( 'Agrif_InitValues_cont', zk, 'V', 1. ) 
     142      mbkv_parent(:,:) = MAX( NINT( zk(:,:) ), 1 )       
     143#endif 
     144 
    112145      Agrif_SpecialValue    = 0._wp 
    113146      Agrif_UseSpecialValue = .TRUE. 
     
    225258            END IF 
    226259         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 
    227266         ! 
    228267      ENDIF 
     
    275314      CALL agrif_declare_variable((/1,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),umsk_id) 
    276315      CALL agrif_declare_variable((/2,1,0/),(/ind3,ind2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vmsk_id) 
     316# if defined key_vertical 
     317      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),mbkt_id) 
     318      CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ht0_id) 
     319# endif 
    277320 
    278321      CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,3/),scales_t_id) 
     
    311354      CALL Agrif_Set_bcinterp(ub2b_interp_id,interp1=Agrif_linear,interp2=AGRIF_ppm) 
    312355      CALL Agrif_Set_bcinterp(vb2b_interp_id,interp1=AGRIF_ppm,interp2=Agrif_linear) 
    313  
     356! 
     357! > Divergence conserving alternative: 
     358!      CALL Agrif_Set_bcinterp(sshn_id,interp=AGRIF_constant) 
     359!      CALL Agrif_Set_bcinterp(unb_id,interp1=Agrif_linear,interp2=AGRIF_constant) 
     360!      CALL Agrif_Set_bcinterp(vnb_id,interp1=AGRIF_constant,interp2=Agrif_linear) 
     361!      CALL Agrif_Set_bcinterp(ub2b_interp_id,interp1=Agrif_linear,interp2=AGRIF_constant) 
     362!      CALL Agrif_Set_bcinterp(vb2b_interp_id,interp1=AGRIF_constant,interp2=Agrif_linear) 
     363!< 
    314364 
    315365      CALL Agrif_Set_bcinterp(un_sponge_id,interp1=Agrif_linear,interp2=AGRIF_ppm) 
     
    319369      CALL Agrif_Set_bcinterp(umsk_id,interp=AGRIF_constant) 
    320370      CALL Agrif_Set_bcinterp(vmsk_id,interp=AGRIF_constant) 
     371 
     372# if defined key_vertical 
     373      CALL Agrif_Set_bcinterp(mbkt_id,interp=AGRIF_constant) 
     374      CALL Agrif_Set_bcinterp(ht0_id ,interp=AGRIF_constant) 
     375# endif 
    321376 
    322377      IF( ln_zdftke.OR.ln_zdfgls )   CALL Agrif_Set_bcinterp( avm_id, interp=AGRIF_linear ) 
     
    341396      CALL Agrif_Set_bc( umsk_id, (/0,0/) ) 
    342397      CALL Agrif_Set_bc( vmsk_id, (/0,0/) ) 
    343  
     398# if defined key_vertical 
     399      ! extend the interpolation zone by 1 more point than necessary: 
     400      CALL Agrif_Set_bc(  mbkt_id, (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 
     401      CALL Agrif_Set_bc(  ht0_id,  (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 
     402# endif 
    344403 
    345404      IF( ln_zdftke.OR.ln_zdfgls )   CALL Agrif_Set_bc( avm_id, (/0,ind1/) ) 
Note: See TracChangeset for help on using the changeset viewer.