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 5770 for branches/2015/dev_r5721_CNRS9_NOC3_LDF/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90 – NEMO

Ignore:
Timestamp:
2015-10-01T14:48:08+02:00 (9 years ago)
Author:
gm
Message:

#1593: LDF-ADV, step II.2: phasing the improvements/simplifications of advective tracer trend (see wiki page)

File:
1 edited

Legend:

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

    r5766 r5770  
    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_ini  : 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 traadv_cen2     ! 2nd order centered scheme (tra_adv_cen2   routine) 
    19    USE traadv_tvd      ! TVD      scheme           (tra_adv_tvd    routine) 
    20    USE traadv_muscl    ! MUSCL    scheme           (tra_adv_muscl  routine) 
    21    USE traadv_muscl2   ! MUSCL2   scheme           (tra_adv_muscl2 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 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 
    2729 
    2830   IMPLICIT NONE 
     
    3335   PUBLIC   trc_adv_ini   
    3436 
    35    !                                        !!: ** Advection (namtrc_adv) ** 
    36    LOGICAL , PUBLIC ::   ln_trcadv_cen2      ! 2nd order centered scheme flag 
    37    LOGICAL , PUBLIC ::   ln_trcadv_tvd       ! TVD scheme flag 
    38    LOGICAL , PUBLIC ::   ln_trcadv_muscl     ! MUSCL scheme flag 
    39    LOGICAL , PUBLIC ::   ln_trcadv_muscl2    ! MUSCL2 scheme flag 
    40    LOGICAL , PUBLIC ::   ln_trcadv_ubs       ! UBS scheme flag 
    41    LOGICAL , PUBLIC ::   ln_trcadv_qck       ! QUICKEST scheme flag 
    42    LOGICAL , PUBLIC ::   ln_trcadv_msc_ups   ! use upstream scheme within muscl 
    43  
    44    INTEGER ::   nadv   ! choice of the type of advection scheme 
     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   ! 
    4560   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra 
    4661   !                                                    ! except at nitrrc000 (=rdttra) if neuler=0 
     
    5065#  include "vectopt_loop_substitute.h90" 
    5166   !!---------------------------------------------------------------------- 
    52    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     67   !! NEMO/TOP 3.7 , NEMO Consortium (2015) 
    5368   !! $Id$  
    5469   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     
    6075      !!                  ***  ROUTINE trc_adv_alloc  *** 
    6176      !!---------------------------------------------------------------------- 
    62  
     77      ! 
    6378      ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc ) 
    64  
     79      ! 
    6580      IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.') 
    66  
     81      ! 
    6782   END FUNCTION trc_adv_alloc 
    6883 
     
    7893      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    7994      ! 
    80       INTEGER ::   jk  
     95      INTEGER ::   jk   ! dummy loop index 
    8196      CHARACTER (len=22) ::   charout 
    8297      REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn  ! effective velocity 
     
    93108      ENDIF 
    94109      !                                               !==  effective transport  ==! 
    95       zun(:,:,jpk) = 0._wp                                                       ! no transport trough the bottom 
    96       zvn(:,:,jpk) = 0._wp 
    97       zwn(:,:,jpk) = 0._wp 
    98110      DO jk = 1, jpkm1 
    99111         zun(:,:,jk) = e2u  (:,:) * fse3u(:,:,jk) * un(:,:,jk)                   ! eulerian transport 
     
    112124      IF( ln_mle    )   CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the mle transport 
    113125      ! 
    114       ! 
    115       SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==! 
    116       ! 
    117       CASE ( 1 )   ;    CALL tra_adv_cen2  ( kt, nittrc000, 'TRC',       zun, zvn, zwn, trb, trn, tra, jptra )   !  2nd order centered 
    118       CASE ( 2 )   ;    CALL tra_adv_tvd   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  TVD  
    119       CASE ( 3 )   ;    CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra, ln_trcadv_msc_ups )   !  MUSCL  
    120       CASE ( 4 )   ;    CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  MUSCL2  
    121       CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  UBS  
    122       CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  QUICKEST  
     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                     ) 
    123145      ! 
    124146      END SELECT 
     
    146168      INTEGER ::  ios                 ! Local integer output status for namelist read 
    147169      !! 
    148       NAMELIST/namtrc_adv/ ln_trcadv_cen2 , ln_trcadv_tvd   ,    & 
    149          &                 ln_trcadv_muscl, ln_trcadv_muscl2,    & 
    150          &                 ln_trcadv_ubs  , ln_trcadv_qck, ln_trcadv_msc_ups 
     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 
    151175      !!---------------------------------------------------------------------- 
    152176      ! 
     
    165189         WRITE(numout,*) '~~~~~~~~~~~' 
    166190         WRITE(numout,*) '   Namelist namtrc_adv : chose a advection scheme for tracers' 
    167          WRITE(numout,*) '      2nd order advection scheme     ln_trcadv_cen2   = ', ln_trcadv_cen2 
    168          WRITE(numout,*) '      TVD advection scheme           ln_trcadv_tvd    = ', ln_trcadv_tvd 
    169          WRITE(numout,*) '      MUSCL  advection scheme        ln_trcadv_muscl  = ', ln_trcadv_muscl 
    170          WRITE(numout,*) '      MUSCL2 advection scheme        ln_trcadv_muscl2 = ', ln_trcadv_muscl2 
    171          WRITE(numout,*) '      UBS    advection scheme        ln_trcadv_ubs    = ', ln_trcadv_ubs 
    172          WRITE(numout,*) '      QUICKEST advection scheme      ln_trcadv_qck    = ', ln_trcadv_qck 
     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 
    173203      ENDIF 
    174204      ! 
    175205 
    176206      ioptio = 0                      ! Parameter control 
    177       IF( ln_trcadv_cen2   )   ioptio = ioptio + 1 
    178       IF( ln_trcadv_tvd    )   ioptio = ioptio + 1 
    179       IF( ln_trcadv_muscl  )   ioptio = ioptio + 1 
    180       IF( ln_trcadv_muscl2 )   ioptio = ioptio + 1 
    181       IF( ln_trcadv_ubs    )   ioptio = ioptio + 1 
    182       IF( ln_trcadv_qck    )   ioptio = ioptio + 1 
    183       ! 
     207      IF( ln_trcadv_cen                      )   nadv = np_CEN 
     208      IF( ln_trcadv_fct                      )   nadv = np_FCT 
     209      IF( ln_trcadv_fct .AND. nn_fct_zts > 0 )   nadv = np_FCT_zts 
     210      IF( ln_trcadv_mus                      )   nadv = np_MUS 
     211      IF( ln_trcadv_ubs                      )   nadv = np_UBS 
     212      IF( ln_trcadv_qck                      )   nadv = np_QCK 
     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 
    184218      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' ) 
    185219      ! 
     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      ! 
    186249      !                              ! Set nadv 
    187       IF( ln_trcadv_cen2   )   nadv =  1 
    188       IF( ln_trcadv_tvd    )   nadv =  2 
    189       IF( ln_trcadv_muscl  )   nadv =  3 
    190       IF( ln_trcadv_muscl2 )   nadv =  4 
    191       IF( ln_trcadv_ubs    )   nadv =  5 
    192       IF( ln_trcadv_qck    )   nadv =  6 
     250      IF( ln_trcadv_cen  )   nadv = np_CEN 
     251      IF( ln_trcadv_fct  )   nadv = np_FCT 
     252      IF( nn_fct_zts > 0 )   nadv = np_FCT_zts 
     253      IF( ln_trcadv_mus  )   nadv = np_MUS 
     254      IF( ln_trcadv_ubs  )   nadv = np_UBS 
     255      IF( ln_trcadv_qck  )   nadv = np_QCK 
    193256      ! 
    194257      IF(lwp) THEN                   ! Print the choice 
    195258         WRITE(numout,*) 
    196          IF( nadv ==  1 )   WRITE(numout,*) '         2nd order scheme is used' 
    197          IF( nadv ==  2 )   WRITE(numout,*) '         TVD       scheme is used' 
    198          IF( nadv ==  3 )   WRITE(numout,*) '         MUSCL     scheme is used' 
    199          IF( nadv ==  4 )   WRITE(numout,*) '         MUSCL2    scheme is used' 
    200          IF( nadv ==  5 )   WRITE(numout,*) '         UBS       scheme is used' 
    201          IF( nadv ==  6 )   WRITE(numout,*) '         QUICKEST  scheme is used' 
     259         IF( nadv == np_NO_adv  )   WRITE(numout,*) '         NO passive tracer advection' 
     260         IF( nadv == np_CEN     )   WRITE(numout,*) '         CEN      scheme is used. Horizontal order: ', nn_cen_h,   & 
     261            &                                                                        ' Vertical   order: ', nn_cen_v 
     262         IF( nadv == np_FCT     )   WRITE(numout,*) '         FCT      scheme is used. Horizontal order: ', nn_fct_h,   & 
     263            &                                                                       ' Vertical   order: ', nn_fct_v 
     264         IF( nadv == np_FCT_zts )   WRITE(numout,*) '         use 2nd order FCT with ', nn_fct_zts,'vertical sub-timestepping' 
     265         IF( nadv == np_MUS     )   WRITE(numout,*) '         MUSCL    scheme is used' 
     266         IF( nadv == np_UBS     )   WRITE(numout,*) '         UBS      scheme is used' 
     267         IF( nadv == np_QCK     )   WRITE(numout,*) '         QUICKEST scheme is used' 
    202268      ENDIF 
    203269      ! 
Note: See TracChangeset for help on using the changeset viewer.