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 6404 for branches/2015/dev_r5803_UKMO_AGRIF_Vert_interp/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90 – NEMO

Ignore:
Timestamp:
2016-03-29T11:24:48+02:00 (8 years ago)
Author:
timgraham
Message:

First attempt at upgrading branch to the head of the trunk. This should include all of the simplification branch from the merge in Dec 2015.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5803_UKMO_AGRIF_Vert_interp/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90

    r6401 r6404  
    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 trd_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  
    7565      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
    76          r2dt(:) =  rdttrc(:)           ! = rdttrc (use or restarting with Euler time stepping) 
     66         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping) 
    7767      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1 
    78          r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog) 
     68         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog) 
    7969      ENDIF 
    8070 
     
    8575 
    8676      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend 
    87       CASE ( -1 )                                       ! esopa: test all possibility with control print 
    88          CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )  
    89          WRITE(charout, FMT="('zdf1 ')") ;  CALL prt_ctl_trc_info(charout) 
    90                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    91          CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )  
    92          WRITE(charout, FMT="('zdf2 ')") ;  CALL prt_ctl_trc_info(charout) 
    93                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    94       CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme  
    95       CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )    !   implicit scheme           
    96  
     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           
    9779      END SELECT 
    9880 
     
    10082         DO jn = 1, jptra 
    10183            DO jk = 1, jpkm1 
    102                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) 
    10385            END DO 
    10486            CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) 
     
    11799 
    118100 
    119    SUBROUTINE zdf_ctl 
     101   SUBROUTINE trc_zdf_ini 
    120102      !!---------------------------------------------------------------------- 
    121       !!                 ***  ROUTINE zdf_ctl  *** 
     103      !!                 ***  ROUTINE trc_zdf_ini  *** 
    122104      !! 
    123105      !! ** Purpose :   Choose the vertical mixing scheme 
     
    128110      !!      NB: The implicit scheme is required when using :  
    129111      !!             - rotated lateral mixing operator 
    130       !!             - TKE, GLS or KPP vertical mixing scheme 
     112      !!             - TKE, GLS vertical mixing scheme 
    131113      !!---------------------------------------------------------------------- 
    132  
    133       !  Define the vertical tracer physics scheme 
    134       ! ========================================== 
    135  
    136       ! Choice from ln_zdfexp already read in namelist in zdfini module 
    137       IF( ln_trczdf_exp ) THEN           ! use explicit scheme 
    138          nzdf = 0 
    139       ELSE                               ! use implicit scheme 
    140          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 
    141133      ENDIF 
    142134 
    143       ! Force implicit schemes 
    144       IF( ln_trcldf_iso                               )   nzdf = 1      ! iso-neutral lateral physics 
    145       IF( ln_trcldf_hor .AND. ln_sco                  )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
    146 #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp 
    147                                                           nzdf = 1      ! TKE, GLS or KPP physics        
    148 #endif 
    149       IF( ln_trczdf_exp .AND. nzdf == 1 )   THEN 
    150          CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & 
    151             &           '          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 
    152138      ENDIF 
    153139 
    154       ! Test: esopa 
    155       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.' ) 
    156149 
    157150      IF(lwp) THEN 
     
    159152         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' 
    160153         WRITE(numout,*) '~~~~~~~~~~~' 
    161          IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used' 
    162154         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme' 
    163155         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme' 
    164156      ENDIF 
    165  
    166    END SUBROUTINE zdf_ctl 
     157      ! 
     158   END SUBROUTINE trc_zdf_ini 
     159    
    167160#else 
    168161   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.