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 9019 for branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90 – NEMO

Ignore:
Timestamp:
2017-12-13T15:58:53+01:00 (6 years ago)
Author:
timgraham
Message:

Merge of dev_CNRS_2017 into branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90

    r7753 r9019  
    1414   !!---------------------------------------------------------------------- 
    1515   !!   tra_adv       : compute ocean tracer advection trend 
    16    !!   tra_adv_ctl   : control the different options of advection scheme 
     16   !!   tra_adv_init  : control the different options of advection scheme 
    1717   !!---------------------------------------------------------------------- 
    1818   USE oce            ! ocean dynamics and active tracers 
    1919   USE dom_oce        ! ocean space and time domain 
    2020   USE domvvl         ! variable vertical scale factors 
     21   USE sbcwave        ! wave module 
     22   USE sbc_oce        ! surface boundary condition: ocean 
    2123   USE traadv_cen     ! centered scheme           (tra_adv_cen  routine) 
    2224   USE traadv_fct     ! FCT      scheme           (tra_adv_fct  routine) 
     
    2729   USE ldftra         ! lateral diffusion: eddy diffusivity & EIV coeff. 
    2830   USE ldfslp         ! Lateral diffusion: slopes of neutral surfaces 
    29    USE trd_oce         ! trends: ocean variables 
    30    USE trdtra          ! trends manager: tracers  
     31   USE trd_oce        ! trends: ocean variables 
     32   USE trdtra         ! trends manager: tracers  
     33   USE diaptr         ! Poleward heat transport  
    3134   ! 
    3235   USE in_out_manager ! I/O manager 
     
    3437   USE prtctl         ! Print control 
    3538   USE lib_mpp        ! MPP library 
    36    USE wrk_nemo       ! Memory Allocation 
    3739   USE timing         ! Timing 
    38    USE sbcwave        ! wave module 
    39    USE sbc_oce        ! surface boundary condition: ocean 
    40    USE diaptr         ! Poleward heat transport  
    4140 
    4241   IMPLICIT NONE 
    4342   PRIVATE 
    4443 
    45    PUBLIC   tra_adv        ! routine called by step module 
    46    PUBLIC   tra_adv_init   ! routine called by opa module 
     44   PUBLIC   tra_adv        ! called by step.F90 
     45   PUBLIC   tra_adv_init   ! called by nemogcm.F90 
    4746 
    4847   !                            !!* Namelist namtra_adv * 
     48   LOGICAL ::   ln_traadv_NONE   ! no advection on T and S 
    4949   LOGICAL ::   ln_traadv_cen    ! centered scheme flag 
    5050   INTEGER ::      nn_cen_h, nn_cen_v   ! =2/4 : horizontal and vertical choices of the order of CEN scheme 
    5151   LOGICAL ::   ln_traadv_fct    ! FCT scheme flag 
    5252   INTEGER ::      nn_fct_h, nn_fct_v   ! =2/4 : horizontal and vertical choices of the order of FCT scheme 
    53    INTEGER ::      nn_fct_zts           ! >=1 : 2nd order FCT with vertical sub-timestepping 
    5453   LOGICAL ::   ln_traadv_mus    ! MUSCL scheme flag 
    5554   LOGICAL ::      ln_mus_ups           ! use upstream scheme in vivcinity of river mouths 
     
    5857   LOGICAL ::   ln_traadv_qck    ! QUICKEST scheme flag 
    5958 
    60    INTEGER ::              nadv             ! choice of the type of advection scheme 
    61    ! 
    62    !                                        ! associated indices: 
     59   INTEGER ::   nadv             ! choice of the type of advection scheme 
     60   !                             ! associated indices: 
    6361   INTEGER, PARAMETER ::   np_NO_adv  = 0   ! no T-S advection 
    6462   INTEGER, PARAMETER ::   np_CEN     = 1   ! 2nd/4th order centered scheme 
    6563   INTEGER, PARAMETER ::   np_FCT     = 2   ! 2nd/4th order Flux Corrected Transport scheme 
    66    INTEGER, PARAMETER ::   np_FCT_zts = 3   ! 2nd order FCT scheme with vertical sub-timestepping 
    67    INTEGER, PARAMETER ::   np_MUS     = 4   ! MUSCL scheme 
    68    INTEGER, PARAMETER ::   np_UBS     = 5   ! 3rd order Upstream Biased Scheme 
    69    INTEGER, PARAMETER ::   np_QCK     = 6   ! QUICK scheme 
     64   INTEGER, PARAMETER ::   np_MUS     = 3   ! MUSCL scheme 
     65   INTEGER, PARAMETER ::   np_UBS     = 4   ! 3rd order Upstream Biased Scheme 
     66   INTEGER, PARAMETER ::   np_QCK     = 5   ! QUICK scheme 
    7067    
    7168   !! * Substitutions 
    7269#  include "vectopt_loop_substitute.h90" 
    7370   !!---------------------------------------------------------------------- 
    74    !! NEMO/OPA 3.7 , NEMO Consortium (2014) 
     71   !! NEMO/OPA 4.0 , NEMO Consortium (2017) 
    7572   !! $Id$ 
    7673   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    8683      !! ** Method  : - Update (ua,va) with the advection term following nadv 
    8784      !!---------------------------------------------------------------------- 
    88       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     85      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    8986      ! 
    9087      INTEGER ::   jk   ! dummy loop index 
    91       REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn 
    92       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrdt, ztrds   ! 3D workspace 
    93       !!---------------------------------------------------------------------- 
    94       ! 
    95       IF( nn_timing == 1 )  CALL timing_start('tra_adv') 
    96       ! 
    97       CALL wrk_alloc( jpi,jpj,jpk,   zun, zvn, zwn ) 
     88      REAL(wp), DIMENSION(jpi,jpj,jpk)        :: zun, zvn, zwn   ! 3D workspace 
     89      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdt, ztrds 
     90      !!---------------------------------------------------------------------- 
     91      ! 
     92      IF( ln_timing )   CALL timing_start('tra_adv') 
    9893      ! 
    9994      !                                          ! set time step 
    100       zun(:,:,:) = 0.0 
    101       zvn(:,:,:) = 0.0 
    102       zwn(:,:,:) = 0.0 
    103       !     
    104       IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000 
    105          r2dt = rdt                                 ! = rdt (restarting with Euler time stepping) 
    106       ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1 
    107          r2dt = 2._wp * rdt                         ! = 2 rdt (leapfrog) 
     95      IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dt =        rdt   ! at nit000             (Euler) 
     96      ELSEIF( kt <= nit000 + 1 )           THEN   ;   r2dt = 2._wp* rdt   ! at nit000 or nit000+1 (Leapfrog) 
    10897      ENDIF 
    10998      ! 
    11099      !                                         !==  effective transport  ==! 
     100      zun(:,:,jpk) = 0._wp 
     101      zvn(:,:,jpk) = 0._wp 
     102      zwn(:,:,jpk) = 0._wp 
    111103      IF( ln_wave .AND. ln_sdw )  THEN 
    112104         DO jk = 1, jpkm1                                                       ! eulerian transport + Stokes Drift 
     
    146138      ! 
    147139      IF( l_trdtra )   THEN                    !* Save ta and sa trends 
    148          CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 
     140         ALLOCATE( ztrdt(jpi,jpj,jpk), ztrds(jpi,jpj,jpk) ) 
    149141         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
    150142         ztrds(:,:,:) = tsa(:,:,:,jp_sal) 
     
    153145      SELECT CASE ( nadv )                      !==  compute advection trend and add it to general trend  ==! 
    154146      ! 
    155       CASE ( np_CEN )                                    ! Centered scheme : 2nd / 4th order 
     147      CASE ( np_CEN )                                 ! Centered scheme : 2nd / 4th order 
    156148         CALL tra_adv_cen    ( kt, nit000, 'TRA',         zun, zvn, zwn     , tsn, tsa, jpts, nn_cen_h, nn_cen_v ) 
    157       CASE ( np_FCT )                                    ! FCT scheme      : 2nd / 4th order 
     149      CASE ( np_FCT )                                 ! FCT scheme      : 2nd / 4th order 
    158150         CALL tra_adv_fct    ( kt, nit000, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts, nn_fct_h, nn_fct_v ) 
    159       CASE ( np_FCT_zts )                                ! 2nd order FCT with vertical time-splitting 
    160          CALL tra_adv_fct_zts( kt, nit000, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts        , nn_fct_zts ) 
    161       CASE ( np_MUS )                                    ! MUSCL 
     151      CASE ( np_MUS )                                 ! MUSCL 
    162152         CALL tra_adv_mus    ( kt, nit000, 'TRA', r2dt, zun, zvn, zwn, tsb,      tsa, jpts        , ln_mus_ups )  
    163       CASE ( np_UBS )                                    ! UBS 
     153      CASE ( np_UBS )                                 ! UBS 
    164154         CALL tra_adv_ubs    ( kt, nit000, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts        , nn_ubs_v   ) 
    165       CASE ( np_QCK )                                    ! QUICKEST 
     155      CASE ( np_QCK )                                 ! QUICKEST 
    166156         CALL tra_adv_qck    ( kt, nit000, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts                     ) 
    167157      ! 
     
    175165         CALL trd_tra( kt, 'TRA', jp_tem, jptra_totad, ztrdt ) 
    176166         CALL trd_tra( kt, 'TRA', jp_sal, jptra_totad, ztrds ) 
    177          CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
     167         DEALLOCATE( ztrdt, ztrds ) 
    178168      ENDIF 
    179169      !                                              ! print mean trends (used for debugging) 
     
    181171         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    182172      ! 
    183       IF( nn_timing == 1 )  CALL timing_stop( 'tra_adv' ) 
    184       ! 
    185       CALL wrk_dealloc( jpi,jpj,jpk,   zun, zvn, zwn ) 
    186       !                                           
     173      IF( ln_timing )   CALL timing_stop( 'tra_adv' ) 
     174      ! 
    187175   END SUBROUTINE tra_adv 
    188176 
     
    197185      INTEGER ::   ioptio, ios   ! Local integers 
    198186      ! 
    199       NAMELIST/namtra_adv/ ln_traadv_cen, nn_cen_h, nn_cen_v,               &   ! CEN 
    200          &                 ln_traadv_fct, nn_fct_h, nn_fct_v, nn_fct_zts,   &   ! FCT 
    201          &                 ln_traadv_mus,                     ln_mus_ups,   &   ! MUSCL 
    202          &                 ln_traadv_ubs,           nn_ubs_v,               &   ! UBS 
    203          &                 ln_traadv_qck                                        ! QCK 
     187      NAMELIST/namtra_adv/ ln_traadv_NONE,                       &   ! No advection 
     188         &                 ln_traadv_cen , nn_cen_h, nn_cen_v,   &   ! CEN 
     189         &                 ln_traadv_fct , nn_fct_h, nn_fct_v,   &   ! FCT 
     190         &                 ln_traadv_mus , ln_mus_ups,           &   ! MUSCL 
     191         &                 ln_traadv_ubs ,           nn_ubs_v,   &   ! UBS 
     192         &                 ln_traadv_qck                             ! QCK 
    204193      !!---------------------------------------------------------------------- 
    205194      ! 
     
    217206         WRITE(numout,*) 
    218207         WRITE(numout,*) 'tra_adv_init : choice/control of the tracer advection scheme' 
    219          WRITE(numout,*) '~~~~~~~~~~~' 
     208         WRITE(numout,*) '~~~~~~~~~~~~' 
    220209         WRITE(numout,*) '   Namelist namtra_adv : chose a advection scheme for tracers' 
     210         WRITE(numout,*) '      No advection on T & S                     ln_traadv_NONE= ', ln_traadv_NONE 
    221211         WRITE(numout,*) '      centered scheme                           ln_traadv_cen = ', ln_traadv_cen 
    222212         WRITE(numout,*) '            horizontal 2nd/4th order               nn_cen_h   = ', nn_fct_h 
     
    225215         WRITE(numout,*) '            horizontal 2nd/4th order               nn_fct_h   = ', nn_fct_h 
    226216         WRITE(numout,*) '            vertical   2nd/4th order               nn_fct_v   = ', nn_fct_v 
    227          WRITE(numout,*) '            2nd order + vertical sub-timestepping  nn_fct_zts = ', nn_fct_zts 
    228217         WRITE(numout,*) '      MUSCL scheme                              ln_traadv_mus = ', ln_traadv_mus 
    229218         WRITE(numout,*) '            + upstream scheme near river mouths    ln_mus_ups = ', ln_mus_ups 
     
    233222      ENDIF 
    234223      ! 
    235       ioptio = 0                       !==  Parameter control  ==! 
    236       IF( ln_traadv_cen )   ioptio = ioptio + 1 
    237       IF( ln_traadv_fct )   ioptio = ioptio + 1 
    238       IF( ln_traadv_mus )   ioptio = ioptio + 1 
    239       IF( ln_traadv_ubs )   ioptio = ioptio + 1 
    240       IF( ln_traadv_qck )   ioptio = ioptio + 1 
    241       ! 
    242       IF( ioptio == 0 ) THEN 
    243          nadv = np_NO_adv 
    244          CALL ctl_warn( 'tra_adv_init: You are running without tracer advection.' ) 
    245       ENDIF 
    246       IF( ioptio /= 1 )   CALL ctl_stop( 'tra_adv_init: Choose ONE advection scheme in namelist namtra_adv' ) 
     224      !                                !==  Parameter control & set nadv ==! 
     225      ioptio = 0                        
     226      IF( ln_traadv_NONE ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_NO_adv   ;   ENDIF 
     227      IF( ln_traadv_cen  ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_CEN      ;   ENDIF 
     228      IF( ln_traadv_fct  ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_FCT      ;   ENDIF 
     229      IF( ln_traadv_mus  ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_MUS      ;   ENDIF 
     230      IF( ln_traadv_ubs  ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_UBS      ;   ENDIF 
     231      IF( ln_traadv_qck  ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_QCK      ;   ENDIF 
     232      ! 
     233      IF( ioptio /= 1 )   CALL ctl_stop( 'tra_adv_init: Choose ONE advection option in namelist namtra_adv' ) 
    247234      ! 
    248235      IF( ln_traadv_cen .AND. ( nn_cen_h /= 2 .AND. nn_cen_h /= 4 )   &          ! Centered 
     
    254241        CALL ctl_stop( 'tra_adv_init: FCT scheme, choose 2nd or 4th order' ) 
    255242      ENDIF 
    256       IF( ln_traadv_fct .AND. nn_fct_zts > 0 ) THEN 
    257          IF( nn_fct_h == 4 ) THEN 
    258             nn_fct_h = 2 
    259             CALL ctl_stop( 'tra_adv_init: force 2nd order FCT scheme, 4th order does not exist with sub-timestepping' ) 
    260          ENDIF 
    261          IF( .NOT.ln_linssh ) THEN 
    262             CALL ctl_stop( 'tra_adv_init: vertical sub-timestepping not allow in non-linear free surface' ) 
    263          ENDIF 
    264          IF( nn_fct_zts == 1 )   CALL ctl_warn( 'tra_adv_init: FCT with ONE sub-timestep = FCT without sub-timestep' ) 
    265       ENDIF 
    266243      IF( ln_traadv_ubs .AND. ( nn_ubs_v /= 2 .AND. nn_ubs_v /= 4 )   ) THEN     ! UBS 
    267244        CALL ctl_stop( 'tra_adv_init: UBS scheme, choose 2nd or 4th order' ) 
     
    275252      ENDIF 
    276253      ! 
    277       !                                !==  used advection scheme  ==!   
    278       !                                      ! set nadv 
    279       IF( ln_traadv_cen                      )   nadv = np_CEN 
    280       IF( ln_traadv_fct                      )   nadv = np_FCT 
    281       IF( ln_traadv_fct .AND. nn_fct_zts > 0 )   nadv = np_FCT_zts 
    282       IF( ln_traadv_mus                      )   nadv = np_MUS 
    283       IF( ln_traadv_ubs                      )   nadv = np_UBS 
    284       IF( ln_traadv_qck                      )   nadv = np_QCK 
    285       ! 
    286       IF(lwp) THEN                           ! Print the choice 
     254      !                                !==  Print the choice  ==!   
     255      IF(lwp) THEN 
    287256         WRITE(numout,*) 
    288257         SELECT CASE ( nadv ) 
     
    292261         CASE( np_FCT     )   ;   WRITE(numout,*) '      ===>>   FCT      scheme is used. Horizontal order: ', nn_fct_h,   & 
    293262            &                                                                      ' Vertical   order: ', nn_fct_v 
    294          CASE( np_FCT_zts )   ;   WRITE(numout,*) '      ===>>   use 2nd order FCT with ', nn_fct_zts,'vertical sub-timestepping' 
    295263         CASE( np_MUS     )   ;   WRITE(numout,*) '      ===>>   MUSCL    scheme is used' 
    296264         CASE( np_UBS     )   ;   WRITE(numout,*) '      ===>>   UBS      scheme is used' 
Note: See TracChangeset for help on using the changeset viewer.