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 6225 for branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/OPA_SRC/C1D/dyndmp.F90 – NEMO

Ignore:
Timestamp:
2016-01-08T10:35:19+01:00 (8 years ago)
Author:
jamesharle
Message:

Update MPP_BDY_UPDATE branch to be consistent with head of trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/OPA_SRC/C1D/dyndmp.F90

    • Property svn:keywords set to Id
    r4624 r6225  
    33   !!                       ***  MODULE  dyndmp  *** 
    44   !! Ocean dynamics: internal restoring trend on momentum (U and V current) 
     5   !!                 This should only be used for C1D case in current form 
    56   !!====================================================================== 
    67   !! History :  3.5  ! 2013-08  (D. Calvert)  Original code 
     8   !!            3.6  ! 2014-08  (T. Graham) Modified to use netcdf file of 
     9   !!                             restoration coefficients supplied to tradmp 
    710   !!---------------------------------------------------------------------- 
    811 
     
    1518   USE dom_oce        ! ocean: domain variables 
    1619   USE c1d            ! 1D vertical configuration 
    17    USE trdmod         ! ocean: trends 
    18    USE trdmod_oce     ! ocean: trends variables 
    1920   USE tradmp         ! ocean: internal damping 
    2021   USE zdf_oce        ! ocean: vertical physics 
     
    2223   USE dtauvd         ! data: U & V current 
    2324   USE zdfmxl         ! vertical physics: mixed layer depth 
     25   ! 
    2426   USE in_out_manager ! I/O manager 
    2527   USE lib_mpp        ! MPP library 
     
    2729   USE wrk_nemo       ! Memory allocation 
    2830   USE timing         ! Timing 
     31   USE iom            ! I/O manager 
    2932 
    3033   IMPLICIT NONE 
     
    3437   PUBLIC   dyn_dmp      ! routine called by step_c1d.F90 
    3538 
    36    LOGICAL, PUBLIC ::   ln_dyndmp           ! Flag for Newtonian damping 
    37  
    38    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  utrdmp    ! damping U current trend (m/s2) 
    39    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  vtrdmp    ! damping V current trend (m/s2) 
    40    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  resto_uv  ! restoring coeff. on U & V current 
     39   LOGICAL, PUBLIC ::   ln_dyndmp   !: Flag for Newtonian damping 
     40 
     41   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  utrdmp    !: damping U current trend (m/s2) 
     42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  vtrdmp    !: damping V current trend (m/s2) 
     43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  resto_uv  !: restoring coeff. on U & V current 
    4144 
    4245   !! * Substitutions 
    43 #  include "domzgr_substitute.h90" 
    4446#  include "vectopt_loop_substitute.h90" 
    4547   !!---------------------------------------------------------------------- 
    46    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    47    !! $Id: dyndmp.F90 3294 2012-01-28 16:44:18Z rblod $  
     48   !! NEMO/OPA 3.7 , NEMO Consortium (2015) 
     49   !! $Id$  
    4850   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4951   !!---------------------------------------------------------------------- 
     
    7375      !!              - calculate damping coefficient 
    7476      !!---------------------------------------------------------------------- 
     77      INTEGER ::   ios, imask   ! local integers 
     78      !! 
    7579      NAMELIST/namc1d_dyndmp/ ln_dyndmp 
    76       INTEGER :: ios 
    77       !!---------------------------------------------------------------------- 
    78  
     80      !!---------------------------------------------------------------------- 
     81      ! 
    7982      REWIND( numnam_ref )              ! Namelist namc1d_dyndmp in reference namelist :  
    8083      READ  ( numnam_ref, namc1d_dyndmp, IOSTAT = ios, ERR = 901) 
    81 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc1d_dyndmp in reference namelist', lwp ) 
    82  
     84901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in reference namelist', lwp ) 
     85      ! 
    8386      REWIND( numnam_cfg )              ! Namelist namc1d_dyndmp in configuration namelist : Parameters of the run 
    8487      READ  ( numnam_cfg, namc1d_dyndmp, IOSTAT = ios, ERR = 902 ) 
    85 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc1d_dyndmp in configuration namelist', lwp ) 
     88902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in configuration namelist', lwp ) 
    8689      IF(lwm) WRITE ( numond, namc1d_dyndmp ) 
    87  
     90      ! 
    8891      IF(lwp) THEN                           ! control print 
    8992         WRITE(numout,*) 
     
    9396         WRITE(numout,*) '      add a damping term or not       ln_dyndmp = ', ln_dyndmp 
    9497         WRITE(numout,*) '   Namelist namtra_dmp    : Set damping parameters' 
    95          WRITE(numout,*) '      horizontal damping option       nn_hdmp   = ', nn_hdmp 
    96          WRITE(numout,*) '      mixed layer damping option      nn_zdmp   = ', nn_zdmp, '(non-C1D zoom: forced to 0)' 
    97          WRITE(numout,*) '      surface time scale (days)       rn_surf   = ', rn_surf 
    98          WRITE(numout,*) '      bottom time scale (days)        rn_bot    = ', rn_bot 
    99          WRITE(numout,*) '      depth of transition (meters)    rn_dep    = ', rn_dep 
    100          WRITE(numout,*) '      create a damping.coeff file     nn_file   = ', nn_file 
     98         WRITE(numout,*) '      Apply relaxation   or not       ln_tradmp = ', ln_tradmp 
     99         WRITE(numout,*) '      mixed layer damping option      nn_zdmp   = ', nn_zdmp 
     100         WRITE(numout,*) '      Damping file name               cn_resto  = ', cn_resto 
    101101         WRITE(numout,*) 
    102102      ENDIF 
    103  
     103      ! 
    104104      IF( ln_dyndmp ) THEN 
    105105         !                                   !==   allocate the data arrays   ==! 
    106106         IF( dyn_dmp_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'dyn_dmp_init: unable to allocate arrays' ) 
    107107         ! 
    108 #if ! defined key_c1d 
    109          SELECT CASE ( nn_hdmp )             !==   control print of horizontal option   ==! 
    110          CASE (  -1  )   ;   IF(lwp) WRITE(numout,*) '   momentum damping in the Med & Red seas only' 
    111          CASE ( 1:90 )   ;   IF(lwp) WRITE(numout,*) '   momentum damping poleward of', nn_hdmp, ' degrees' 
    112          CASE DEFAULT 
    113             WRITE(ctmp1,*) '          bad flag value for nn_hdmp = ', nn_hdmp 
    114             CALL ctl_stop(ctmp1) 
    115          END SELECT 
    116          ! 
    117 #endif 
    118108         SELECT CASE ( nn_zdmp )             !==   control print of vertical option   ==! 
    119109         CASE ( 0    )   ;   IF(lwp) WRITE(numout,*) '   momentum damping throughout the water column' 
     
    132122         utrdmp(:,:,:) = 0._wp               ! internal damping trends 
    133123         vtrdmp(:,:,:) = 0._wp 
    134          !                                   !==   Damping coefficients calculation:                           ==! 
    135          !                                   !==   use tradmp.F90 subroutines dtacof, dtacof_zoom and cofdis   ==! 
    136          !                                   !!!   NOTE: these need to be altered for use in this module if  
    137          !                                   !!!       they are to be used outside the C1D context  
    138          !                                   !!!       (use of U,V grid variables) 
    139          IF( lzoom .AND. .NOT. lk_c1d ) THEN   ;   CALL dtacof_zoom( resto_uv ) 
    140          ELSE               ;   CALL dtacof( nn_hdmp, rn_surf, rn_bot, rn_dep, nn_file, 'DYN', resto_uv ) 
    141          ENDIF 
    142          ! 
     124         ! 
     125         !Read in mask from file 
     126         CALL iom_open ( cn_resto, imask) 
     127         CALL iom_get  ( imask, jpdom_autoglo, 'resto', resto) 
     128         CALL iom_close( imask ) 
    143129      ENDIF 
    144130      ! 
     
    164150      !! ** Action  : - (ua,va)   momentum trends updated with the damping trend 
    165151      !!---------------------------------------------------------------------- 
    166       ! 
    167       INTEGER, INTENT(in) ::   kt                        ! ocean time-step index 
    168       !! 
    169       INTEGER  ::   ji, jj, jk                           ! dummy loop indices 
    170       REAL(wp) ::   zua, zva                             ! local scalars 
    171       REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  zuv_dta  ! Read in data  
     152      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     153      !! 
     154      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     155      REAL(wp) ::   zua, zva     ! local scalars 
     156      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   zuv_dta   ! Read in data  
    172157      !!---------------------------------------------------------------------- 
    173158      ! 
    174159      IF( nn_timing == 1 )  CALL timing_start( 'dyn_dmp' ) 
    175160      ! 
    176       CALL wrk_alloc( jpi, jpj, jpk, 2,  zuv_dta ) 
     161      CALL wrk_alloc( jpi,jpj,jpk,2,   zuv_dta ) 
    177162      ! 
    178163      !                           !==   read and interpolate U & V current data at kt   ==! 
     
    219204            DO jj = 2, jpjm1 
    220205               DO ji = fs_2, fs_jpim1   ! vector opt. 
    221                   IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN 
     206                  IF( gdept_n(ji,jj,jk) >= hmlp (ji,jj) ) THEN 
    222207                     zua = resto_uv(ji,jj,jk) * ( zuv_dta(ji,jj,jk,1) - ub(ji,jj,jk) ) 
    223208                     zva = resto_uv(ji,jj,jk) * ( zuv_dta(ji,jj,jk,2) - vb(ji,jj,jk) ) 
     
    236221      END SELECT 
    237222      ! 
    238       !                           ! Trend diagnostic 
    239       IF( l_trddyn )   CALL trd_mod( utrdmp, vtrdmp, jpdyn_trd_dat, 'DYN', kt ) 
    240       ! 
    241223      !                           ! Control print 
    242224      IF( ln_ctl   )   CALL prt_ctl( tab3d_1=ua(:,:,:), clinfo1=' dmp  - Ua: ', mask1=umask,   & 
    243225         &                           tab3d_2=va(:,:,:), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' ) 
    244226      ! 
    245       CALL wrk_dealloc( jpi, jpj, jpk, 2,  zuv_dta ) 
     227      CALL wrk_dealloc( jpi,jpj,jpk,2,   zuv_dta ) 
    246228      ! 
    247229      IF( nn_timing == 1 )  CALL timing_stop( 'dyn_dmp') 
Note: See TracChangeset for help on using the changeset viewer.