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 13334 for NEMO/branches/2020/dev_r13312_AGRIF-03-04_jchanut_vinterp_tstep/tests/VORTEX/MY_SRC/domvvl.F90 – NEMO

Ignore:
Timestamp:
2020-07-22T16:20:32+02:00 (4 years ago)
Author:
jchanut
Message:

finish bypassing ocean/ice initialization with AGRIF, #2222, #2129

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13312_AGRIF-03-04_jchanut_vinterp_tstep/tests/VORTEX/MY_SRC/domvvl.F90

    r13295 r13334  
    99   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability 
    1010   !!            4.1  !  2019-08  (A. Coward, D. Storkey) rename dom_vvl_sf_swp -> dom_vvl_sf_update for new timestepping 
     11   !!            4.x  ! 2020-02  (G. Madec, S. Techene) introduce ssh to h0 ratio 
    1112   !!---------------------------------------------------------------------- 
    1213 
    13    !!---------------------------------------------------------------------- 
    14    !!   dom_vvl_init     : define initial vertical scale factors, depths and column thickness 
    15    !!   dom_vvl_sf_nxt   : Compute next vertical scale factors 
    16    !!   dom_vvl_sf_update   : Swap vertical scale factors and update the vertical grid 
    17    !!   dom_vvl_interpol : Interpolate vertical scale factors from one grid point to another 
    18    !!   dom_vvl_rst      : read/write restart file 
    19    !!   dom_vvl_ctl      : Check the vvl options 
    20    !!---------------------------------------------------------------------- 
    2114   USE oce             ! ocean dynamics and tracers 
    2215   USE phycst          ! physical constant 
     
    3326   USE timing          ! Timing 
    3427 
     28   USE agrif_oce ! initial state interpolation 
     29   USE agrif_oce_interp 
     30 
    3531   IMPLICIT NONE 
    3632   PRIVATE 
    37  
    38    PUBLIC  dom_vvl_init       ! called by domain.F90 
    39    PUBLIC  dom_vvl_zgr        ! called by isfcpl.F90 
    40    PUBLIC  dom_vvl_sf_nxt     ! called by step.F90 
    41    PUBLIC  dom_vvl_sf_update  ! called by step.F90 
    42    PUBLIC  dom_vvl_interpol   ! called by dynnxt.F90 
    4333 
    4434   !                                                      !!* Namelist nam_vvl 
     
    6353   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   :: frq_rst_hdv                 ! retoring period for low freq. divergence 
    6454 
     55#if defined key_qco 
     56   !!---------------------------------------------------------------------- 
     57   !!   'key_qco'      EMPTY MODULE      Quasi-Eulerian vertical coordonate 
     58   !!---------------------------------------------------------------------- 
     59#else 
     60   !!---------------------------------------------------------------------- 
     61   !!   Default key      Old management of time varying vertical coordinate 
     62   !!---------------------------------------------------------------------- 
     63    
     64   !!---------------------------------------------------------------------- 
     65   !!   dom_vvl_init     : define initial vertical scale factors, depths and column thickness 
     66   !!   dom_vvl_sf_nxt   : Compute next vertical scale factors 
     67   !!   dom_vvl_sf_update   : Swap vertical scale factors and update the vertical grid 
     68   !!   dom_vvl_interpol : Interpolate vertical scale factors from one grid point to another 
     69   !!   dom_vvl_rst      : read/write restart file 
     70   !!   dom_vvl_ctl      : Check the vvl options 
     71   !!---------------------------------------------------------------------- 
     72 
     73   PUBLIC  dom_vvl_init       ! called by domain.F90 
     74   PUBLIC  dom_vvl_zgr        ! called by isfcpl.F90 
     75   PUBLIC  dom_vvl_sf_nxt     ! called by step.F90 
     76   PUBLIC  dom_vvl_sf_update  ! called by step.F90 
     77   PUBLIC  dom_vvl_interpol   ! called by dynnxt.F90 
     78    
    6579   !! * Substitutions 
    6680#  include "do_loop_substitute.h90" 
     
    135149      ! 
    136150   END SUBROUTINE dom_vvl_init 
    137    ! 
     151 
     152 
    138153   SUBROUTINE dom_vvl_zgr(Kbb, Kmm, Kaa) 
    139154      !!---------------------------------------------------------------------- 
     
    261276            IF( cn_cfg == "orca" .OR. cn_cfg == "ORCA" ) THEN 
    262277               IF( nn_cfg == 3 ) THEN   ! ORCA2: Suppress ztilde in the Foxe Basin for ORCA2 
    263                   ii0 = 103   ;   ii1 = 111        
    264                   ij0 = 128   ;   ij1 = 135   ;    
     278                  ii0 = 103 + nn_hls - 1   ;   ii1 = 111 + nn_hls - 1       
     279                  ij0 = 128 + nn_hls       ;   ij1 = 135 + nn_hls 
    265280                  frq_rst_e3t( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  0.0_wp 
    266281                  frq_rst_hdv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  1.e0_wp / rn_Dt 
     
    450465            ELSE 
    451466               ijk_max = MAXLOC( ze3t(:,:,:) ) 
    452                ijk_max(1) = mig0_oldcmp(ijk_max(1)) 
    453                ijk_max(2) = mjg0_oldcmp(ijk_max(2)) 
     467               ijk_max(1) = ijk_max(1) + nimpp - 1 
     468               ijk_max(2) = ijk_max(2) + njmpp - 1 
    454469               ijk_min = MINLOC( ze3t(:,:,:) ) 
    455                ijk_min(1) = mig0_oldcmp(ijk_min(1)) 
    456                ijk_min(2) = mjg0_oldcmp(ijk_min(2)) 
     470               ijk_min(1) = ijk_min(1) + nimpp - 1 
     471               ijk_min(2) = ijk_min(2) + njmpp - 1 
    457472            ENDIF 
    458473            IF (lwp) THEN 
     
    792807         !                                   ! =============== 
    793808         IF( ln_rstart ) THEN                   !* Read the restart file 
    794             CALL rst_read_open                  !  open the restart file if necessary 
    795             CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    ) 
    796             ! 
    797             id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. ) 
    798             id2 = iom_varid( numror, 'e3t_n', ldstop = .FALSE. ) 
    799             id3 = iom_varid( numror, 'tilde_e3t_b', ldstop = .FALSE. ) 
    800             id4 = iom_varid( numror, 'tilde_e3t_n', ldstop = .FALSE. ) 
    801             id5 = iom_varid( numror, 'hdiv_lf', ldstop = .FALSE. ) 
    802             ! 
     809#if defined key_agrif 
     810            IF ( (.NOT.Agrif_root()).AND.(ln_init_chfrpar) ) THEN 
     811               ! skip reading restart if initialized from parent: 
     812               id1 = -1 ; id2 = -1 ; id3 = -1 ; id4 = -1 ; id5 = -1 
     813            ELSE 
     814#endif 
     815               CALL rst_read_open                  !  open the restart file if necessary 
     816               CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    ) 
     817               ! 
     818               id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. ) 
     819               id2 = iom_varid( numror, 'e3t_n', ldstop = .FALSE. ) 
     820               id3 = iom_varid( numror, 'tilde_e3t_b', ldstop = .FALSE. ) 
     821               id4 = iom_varid( numror, 'tilde_e3t_n', ldstop = .FALSE. ) 
     822               id5 = iom_varid( numror, 'hdiv_lf', ldstop = .FALSE. ) 
     823#if defined key_agrif 
     824            ENDIF 
     825#endif 
    803826            !                             ! --------- ! 
    804827            !                             ! all cases ! 
     
    837860               DO jk = 1, jpk 
    838861                  e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kmm) ) & 
    839                       &                          / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    840                       &          + e3t_0(:,:,jk)                               * (1._wp -tmask(:,:,jk)) 
     862                      &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
     863                      &            + e3t_0(:,:,jk)                               * (1._wp -tmask(:,:,jk)) 
    841864               END DO 
    842865               e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
     
    911934            ELSE 
    912935               ! 
    913                ! usr_def_istate called here only to get ssh(Kbb) needed to initialize e3t(Kbb) and e3t(Kmm) 
    914                ! 
    915                CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )   
    916                ! 
    917                ! usr_def_istate will be called again in istate_init to initialize ts, ssh, u and v 
     936               ! Just to read set ssh in fact, called latter once vertical grid 
     937               ! is set up: 
     938               CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
    918939               ! 
    919940               DO jk=1,jpk 
    920941                  e3t(:,:,jk,Kbb) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kbb) ) & 
    921                     &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)  & 
    922                     &            + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) )   ! make sure e3t(:,:,:,Kbb) != 0 on land points 
     942                     &                             / ( ht_0(:,:) + 1._wp -ssmask(:,:) ) * tmask(:,:,jk) & 
     943                     &             + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
    923944               END DO 
    924945               e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb) 
    925                ssh(:,:,Kmm) = ssh(:,:,Kbb)                                     ! needed later for gde3w 
     946!               ssh(:,:,Kmm)=0._wp 
     947!               e3t(:,:,:,Kmm)=e3t_0(:,:,:) 
     948!               e3t(:,:,:,Kbb)=e3t_0(:,:,:) 
    926949               ! 
    927950            END IF           ! end of ll_wd edits 
     
    933956            END IF 
    934957         ENDIF 
     958 
     959#if defined key_agrif 
     960         IF ( .NOT.Agrif_root().AND.(ln_init_chfrpar) ) THEN 
     961            ! Interpolate initial ssh from parent: 
     962            CALL Agrif_istate_ssh( Kbb, Kmm ) 
     963            ! 
     964            DO jk = 1, jpk 
     965               e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kmm)  ) & 
     966                 &                              / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
     967                 &              + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
     968            END DO 
     969            e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
     970         ENDIF 
     971#endif 
    935972         ! 
    936973      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file 
     
    10301067   END SUBROUTINE dom_vvl_ctl 
    10311068 
     1069#endif 
     1070 
    10321071   !!====================================================================== 
    10331072END MODULE domvvl 
Note: See TracChangeset for help on using the changeset viewer.