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 8129 for branches/2017/dev_r8127_AGRIF_LIM3_GHOST/NEMOGCM/NEMO/NST_SRC/agrif_user.F90 – NEMO

Ignore:
Timestamp:
2017-06-02T16:08:12+02:00 (7 years ago)
Author:
clem
Message:

make those things work: ghostcells>1 + nn_ice(child)=0 + fix timing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r8127_AGRIF_LIM3_GHOST/NEMOGCM/NEMO/NST_SRC/agrif_user.F90

    r7761 r8129  
    127127   !! 
    128128   IMPLICIT NONE 
     129   ! 
     130   INTEGER :: ind1, ind2, ind3 
    129131   !!---------------------------------------------------------------------- 
    130132 
    131133   ! 1. Declaration of the type of variable which have to be interpolated 
    132134   !--------------------------------------------------------------------- 
    133    CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e1u_id) 
    134    CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e2v_id) 
     135   !!clem ghost 
     136   ind1 =     nbghostcells 
     137   ind2 = 1 + nbghostcells 
     138   ind3 = 2 + nbghostcells 
     139   CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e1u_id) 
     140   CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e2v_id) 
     141   !!clem ghost 
    135142 
    136143   ! 2. Type of interpolation 
     
    141148   ! 3. Location of interpolation 
    142149   !----------------------------- 
    143    CALL Agrif_Set_bc(e1u_id,(/0,0/)) 
    144    CALL Agrif_Set_bc(e2v_id,(/0,0/)) 
     150   !!clem ghost (previously set to /0,0/) 
     151   CALL Agrif_Set_bc(e1u_id,(/0,ind1/)) 
     152   CALL Agrif_Set_bc(e2v_id,(/0,ind1/)) 
     153   !!clem ghost 
    145154 
    146155   ! 5. Update type 
     
    337346   !!---------------------------------------------------------------------- 
    338347   USE agrif_util 
    339    USE par_oce       !   ONLY : jpts 
     348   USE par_oce       !   ONLY : jpts and ghostcells 
    340349   USE oce 
    341350   USE agrif_oce 
    342351   !! 
    343352   IMPLICIT NONE 
     353   ! 
     354   INTEGER :: ind1, ind2, ind3 
    344355   !!---------------------------------------------------------------------- 
    345356 
    346357   ! 1. Declaration of the type of variable which have to be interpolated 
    347358   !--------------------------------------------------------------------- 
    348    CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_id) 
    349    CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_sponge_id) 
    350  
    351    CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),un_interp_id) 
    352    CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vn_interp_id) 
    353    CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),un_update_id) 
    354    CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vn_update_id) 
    355    CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),un_sponge_id) 
    356    CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vn_sponge_id) 
    357  
    358    CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),e3t_id) 
    359    CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),umsk_id) 
    360    CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vmsk_id) 
    361  
    362    CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,3/),scales_t_id) 
    363  
    364    CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),unb_id) 
    365    CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vnb_id) 
    366    CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_interp_id) 
    367    CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_interp_id) 
    368    CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_update_id) 
    369    CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_update_id) 
    370  
    371    CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),sshn_id) 
     359   !!clem ghost 
     360   ind1 =     nbghostcells 
     361   ind2 = 1 + nbghostcells 
     362   ind3 = 2 + nbghostcells 
     363   CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_id) 
     364   CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_sponge_id) 
     365 
     366   CALL agrif_declare_variable((/1,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),un_interp_id) 
     367   CALL agrif_declare_variable((/2,1,0/),(/ind3,ind2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vn_interp_id) 
     368   CALL agrif_declare_variable((/1,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),un_update_id) 
     369   CALL agrif_declare_variable((/2,1,0/),(/ind3,ind2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vn_update_id) 
     370   CALL agrif_declare_variable((/1,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),un_sponge_id) 
     371   CALL agrif_declare_variable((/2,1,0/),(/ind3,ind2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vn_sponge_id) 
     372 
     373   CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),e3t_id) 
     374   CALL agrif_declare_variable((/1,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),umsk_id) 
     375   CALL agrif_declare_variable((/2,1,0/),(/ind3,ind2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vmsk_id) 
     376 
     377   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) 
     378 
     379   CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),unb_id) 
     380   CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vnb_id) 
     381   CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_interp_id) 
     382   CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_interp_id) 
     383   CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_update_id) 
     384   CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_update_id) 
     385 
     386   CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),sshn_id) 
    372387 
    373388# if defined key_zdftke 
    374    CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/), en_id) 
    375    CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),avt_id) 
    376    CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),avm_id) 
     389   CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/), en_id) 
     390   CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),avt_id) 
     391   CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),avm_id) 
    377392# endif 
     393   !!clem ghost 
    378394 
    379395   ! 2. Type of interpolation 
     
    407423   ! 3. Location of interpolation 
    408424   !----------------------------- 
    409    CALL Agrif_Set_bc(tsn_id,(/0,1/)) 
    410    CALL Agrif_Set_bc(un_interp_id,(/0,1/)) 
    411    CALL Agrif_Set_bc(vn_interp_id,(/0,1/)) 
    412  
    413 !   CALL Agrif_Set_bc(tsn_sponge_id,(/-3*Agrif_irhox(),0/)) 
    414 !   CALL Agrif_Set_bc(un_sponge_id,(/-2*Agrif_irhox()-1,0/)) 
    415 !   CALL Agrif_Set_bc(vn_sponge_id,(/-2*Agrif_irhox()-1,0/)) 
    416    CALL Agrif_Set_bc(tsn_sponge_id,(/-nn_sponge_len*Agrif_irhox()-1,0/)) 
     425   !!clem ghost 
     426   CALL Agrif_Set_bc(tsn_id,(/0,ind1/)) 
     427   CALL Agrif_Set_bc(un_interp_id,(/0,ind1/)) 
     428   CALL Agrif_Set_bc(vn_interp_id,(/0,ind1/)) 
     429 
     430   ! clem: previously set to /-,0/ 
     431   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  
    417432   CALL Agrif_Set_bc(un_sponge_id ,(/-nn_sponge_len*Agrif_irhox()-1,0/)) 
    418433   CALL Agrif_Set_bc(vn_sponge_id ,(/-nn_sponge_len*Agrif_irhox()-1,0/)) 
    419434 
    420    CALL Agrif_Set_bc(sshn_id,(/0,0/)) 
    421    CALL Agrif_Set_bc(unb_id ,(/0,0/)) 
    422    CALL Agrif_Set_bc(vnb_id ,(/0,0/)) 
    423    CALL Agrif_Set_bc(ub2b_interp_id,(/0,0/)) 
    424    CALL Agrif_Set_bc(vb2b_interp_id,(/0,0/)) 
    425  
    426    CALL Agrif_Set_bc(e3t_id,(/-2*Agrif_irhox()-1,0/))   ! if west and rhox=3: column 2 to 9 
    427    CALL Agrif_Set_bc(umsk_id,(/0,0/)) 
    428    CALL Agrif_Set_bc(vmsk_id,(/0,0/)) 
    429  
     435   CALL Agrif_Set_bc(sshn_id,(/0,ind1/)) 
     436   CALL Agrif_Set_bc(unb_id ,(/0,ind1/)) 
     437   CALL Agrif_Set_bc(vnb_id ,(/0,ind1/)) 
     438   CALL Agrif_Set_bc(ub2b_interp_id,(/0,ind1/)) 
     439   CALL Agrif_Set_bc(vb2b_interp_id,(/0,ind1/)) 
     440 
     441   CALL Agrif_Set_bc(e3t_id,(/-2*Agrif_irhox()-1,ind1/))   ! if west and rhox=3 and ghost=1: column 1 to 9 
     442   CALL Agrif_Set_bc(umsk_id,(/0,ind1/)) 
     443   CALL Agrif_Set_bc(vmsk_id,(/0,ind1/)) 
     444 
     445   ! clem: previously set to /0,1/ 
    430446# if defined key_zdftke 
    431    CALL Agrif_Set_bc(avm_id ,(/0,1/)) 
     447   CALL Agrif_Set_bc(avm_id ,(/0,ind1/)) 
    432448# endif 
     449   !!clem ghost 
    433450 
    434451   ! 5. Update type 
     
    623640   USE Agrif_Util 
    624641   USE ice 
    625  
    626    IMPLICIT NONE 
     642   USE par_oce, ONLY : nbghostcells 
     643   ! 
     644   IMPLICIT NONE 
     645   ! 
     646   INTEGER :: ind1, ind2, ind3 
    627647   !!---------------------------------------------------------------------- 
    628648   ! 
     
    634654   !                            2,2 = two ghost lines 
    635655   !------------------------------------------------------------------------------------- 
    636    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 ) 
    637    CALL agrif_declare_variable((/1,2/)    ,(/2,3/),(/'x','y'/)    ,(/1,1/)  ,(/nlci,nlcj/)                      ,u_ice_id   ) 
    638    CALL agrif_declare_variable((/2,1/)    ,(/3,2/),(/'x','y'/)    ,(/1,1/)  ,(/nlci,nlcj/)                      ,v_ice_id   ) 
     656   !!clem ghost 
     657   ind1 =     nbghostcells 
     658   ind2 = 1 + nbghostcells 
     659   ind3 = 2 + nbghostcells 
     660   CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(5+nlay_s+nlay_i)/),tra_ice_id ) 
     661   CALL agrif_declare_variable((/1,2/)  ,(/ind2,ind3/)  ,(/'x','y'/)    ,(/1,1/)  ,(/nlci,nlcj/)                      ,u_ice_id   ) 
     662   CALL agrif_declare_variable((/2,1/)  ,(/ind3,ind2/)  ,(/'x','y'/)    ,(/1,1/)  ,(/nlci,nlcj/)                      ,v_ice_id   ) 
     663   !!clem ghost 
    639664 
    640665   ! 2. Set interpolations (normal & tangent to the grid cell for velocities) 
     
    646671   ! 3. Set location of interpolations 
    647672   !---------------------------------- 
    648    CALL Agrif_Set_bc(tra_ice_id,(/0,1/)) 
    649    CALL Agrif_Set_bc(u_ice_id  ,(/0,1/)) 
    650    CALL Agrif_Set_bc(v_ice_id  ,(/0,1/)) 
     673   !!clem ghost 
     674   CALL Agrif_Set_bc(tra_ice_id,(/0,ind1/)) 
     675   CALL Agrif_Set_bc(u_ice_id  ,(/0,ind1/)) 
     676   CALL Agrif_Set_bc(v_ice_id  ,(/0,ind1/)) 
     677   !!clem ghost 
    651678 
    652679   ! 4. Set update type in case 2 ways (child=>parent) (normal & tangent to the grid cell for velocities) 
     
    777804   !! 
    778805   IMPLICIT NONE 
     806   ! 
     807   INTEGER :: ind1, ind2, ind3 
    779808   !!---------------------------------------------------------------------- 
    780809 
    781810   ! 1. Declaration of the type of variable which have to be interpolated 
    782811   !--------------------------------------------------------------------- 
    783    CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_id) 
    784    CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_sponge_id) 
     812   !!clem ghost 
     813   ind1 =     nbghostcells 
     814   ind2 = 1 + nbghostcells 
     815   ind3 = 2 + nbghostcells 
     816   CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_id) 
     817   CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_sponge_id) 
    785818 
    786819   ! 2. Type of interpolation 
     
    791824   ! 3. Location of interpolation 
    792825   !----------------------------- 
    793    CALL Agrif_Set_bc(trn_id,(/0,1/)) 
    794 !   CALL Agrif_Set_bc(trn_sponge_id,(/-3*Agrif_irhox(),0/)) 
    795    CALL Agrif_Set_bc(trn_sponge_id,(/-nn_sponge_len*Agrif_irhox()-1,0/)) 
     826   !!clem ghost 
     827   CALL Agrif_Set_bc(trn_id,(/0,ind1/)) 
     828   !clem: previously set to /-,0/ 
     829   CALL Agrif_Set_bc(trn_sponge_id,(/-nn_sponge_len*Agrif_irhox()-1,ind1/)) 
    796830 
    797831   ! 5. Update type 
Note: See TracChangeset for help on using the changeset viewer.