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 14994 for NEMO/branches/2021/ticket2669_isf_fluxes/tests/VORTEX/MY_SRC/usrdef_hgr.F90 – NEMO

Ignore:
Timestamp:
2021-06-15T16:39:31+02:00 (3 years ago)
Author:
mathiot
Message:

ticket #2669: update to the head of trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/ticket2669_isf_fluxes/tests/VORTEX/MY_SRC/usrdef_hgr.F90

    r14223 r14994  
    2323   IMPLICIT NONE 
    2424   PRIVATE 
     25 
     26   REAL(wp) :: roffsetx, roffsety ! Offset in km to first f-point 
    2527 
    2628   PUBLIC   usr_def_hgr   ! called by domhgr.F90 
     
    6466      ! 
    6567      INTEGER  ::   ji, jj     ! dummy loop indices 
    66       REAL(wp) ::   zphi0, zlam0, zbeta, zf0 
     68      REAL(wp) ::   zbeta, zf0 
    6769      REAL(wp) ::   zti, ztj   ! local scalars 
    6870      !!------------------------------------------------------------------------------- 
     
    7779      ! Position coordinates (in kilometers) 
    7880      !                          ========== 
    79 #if defined key_agrif  
    80       IF( Agrif_Root() ) THEN 
    81 #endif 
    82          zlam0 = -REAL(Ni0glo, wp) * 0.5 * 1.e-3 * rn_dx 
    83          zphi0 = -REAL(Nj0glo, wp) * 0.5 * 1.e-3 * rn_dy 
     81      ! offset is given at first f-point, i.e. at (i,j) = (nn_hls+1, nn_hls+1) 
     82      ! Here we assume the grid is centred around a T-point at the middle of 
     83      ! of the domain (hence domain size is odd)  
     84      roffsetx = (-REAL(Ni0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dx 
     85      roffsety = (-REAL(Nj0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dy 
    8486#if defined key_agrif 
    85       ELSE 
    86          ! ! let lower left longitude and latitude from parent 
    87          zlam0 = ( 0.5_wp - REAL(Ni0glo, wp) * 0.5 ) * 1.e-3 * Agrif_irhox() * rn_dx  & 
    88             &  + ( Agrif_Ix() + nbghostcells - 1 ) * Agrif_irhox() * rn_dx * 1.e-3 - ( 0.5_wp + nbghostcells ) * rn_dx * 1.e-3 
    89          zphi0 = ( 0.5_wp - REAL(Nj0glo, wp) * 0.5 ) * 1.e-3 * Agrif_irhoy() * rn_dy  & 
    90             &  + ( Agrif_Iy() + nbghostcells - 1 ) * Agrif_irhoy() * rn_dy * 1.e-3 - ( 0.5_wp + nbghostcells ) * rn_dy * 1.e-3 
    91       ENDIF  
    92 #endif 
     87      IF( .NOT.Agrif_Root() ) THEN 
     88         ! deduce offset from parent: 
     89         roffsetx = Agrif_Parent(roffsetx) & 
     90                  & + (-(nbghostcells_x   - 1) + (Agrif_Parent(nbghostcells_x  ) + Agrif_Ix()-2)*Agrif_Rhox()) * 1.e-3 * rn_dx 
     91         roffsety = Agrif_Parent(roffsety) & 
     92                  & + (-(nbghostcells_y_s - 1) + (Agrif_Parent(nbghostcells_y_s) + Agrif_Iy()-2)*Agrif_Rhoy()) * 1.e-3 * rn_dy 
     93      ENDIF 
     94#endif          
     95      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     96         zti = REAL( mig0(ji)-1, wp )  ! start at i=0 in the global grid without halos 
     97         ztj = REAL( mjg0(jj)-1, wp )  ! start at j=0 in the global grid without halos 
    9398          
    94       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    95          zti = REAL( mig0(ji), wp ) - 0.5_wp  ! start at i=0.5 in the global grid without halos 
    96          ztj = REAL( mjg0(jj), wp ) - 0.5_wp  ! start at j=0.5 in the global grid without halos 
    97           
    98          plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 *   zti 
    99          plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * ( zti + 0.5_wp ) 
     99         plamt(ji,jj) = roffsetx + rn_dx * 1.e-3 * ( zti - 0.5_wp ) 
     100         plamu(ji,jj) = roffsetx + rn_dx * 1.e-3 *   zti  
    100101         plamv(ji,jj) = plamt(ji,jj)  
    101102         plamf(ji,jj) = plamu(ji,jj)  
    102103          
    103          pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 *   ztj 
    104          pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * ( ztj + 0.5_wp ) 
     104         pphit(ji,jj) = roffsety + rn_dy * 1.e-3 * ( ztj - 0.5_wp ) 
     105         pphiv(ji,jj) = roffsety + rn_dy * 1.e-3 *   ztj  
    105106         pphiu(ji,jj) = pphit(ji,jj)  
    106107         pphif(ji,jj) = pphiv(ji,jj)  
Note: See TracChangeset for help on using the changeset viewer.