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 5974 for branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

Ignore:
Timestamp:
2015-12-02T11:52:05+01:00 (8 years ago)
Author:
timgraham
Message:

Upgrade to head of trunk (r5936)

Location:
branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP
Files:
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90

    r5682 r5974  
    44   !! Ocean passive tracers:  advection trend  
    55   !!============================================================================== 
    6    !! History :  2.0  !  05-11  (G. Madec)  Original code 
    7    !!            3.0  !  10-06  (C. Ethe)   Adapted to passive tracers 
     6   !! History :  2.0  !  2005-11  (G. Madec)  Original code 
     7   !!            3.0  !  2010-06  (C. Ethe)   Adapted to passive tracers 
     8   !!            3.7  !  2014-05  (G. Madec, C. Ethe)  Add 2nd/4th order cases for CEN and FCT schemes  
    89   !!---------------------------------------------------------------------- 
    910#if defined key_top 
     
    1112   !!   'key_top'                                                TOP models 
    1213   !!---------------------------------------------------------------------- 
    13    !!   trc_adv      : compute ocean tracer advection trend 
    14    !!   trc_adv_ctl  : control the different options of advection scheme 
    15    !!---------------------------------------------------------------------- 
    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 traadv_cen2     ! 2nd order centered scheme (tra_adv_cen2   routine) 
    20    USE traadv_tvd      ! TVD      scheme           (tra_adv_tvd    routine) 
    21    USE traadv_muscl    ! MUSCL    scheme           (tra_adv_muscl  routine) 
    22    USE traadv_muscl2   ! MUSCL2   scheme           (tra_adv_muscl2 routine) 
    23    USE traadv_ubs      ! UBS      scheme           (tra_adv_ubs    routine) 
    24    USE traadv_qck      ! QUICKEST scheme           (tra_adv_qck    routine) 
    25    USE traadv_eiv      ! eddy induced velocity     (tra_adv_eiv    routine) 
    26    USE traadv_mle      ! ML eddy induced velocity  (tra_adv_mle    routine) 
    27    USE ldftra_oce      ! lateral diffusion coefficient on tracers 
    28    USE prtctl_trc      ! Print control 
     14   !!   trc_adv       : compute ocean tracer advection trend 
     15   !!   trc_adv_ini   : control the different options of advection scheme 
     16   !!---------------------------------------------------------------------- 
     17   USE oce_trc        ! ocean dynamics and active tracers 
     18   USE trc            ! ocean passive tracers variables 
     19   USE traadv_cen     ! centered scheme           (tra_adv_cen  routine) 
     20   USE traadv_fct     ! FCT      scheme           (tra_adv_fct  routine) 
     21   USE traadv_mus     ! MUSCL    scheme           (tra_adv_mus  routine) 
     22   USE traadv_ubs     ! UBS      scheme           (tra_adv_ubs  routine) 
     23   USE traadv_qck     ! QUICKEST scheme           (tra_adv_qck  routine) 
     24   USE traadv_mle     ! ML eddy induced velocity  (tra_adv_mle  routine) 
     25   USE ldftra         ! lateral diffusion coefficient on tracers 
     26   USE ldfslp         ! Lateral diffusion: slopes of neutral surfaces 
     27   ! 
     28   USE prtctl_trc     ! Print control 
    2929 
    3030   IMPLICIT NONE 
    3131   PRIVATE 
    3232 
    33    PUBLIC   trc_adv          ! routine called by step module 
    34    PUBLIC   trc_adv_alloc    ! routine called by nemogcm module 
    35  
    36    INTEGER ::   nadv   ! choice of the type of advection scheme 
     33   PUBLIC   trc_adv        
     34   PUBLIC   trc_adv_alloc  
     35   PUBLIC   trc_adv_ini   
     36 
     37   !                            !!* Namelist namtrc_adv * 
     38   LOGICAL ::   ln_trcadv_cen    ! centered scheme flag 
     39   INTEGER ::      nn_cen_h, nn_cen_v   ! =2/4 : horizontal and vertical choices of the order of CEN scheme 
     40   LOGICAL ::   ln_trcadv_fct    ! FCT scheme flag 
     41   INTEGER ::      nn_fct_h, nn_fct_v   ! =2/4 : horizontal and vertical choices of the order of FCT scheme 
     42   INTEGER ::      nn_fct_zts           ! >=1 : 2nd order FCT with vertical sub-timestepping 
     43   LOGICAL ::   ln_trcadv_mus    ! MUSCL scheme flag 
     44   LOGICAL ::      ln_mus_ups           ! use upstream scheme in vivcinity of river mouths 
     45   LOGICAL ::   ln_trcadv_ubs    ! UBS scheme flag 
     46   INTEGER ::      nn_ubs_v             ! =2/4 : vertical choice of the order of UBS scheme 
     47   LOGICAL ::   ln_trcadv_qck    ! QUICKEST scheme flag 
     48 
     49   !                                        ! choices of advection scheme: 
     50   INTEGER, PARAMETER ::   np_NO_adv  = 0   ! no T-S advection 
     51   INTEGER, PARAMETER ::   np_CEN     = 1   ! 2nd/4th order centered scheme 
     52   INTEGER, PARAMETER ::   np_FCT     = 2   ! 2nd/4th order Flux Corrected Transport scheme 
     53   INTEGER, PARAMETER ::   np_FCT_zts = 3   ! 2nd order FCT scheme with vertical sub-timestepping 
     54   INTEGER, PARAMETER ::   np_MUS     = 4   ! MUSCL scheme 
     55   INTEGER, PARAMETER ::   np_UBS     = 5   ! 3rd order Upstream Biased Scheme 
     56   INTEGER, PARAMETER ::   np_QCK     = 6   ! QUICK scheme 
     57 
     58   INTEGER ::              nadv             ! chosen advection scheme 
     59   ! 
    3760   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra 
    3861   !                                                    ! except at nitrrc000 (=rdttra) if neuler=0 
     
    4265#  include "vectopt_loop_substitute.h90" 
    4366   !!---------------------------------------------------------------------- 
    44    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     67   !! NEMO/TOP 3.7 , NEMO Consortium (2015) 
    4568   !! $Id$  
    4669   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     
    5275      !!                  ***  ROUTINE trc_adv_alloc  *** 
    5376      !!---------------------------------------------------------------------- 
    54  
     77      ! 
    5578      ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc ) 
    56  
     79      ! 
    5780      IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.') 
    58  
     81      ! 
    5982   END FUNCTION trc_adv_alloc 
    6083 
     
    6891      !! ** Method  : - Update the tracer with the advection term following nadv 
    6992      !!---------------------------------------------------------------------- 
    70       !! 
    7193      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    7294      ! 
    73       INTEGER ::   jk  
     95      INTEGER ::   jk   ! dummy loop index 
    7496      CHARACTER (len=22) ::   charout 
    7597      REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn  ! effective velocity 
    7698      !!---------------------------------------------------------------------- 
    7799      ! 
    78       IF( nn_timing == 1 )  CALL timing_start('trc_adv') 
    79       ! 
    80       CALL wrk_alloc( jpi, jpj, jpk, zun, zvn, zwn ) 
    81       ! 
    82  
    83       IF( kt == nittrc000 )   CALL trc_adv_ctl          ! initialisation & control of options 
    84  
     100      IF( nn_timing == 1 )   CALL timing_start('trc_adv') 
     101      ! 
     102      CALL wrk_alloc( jpi,jpj,jpk,   zun, zvn, zwn ) 
     103      ! 
    85104      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
    86105         r2dt(:) =  rdttrc(:)           ! = rdttrc (use or restarting with Euler time stepping) 
     
    88107         r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog) 
    89108      ENDIF 
    90       !                                                   ! effective transport 
     109      !                                               !==  effective transport  ==! 
    91110      DO jk = 1, jpkm1 
    92          !                                                ! eulerian transport only 
    93          zun(:,:,jk) = e2u  (:,:) * fse3u(:,:,jk) * un(:,:,jk) 
     111         zun(:,:,jk) = e2u  (:,:) * fse3u(:,:,jk) * un(:,:,jk)                   ! eulerian transport 
    94112         zvn(:,:,jk) = e1v  (:,:) * fse3v(:,:,jk) * vn(:,:,jk) 
    95113         zwn(:,:,jk) = e1e2t(:,:)                 * wn(:,:,jk) 
    96          ! 
    97114      END DO 
    98115      ! 
    99       IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN 
     116      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN                                 ! add z-tilde and/or vvl corrections 
    100117         zun(:,:,:) = zun(:,:,:) + un_td(:,:,:) 
    101118         zvn(:,:,:) = zvn(:,:,:) + vn_td(:,:,:) 
    102119      ENDIF 
    103120      ! 
    104       zun(:,:,jpk) = 0._wp                                                     ! no transport trough the bottom 
    105       zvn(:,:,jpk) = 0._wp                                                     ! no transport trough the bottom 
    106       zwn(:,:,jpk) = 0._wp                                                     ! no transport trough the bottom 
    107  
    108       IF( lk_traldf_eiv .AND. .NOT. ln_traldf_grif )   &  ! add the eiv transport (if necessary) 
    109          &              CALL tra_adv_eiv( kt, nittrc000, zun, zvn, zwn, 'TRC' ) 
    110       ! 
    111       IF( ln_mle    )   CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' )    ! add the mle transport (if necessary) 
    112       ! 
    113       SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==! 
    114       CASE ( 1 )   ;    CALL tra_adv_cen2  ( kt, nittrc000, 'TRC',       zun, zvn, zwn, trb, trn, tra, jptra )   !  2nd order centered 
    115       CASE ( 2 )   ;    CALL tra_adv_tvd   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  TVD  
    116       CASE ( 3 )   ;    CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra, ln_trcadv_msc_ups )   !  MUSCL  
    117       CASE ( 4 )   ;    CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  MUSCL2  
    118       CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  UBS  
    119       CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  QUICKEST  
    120       ! 
    121       CASE (-1 )                                      !==  esopa: test all possibility with control print  ==! 
    122          CALL tra_adv_cen2  ( kt, nittrc000, 'TRC',       zun, zvn, zwn, trb, trn, tra, jptra )           
    123          WRITE(charout, FMT="('adv1')")  ; CALL prt_ctl_trc_info(charout) 
    124                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    125          CALL tra_adv_tvd   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    126          WRITE(charout, FMT="('adv2')")  ; CALL prt_ctl_trc_info(charout) 
    127                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    128          CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra, ln_trcadv_msc_ups  )           
    129          WRITE(charout, FMT="('adv3')")  ; CALL prt_ctl_trc_info(charout) 
    130                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    131          CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    132          WRITE(charout, FMT="('adv4')")  ; CALL prt_ctl_trc_info(charout) 
    133                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    134          CALL tra_adv_ubs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    135          WRITE(charout, FMT="('adv5')")  ; CALL prt_ctl_trc_info(charout) 
    136                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    137          CALL tra_adv_qck   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )           
    138          WRITE(charout, FMT="('adv6')")  ; CALL prt_ctl_trc_info(charout) 
    139                                            CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 
    140          ! 
     121      IF( ln_ldfeiv .AND. .NOT. ln_traldf_triad )   &  
     122         &              CALL ldf_eiv_trp( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the eiv transport 
     123      ! 
     124      IF( ln_mle    )   CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the mle transport 
     125      ! 
     126      zun(:,:,jpk) = 0._wp                                                       ! no transport trough the bottom 
     127      zvn(:,:,jpk) = 0._wp 
     128      zwn(:,:,jpk) = 0._wp 
     129      ! 
     130      ! 
     131      SELECT CASE ( nadv )                      !==  compute advection trend and add it to general trend  ==! 
     132      ! 
     133      CASE ( np_CEN )                                    ! Centered : 2nd / 4th order 
     134         CALL tra_adv_cen    ( kt, nittrc000,'TRC',       zun, zvn, zwn     , trn, tra, jptra, nn_cen_h, nn_cen_v ) 
     135      CASE ( np_FCT )                                    ! FCT      : 2nd / 4th order 
     136         CALL tra_adv_fct    ( kt, nittrc000,'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra, nn_fct_h, nn_fct_v ) 
     137      CASE ( np_FCT_zts )                                ! 2nd order FCT with vertical time-splitting 
     138         CALL tra_adv_fct_zts( kt, nittrc000,'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra        , nn_fct_zts ) 
     139      CASE ( np_MUS )                                    ! MUSCL 
     140         CALL tra_adv_mus    ( kt, nittrc000,'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra        , ln_mus_ups )  
     141      CASE ( np_UBS )                                    ! UBS 
     142         CALL tra_adv_ubs    ( kt, nittrc000,'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra        , nn_ubs_v   ) 
     143      CASE ( np_QCK )                                    ! QUICKEST 
     144         CALL tra_adv_qck    ( kt, nittrc000,'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra                     ) 
     145      ! 
    141146      END SELECT 
    142  
    143       !                                              ! print mean trends (used for debugging) 
    144       IF( ln_ctl )   THEN 
     147      !                   
     148      IF( ln_ctl )   THEN                             !== print mean trends (used for debugging) 
    145149         WRITE(charout, FMT="('adv ')")  ;  CALL prt_ctl_trc_info(charout) 
    146150                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    147151      END IF 
    148152      ! 
    149       CALL wrk_dealloc( jpi, jpj, jpk, zun, zvn, zwn ) 
     153      CALL wrk_dealloc( jpi,jpj,jpk,  zun, zvn, zwn ) 
    150154      ! 
    151155      IF( nn_timing == 1 )  CALL timing_stop('trc_adv') 
     
    154158 
    155159 
    156    SUBROUTINE trc_adv_ctl 
     160   SUBROUTINE trc_adv_ini 
    157161      !!--------------------------------------------------------------------- 
    158       !!                  ***  ROUTINE trc_adv_ctl  *** 
     162      !!                  ***  ROUTINE trc_adv_ini  *** 
    159163      !!                 
    160164      !! ** Purpose : Control the consistency between namelist options for  
     
    162166      !!---------------------------------------------------------------------- 
    163167      INTEGER ::   ioptio 
    164       !!---------------------------------------------------------------------- 
    165  
    166       ioptio = 0                      ! Parameter control 
    167       IF( ln_trcadv_cen2   )   ioptio = ioptio + 1 
    168       IF( ln_trcadv_tvd    )   ioptio = ioptio + 1 
    169       IF( ln_trcadv_muscl  )   ioptio = ioptio + 1 
    170       IF( ln_trcadv_muscl2 )   ioptio = ioptio + 1 
    171       IF( ln_trcadv_ubs    )   ioptio = ioptio + 1 
    172       IF( ln_trcadv_qck    )   ioptio = ioptio + 1 
    173       IF( lk_esopa         )   ioptio =          1 
    174  
     168      INTEGER ::  ios                 ! Local integer output status for namelist read 
     169      !! 
     170      NAMELIST/namtrc_adv/ ln_trcadv_cen, nn_cen_h, nn_cen_v,               &   ! CEN 
     171         &                 ln_trcadv_fct, nn_fct_h, nn_fct_v, nn_fct_zts,   &   ! FCT 
     172         &                 ln_trcadv_mus,                     ln_mus_ups,   &   ! MUSCL 
     173         &                 ln_trcadv_ubs,           nn_ubs_v,               &   ! UBS 
     174         &                 ln_trcadv_qck                                        ! QCK 
     175      !!---------------------------------------------------------------------- 
     176      ! 
     177      REWIND( numnat_ref )              !  namtrc_adv in reference namelist  
     178      READ  ( numnat_ref, namtrc_adv, IOSTAT = ios, ERR = 901) 
     179901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_adv in reference namelist', lwp ) 
     180 
     181      REWIND( numnat_cfg )              ! namtrc_adv in configuration namelist 
     182      READ  ( numnat_cfg, namtrc_adv, IOSTAT = ios, ERR = 902 ) 
     183902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_adv in configuration namelist', lwp ) 
     184      IF(lwm) WRITE ( numont, namtrc_adv ) 
     185 
     186      IF(lwp) THEN                    ! Namelist print 
     187         WRITE(numout,*) 
     188         WRITE(numout,*) 'trc_adv_ini : choice/control of the tracer advection scheme' 
     189         WRITE(numout,*) '~~~~~~~~~~~' 
     190         WRITE(numout,*) '   Namelist namtrc_adv : chose a advection scheme for tracers' 
     191         WRITE(numout,*) '      centered scheme                           ln_trcadv_cen = ', ln_trcadv_cen 
     192         WRITE(numout,*) '            horizontal 2nd/4th order               nn_cen_h   = ', nn_fct_h 
     193         WRITE(numout,*) '            vertical   2nd/4th order               nn_cen_v   = ', nn_fct_v 
     194         WRITE(numout,*) '      Flux Corrected Transport scheme           ln_trcadv_fct = ', ln_trcadv_fct 
     195         WRITE(numout,*) '            horizontal 2nd/4th order               nn_fct_h   = ', nn_fct_h 
     196         WRITE(numout,*) '            vertical   2nd/4th order               nn_fct_v   = ', nn_fct_v 
     197         WRITE(numout,*) '            2nd order + vertical sub-timestepping  nn_fct_zts = ', nn_fct_zts 
     198         WRITE(numout,*) '      MUSCL scheme                              ln_trcadv_mus = ', ln_trcadv_mus 
     199         WRITE(numout,*) '            + upstream scheme near river mouths    ln_mus_ups = ', ln_mus_ups 
     200         WRITE(numout,*) '      UBS scheme                                ln_trcadv_ubs = ', ln_trcadv_ubs 
     201         WRITE(numout,*) '            vertical   2nd/4th order               nn_ubs_v   = ', nn_ubs_v 
     202         WRITE(numout,*) '      QUICKEST scheme                           ln_trcadv_qck = ', ln_trcadv_qck 
     203      ENDIF 
     204      ! 
     205 
     206      ioptio = 0                       !==  Parameter control  ==! 
     207      IF( ln_trcadv_cen )   ioptio = ioptio + 1 
     208      IF( ln_trcadv_fct )   ioptio = ioptio + 1 
     209      IF( ln_trcadv_mus )   ioptio = ioptio + 1 
     210      IF( ln_trcadv_ubs )   ioptio = ioptio + 1 
     211      IF( ln_trcadv_qck )   ioptio = ioptio + 1 
     212 
     213      ! 
     214      IF( ioptio == 0 ) THEN 
     215         nadv = np_NO_adv 
     216         CALL ctl_warn( 'trc_adv_init: You are running without tracer advection.' ) 
     217      ENDIF 
    175218      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' ) 
    176  
    177       !                              ! Set nadv 
    178       IF( ln_trcadv_cen2   )   nadv =  1 
    179       IF( ln_trcadv_tvd    )   nadv =  2 
    180       IF( ln_trcadv_muscl  )   nadv =  3 
    181       IF( ln_trcadv_muscl2 )   nadv =  4 
    182       IF( ln_trcadv_ubs    )   nadv =  5 
    183       IF( ln_trcadv_qck    )   nadv =  6 
    184       IF( lk_esopa         )   nadv = -1 
    185  
     219      ! 
     220      IF( ln_trcadv_cen .AND. ( nn_cen_h /= 2 .AND. nn_cen_h /= 4 )   & 
     221                        .AND. ( nn_cen_v /= 2 .AND. nn_cen_v /= 4 )   ) THEN 
     222        CALL ctl_stop( 'trc_adv_init: CEN scheme, choose 2nd or 4th order' ) 
     223      ENDIF 
     224      IF( ln_trcadv_fct .AND. ( nn_fct_h /= 2 .AND. nn_fct_h /= 4 )   & 
     225                        .AND. ( nn_fct_v /= 2 .AND. nn_fct_v /= 4 )   ) THEN 
     226        CALL ctl_stop( 'trc_adv_init: FCT scheme, choose 2nd or 4th order' ) 
     227      ENDIF 
     228      IF( ln_trcadv_fct .AND. nn_fct_zts > 0 ) THEN 
     229         IF( nn_fct_h == 4 ) THEN 
     230            nn_fct_h = 2 
     231            CALL ctl_stop( 'trc_adv_init: force 2nd order FCT scheme, 4th order does not exist with sub-timestepping' ) 
     232         ENDIF 
     233         IF( lk_vvl ) THEN 
     234            CALL ctl_stop( 'trc_adv_init: vertical sub-timestepping not allow in non-linear free surface' ) 
     235         ENDIF 
     236         IF( nn_fct_zts == 1 )   CALL ctl_warn( 'trc_adv_init: FCT with ONE sub-timestep = FCT without sub-timestep' ) 
     237      ENDIF 
     238      IF( ln_trcadv_ubs .AND. ( nn_ubs_v /= 2 .AND. nn_ubs_v /= 4 )   ) THEN 
     239        CALL ctl_stop( 'trc_adv_init: UBS scheme, choose 2nd or 4th order' ) 
     240      ENDIF 
     241      IF( ln_trcadv_ubs .AND. nn_ubs_v == 4 ) THEN 
     242         CALL ctl_warn( 'trc_adv_init: UBS scheme, only 2nd FCT scheme available on the vertical. It will be used' ) 
     243      ENDIF 
     244      IF( ln_isfcav ) THEN                                                       ! ice-shelf cavities 
     245         IF(  ln_trcadv_cen .AND. nn_cen_v /= 4    .OR.   &                            ! NO 4th order with ISF 
     246            & ln_trcadv_fct .AND. nn_fct_v /= 4   )   CALL ctl_stop( 'tra_adv_init: 4th order COMPACT scheme not allowed with ISF' ) 
     247      ENDIF 
     248      ! 
     249      !                                !==  used advection scheme  ==! 
     250      !                                      ! set nadv 
     251      IF( ln_trcadv_cen                      )   nadv = np_CEN 
     252      IF( ln_trcadv_fct                      )   nadv = np_FCT 
     253      IF( ln_trcadv_fct .AND. nn_fct_zts > 0 )   nadv = np_FCT_zts 
     254      IF( ln_trcadv_mus                      )   nadv = np_MUS 
     255      IF( ln_trcadv_ubs                      )   nadv = np_UBS 
     256      IF( ln_trcadv_qck                      )   nadv = np_QCK 
     257      ! 
    186258      IF(lwp) THEN                   ! Print the choice 
    187259         WRITE(numout,*) 
    188          IF( nadv ==  1 )   WRITE(numout,*) '         2nd order scheme is used' 
    189          IF( nadv ==  2 )   WRITE(numout,*) '         TVD       scheme is used' 
    190          IF( nadv ==  3 )   WRITE(numout,*) '         MUSCL     scheme is used' 
    191          IF( nadv ==  4 )   WRITE(numout,*) '         MUSCL2    scheme is used' 
    192          IF( nadv ==  5 )   WRITE(numout,*) '         UBS       scheme is used' 
    193          IF( nadv ==  6 )   WRITE(numout,*) '         QUICKEST  scheme is used' 
    194          IF( nadv == -1 )   WRITE(numout,*) '         esopa test: use all advection scheme' 
    195       ENDIF 
    196       ! 
    197    END SUBROUTINE trc_adv_ctl 
     260         IF( nadv == np_NO_adv  )   WRITE(numout,*) '         NO passive tracer advection' 
     261         IF( nadv == np_CEN     )   WRITE(numout,*) '         CEN      scheme is used. Horizontal order: ', nn_cen_h,   & 
     262            &                                                                        ' Vertical   order: ', nn_cen_v 
     263         IF( nadv == np_FCT     )   WRITE(numout,*) '         FCT      scheme is used. Horizontal order: ', nn_fct_h,   & 
     264            &                                                                       ' Vertical   order: ', nn_fct_v 
     265         IF( nadv == np_FCT_zts )   WRITE(numout,*) '         use 2nd order FCT with ', nn_fct_zts,'vertical sub-timestepping' 
     266         IF( nadv == np_MUS     )   WRITE(numout,*) '         MUSCL    scheme is used' 
     267         IF( nadv == np_UBS     )   WRITE(numout,*) '         UBS      scheme is used' 
     268         IF( nadv == np_QCK     )   WRITE(numout,*) '         QUICKEST scheme is used' 
     269      ENDIF 
     270      ! 
     271   END SUBROUTINE trc_adv_ini 
    198272    
    199273#else 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trcbbl.F90

    r4990 r5974  
    2222   USE oce_trc             ! ocean dynamics and active tracers variables 
    2323   USE trc                 ! ocean passive tracers variables 
    24    USE trcnam_trp      ! passive tracers transport namelist variables 
    2524   USE trabbl              !  
    2625   USE prtctl_trc          ! Print control for debbuging 
     
    3029   PUBLIC   trc_bbl       !  routine called by step.F90 
    3130 
    32  
    33    !! * Substitutions 
    34 #  include "top_substitute.h90" 
    3531   !!---------------------------------------------------------------------- 
    3632   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90

    r5682 r5974  
    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 
     
    2928   PRIVATE 
    3029 
    31    PUBLIC trc_dmp            ! routine called by step.F90 
    32    PUBLIC trc_dmp_clo        ! routine called by step.F90 
    33    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 
    3437 
    3538   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   restotr   ! restoring coeff. on tracers (s-1) 
     
    4043 
    4144   !! * Substitutions 
    42 #  include "top_substitute.h90" 
     45#  include "domzgr_substitute.h90" 
     46#  include "vectopt_loop_substitute.h90" 
    4347   !!---------------------------------------------------------------------- 
    4448   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    9094      IF( nn_timing == 1 )  CALL timing_start('trc_dmp') 
    9195      ! 
    92       ! 0. Initialization (first time-step only) 
    93       !    -------------- 
    94       IF( kt == nittrc000 ) CALL trc_dmp_init 
    95  
    9696      IF( l_trdtrc )   CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )   ! temporary save of trends 
    9797      ! 
     
    171171   END SUBROUTINE trc_dmp 
    172172 
     173   SUBROUTINE trc_dmp_ini 
     174      !!---------------------------------------------------------------------- 
     175      !!                  ***  ROUTINE trc_dmp_ini  *** 
     176      !!  
     177      !! ** Purpose :   Initialization for the newtonian damping  
     178      !! 
     179      !! ** Method  :   read the nammbf namelist and check the parameters 
     180      !!              called by trc_dmp at the first timestep (nittrc000) 
     181      !!---------------------------------------------------------------------- 
     182      ! 
     183      INTEGER ::  ios                 ! Local integer output status for namelist read 
     184      INTEGER :: imask  !local file handle 
     185      ! 
     186      NAMELIST/namtrc_dmp/ nn_zdmp_tr , cn_resto_tr 
     187      !!---------------------------------------------------------------------- 
     188 
     189      IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
     190      ! 
     191 
     192      REWIND( numnat_ref )              ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping 
     193      READ  ( numnat_ref, namtrc_dmp, IOSTAT = ios, ERR = 909) 
     194909   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in reference namelist', lwp ) 
     195 
     196      REWIND( numnat_cfg )              ! Namelist namtrc_dmp in configuration namelist : Passive tracers newtonian damping 
     197      READ  ( numnat_cfg, namtrc_dmp, IOSTAT = ios, ERR = 910) 
     198910   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in configuration namelist', lwp ) 
     199      IF(lwm) WRITE ( numont, namtrc_dmp ) 
     200 
     201      IF(lwp) THEN                       ! Namelist print 
     202         WRITE(numout,*) 
     203         WRITE(numout,*) 'trc_dmp : Passive tracers newtonian damping' 
     204         WRITE(numout,*) '~~~~~~~' 
     205         WRITE(numout,*) '   Namelist namtrc_dmp : set damping parameter' 
     206         WRITE(numout,*) '      mixed layer damping option     nn_zdmp_tr = ', nn_zdmp_tr, '(zoom: forced to 0)' 
     207         WRITE(numout,*) '      Restoration coeff file    cn_resto_tr = ', cn_resto_tr 
     208      ENDIF 
     209      ! 
     210      IF( lzoom .AND. .NOT.lk_c1d )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
     211      SELECT CASE ( nn_zdmp_tr ) 
     212      CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column' 
     213      CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)' 
     214      CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer' 
     215      CASE DEFAULT 
     216         WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 
     217         CALL ctl_stop(ctmp1) 
     218      END SELECT 
     219 
     220      IF( .NOT.lk_c1d ) THEN 
     221         IF( .NOT. ln_tradmp )   & 
     222            &   CALL ctl_stop( 'passive trace damping need ln_tradmp to compute damping coef.' ) 
     223         ! 
     224         !                          ! Read damping coefficients from file 
     225         !Read in mask from file 
     226         CALL iom_open ( cn_resto_tr, imask) 
     227         CALL iom_get  ( imask, jpdom_autoglo, 'resto', restotr) 
     228         CALL iom_close( imask ) 
     229         ! 
     230      ENDIF 
     231      IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init') 
     232      ! 
     233   END SUBROUTINE trc_dmp_ini 
     234 
    173235   SUBROUTINE trc_dmp_clo( kt ) 
    174236      !!--------------------------------------------------------------------- 
     
    303365 
    304366 
    305    SUBROUTINE trc_dmp_init 
    306       !!---------------------------------------------------------------------- 
    307       !!                  ***  ROUTINE trc_dmp_init  *** 
    308       !!  
    309       !! ** Purpose :   Initialization for the newtonian damping  
    310       !! 
    311       !! ** Method  :   read the nammbf namelist and check the parameters 
    312       !!              called by trc_dmp at the first timestep (nittrc000) 
    313       !!---------------------------------------------------------------------- 
    314       ! 
    315       INTEGER :: imask  !local file handle 
    316  
    317       IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
    318       ! 
    319  
    320       IF( lzoom )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
    321       SELECT CASE ( nn_zdmp_tr ) 
    322       CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column' 
    323       CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)' 
    324       CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer' 
    325       CASE DEFAULT 
    326          WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 
    327          CALL ctl_stop(ctmp1) 
    328       END SELECT 
    329  
    330       IF( .NOT. ln_tradmp )   & 
    331          &   CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' ) 
    332       ! 
    333       !                          ! Read damping coefficients from file 
    334       !Read in mask from file 
    335       CALL iom_open ( cn_resto_tr, imask) 
    336       CALL iom_get  ( imask, jpdom_autoglo, 'resto', restotr) 
    337       CALL iom_close( imask ) 
    338       ! 
    339       IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init') 
    340       ! 
    341    END SUBROUTINE trc_dmp_init 
    342  
    343367#else 
    344368   !!---------------------------------------------------------------------- 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90

    r5682 r5974  
    44   !! Ocean Passive tracers : lateral diffusive trends 
    55   !!===================================================================== 
    6    !! History :  9.0  ! 2005-11 (G. Madec)  Original code 
    7    !!       NEMO 3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA 
     6   !! History :  1.0  ! 2005-11  (G. Madec)  Original code 
     7   !!            3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA 
     8   !!            3.7  ! 2014-03  (G. Madec)  LDF simplification 
    89   !!---------------------------------------------------------------------- 
    910#if defined key_top 
     
    1112   !!   'key_top'                                                TOP models 
    1213   !!---------------------------------------------------------------------- 
    13    !!---------------------------------------------------------------------- 
    14    !!   trc_ldf     : update the tracer trend with the lateral diffusion 
    15    !!       ldf_ctl : initialization, namelist read, and parameters control 
    16    !!---------------------------------------------------------------------- 
    17    USE oce_trc         ! ocean dynamics and active tracers 
    18    USE trc             ! ocean passive tracers variables 
    19    USE trcnam_trp      ! passive tracers transport namelist variables 
    20    USE ldftra_oce      ! lateral diffusion coefficient on tracers 
    21    USE ldfslp          ! ??? 
    22    USE traldf_bilapg   ! lateral mixing            (tra_ldf_bilapg routine) 
    23    USE traldf_bilap    ! lateral mixing            (tra_ldf_bilap routine) 
    24    USE traldf_iso      ! lateral mixing            (tra_ldf_iso routine) 
    25    USE traldf_iso_grif ! lateral mixing          (tra_ldf_iso_grif routine) 
    26    USE traldf_lap      ! lateral mixing            (tra_ldf_lap routine) 
    27    USE trd_oce 
    28    USE trdtra 
     14   !!   trc_ldf      : update the tracer trend with the lateral diffusion 
     15   !!   trc_ldf_ini  : initialization, namelist read, and parameters control 
     16   !!---------------------------------------------------------------------- 
     17   USE trc           ! ocean passive tracers variables 
     18   USE oce_trc       ! ocean dynamics and active tracers 
     19   USE ldfslp        ! lateral diffusion: iso-neutral slope 
     20   USE traldf_lap    ! lateral diffusion: laplacian iso-level            operator  (tra_ldf_lap   routine) 
     21   USE traldf_iso    ! lateral diffusion: laplacian iso-neutral standard operator  (tra_ldf_iso   routine) 
     22   USE traldf_triad  ! lateral diffusion: laplacian iso-neutral triad    operator  (tra_ldf_triad routine) 
     23   USE traldf_blp    ! lateral diffusion (iso-level lap/blp)                       (tra_ldf_lap   routine) 
     24   USE trd_oce       ! trends: ocean variables 
     25   USE trdtra        ! trends manager: tracers  
     26   ! 
    2927   USE prtctl_trc      ! Print control 
    3028 
     
    3230   PRIVATE 
    3331 
    34    PUBLIC   trc_ldf    ! called by step.F90 
    35    !                                                 !!: ** lateral mixing namelist (nam_trcldf) ** 
    36    REAL(wp) ::  rldf_rat    ! ratio between active and passive tracers diffusive coefficient 
     32   PUBLIC   trc_ldf     
     33   PUBLIC   trc_ldf_ini    
     34   ! 
     35   LOGICAL , PUBLIC ::   ln_trcldf_lap       !:   laplacian operator 
     36   LOGICAL , PUBLIC ::   ln_trcldf_blp       !: bilaplacian operator 
     37   LOGICAL , PUBLIC ::   ln_trcldf_lev       !: iso-level   direction 
     38   LOGICAL , PUBLIC ::   ln_trcldf_hor       !: horizontal  direction (rotation to geopotential) 
     39   LOGICAL , PUBLIC ::   ln_trcldf_iso       !: iso-neutral direction (standard) 
     40   LOGICAL , PUBLIC ::   ln_trcldf_triad     !: iso-neutral direction (triad) 
     41   REAL(wp), PUBLIC ::   rn_ahtrc_0          !:   laplacian diffusivity coefficient for passive tracer [m2/s] 
     42   REAL(wp), PUBLIC ::   rn_bhtrc_0          !: bilaplacian      -          --     -       -   [m4/s] 
     43   ! 
     44                                                 !!: ** lateral mixing namelist (nam_trcldf) ** 
     45   REAL(wp) ::  rldf    ! ratio between active and passive tracers diffusive coefficient 
    3746   INTEGER  ::  nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) 
     47    
    3848   !! * Substitutions 
    3949#  include "domzgr_substitute.h90" 
    4050#  include "vectopt_loop_substitute.h90" 
    4151   !!---------------------------------------------------------------------- 
    42    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     52   !! NEMO/TOP 3.7 , NEMO Consortium (2014) 
    4353   !! $Id$ 
    4454   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    4555   !!---------------------------------------------------------------------- 
    46  
    4756CONTAINS 
    4857 
     
    5867      INTEGER            :: jn 
    5968      CHARACTER (len=22) :: charout 
     69      REAL(wp), POINTER, DIMENSION(:,:,:)   ::   zahu, zahv 
    6070      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   ztrtrd 
    6171      !!---------------------------------------------------------------------- 
     
    6373      IF( nn_timing == 1 )   CALL timing_start('trc_ldf') 
    6474      ! 
    65       IF( kt == nittrc000 )   CALL ldf_ctl          ! initialisation & control of options 
    66  
    67       rldf = rldf_rat 
    68  
    6975      IF( l_trdtrc )  THEN 
    70          CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) 
     76         CALL wrk_alloc( jpi,jpj,jpk,jptra,  ztrtrd ) 
    7177         ztrtrd(:,:,:,:)  = tra(:,:,:,:) 
    7278      ENDIF 
    73  
    74       SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend 
    75       CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra        )  ! iso-level laplacian 
    76       CASE ( 1 )                                                                                            ! rotated laplacian 
    77                        IF( ln_traldf_grif ) THEN 
    78                           CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
    79                        ELSE 
    80                           CALL tra_ldf_iso     ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra, rn_ahtb_0 ) 
    81                        ENDIF 
    82       CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra            )  ! iso-level bilaplacian 
    83       CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, nittrc000, 'TRC',             trb, tra, jptra            )  ! s-coord. horizontal bilaplacian 
    84          ! 
    85       CASE ( -1 )                                     ! esopa: test all possibility with control print 
    86          CALL tra_ldf_lap   ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra            ) 
    87          WRITE(charout, FMT="('ldf0 ')") ;  CALL prt_ctl_trc_info(charout) 
    88                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    89          IF( ln_traldf_grif ) THEN 
    90             CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
    91          ELSE 
    92             CALL tra_ldf_iso     ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra, rn_ahtb_0 ) 
    93          ENDIF 
    94          WRITE(charout, FMT="('ldf1 ')") ;  CALL prt_ctl_trc_info(charout) 
    95                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    96          CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra            ) 
    97          WRITE(charout, FMT="('ldf2 ')") ;  CALL prt_ctl_trc_info(charout) 
    98                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    99          CALL tra_ldf_bilapg( kt, nittrc000, 'TRC',             trb, tra, jptra            ) 
    100          WRITE(charout, FMT="('ldf3 ')") ;  CALL prt_ctl_trc_info(charout) 
    101                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     79      ! 
     80      !                                        !* set the lateral diffusivity coef. for passive tracer       
     81      CALL wrk_alloc( jpi,jpj,jpk,   zahu, zahv ) 
     82      zahu(:,:,:) = rldf * ahtu(:,:,:) 
     83      zahv(:,:,:) = rldf * ahtv(:,:,:) 
     84 
     85      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend 
     86      ! 
     87      CASE ( np_lap   )                               ! iso-level laplacian 
     88         CALL tra_ldf_lap  ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb,      tra, jptra,  1   ) 
     89         ! 
     90      CASE ( np_lap_i )                               ! laplacian : standard iso-neutral operator (Madec) 
     91         CALL tra_ldf_iso  ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra,  1   ) 
     92         ! 
     93      CASE ( np_lap_it )                              ! laplacian : triad iso-neutral operator (griffies) 
     94         CALL tra_ldf_triad( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra,  1   ) 
     95         ! 
     96      CASE ( np_blp , np_blp_i , np_blp_it )          ! bilaplacian: all operator (iso-level, -neutral) 
     97         CALL tra_ldf_blp  ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb     , tra, jptra, nldf ) 
     98         ! 
    10299      END SELECT 
    103100      ! 
    104       IF( l_trdtrc )   THEN                      ! save the horizontal diffusive trends for further diagnostics 
     101      IF( l_trdtrc )   THEN                    ! save the horizontal diffusive trends for further diagnostics 
    105102        DO jn = 1, jptra 
    106103           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 
     
    109106        CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 
    110107      ENDIF 
    111       !                                          ! print mean trends (used for debugging) 
    112       IF( ln_ctl )   THEN 
    113          WRITE(charout, FMT="('ldf ')") ;  CALL prt_ctl_trc_info(charout) 
    114                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    115       ENDIF 
     108      !                                        ! print mean trends (used for debugging) 
     109      IF( ln_ctl ) THEN 
     110         WRITE(charout, FMT="('ldf ')")   ;   CALL prt_ctl_trc_info(charout) 
     111                                              CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     112      ENDIF 
     113      ! 
     114      CALL wrk_dealloc( jpi,jpj,jpk,   zahu, zahv ) 
    116115      ! 
    117116      IF( nn_timing == 1 )   CALL timing_stop('trc_ldf') 
     
    120119 
    121120 
    122    SUBROUTINE ldf_ctl 
     121   SUBROUTINE trc_ldf_ini 
    123122      !!---------------------------------------------------------------------- 
    124123      !!                  ***  ROUTINE ldf_ctl  *** 
    125124      !! 
    126       !! ** Purpose :   Choice of the operator for the lateral tracer diffusion 
     125      !! ** Purpose :   Define the operator for the lateral diffusion 
    127126      !! 
    128127      !! ** Method  :   set nldf from the namtra_ldf logicals 
    129       !!      nldf == -2   No lateral diffusion 
    130       !!      nldf == -1   ESOPA test: ALL operators are used 
    131128      !!      nldf ==  0   laplacian operator 
    132129      !!      nldf ==  1   Rotated laplacian operator 
     
    134131      !!      nldf ==  3   Rotated bilaplacian 
    135132      !!---------------------------------------------------------------------- 
    136       INTEGER ::   ioptio, ierr         ! temporary integers 
    137       !!---------------------------------------------------------------------- 
    138  
    139       IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN 
    140          IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN 
    141             rldf_rat = 1.0_wp 
    142          ELSE 
    143             CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
    144          END IF 
    145       ELSE 
    146          rldf_rat = rn_ahtrc_0 / rn_aht_0 
    147       END IF 
    148       !  Define the lateral mixing oparator for tracers 
    149       ! =============================================== 
    150  
    151       !                               ! control the input 
     133      INTEGER ::   ioptio, ierr   ! temporary integers 
     134      INTEGER ::   ios            ! Local integer output status for namelist read 
     135      ! 
     136      NAMELIST/namtrc_ldf/ ln_trcldf_lap, ln_trcldf_blp,                                  & 
     137         &                 ln_trcldf_lev, ln_trcldf_hor, ln_trcldf_iso, ln_trcldf_triad,  & 
     138         &                 rn_ahtrc_0   , rn_bhtrc_0 
     139      !!---------------------------------------------------------------------- 
     140      REWIND( numnat_ref )              !  namtrc_ldf in reference namelist  
     141      READ  ( numnat_ref, namtrc_ldf, IOSTAT = ios, ERR = 903) 
     142903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ldf in reference namelist', lwp ) 
     143 
     144      REWIND( numnat_cfg )              !  namtrc_ldf in configuration namelist  
     145      READ  ( numnat_cfg, namtrc_ldf, IOSTAT = ios, ERR = 904 ) 
     146904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ldf in configuration namelist', lwp ) 
     147      IF(lwm) WRITE ( numont, namtrc_ldf ) 
     148 
     149      IF(lwp) THEN                    ! Namelist print 
     150         WRITE(numout,*) 
     151         WRITE(numout,*) 'trc_ldf_ini : lateral tracer diffusive operator' 
     152         WRITE(numout,*) '~~~~~~~~~~~' 
     153         WRITE(numout,*) '   Namelist namtrc_ldf : set lateral mixing parameters (type, direction, coefficients)' 
     154         WRITE(numout,*) '      operator' 
     155         WRITE(numout,*) '           laplacian                 ln_trcldf_lap   = ', ln_trcldf_lap 
     156         WRITE(numout,*) '         bilaplacian                 ln_trcldf_blp   = ', ln_trcldf_blp 
     157         WRITE(numout,*) '      direction of action' 
     158         WRITE(numout,*) '         iso-level                   ln_trcldf_lev   = ', ln_trcldf_lev 
     159         WRITE(numout,*) '         horizontal (geopotential)   ln_trcldf_hor   = ', ln_trcldf_hor 
     160         WRITE(numout,*) '         iso-neutral (standard)      ln_trcldf_iso   = ', ln_trcldf_iso 
     161         WRITE(numout,*) '         iso-neutral (triad)         ln_trcldf_triad = ', ln_trcldf_triad 
     162         WRITE(numout,*) '      diffusivity coefficient' 
     163         WRITE(numout,*) '           laplacian                 rn_ahtrc_0      = ', rn_ahtrc_0 
     164         WRITE(numout,*) '         bilaplacian                 rn_bhtrc_0      = ', rn_bhtrc_0 
     165      ENDIF 
     166      !       
     167      !                                ! control the namelist parameters 
    152168      ioptio = 0 
    153       IF( ln_trcldf_lap   )   ioptio = ioptio + 1 
    154       IF( ln_trcldf_bilap )   ioptio = ioptio + 1 
    155       IF( ioptio >  1 )   CALL ctl_stop( '          use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 
    156       IF( ioptio == 0 )   nldf = -2   ! No lateral diffusion 
     169      IF( ln_trcldf_lap )   ioptio = ioptio + 1 
     170      IF( ln_trcldf_blp )   ioptio = ioptio + 1 
     171      IF( ioptio >  1   )   CALL ctl_stop( 'trc_ldf_ctl: use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 
     172      IF( ioptio == 0   )   nldf = np_no_ldf   ! No lateral diffusion 
     173       
     174      IF( ln_trcldf_lap .AND. ln_trcldf_blp )   CALL ctl_stop( 'trc_ldf_ctl: bilaplacian should be used on both TRC and TRA' ) 
     175      IF( ln_trcldf_blp .AND. ln_trcldf_lap )   CALL ctl_stop( 'trc_ldf_ctl:   laplacian should be used on both TRC and TRA' ) 
     176       
    157177      ioptio = 0 
    158       IF( ln_trcldf_level )   ioptio = ioptio + 1 
    159       IF( ln_trcldf_hor   )   ioptio = ioptio + 1 
    160       IF( ln_trcldf_iso   )   ioptio = ioptio + 1 
    161       IF( ioptio /= 1 )   CALL ctl_stop( '          use only ONE direction (level/hor/iso)' ) 
     178      IF( ln_trcldf_lev )   ioptio = ioptio + 1 
     179      IF( ln_trcldf_hor )   ioptio = ioptio + 1 
     180      IF( ln_trcldf_iso )   ioptio = ioptio + 1 
     181      IF( ioptio /= 1   )   CALL ctl_stop( 'trc_ldf_ctl: use only ONE direction (level/hor/iso)' ) 
    162182 
    163183      ! defined the type of lateral diffusion from ln_trcldf_... logicals 
    164184      ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully 
    165185      ierr = 0 
    166       IF( ln_trcldf_lap ) THEN       ! laplacian operator 
     186      IF( ln_trcldf_lap ) THEN      !==  laplacian operator  ==! 
    167187         IF ( ln_zco ) THEN                ! z-coordinate 
    168             IF ( ln_trcldf_level )   nldf = 0      ! iso-level  (no rotation) 
    169             IF ( ln_trcldf_hor   )   nldf = 0      ! horizontal (no rotation) 
    170             IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    171          ENDIF 
    172          IF ( ln_zps ) THEN             ! z-coordinate 
    173             IF ( ln_trcldf_level )   ierr = 1      ! iso-level not allowed 
    174             IF ( ln_trcldf_hor   )   nldf = 0      ! horizontal (no rotation) 
    175             IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    176          ENDIF 
    177          IF ( ln_sco ) THEN             ! z-coordinate 
    178             IF ( ln_trcldf_level )   nldf = 0      ! iso-level  (no rotation) 
    179             IF ( ln_trcldf_hor   )   nldf = 1      ! horizontal (   rotation) 
    180             IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation) 
    181          ENDIF 
    182       ENDIF 
    183  
    184       IF( ln_trcldf_bilap ) THEN      ! bilaplacian operator 
     188            IF ( ln_trcldf_lev   )   nldf = np_lap     ! iso-level = horizontal (no rotation) 
     189            IF ( ln_trcldf_hor   )   nldf = np_lap     ! iso-level = horizontal (no rotation) 
     190            IF ( ln_trcldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation) 
     191            IF ( ln_trcldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation) 
     192         ENDIF 
     193         IF ( ln_zps ) THEN             ! z-coordinate with partial step 
     194            IF ( ln_trcldf_lev   )   ierr = 1         ! iso-level not allowed  
     195            IF ( ln_trcldf_hor   )   nldf = np_lap     ! horizontal (no rotation) 
     196            IF ( ln_trcldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard (rotation) 
     197            IF ( ln_trcldf_triad )   nldf = np_lap_it  ! iso-neutral: triad    (rotation) 
     198         ENDIF 
     199         IF ( ln_sco ) THEN             ! s-coordinate 
     200            IF ( ln_trcldf_lev   )   nldf = np_lap     ! iso-level  (no rotation) 
     201            IF ( ln_trcldf_hor   )   nldf = np_lap_it  ! horizontal (   rotation)       !!gm   a checker.... 
     202            IF ( ln_trcldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard (rotation) 
     203            IF ( ln_trcldf_triad )   nldf = np_lap_it  ! iso-neutral: triad    (rotation) 
     204         ENDIF 
     205         !                                ! diffusivity ratio: passive / active tracers  
     206         IF( ABS(rn_aht_0) < 2._wp*TINY(1.e0) ) THEN 
     207            IF( ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0) ) THEN 
     208               rldf = 1.0_wp 
     209            ELSE 
     210               CALL ctl_stop( 'STOP', 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
     211            ENDIF 
     212         ELSE 
     213            rldf = rn_ahtrc_0 / rn_aht_0 
     214         ENDIF 
     215      ENDIF 
     216      ! 
     217      IF( ln_trcldf_blp ) THEN      !==  bilaplacian operator  ==! 
    185218         IF ( ln_zco ) THEN                ! z-coordinate 
    186             IF ( ln_trcldf_level )   nldf = 2      ! iso-level  (no rotation) 
    187             IF ( ln_trcldf_hor   )   nldf = 2      ! horizontal (no rotation) 
    188             IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    189          ENDIF 
    190          IF ( ln_zps ) THEN             ! z-coordinate 
    191             IF ( ln_trcldf_level )   ierr = 1      ! iso-level not allowed 
    192             IF ( ln_trcldf_hor   )   nldf = 2      ! horizontal (no rotation) 
    193             IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    194          ENDIF 
    195          IF ( ln_sco ) THEN             ! z-coordinate 
    196             IF ( ln_trcldf_level )   nldf = 2      ! iso-level  (no rotation) 
    197             IF ( ln_trcldf_hor   )   nldf = 3      ! horizontal (   rotation) 
    198             IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation) 
    199          ENDIF 
    200       ENDIF 
    201  
     219            IF ( ln_trcldf_lev   )   nldf = np_blp     ! iso-level = horizontal (no rotation) 
     220            IF ( ln_trcldf_hor   )   nldf = np_blp     ! iso-level = horizontal (no rotation) 
     221            IF ( ln_trcldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard (rotation) 
     222            IF ( ln_trcldf_triad )   nldf = np_blp_it  ! iso-neutral: triad    (rotation) 
     223         ENDIF 
     224         IF ( ln_zps ) THEN             ! z-coordinate with partial step 
     225            IF ( ln_trcldf_lev   )   ierr = 1         ! iso-level not allowed  
     226            IF ( ln_trcldf_hor   )   nldf = np_blp     ! horizontal (no rotation) 
     227            IF ( ln_trcldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard (rotation) 
     228            IF ( ln_trcldf_triad )   nldf = np_blp_it  ! iso-neutral: triad    (rotation) 
     229         ENDIF 
     230         IF ( ln_sco ) THEN             ! s-coordinate 
     231            IF ( ln_trcldf_lev   )   nldf = np_blp     ! iso-level  (no rotation) 
     232            IF ( ln_trcldf_hor   )   nldf = np_blp_it  ! horizontal (   rotation)       !!gm   a checker.... 
     233            IF ( ln_trcldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard (rotation) 
     234            IF ( ln_trcldf_triad )   nldf = np_blp_it  ! iso-neutral: triad    (rotation) 
     235         ENDIF 
     236         !                                ! diffusivity ratio: passive / active tracers  
     237         IF( ABS(rn_bht_0) < 2._wp*TINY(1.e0) ) THEN 
     238            IF( ABS(rn_bhtrc_0) < 2._wp*TINY(1.e0) ) THEN 
     239               rldf = 1.0_wp 
     240            ELSE 
     241               CALL ctl_stop( 'STOP', 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
     242            ENDIF 
     243         ELSE 
     244            rldf = SQRT(  ABS( rn_bhtrc_0 / rn_bht_0 )  ) 
     245         ENDIF 
     246      ENDIF 
     247      ! 
    202248      IF( ierr == 1 )   CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) 
    203       IF( ierr == 2 )   CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) 
    204       IF( lk_traldf_eiv .AND. .NOT.ln_trcldf_iso )   & 
     249      IF( ln_ldfeiv .AND. .NOT.ln_trcldf_iso )   & 
    205250           CALL ctl_stop( '          eddy induced velocity on tracers',   & 
    206251           &              ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) 
    207252      IF( nldf == 1 .OR. nldf == 3 ) THEN      ! rotation 
    208          IF( .NOT.lk_ldfslp )   CALL ctl_stop( '          the rotation of the diffusive tensor require key_ldfslp' ) 
    209 #if defined key_offline 
    210          l_traldf_rot = .TRUE.                 ! needed for trazdf_imp 
    211 #endif 
    212       ENDIF 
    213  
    214       IF( lk_esopa ) THEN 
    215          IF(lwp) WRITE(numout,*) '          esopa control: use all lateral physics options' 
    216          nldf = -1 
    217       ENDIF 
    218  
     253         IF( .NOT.l_ldfslp )   CALL ctl_stop( '          the rotation of the diffusive tensor require l_ldfslp' ) 
     254      ENDIF 
     255      ! 
    219256      IF(lwp) THEN 
    220257         WRITE(numout,*) 
    221          IF( nldf == -2 )   WRITE(numout,*) '          NO lateral diffusion' 
    222          IF( nldf == -1 )   WRITE(numout,*) '          ESOPA test All scheme used' 
    223          IF( nldf ==  0 )   WRITE(numout,*) '          laplacian operator' 
    224          IF( nldf ==  1 )   WRITE(numout,*) '          Rotated laplacian operator' 
    225          IF( nldf ==  2 )   WRITE(numout,*) '          bilaplacian operator' 
    226          IF( nldf ==  3 )   WRITE(numout,*) '          Rotated bilaplacian' 
    227       ENDIF 
    228  
    229       IF( ln_trcldf_bilap ) THEN 
    230          IF(lwp) WRITE(numout,*) '          biharmonic tracer diffusion' 
    231          IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa )   CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' ) 
    232       ELSE 
    233          IF(lwp) WRITE(numout,*) '          harmonic tracer diffusion (default)' 
    234          IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa )   CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' ) 
    235       ENDIF 
    236  
    237       ! ratio between active and passive tracers diffusive coef. 
    238       IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN 
    239          IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN 
    240             rldf_rat = 1.0_wp 
    241          ELSE 
    242             CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) 
    243          END IF 
    244       ELSE 
    245          rldf_rat = rn_ahtrc_0 / rn_aht_0 
    246       END IF 
    247       IF( rldf_rat < 0 ) THEN 
    248          IF( .NOT.lk_offline ) THEN  
    249             CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' ) 
    250          ELSE 
    251             CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' ) 
    252          ENDIF  
    253       ENDIF 
    254       ! 
    255    END SUBROUTINE ldf_ctl 
     258         IF( nldf == np_no_ldf )   WRITE(numout,*) '          NO lateral diffusion' 
     259         IF( nldf == np_lap    )   WRITE(numout,*) '          laplacian iso-level operator' 
     260         IF( nldf == np_lap_i  )   WRITE(numout,*) '          Rotated laplacian operator (standard)' 
     261         IF( nldf == np_lap_it )   WRITE(numout,*) '          Rotated laplacian operator (triad)' 
     262         IF( nldf == np_blp    )   WRITE(numout,*) '          bilaplacian iso-level operator' 
     263         IF( nldf == np_blp_i  )   WRITE(numout,*) '          Rotated bilaplacian operator (standard)' 
     264         IF( nldf == np_blp_it )   WRITE(numout,*) '          Rotated bilaplacian operator (triad)' 
     265      ENDIF 
     266      ! 
     267   END SUBROUTINE trc_ldf_ini 
    256268#else 
    257269   !!---------------------------------------------------------------------- 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90

    r4990 r5974  
    2222   PRIVATE 
    2323 
    24    PUBLIC trc_rad         ! routine called by trcstp.F90 
    25  
    26    !! * Substitutions 
    27 #  include "top_substitute.h90" 
     24   PUBLIC trc_rad      
     25   PUBLIC trc_rad_ini   
     26 
     27   LOGICAL , PUBLIC ::   ln_trcrad           !: flag to artificially correct negative concentrations 
     28 
    2829   !!---------------------------------------------------------------------- 
    2930   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    7677      ! 
    7778   END SUBROUTINE trc_rad 
     79 
     80   SUBROUTINE trc_rad_ini 
     81      !!--------------------------------------------------------------------- 
     82      !!                  ***  ROUTINE trc _rad_ini *** 
     83      !! 
     84      !! ** Purpose : read  namelist options  
     85      !!---------------------------------------------------------------------- 
     86      INTEGER ::  ios                 ! Local integer output status for namelist read 
     87      NAMELIST/namtrc_rad/ ln_trcrad 
     88      !!---------------------------------------------------------------------- 
     89 
     90      ! 
     91      REWIND( numnat_ref )              ! namtrc_rad in reference namelist  
     92      READ  ( numnat_ref, namtrc_rad, IOSTAT = ios, ERR = 907) 
     93907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in reference namelist', lwp ) 
     94 
     95      REWIND( numnat_cfg )              ! namtrc_rad in configuration namelist  
     96      READ  ( numnat_cfg, namtrc_rad, IOSTAT = ios, ERR = 908 ) 
     97908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in configuration namelist', lwp ) 
     98      IF(lwm) WRITE ( numont, namtrc_rad ) 
     99 
     100      IF(lwp) THEN                     !   ! Control print 
     101         WRITE(numout,*) 
     102         WRITE(numout,*) '   Namelist namtrc_rad : treatment of negative concentrations' 
     103         WRITE(numout,*) '      correct artificially negative concen. or not ln_trcrad = ', ln_trcrad 
     104      ENDIF 
     105      ! 
     106   END SUBROUTINE trc_rad_ini 
    78107 
    79108   SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90

    r5682 r5974  
    3131 
    3232   !! * Substitutions 
    33 #  include "top_substitute.h90" 
     33#  include "domzgr_substitute.h90" 
     34#  include "vectopt_loop_substitute.h90" 
    3435   !!---------------------------------------------------------------------- 
    3536   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    8384         CASE( 0    )   ;   zswitch = 1  ! (0) standard levitating sea-ice : salt exchange only 
    8485         CASE( 1, 2 )   ;   zswitch = 0  ! (1) levitating sea-ice: salt and volume exchange but no pressure effect                                 
    85                                          ! (2) embedded sea-ice : salt and volume fluxes and pressure 
     86      !                                  ! (2) embedded sea-ice : salt and volume fluxes and pressure 
    8687      END SELECT 
    8788 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90

    r5682 r5974  
    1515   USE oce_trc         ! ocean dynamics and active tracers variables 
    1616   USE trc             ! ocean passive tracers variables  
    17    USE trcnam_trp      ! passive tracers transport namelist variables 
    1817   USE trabbl          ! bottom boundary layer               (trc_bbl routine) 
    1918   USE trcbbl          ! bottom boundary layer               (trc_bbl routine) 
    20    USE zdfkpp          ! KPP non-local tracer fluxes         (trc_kpp routine) 
    2119   USE trcdmp          ! internal damping                    (trc_dmp routine) 
    2220   USE trcldf          ! lateral mixing                      (trc_ldf routine) 
     
    3836   PUBLIC   trc_trp    ! called by trc_stp 
    3937 
    40    !! * Substitutions 
    41 #  include "top_substitute.h90" 
    4238   !!---------------------------------------------------------------------- 
    4339   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    4844CONTAINS 
    4945 
    50    SUBROUTINE trc_trp( kstp ) 
     46   SUBROUTINE trc_trp( kt ) 
    5147      !!---------------------------------------------------------------------- 
    5248      !!                     ***  ROUTINE trc_trp  *** 
     
    5753      !!              - Update the passive tracers 
    5854      !!---------------------------------------------------------------------- 
    59       INTEGER, INTENT( in ) ::  kstp  ! ocean time-step index 
     55      INTEGER, INTENT( in ) ::  kt  ! ocean time-step index 
    6056      !! --------------------------------------------------------------------- 
    6157      ! 
     
    6460      IF( .NOT. lk_c1d ) THEN 
    6561         ! 
    66                                 CALL trc_sbc( kstp )            ! surface boundary condition 
    67          IF( lk_trabbl )        CALL trc_bbl( kstp )            ! advective (and/or diffusive) bottom boundary layer scheme 
    68          IF( ln_trcdmp )        CALL trc_dmp( kstp )            ! internal damping trends 
    69          IF( ln_trcdmp_clo )    CALL trc_dmp_clo( kstp )        ! internal damping trends on closed seas only 
    70                                 CALL trc_adv( kstp )            ! horizontal & vertical advection  
    71                                 CALL trc_ldf( kstp )            ! lateral mixing 
    72          IF( .NOT. lk_offline .AND. lk_zdfkpp )    & 
    73             &                   CALL trc_kpp( kstp )            ! KPP non-local tracer fluxes 
     62                                CALL trc_sbc    ( kt )      ! surface boundary condition 
     63         IF( lk_trabbl )        CALL trc_bbl    ( kt )      ! advective (and/or diffusive) bottom boundary layer scheme 
     64         IF( ln_trcdmp )        CALL trc_dmp    ( kt )      ! internal damping trends 
     65         IF( ln_trcdmp_clo )    CALL trc_dmp_clo( kt )      ! internal damping trends on closed seas only 
     66                                CALL trc_adv    ( kt )      ! horizontal & vertical advection  
     67         !                                                         ! Partial top/bottom cell: GRADh( trb )   
     68         IF( ln_zps ) THEN 
     69           IF( ln_isfcav ) THEN ; CALL zps_hde_isf( kt, jptra, trb, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )  ! both top & bottom 
     70           ELSE                 ; CALL zps_hde    ( kt, jptra, trb, gtru, gtrv )                                      !  only bottom 
     71           ENDIF 
     72         ENDIF 
     73         !                                                       
     74                                CALL trc_ldf    ( kt )      ! lateral mixing 
    7475#if defined key_agrif 
    75          IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc           ! tracers sponge 
     76         IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc       ! tracers sponge 
    7677#endif 
    77                                 CALL trc_zdf( kstp )            ! vertical mixing and after tracer fields 
    78                                 CALL trc_nxt( kstp )            ! tracer fields at next time step      
    79          IF( ln_trcrad )        CALL trc_rad( kstp )            ! Correct artificial negative concentrations 
     78                                CALL trc_zdf    ( kt )      ! vertical mixing and after tracer fields 
     79                                CALL trc_nxt    ( kt )      ! tracer fields at next time step      
     80         IF( ln_trcrad )        CALL trc_rad    ( kt )      ! Correct artificial negative concentrations 
    8081 
    8182#if defined key_agrif 
    82       IF( .NOT. Agrif_Root())   CALL Agrif_Update_Trc( kstp )  ! Update tracer at AGRIF zoom boundaries : children only 
     83         IF( .NOT.Agrif_Root()) CALL Agrif_Update_Trc( kt ) ! Update tracer at AGRIF zoom boundaries : children only 
    8384#endif 
    84  
    85          IF( ln_zps  .AND. .NOT. ln_isfcav)        & 
    86             &            CALL zps_hde    ( kstp, jptra, trn, gtru, gtrv )   ! Partial steps: now horizontal gradient of passive 
    87          IF( ln_zps .AND.        ln_isfcav)        & 
    88             &            CALL zps_hde_isf( kstp, jptra, trn, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )  ! Partial steps: now horizontal gradient of passive 
    89                                                                 ! tracers at the bottom ocean level 
    9085         ! 
    9186      ELSE                                               ! 1D vertical configuration 
    92                                 CALL trc_sbc( kstp )            ! surface boundary condition 
    93          IF( .NOT. lk_offline .AND. lk_zdfkpp )    & 
    94             &                   CALL trc_kpp( kstp )            ! KPP non-local tracer fluxes 
    95                                 CALL trc_zdf( kstp )            ! vertical mixing and after tracer fields 
    96                                 CALL trc_nxt( kstp )            ! tracer fields at next time step      
    97           IF( ln_trcrad )       CALL trc_rad( kstp )            ! Correct artificial negative concentrations 
     87                                CALL trc_sbc( kt )            ! surface boundary condition 
     88         IF( ln_trcdmp )        CALL trc_dmp( kt )            ! internal damping trends 
     89                                CALL trc_zdf( kt )            ! vertical mixing and after tracer fields 
     90                                CALL trc_nxt( kt )            ! tracer fields at next time step      
     91          IF( ln_trcrad )       CALL trc_rad( kt )            ! Correct artificial negative concentrations 
    9892         ! 
    9993      END IF 
     
    108102   !!---------------------------------------------------------------------- 
    109103CONTAINS 
    110    SUBROUTINE trc_trp( kstp )              ! Empty routine 
    111       INTEGER, INTENT(in) ::   kstp 
    112       WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kstp 
     104   SUBROUTINE trc_trp( kt )              ! Empty routine 
     105      INTEGER, INTENT(in) ::   kt 
     106      WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kt 
    113107   END SUBROUTINE trc_trp 
    114108#endif 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90

    r5682 r5974  
    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   PUBLIC   trc_zdf_alloc   ! called by nemogcm.F90  
     31    
     32   !                                        !!** Vertical diffusion (nam_trczdf) ** 
     33   LOGICAL , PUBLIC ::   ln_trczdf_exp       !: explicit vertical diffusion scheme flag 
     34   INTEGER , PUBLIC ::   nn_trczdf_exp       !: number of sub-time step (explicit time stepping) 
    3035 
    3136   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used 
     
    3944#  include "vectopt_loop_substitute.h90" 
    4045   !!---------------------------------------------------------------------- 
    41    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     46   !! NEMO/TOP 3.7 , NEMO Consortium (2015) 
    4247   !! $Id$  
    4348   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    7176      IF( nn_timing == 1 )  CALL timing_start('trc_zdf') 
    7277      ! 
    73       IF( kt == nittrc000 )   CALL zdf_ctl          ! initialisation & control of options 
    74  
    7578      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000 
    7679         r2dt(:) =  rdttrc(:)           ! = rdttrc (use or restarting with Euler time stepping) 
     
    8588 
    8689      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' ) 
    9490      CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme  
    9591      CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt,                trb, tra, jptra )    !   implicit scheme           
    96  
    9792      END SELECT 
    9893 
     
    117112 
    118113 
    119    SUBROUTINE zdf_ctl 
     114   SUBROUTINE trc_zdf_ini 
    120115      !!---------------------------------------------------------------------- 
    121       !!                 ***  ROUTINE zdf_ctl  *** 
     116      !!                 ***  ROUTINE trc_zdf_ini  *** 
    122117      !! 
    123118      !! ** Purpose :   Choose the vertical mixing scheme 
     
    128123      !!      NB: The implicit scheme is required when using :  
    129124      !!             - rotated lateral mixing operator 
    130       !!             - TKE, GLS or KPP vertical mixing scheme 
     125      !!             - TKE, GLS vertical mixing scheme 
    131126      !!---------------------------------------------------------------------- 
    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 
     127      INTEGER ::  ios                 ! Local integer output status for namelist read 
     128      !! 
     129      NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp 
     130      !!---------------------------------------------------------------------- 
     131      ! 
     132      REWIND( numnat_ref )             ! namtrc_zdf in reference namelist  
     133      READ  ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905) 
     134905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp ) 
     135      ! 
     136      REWIND( numnat_cfg )             ! namtrc_zdf in configuration namelist  
     137      READ  ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 ) 
     138906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp ) 
     139      IF(lwm) WRITE ( numont, namtrc_zdf ) 
     140      ! 
     141      IF(lwp) THEN                     ! Control print 
     142         WRITE(numout,*) 
     143         WRITE(numout,*) '   Namelist namtrc_zdf : set vertical diffusion  parameters' 
     144         WRITE(numout,*) '      time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp 
     145         WRITE(numout,*) '      number of time step              nn_trczdf_exp = ', nn_trczdf_exp 
    141146      ENDIF 
    142147 
    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.' ) 
     148      !                                ! Define the vertical tracer physics scheme 
     149      IF( ln_trczdf_exp ) THEN   ;   nzdf = 0     ! explicit scheme 
     150      ELSE                       ;   nzdf = 1     ! implicit scheme 
    152151      ENDIF 
    153152 
    154       ! Test: esopa 
    155       IF( lk_esopa )    nzdf = -1                      ! All schemes used 
     153      !                                ! Force implicit schemes 
     154      IF( ln_trcldf_iso              )   nzdf = 1      ! iso-neutral lateral physics 
     155      IF( ln_trcldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate 
     156#if defined key_zdftke || defined key_zdfgls  
     157                                         nzdf = 1      ! TKE or GLS physics        
     158#endif 
     159      IF( ln_trczdf_exp .AND. nzdf == 1 )  &  
     160         CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', & 
     161            &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' ) 
    156162 
    157163      IF(lwp) THEN 
     
    159165         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' 
    160166         WRITE(numout,*) '~~~~~~~~~~~' 
    161          IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used' 
    162167         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme' 
    163168         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme' 
    164169      ENDIF 
    165  
    166    END SUBROUTINE zdf_ctl 
     170      ! 
     171   END SUBROUTINE trc_zdf_ini 
     172    
    167173#else 
    168174   !!---------------------------------------------------------------------- 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc.F90

    r5682 r5974  
    88   !!                 !  07-06  (C. Deltel)  key_gyre : do not call lbc_lnk 
    99   !!---------------------------------------------------------------------- 
    10 #if   defined key_top && ( defined key_trdmxl_trc   ||   defined key_esopa ) 
     10#if   defined key_top   &&   defined key_trdmxl_trc 
    1111   !!---------------------------------------------------------------------- 
    1212   !!   'key_trdmxl_trc'                      mixed layer trend diagnostics 
     
    2424   USE zdfddm  , ONLY : avs  ! salinity vertical diffusivity coeff. at w-point 
    2525# endif 
    26    USE trcnam_trp        ! passive tracers transport namelist variables 
    2726   USE trdtrc_oce    ! definition of main arrays used for trends computations 
    2827   USE in_out_manager    ! I/O manager 
     
    6766 
    6867   !! * Substitutions 
    69 #  include "top_substitute.h90" 
     68#  include "domzgr_substitute.h90" 
    7069#  include "zdfddm_substitute.h90" 
    7170   !!---------------------------------------------------------------------- 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc.F90

    r5682 r5974  
    1414   !!---------------------------------------------------------------------- 
    1515   USE trc               ! tracer definitions (trn, trb, tra, etc.) 
    16    USE trcnam_trp 
    1716   USE trd_oce 
    1817   USE trdtrc_oce       ! definition of main arrays used for trends computations 
     
    2928   PUBLIC trd_trc 
    3029 
    31    !! * Substitutions 
    32 #  include "top_substitute.h90" 
    3330   !!---------------------------------------------------------------------- 
    3431   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc_oce.F90

    r5682 r5974  
    44   !! Ocean trends :   set tracer and momentum trend variables 
    55   !!====================================================================== 
    6 #if defined key_top   ||   defined key_esopa 
     6#if defined key_top 
    77   !!---------------------------------------------------------------------- 
    88   !!   'key_top'                                                TOP models 
     
    3030# endif 
    3131 
    32 # if defined key_trdmxl_trc   ||   defined key_esopa 
     32# if defined key_trdmxl_trc 
    3333   !!---------------------------------------------------------------------- 
    3434   !!   'key_trdmxl_trc'                     mixed layer trends diagnostics 
Note: See TracChangeset for help on using the changeset viewer.