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 3294 for trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90 – NEMO

Ignore:
Timestamp:
2012-01-28T17:44:18+01:00 (12 years ago)
Author:
rblod
Message:

Merge of 3.4beta into the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90

    r2715 r3294  
    88   !!   NEMO     0.5  !  2002-08  (G. Madec)  F90: Free form and module 
    99   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps 
     10   !!            3.4  !  2012-01  (H. Liu) Semi-implicit bottom friction 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    2021   USE in_out_manager  ! I/O manager 
    2122   USE lib_mpp         ! MPP library 
     23   USE zdfbfr          ! Bottom friction setup 
     24   USE wrk_nemo        ! Memory Allocation 
     25   USE timing          ! Timing 
    2226 
    2327   IMPLICIT NONE 
     
    5458      !! ** Action : - Update (ua,va) arrays with the after vertical diffusive mixing trend. 
    5559      !!--------------------------------------------------------------------- 
    56       USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
    57       USE oce     , ONLY:  zwd  => ta       , zws   => sa   ! (ta,sa) used as 3D workspace 
    58       USE wrk_nemo, ONLY:   zwi => wrk_3d_3                 ! 3D workspace 
    59       !! 
    60       INTEGER , INTENT(in) ::   kt    ! ocean time-step index 
     60      INTEGER , INTENT(in) ::  kt     ! ocean time-step index 
    6161      REAL(wp), INTENT(in) ::  p2dt   ! vertical profile of tracer time-step 
    6262      !! 
    6363      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     64      INTEGER  ::   ikbu, ikbv   ! local integers 
    6465      REAL(wp) ::   z1_p2dt, zcoef, zzwi, zzws, zrhs   ! local scalars 
    6566      !!---------------------------------------------------------------------- 
    6667 
    67       IF( wrk_in_use(3, 3) ) THEN 
    68          CALL ctl_stop('dyn_zdf_imp: requested workspace array unavailable')   ;   RETURN 
    69       END IF 
    70  
     68      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwi, zwd, zws 
     69      REAL(wp), POINTER, DIMENSION(:,:)   ::  zavmu, zavmv 
     70      !!---------------------------------------------------------------------- 
     71      ! 
     72      IF( nn_timing == 1 )  CALL timing_start('dyn_zdf_imp') 
     73      ! 
     74      CALL wrk_alloc( jpi,jpj,jpk, zwi, zwd, zws )  
     75      CALL wrk_alloc( jpi,jpj, zavmu, zavmv )  
     76      ! 
    7177      IF( kt == nit000 ) THEN 
    7278         IF(lwp) WRITE(numout,*) 
     
    7985      z1_p2dt = 1._wp / p2dt      ! inverse of the timestep 
    8086 
    81       ! 1. Vertical diffusion on u 
     87      ! 1. Apply semi-implicit bottom friction 
     88      ! -------------------------------------- 
     89      ! Only needed for semi-implicit bottom friction setup. The explicit 
     90      ! bottom friction has been included in "u(v)a" which act as the R.H.S 
     91      ! column vector of the tri-diagonal matrix equation 
     92      ! 
     93 
     94      IF( ln_bfrimp ) THEN 
     95# if defined key_vectopt_loop 
     96      DO jj = 1, 1 
     97         DO ji = jpi+2, jpij-jpi-1   ! vector opt. (forced unrolling) 
     98# else 
     99      DO jj = 2, jpjm1 
     100         DO ji = 2, jpim1 
     101# endif 
     102            ikbu = mbku(ji,jj)         ! ocean bottom level at u- and v-points  
     103            ikbv = mbkv(ji,jj)         ! (deepest ocean u- and v-points) 
     104            zavmu(ji,jj) = avmu(ji,jj,ikbu+1) 
     105            zavmv(ji,jj) = avmv(ji,jj,ikbv+1) 
     106            avmu(ji,jj,ikbu+1) = -bfrua(ji,jj) * fse3uw(ji,jj,ikbu+1)  
     107            avmv(ji,jj,ikbv+1) = -bfrva(ji,jj) * fse3vw(ji,jj,ikbv+1) 
     108         END DO 
     109      END DO 
     110      ENDIF 
     111 
     112      ! 2. Vertical diffusion on u 
    82113      ! --------------------------- 
    83114      ! Matrix and second member construction 
    84115      ! bottom boundary condition: both zwi and zws must be masked as avmu can take 
    85       ! non zero value at the ocean bottom depending on the bottom friction 
    86       ! used but the bottom velocities have already been updated with the bottom 
    87       ! friction velocity in dyn_bfr using values from the previous timestep. There 
    88       ! is no need to include these in the implicit calculation. 
     116      ! non zero value at the ocean bottom depending on the bottom friction used. 
    89117      ! 
    90118      DO jk = 1, jpkm1        ! Matrix 
     
    168196 
    169197 
    170       ! 2. Vertical diffusion on v 
     198      ! 3. Vertical diffusion on v 
    171199      ! --------------------------- 
    172200      ! Matrix and second member construction 
    173201      ! bottom boundary condition: both zwi and zws must be masked as avmv can take 
    174       ! non zero value at the ocean bottom depending on the bottom friction 
    175       ! used but the bottom velocities have already been updated with the bottom 
    176       ! friction velocity in dyn_bfr using values from the previous timestep. There 
    177       ! is no need to include these in the implicit calculation. 
     202      ! non zero value at the ocean bottom depending on the bottom friction used 
    178203      ! 
    179204      DO jk = 1, jpkm1        ! Matrix 
     
    255280         END DO 
    256281      END DO 
    257       ! 
    258       IF( wrk_not_released(3, 3) )   CALL ctl_stop('dyn_zdf_imp: failed to release workspace array') 
     282 
     283      !! restore bottom layer avmu(v)  
     284      IF( ln_bfrimp ) THEN 
     285# if defined key_vectopt_loop 
     286      DO jj = 1, 1 
     287         DO ji = jpi+2, jpij-jpi-1   ! vector opt. (forced unrolling) 
     288# else 
     289      DO jj = 2, jpjm1 
     290         DO ji = 2, jpim1 
     291# endif 
     292            ikbu = mbku(ji,jj)         ! ocean bottom level at u- and v-points  
     293            ikbv = mbkv(ji,jj)         ! (deepest ocean u- and v-points) 
     294            avmu(ji,jj,ikbu+1) = zavmu(ji,jj) 
     295            avmv(ji,jj,ikbv+1) = zavmv(ji,jj) 
     296         END DO 
     297      END DO 
     298      ENDIF 
     299      ! 
     300      CALL wrk_dealloc( jpi,jpj,jpk, zwi, zwd, zws)  
     301      CALL wrk_dealloc( jpi,jpj, zavmu, zavmv)  
     302      ! 
     303      IF( nn_timing == 1 )  CALL timing_stop('dyn_zdf_imp') 
    259304      ! 
    260305   END SUBROUTINE dyn_zdf_imp 
Note: See TracChangeset for help on using the changeset viewer.