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 9023 for branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90 – NEMO

Ignore:
Timestamp:
2017-12-13T18:08:50+01:00 (6 years ago)
Author:
timgraham
Message:

Merged METO_MERCATOR branch and resolved all conflicts in OPA_SRC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90

    r9019 r9023  
    672672      ! 
    673673      INTEGER ::   ji, jj, jk                                       ! dummy loop indices 
    674       REAL(wp) ::  zlnwd                                            ! =1./0. when ln_wd = T/F 
     674      REAL(wp) ::  zlnwd                                            ! =1./0. when ln_wd_il = T/F 
    675675      !!---------------------------------------------------------------------- 
    676676      ! 
    677677      IF( ln_timing )   CALL timing_start('dom_vvl_interpol') 
    678678      ! 
    679       IF(ln_wd) THEN 
     679      IF(ln_wd_il) THEN 
    680680        zlnwd = 1.0_wp 
    681681      ELSE 
     
    869869         ELSE                                   !* Initialize at "rest" 
    870870            ! 
    871             IF( ln_wd .AND. ( cn_cfg == 'wad' ) ) THEN 
    872               ! Wetting and drying test case 
    873               CALL usr_def_istate( gdept_b, tmask, tsb, ub, vb, sshb  ) 
    874                        tsn  (:,:,:,:) = tsb (:,:,:,:)       ! set now values from to before ones 
    875                        sshn (:,:)     = sshb(:,:) 
    876                        un   (:,:,:)   = ub  (:,:,:) 
    877                        vn   (:,:,:)   = vb  (:,:,:) 
    878                                                 ! uniform T-S fields and initial ssh slope 
    879                ! needs to be called here and in istate which is called later. 
    880                ! Adjust vertical metrics 
     871 
     872            IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential  
     873               ! 
     874               IF( cn_cfg == 'wad' ) THEN 
     875                  ! Wetting and drying test case 
     876                  CALL usr_def_istate( gdept_b, tmask, tsb, ub, vb, sshb  ) 
     877                  tsn  (:,:,:,:) = tsb (:,:,:,:)       ! set now values from to before ones 
     878                  sshn (:,:)     = sshb(:,:) 
     879                  un   (:,:,:)   = ub  (:,:,:) 
     880                  vn   (:,:,:)   = vb  (:,:,:) 
     881               ELSE 
     882                  ! if not test case 
     883                  sshn(:,:) = -ssh_ref 
     884                  sshb(:,:) = -ssh_ref 
     885 
     886                  DO jj = 1, jpj 
     887                     DO ji = 1, jpi 
     888                        IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth 
     889 
     890                           sshb(ji,jj) = rn_wdmin1 - (ht_0(ji,jj) ) 
     891                           sshn(ji,jj) = rn_wdmin1 - (ht_0(ji,jj) ) 
     892                           ssha(ji,jj) = rn_wdmin1 - (ht_0(ji,jj) ) 
     893                        ENDIF 
     894                     ENDDO 
     895                  ENDDO 
     896               ENDIF !If test case else 
     897 
     898               ! Adjust vertical metrics for all wad 
    881899               DO jk = 1, jpk 
    882                   e3t_n(:,:,jk) =  e3t_0(:,:,jk) * ( ht_0(:,:) + sshn(:,:) ) & 
     900                  e3t_n(:,:,jk) =  e3t_0(:,:,jk) * ( ht_0(:,:) + sshn(:,:)  ) & 
    883901                    &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    884                     &            + e3t_0(:,:,jk)                               * (1._wp -tmask(:,:,jk)) 
     902                    &            + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
    885903               END DO 
    886904               e3t_b(:,:,:) = e3t_n(:,:,:) 
    887                ! 
    888             ELSEIF( ln_wd ) THEN 
    889                ! 
    890               DO jj = 1, jpj 
    891                 DO ji = 1, jpi 
    892                   IF( e3t_0(ji,jj,1) <= 0.5_wp * rn_wdmin1 ) THEN 
    893                      ! potential bug 
    894                      ! Warning this assumes 2 layers only over wetting locations. needs investigating 
    895                      e3t_b(ji,jj,:) = 0.5_wp * rn_wdmin1 
    896                      e3t_n(ji,jj,:) = 0.5_wp * rn_wdmin1 
    897                      e3t_a(ji,jj,:) = 0.5_wp * rn_wdmin1 
    898                      sshb(ji,jj) = rn_wdmin1 - ht_wd(ji,jj)           !!gm I don't understand that ! 
    899                      sshn(ji,jj) = rn_wdmin1 - ht_wd(ji,jj) 
    900                      ssha(ji,jj) = rn_wdmin1 - ht_wd(ji,jj) 
    901                   ENDIF 
    902                 ENDDO 
    903               ENDDO 
     905 
     906               DO ji = 1, jpi 
     907                  DO jj = 1, jpj 
     908                     IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN 
     909                       CALL ctl_stop( 'dom_vvl_rst: ht_0 must be positive at potentially wet points' ) 
     910                     ENDIF 
     911                  END DO  
     912               END DO  
     913  
    904914               ! 
    905915            ELSE 
     
    909919               sshn(:,:) = 0.0_wp 
    910920               ! 
    911             END IF 
     921            END IF           ! end of ll_wd edits 
    912922 
    913923            IF( ln_vvl_ztilde .OR. ln_vvl_layer) THEN 
     
    10221032      ! 
    10231033#if defined key_agrif 
    1024       IF(.NOT.Agrif_Root() )   CALL ctl_stop( 'AGRIF not implemented with non-linear free surface' ) 
     1034      IF( (.NOT.Agrif_Root()).AND.(.NOT.ln_vvl_zstar) )CALL ctl_stop( 'AGRIF is implemented with zstar coordinate only' ) 
    10251035#endif 
    10261036      ! 
Note: See TracChangeset for help on using the changeset viewer.