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/trczdf.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/trczdf.F90

    r3680 r6225  
    1111   !!   'key_top'                                                TOP models 
    1212   !!---------------------------------------------------------------------- 
    13    !!   trc_ldf     : update the tracer trend with the lateral diffusion 
    14    !!       ldf_ctl : initialization, namelist read, and parameters control 
     13   !!   trc_zdf      : update the tracer trend with the lateral diffusion 
     14   !!   trc_zdf_ini : initialization, namelist read, and parameters control 
    1515   !!---------------------------------------------------------------------- 
    16    USE oce_trc         ! ocean dynamics and active tracers 
    17    USE trc             ! ocean passive tracers variables 
    18    USE trcnam_trp      ! passive tracers transport namelist variables 
    19    USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine) 
    20    USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine) 
    21    USE trdmod_oce 
    22    USE trdtra 
    23    USE prtctl_trc      ! Print control 
     16   USE trc           ! ocean passive tracers variables 
     17   USE oce_trc       ! ocean dynamics and active tracers 
     18   USE trd_oce       ! trends: ocean variables 
     19   USE trazdf_exp    ! vertical diffusion: explicit (tra_zdf_exp     routine) 
     20   USE trazdf_imp    ! vertical diffusion: implicit (tra_zdf_imp     routine) 
     21   USE trcldf        ! passive tracers: lateral diffusion 
     22   USE trdtra        ! trends manager: tracers  
     23   USE prtctl_trc    ! Print control 
    2424 
    2525   IMPLICIT NONE 
    2626   PRIVATE 
    2727 
    28    PUBLIC   trc_zdf          ! called by step.F90  
    29    PUBLIC   trc_zdf_alloc    ! called by nemogcm.F90  
     28   PUBLIC   trc_zdf         ! called by step.F90  
     29   PUBLIC   trc_zdf_ini     ! called by nemogcm.F90  
     30    
     31   !                                        !!** Vertical diffusion (nam_trczdf) ** 
     32   LOGICAL , PUBLIC ::   ln_trczdf_exp       !: explicit vertical diffusion scheme flag 
     33   INTEGER , PUBLIC ::   nn_trczdf_exp       !: number of sub-time step (explicit time stepping) 
    3034 
    3135   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used 
    3236      !                                ! defined from ln_zdf...  namlist logicals) 
    33    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::  r2dt   ! vertical profile time-step, = 2 rdttra 
    34       !                                                 ! except at nittrc000 (=rdttra) if neuler=0 
     37   REAL(wp) ::  r2dttrc   ! vertical profile time-step, = 2 rdt 
     38      !                   ! except at nittrc000 (=rdt) if neuler=0 
    3539 
    3640   !! * Substitutions 
    37 #  include "domzgr_substitute.h90" 
    3841#  include "zdfddm_substitute.h90" 
    3942#  include "vectopt_loop_substitute.h90" 
    4043   !!---------------------------------------------------------------------- 
    41    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     44   !! NEMO/TOP 3.7 , NEMO Consortium (2015) 
    4245   !! $Id$  
    4346   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4447   !!---------------------------------------------------------------------- 
    4548CONTAINS 
    46     
    47    INTEGER FUNCTION trc_zdf_alloc() 
    48       !!---------------------------------------------------------------------- 
    49       !!                  ***  ROUTINE trc_zdf_alloc  *** 
    50       !!---------------------------------------------------------------------- 
    51       ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc ) 
    52       ! 
    53       IF( trc_zdf_alloc /= 0 )   CALL ctl_warn('trc_zdf_alloc : failed to allocate array.') 
    54       ! 
    55    END FUNCTION trc_zdf_alloc 
    56  
    5749 
    5850   SUBROUTINE trc_zdf( kt ) 
     
    7163      IF( nn_timing == 1 )  CALL timing_start('trc_zdf') 
    7264      ! 
    73       IF( kt == nittrc000 )   CALL zdf_ctl          ! initialisation & control of options 
    74  
    75       IF( ln_top_euler) THEN 
    76          r2dt(:) =  rdttrc(:)              ! = rdttrc (use Euler time stepping) 
    77       ELSE 
    78          IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000 
    79             r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping) 
    80          ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1 
    81             r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog) 
    82          ENDIF 
     65      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
     66         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping) 
     67      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1 
     68         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog) 
    8369      ENDIF 
    8470 
     
    8975 
    9076      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend 
    91       CASE ( -1 )                                       ! esopa: test all possibility with control print 
    92          CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )  
    93          WRITE(charout, FMT="('zdf1 ')") ;  CALL prt_ctl_trc_info(charout) 
    94                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    95          CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )  
    96          WRITE(charout, FMT="('zdf2 ')") ;  CALL prt_ctl_trc_info(charout) 
    97                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    98       CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme  
    99       CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )    !   implicit scheme           
    100  
     77      CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dttrc, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme  
     78      CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dttrc,                trb, tra, jptra )    !   implicit scheme           
    10179      END SELECT 
    10280 
     
    10482         DO jn = 1, jptra 
    10583            DO jk = 1, jpkm1 
    106                ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn) 
     84               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn) 
    10785            END DO 
    108             CALL trd_tra( kt, 'TRC', jn, jptra_trd_zdf, ztrtrd(:,:,:,jn) ) 
     86            CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) 
    10987         END DO 
    11088         CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 
     
    12199 
    122100 
    123    SUBROUTINE zdf_ctl 
     101   SUBROUTINE trc_zdf_ini 
    124102      !!---------------------------------------------------------------------- 
    125       !!                 ***  ROUTINE zdf_ctl  *** 
     103      !!                 ***  ROUTINE trc_zdf_ini  *** 
    126104      !! 
    127105      !! ** Purpose :   Choose the vertical mixing scheme 
     
    132110      !!      NB: The implicit scheme is required when using :  
    133111      !!             - rotated lateral mixing operator 
    134       !!             - TKE, GLS or KPP vertical mixing scheme 
     112      !!             - TKE, GLS vertical mixing scheme 
    135113      !!---------------------------------------------------------------------- 
    136  
    137       !  Define the vertical tracer physics scheme 
    138       ! ========================================== 
    139  
    140       ! Choice from ln_zdfexp already read in namelist in zdfini module 
    141       IF( ln_trczdf_exp ) THEN           ! use explicit scheme 
    142          nzdf = 0 
    143       ELSE                               ! use implicit scheme 
    144          nzdf = 1 
     114      INTEGER ::  ios                 ! Local integer output status for namelist read 
     115      !! 
     116      NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp 
     117      !!---------------------------------------------------------------------- 
     118      ! 
     119      REWIND( numnat_ref )             ! namtrc_zdf in reference namelist  
     120      READ  ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905) 
     121905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp ) 
     122      ! 
     123      REWIND( numnat_cfg )             ! namtrc_zdf in configuration namelist  
     124      READ  ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 ) 
     125906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp ) 
     126      IF(lwm) WRITE ( numont, namtrc_zdf ) 
     127      ! 
     128      IF(lwp) THEN                     ! Control print 
     129         WRITE(numout,*) 
     130         WRITE(numout,*) '   Namelist namtrc_zdf : set vertical diffusion  parameters' 
     131         WRITE(numout,*) '      time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp 
     132         WRITE(numout,*) '      number of time step              nn_trczdf_exp = ', nn_trczdf_exp 
    145133      ENDIF 
    146134 
    147       ! Force implicit schemes 
    148       IF( ln_trcldf_iso                               )   nzdf = 1      ! iso-neutral lateral physics 
    149       IF( ln_trcldf_hor .AND. ln_sco                  )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
    150 #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp 
    151                                                           nzdf = 1      ! TKE, GLS or KPP physics        
    152 #endif 
    153       IF( ln_trczdf_exp .AND. nzdf == 1 )   THEN 
    154          CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & 
    155             &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' ) 
     135      !                                ! Define the vertical tracer physics scheme 
     136      IF( ln_trczdf_exp ) THEN   ;   nzdf = 0     ! explicit scheme 
     137      ELSE                       ;   nzdf = 1     ! implicit scheme 
    156138      ENDIF 
    157139 
    158       ! Test: esopa 
    159       IF( lk_esopa )    nzdf = -1                      ! All schemes used 
     140      !                                ! Force implicit schemes 
     141      IF( ln_trcldf_iso              )   nzdf = 1      ! iso-neutral lateral physics 
     142      IF( ln_trcldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
     143#if defined key_zdftke || defined key_zdfgls  
     144                                         nzdf = 1      ! TKE or GLS physics        
     145#endif 
     146      IF( ln_trczdf_exp .AND. nzdf == 1 )  &  
     147         CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', & 
     148            &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' ) 
    160149 
    161150      IF(lwp) THEN 
     
    163152         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' 
    164153         WRITE(numout,*) '~~~~~~~~~~~' 
    165          IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used' 
    166154         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme' 
    167155         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme' 
    168156      ENDIF 
    169  
    170    END SUBROUTINE zdf_ctl 
     157      ! 
     158   END SUBROUTINE trc_zdf_ini 
     159    
    171160#else 
    172161   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.