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 7761 for trunk/NEMOGCM/NEMO/NST_SRC/agrif_user.F90 – NEMO

Ignore:
Timestamp:
2017-03-06T18:58:35+01:00 (7 years ago)
Author:
clem
Message:

make AGRIF and LIM3 fully compatible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/NST_SRC/agrif_user.F90

    r7646 r7761  
    3737      jpim1   = jpi-1  
    3838      jpjm1   = jpj-1  
    39       jpkm1   = jpk-1                                          
     39      jpkm1   = MAX( 1, jpk-1 )                                          
    4040      jpij    = jpi*jpj  
    4141      nperio  = 0 
     
    8383# if defined key_top 
    8484   CALL Agrif_InitValues_cont_top 
     85# endif 
     86# if defined key_lim3 
     87   CALL Agrif_InitValues_cont_lim3 
    8588# endif 
    8689   ! 
     
    290293         ! check if vmask agree with parent along northern and southern boundaries: 
    291294         CALL Agrif_Bc_variable(vmsk_id,calledweight=1.,procname=interpvmsk) 
    292     ! check if tmask and vertical scale factors agree with parent over first two coarse grid points: 
     295        ! check if tmask and vertical scale factors agree with parent over first two coarse grid points: 
    293296         CALL Agrif_Bc_variable(e3t_id,calledweight=1.,procname=interpe3t) 
    294297         ! 
    295298         IF (lk_mpp) CALL mpp_sum( kindic_agr ) 
    296          IF( kindic_agr /= 0 ) THEN                    
     299         IF( kindic_agr /= 0 ) THEN 
    297300            CALL ctl_stop('Child Bathymetry is not correct near boundaries.') 
    298301         ELSE 
     
    457460!   CALL Agrif_Set_Updatetype(vb2b_update_id,update1 = Agrif_Update_Full_Weighting, update2 = Agrif_Update_Average) 
    458461!   CALL Agrif_Set_Updatetype(sshn_id, update = Agrif_Update_Full_Weighting) 
    459   
     462 
    460463   ! 
    461464END SUBROUTINE agrif_declare_var 
     
    579582   CALL agrif_declare_var_lim3 
    580583 
    581    ! Controls (clem) 
     584   ! Controls 
     585 
     586   ! clem: For some reason, nn_fsbc(child)/=1 does not work properly (signal is largely degraded by the agrif zoom) 
     587   !          the run must satisfy CFL=Uice/(dx/dt) < 0.6/nn_fsbc(child) 
     588   !          therefore, if nn_fsbc(child)>1 one must reduce the time-step in proportion to nn_fsbc(child), which is not acceptable 
     589   !       If a solution is found, the following stop could be removed 
     590   IF( nn_fsbc > 1 )  CALL ctl_stop('nn_fsbc(child) must be set to 1 otherwise agrif and lim3 do not work properly') 
     591 
    582592   ! stop if rhot * nn_fsbc(parent) /= N * nn_fsbc(child) with N being integer 
    583593   IF( MOD( Agrif_irhot() * Agrif_Parent(nn_fsbc), nn_fsbc ) /= 0 )  THEN 
     
    591601   ! First Interpolations (using "after" ice subtime step => lim_nbstep=1) 
    592602   !---------------------------------------------------------------------- 
    593    lim_nbstep = 1 
     603!!   lim_nbstep = 1 
     604   lim_nbstep = ( Agrif_irhot() * Agrif_Parent(nn_fsbc) / nn_fsbc ) ! clem: to have calledweight=1 in interp (otherwise the western border of the zoom is wrong) 
    594605   CALL agrif_interp_lim3('U') ! interpolation of ice velocities 
    595606   CALL agrif_interp_lim3('V') ! interpolation of ice velocities 
     
    618629   ! 1. Declaration of the type of variable which have to be interpolated (parent=>child) 
    619630   !       agrif_declare_variable(position,1st point index,--,--,dimensions,name) 
     631   !           ex.:  position=> 1,1 = not-centered (in i and j) 
     632   !                            2,2 =     centered (    -     ) 
     633   !                 index   => 1,1 = one ghost line 
     634   !                            2,2 = two ghost lines 
    620635   !------------------------------------------------------------------------------------- 
    621636   CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(5+nlay_s+nlay_i)/),tra_ice_id ) 
     
    637652   ! 4. Set update type in case 2 ways (child=>parent) (normal & tangent to the grid cell for velocities) 
    638653   !-------------------------------------------------- 
    639    CALL Agrif_Set_Updatetype(tra_ice_id, update = AGRIF_Update_Average) ! clem je comprends pas average/copy 
     654   CALL Agrif_Set_Updatetype(tra_ice_id, update = AGRIF_Update_Average) 
    640655   CALL Agrif_Set_Updatetype(u_ice_id  ,update1 = Agrif_Update_Copy   , update2 = Agrif_Update_Average) 
    641656   CALL Agrif_Set_Updatetype(v_ice_id  ,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy   ) 
Note: See TracChangeset for help on using the changeset viewer.