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/TOP_SRC/TRP/trcdmp.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/TOP_SRC/TRP/trcdmp.F90

    r4359 r6225  
    1818   USE oce_trc         ! ocean dynamics and tracers variables 
    1919   USE trc             ! ocean passive tracers variables 
    20    USE trcnam_trp      ! passive tracers transport namelist variables 
    2120   USE trcdta 
    2221   USE tradmp 
    2322   USE prtctl_trc      ! Print control for debbuging 
    2423   USE trdtra 
    25    USE trdmod_oce 
     24   USE trd_oce 
     25   USE iom 
    2626 
    2727   IMPLICIT NONE 
    2828   PRIVATE 
    2929 
    30    PUBLIC trc_dmp            ! routine called by step.F90 
    31    PUBLIC trc_dmp_clo        ! routine called by step.F90 
    32    PUBLIC trc_dmp_alloc      ! routine called by nemogcm.F90 
     30   PUBLIC trc_dmp       
     31   PUBLIC trc_dmp_clo    
     32   PUBLIC trc_dmp_alloc   
     33   PUBLIC trc_dmp_ini     
     34 
     35   INTEGER , PUBLIC ::   nn_zdmp_tr    ! = 0/1/2 flag for damping in the mixed layer 
     36   CHARACTER(LEN=200) , PUBLIC :: cn_resto_tr    !File containing restoration coefficient 
    3337 
    3438   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   restotr   ! restoring coeff. on tracers (s-1) 
     
    3943 
    4044   !! * Substitutions 
    41 #  include "top_substitute.h90" 
     45#  include "vectopt_loop_substitute.h90" 
    4246   !!---------------------------------------------------------------------- 
    4347   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    44    !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/TRP/trcdmp.F90,v 1.11 2006/09/01 14:03:49 opalod Exp $  
     48   !! $Id$  
    4549   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4650   !!---------------------------------------------------------------------- 
     
    7579      !! ** Action  : - update the tracer trends tra with the newtonian  
    7680      !!                damping trends. 
    77       !!              - save the trends ('key_trdmld_trc') 
    78       !!---------------------------------------------------------------------- 
    79       !! 
    80       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    81       !! 
    82       INTEGER  ::   ji, jj, jk, jn, jl       ! dummy loop indices 
    83       REAL(wp) ::   ztra                 ! temporary scalars 
    84       CHARACTER (len=22) :: charout 
     81      !!              - save the trends ('key_trdmxl_trc') 
     82      !!---------------------------------------------------------------------- 
     83      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     84      ! 
     85      INTEGER ::   ji, jj, jk, jn, jl   ! dummy loop indices 
     86      CHARACTER (len=22) ::   charout 
    8587      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrd 
    86       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace 
     88      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrcdta   ! 3D  workspace 
    8789      !!---------------------------------------------------------------------- 
    8890      ! 
    8991      IF( nn_timing == 1 )  CALL timing_start('trc_dmp') 
    9092      ! 
    91       ! 0. Initialization (first time-step only) 
    92       !    -------------- 
    93       IF( kt == nittrc000 ) CALL trc_dmp_init 
    94  
    9593      IF( l_trdtrc )   CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )   ! temporary save of trends 
    9694      ! 
     
    104102            ! 
    105103            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
    106                 
     104               ! 
    107105               jl = n_trc_index(jn)  
    108106               CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) )   ! read tracer data at nit000 
    109107               ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) 
    110  
     108               ! 
    111109               SELECT CASE ( nn_zdmp_tr ) 
    112110               ! 
     
    115113                     DO jj = 2, jpjm1 
    116114                        DO ji = fs_2, fs_jpim1   ! vector opt. 
    117                            ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    118                            tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 
     115                           tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    119116                        END DO 
    120117                     END DO 
    121118                  END DO 
    122                ! 
     119                  ! 
    123120               CASE ( 1 )                !==  no damping in the turbocline (avt > 5 cm2/s)  ==! 
    124121                  DO jk = 1, jpkm1 
    125122                     DO jj = 2, jpjm1 
    126123                        DO ji = fs_2, fs_jpim1   ! vector opt. 
    127                            IF( avt(ji,jj,jk) <= 5.e-4 )  THEN  
    128                               ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    129                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 
     124                           IF( avt(ji,jj,jk) <= 5.e-4_wp )  THEN  
     125                              tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    130126                           ENDIF 
    131127                        END DO 
    132128                     END DO 
    133129                  END DO 
    134                ! 
     130                  ! 
    135131               CASE ( 2 )               !==  no damping in the mixed layer   ==!  
    136132                  DO jk = 1, jpkm1 
    137133                     DO jj = 2, jpjm1 
    138134                        DO ji = fs_2, fs_jpim1   ! vector opt. 
    139                            IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN 
    140                               ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    141                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 
     135                           IF( gdept_n(ji,jj,jk) >= hmlp (ji,jj) ) THEN 
     136                              tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 
    142137                           END IF 
    143138                        END DO 
    144139                     END DO 
    145140                  END DO 
    146                 
     141                   
    147142               END SELECT 
    148143               !  
     
    151146            IF( l_trdtrc ) THEN 
    152147               ztrtrd(:,:,:) = tra(:,:,:,jn) -  ztrtrd(:,:,:) 
    153                CALL trd_tra( kt, 'TRC', jn, jptra_trd_dmp, ztrtrd ) 
     148               CALL trd_tra( kt, 'TRC', jn, jptra_dmp, ztrtrd ) 
    154149            END IF 
    155150            !                                                       ! =========== 
     
    161156      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd ) 
    162157      !                                          ! print mean trends (used for debugging) 
    163       IF( ln_ctl )   THEN 
    164          WRITE(charout, FMT="('dmp ')") ;  CALL prt_ctl_trc_info(charout) 
    165                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     158      IF( ln_ctl ) THEN 
     159         WRITE(charout, FMT="('dmp ')") 
     160         CALL prt_ctl_trc_info(charout) 
     161         CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    166162      ENDIF 
    167163      ! 
     
    169165      ! 
    170166   END SUBROUTINE trc_dmp 
     167 
     168 
     169   SUBROUTINE trc_dmp_ini 
     170      !!---------------------------------------------------------------------- 
     171      !!                  ***  ROUTINE trc_dmp_ini  *** 
     172      !!  
     173      !! ** Purpose :   Initialization for the newtonian damping  
     174      !! 
     175      !! ** Method  :   read the nammbf namelist and check the parameters 
     176      !!              called by trc_dmp at the first timestep (nittrc000) 
     177      !!---------------------------------------------------------------------- 
     178      INTEGER ::   ios, imask  ! local integers 
     179      !! 
     180      NAMELIST/namtrc_dmp/ nn_zdmp_tr , cn_resto_tr 
     181      !!---------------------------------------------------------------------- 
     182      ! 
     183      IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
     184      ! 
     185      REWIND( numnat_ref )              ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping 
     186      READ  ( numnat_ref, namtrc_dmp, IOSTAT = ios, ERR = 909) 
     187909   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in reference namelist', lwp ) 
     188 
     189      REWIND( numnat_cfg )              ! Namelist namtrc_dmp in configuration namelist : Passive tracers newtonian damping 
     190      READ  ( numnat_cfg, namtrc_dmp, IOSTAT = ios, ERR = 910) 
     191910   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in configuration namelist', lwp ) 
     192      IF(lwm) WRITE ( numont, namtrc_dmp ) 
     193 
     194      IF(lwp) THEN                       ! Namelist print 
     195         WRITE(numout,*) 
     196         WRITE(numout,*) 'trc_dmp : Passive tracers newtonian damping' 
     197         WRITE(numout,*) '~~~~~~~' 
     198         WRITE(numout,*) '   Namelist namtrc_dmp : set damping parameter' 
     199         WRITE(numout,*) '      mixed layer damping option     nn_zdmp_tr = ', nn_zdmp_tr, '(zoom: forced to 0)' 
     200         WRITE(numout,*) '      Restoration coeff file    cn_resto_tr = ', cn_resto_tr 
     201      ENDIF 
     202      ! 
     203      IF( lzoom .AND. .NOT.lk_c1d )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
     204      SELECT CASE ( nn_zdmp_tr ) 
     205      CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column' 
     206      CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)' 
     207      CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer' 
     208      CASE DEFAULT 
     209         WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 
     210         CALL ctl_stop(ctmp1) 
     211      END SELECT 
     212 
     213      IF( .NOT.lk_c1d ) THEN 
     214         IF( .NOT. ln_tradmp )   & 
     215            &   CALL ctl_stop( 'passive trace damping need ln_tradmp to compute damping coef.' ) 
     216         ! 
     217         !                          ! Read damping coefficients from file 
     218         !Read in mask from file 
     219         CALL iom_open ( cn_resto_tr, imask) 
     220         CALL iom_get  ( imask, jpdom_autoglo, 'resto', restotr) 
     221         CALL iom_close( imask ) 
     222         ! 
     223      ENDIF 
     224      IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init') 
     225      ! 
     226   END SUBROUTINE trc_dmp_ini 
     227 
    171228 
    172229   SUBROUTINE trc_dmp_clo( kt ) 
     
    182239      !!                nctsi2(), nctsj2() : north-east Closed sea limits (i,j) 
    183240      !!---------------------------------------------------------------------- 
    184       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    185       ! 
    186       INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indicesa 
    187       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace 
    188  
    189       !!---------------------------------------------------------------------- 
    190  
     241      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     242      ! 
     243      INTEGER ::   ji , jj, jk, jn, jl, jc   ! dummy loop indicesa 
     244      INTEGER ::   isrow                     ! local index 
     245      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrcdta   ! 3D  workspace 
     246      !!---------------------------------------------------------------------- 
     247      ! 
    191248      IF( kt == nit000 ) THEN 
    192249         ! initial values 
     
    200257            ! 
    201258            SELECT CASE ( jp_cfg ) 
     259            !                                           ! ======================= 
     260            CASE ( 1 )                                  ! eORCA_R1 configuration 
     261            !                                           ! ======================= 
     262            isrow = 332 - jpjglo 
     263            ! 
     264                                                        ! Caspian Sea 
     265            nctsi1(1)   = 332  ; nctsj1(1)   = 243 - isrow 
     266            nctsi2(1)   = 344  ; nctsj2(1)   = 275 - isrow 
     267            !                                         
    202268            !                                           ! ======================= 
    203269            CASE ( 2 )                                  !  ORCA_R2 configuration 
     
    291357   END SUBROUTINE trc_dmp_clo 
    292358 
    293  
    294    SUBROUTINE trc_dmp_init 
    295       !!---------------------------------------------------------------------- 
    296       !!                  ***  ROUTINE trc_dmp_init  *** 
    297       !!  
    298       !! ** Purpose :   Initialization for the newtonian damping  
    299       !! 
    300       !! ** Method  :   read the nammbf namelist and check the parameters 
    301       !!              called by trc_dmp at the first timestep (nittrc000) 
    302       !!---------------------------------------------------------------------- 
    303       ! 
    304       IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
    305       ! 
    306       SELECT CASE ( nn_hdmp_tr ) 
    307       CASE (  -1  )   ;   IF(lwp) WRITE(numout,*) '   tracer damping in the Med & Red seas only' 
    308       CASE ( 1:90 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping poleward of', nn_hdmp_tr, ' degrees' 
    309       CASE DEFAULT 
    310          WRITE(ctmp1,*) '          bad flag value for nn_hdmp_tr = ', nn_hdmp_tr 
    311          CALL ctl_stop(ctmp1) 
    312       END SELECT 
    313  
    314       IF( lzoom )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
    315       SELECT CASE ( nn_zdmp_tr ) 
    316       CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column' 
    317       CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)' 
    318       CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer' 
    319       CASE DEFAULT 
    320          WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 
    321          CALL ctl_stop(ctmp1) 
    322       END SELECT 
    323  
    324       IF( .NOT. ln_tradmp )   & 
    325          &   CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' ) 
    326       ! 
    327       !                          ! Damping coefficients initialization 
    328       IF( lzoom ) THEN   ;   CALL dtacof_zoom( restotr ) 
    329       ELSE               ;   CALL dtacof( nn_hdmp_tr, rn_surf_tr, rn_bot_tr, rn_dep_tr,  & 
    330                              &            nn_file_tr, 'TRC'     , restotr                ) 
    331       ENDIF 
    332       ! 
    333       IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init') 
    334       ! 
    335    END SUBROUTINE trc_dmp_init 
    336  
    337359#else 
    338360   !!---------------------------------------------------------------------- 
     
    346368#endif 
    347369 
    348  
    349370   !!====================================================================== 
    350371END MODULE trcdmp 
Note: See TracChangeset for help on using the changeset viewer.