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.
trcadv.F90 in NEMO/trunk/src/TOP/TRP – NEMO

source: NEMO/trunk/src/TOP/TRP/trcadv.F90 @ 13237

Last change on this file since 13237 was 13237, checked in by smasson, 4 years ago

trunk: Mid-year merge, merge back KERNEL-06_techene_e3

  • Property svn:keywords set to Id
File size: 14.0 KB
Line 
1MODULE trcadv
2   !!==============================================================================
3   !!                       ***  MODULE  trcadv  ***
4   !! Ocean passive tracers:  advection trend
5   !!==============================================================================
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
9   !!            4.0  !  2017-09  (G. Madec)  remove vertical time-splitting option
10   !!----------------------------------------------------------------------
11#if defined key_top
12   !!----------------------------------------------------------------------
13   !!   'key_top'                                                TOP models
14   !!----------------------------------------------------------------------
15   !!   trc_adv       : compute ocean tracer advection trend
16   !!   trc_adv_ini   : control the different options of advection scheme
17   !!----------------------------------------------------------------------
18   USE oce_trc        ! ocean dynamics and active tracers
19   USE trc            ! ocean passive tracers variables
20   USE sbcwave        ! wave module
21   USE sbc_oce        ! surface boundary condition: ocean
22   USE traadv_cen     ! centered scheme           (tra_adv_cen  routine)
23   USE traadv_fct     ! FCT      scheme           (tra_adv_fct  routine)
24   USE traadv_mus     ! MUSCL    scheme           (tra_adv_mus  routine)
25   USE traadv_ubs     ! UBS      scheme           (tra_adv_ubs  routine)
26   USE traadv_qck     ! QUICKEST scheme           (tra_adv_qck  routine)
27   USE tramle         ! ML eddy induced transport (tra_adv_mle  routine)
28   USE ldftra         ! lateral diffusion: eddy diffusivity & EIV coeff.
29   USE ldfslp         ! Lateral diffusion: slopes of neutral surfaces
30   !
31   USE prtctl_trc     ! control print
32   USE timing         ! Timing
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   trc_adv       ! called by trctrp.F90
38   PUBLIC   trc_adv_ini   ! called by trcini.F90
39
40   !                            !!* Namelist namtrc_adv *
41   LOGICAL ::   ln_trcadv_OFF    ! no advection on passive tracers
42   LOGICAL ::   ln_trcadv_cen    ! centered scheme flag
43   INTEGER ::      nn_cen_h, nn_cen_v   ! =2/4 : horizontal and vertical choices of the order of CEN scheme
44   LOGICAL ::   ln_trcadv_fct    ! FCT scheme flag
45   INTEGER ::      nn_fct_h, nn_fct_v   ! =2/4 : horizontal and vertical choices of the order of FCT scheme
46   LOGICAL ::   ln_trcadv_mus    ! MUSCL scheme flag
47   LOGICAL ::      ln_mus_ups           ! use upstream scheme in vivcinity of river mouths
48   LOGICAL ::   ln_trcadv_ubs    ! UBS scheme flag
49   INTEGER ::      nn_ubs_v             ! =2/4 : vertical choice of the order of UBS scheme
50   LOGICAL ::   ln_trcadv_qck    ! QUICKEST scheme flag
51
52   INTEGER ::   nadv             ! choice of the type of advection scheme
53   !                             ! associated indices:
54   INTEGER, PARAMETER ::   np_NO_adv  = 0   ! no T-S advection
55   INTEGER, PARAMETER ::   np_CEN     = 1   ! 2nd/4th order centered scheme
56   INTEGER, PARAMETER ::   np_FCT     = 2   ! 2nd/4th order Flux Corrected Transport scheme
57   INTEGER, PARAMETER ::   np_MUS     = 3   ! MUSCL scheme
58   INTEGER, PARAMETER ::   np_UBS     = 4   ! 3rd order Upstream Biased Scheme
59   INTEGER, PARAMETER ::   np_QCK     = 5   ! QUICK scheme
60   
61#  include "domzgr_substitute.h90"
62   !!----------------------------------------------------------------------
63   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
64   !! $Id$
65   !! Software governed by the CeCILL license (see ./LICENSE)
66   !!----------------------------------------------------------------------
67CONTAINS
68
69   SUBROUTINE trc_adv( kt, Kbb, Kmm, ptr, Krhs  )
70      !!----------------------------------------------------------------------
71      !!                  ***  ROUTINE trc_adv  ***
72      !!
73      !! ** Purpose :   compute the ocean tracer advection trend.
74      !!
75      !! ** Method  : - Update after tracers (tr(Krhs)) with the advection term following nadv
76      !!----------------------------------------------------------------------
77      INTEGER                                   , INTENT(in)    :: kt   ! ocean time-step index
78      INTEGER                                   , INTENT(in)    :: Kbb, Kmm, Krhs ! time level indices
79      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
80      !
81      INTEGER ::   jk   ! dummy loop index
82      CHARACTER (len=22) ::   charout
83      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zuu, zvv, zww  ! effective velocity
84      !!----------------------------------------------------------------------
85      !
86      IF( ln_timing )   CALL timing_start('trc_adv')
87      !
88      !                                         !==  effective transport  ==!
89      IF( l_offline ) THEN
90         zuu(:,:,:) = uu(:,:,:,Kmm)                ! already in (uu(Kmm),vv(Kmm),ww)
91         zvv(:,:,:) = vv(:,:,:,Kmm)
92         zww(:,:,:) = ww(:,:,:)
93      ELSE                                         ! build the effective transport
94         zuu(:,:,jpk) = 0._wp
95         zvv(:,:,jpk) = 0._wp
96         zww(:,:,jpk) = 0._wp
97         IF( ln_wave .AND. ln_sdw )  THEN
98            DO jk = 1, jpkm1                                                       ! eulerian transport + Stokes Drift
99               zuu(:,:,jk) = e2u  (:,:) * e3u(:,:,jk,Kmm) * ( uu(:,:,jk,Kmm) + usd(:,:,jk) )
100               zvv(:,:,jk) = e1v  (:,:) * e3v(:,:,jk,Kmm) * ( vv(:,:,jk,Kmm) + vsd(:,:,jk) )
101               zww(:,:,jk) = e1e2t(:,:)                   * ( ww(:,:,jk) + wsd(:,:,jk) )
102            END DO
103         ELSE
104            DO jk = 1, jpkm1
105               zuu(:,:,jk) = e2u  (:,:) * e3u(:,:,jk,Kmm) * uu(:,:,jk,Kmm)                   ! eulerian transport
106               zvv(:,:,jk) = e1v  (:,:) * e3v(:,:,jk,Kmm) * vv(:,:,jk,Kmm)
107               zww(:,:,jk) = e1e2t(:,:)                   * ww(:,:,jk)
108            END DO
109         ENDIF
110         !
111         IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN                                 ! add z-tilde and/or vvl corrections
112            zuu(:,:,:) = zuu(:,:,:) + un_td(:,:,:)
113            zvv(:,:,:) = zvv(:,:,:) + vn_td(:,:,:)
114         ENDIF
115         !
116         IF( ln_ldfeiv .AND. .NOT. ln_traldf_triad )   & 
117            &              CALL ldf_eiv_trp( kt, nittrc000, zuu, zvv, zww, 'TRC', Kmm, Krhs )  ! add the eiv transport
118         !
119         IF( ln_mle    )   CALL tra_mle_trp( kt, nittrc000, zuu, zvv, zww, 'TRC', Kmm       )  ! add the mle transport
120         !
121      ENDIF
122      !
123      SELECT CASE ( nadv )                      !==  compute advection trend and add it to general trend  ==!
124      !
125      CASE ( np_CEN )                                 ! Centered : 2nd / 4th order
126         CALL tra_adv_cen( kt, nittrc000,'TRC',          zuu, zvv, zww,      Kmm, ptr, jptra, Krhs, nn_cen_h, nn_cen_v )
127      CASE ( np_FCT )                                 ! FCT      : 2nd / 4th order
128         CALL tra_adv_fct( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, nn_fct_h, nn_fct_v )
129      CASE ( np_MUS )                                 ! MUSCL
130         CALL tra_adv_mus( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, ln_mus_ups         ) 
131      CASE ( np_UBS )                                 ! UBS
132         CALL tra_adv_ubs( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, nn_ubs_v           )
133      CASE ( np_QCK )                                 ! QUICKEST
134         CALL tra_adv_qck( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs                     )
135      !
136      END SELECT
137      !                 
138      IF( sn_cfctl%l_prttrc ) THEN        !== print mean trends (used for debugging)
139         WRITE(charout, FMT="('adv ')")
140         CALL prt_ctl_trc_info(charout)
141         CALL prt_ctl_trc( tab4d=tr(:,:,:,:,Krhs), mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
142      END IF
143      !
144      IF( ln_timing )   CALL timing_stop('trc_adv')
145      !
146   END SUBROUTINE trc_adv
147
148
149   SUBROUTINE trc_adv_ini
150      !!---------------------------------------------------------------------
151      !!                  ***  ROUTINE trc_adv_ini  ***
152      !!               
153      !! ** Purpose :   Control the consistency between namelist options for
154      !!              passive tracer advection schemes and set nadv
155      !!----------------------------------------------------------------------
156      INTEGER ::   ioptio, ios   ! Local integer
157      !!
158      NAMELIST/namtrc_adv/ ln_trcadv_OFF,                        &   ! No advection
159         &                 ln_trcadv_cen, nn_cen_h, nn_cen_v,    &   ! CEN
160         &                 ln_trcadv_fct, nn_fct_h, nn_fct_v,    &   ! FCT
161         &                 ln_trcadv_mus, ln_mus_ups,            &   ! MUSCL
162         &                 ln_trcadv_ubs,           nn_ubs_v,    &   ! UBS
163         &                 ln_trcadv_qck                             ! QCK
164      !!----------------------------------------------------------------------
165      !
166      !                                !==  Namelist  ==!
167      READ  ( numnat_ref, namtrc_adv, IOSTAT = ios, ERR = 901)
168901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_adv in reference namelist' )
169      READ  ( numnat_cfg, namtrc_adv, IOSTAT = ios, ERR = 902 )
170902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_adv in configuration namelist' )
171      IF(lwm) WRITE ( numont, namtrc_adv )
172      !
173      IF(lwp) THEN                           ! Namelist print
174         WRITE(numout,*)
175         WRITE(numout,*) 'trc_adv_ini : choice/control of the tracer advection scheme'
176         WRITE(numout,*) '~~~~~~~~~~~'
177         WRITE(numout,*) '   Namelist namtrc_adv : chose a advection scheme for tracers'
178         WRITE(numout,*) '      No advection on passive tracers           ln_trcadv_OFF = ', ln_trcadv_OFF
179         WRITE(numout,*) '      centered scheme                           ln_trcadv_cen = ', ln_trcadv_cen
180         WRITE(numout,*) '            horizontal 2nd/4th order               nn_cen_h   = ', nn_fct_h
181         WRITE(numout,*) '            vertical   2nd/4th order               nn_cen_v   = ', nn_fct_v
182         WRITE(numout,*) '      Flux Corrected Transport scheme           ln_trcadv_fct = ', ln_trcadv_fct
183         WRITE(numout,*) '            horizontal 2nd/4th order               nn_fct_h   = ', nn_fct_h
184         WRITE(numout,*) '            vertical   2nd/4th order               nn_fct_v   = ', nn_fct_v
185         WRITE(numout,*) '      MUSCL scheme                              ln_trcadv_mus = ', ln_trcadv_mus
186         WRITE(numout,*) '            + upstream scheme near river mouths    ln_mus_ups = ', ln_mus_ups
187         WRITE(numout,*) '      UBS scheme                                ln_trcadv_ubs = ', ln_trcadv_ubs
188         WRITE(numout,*) '            vertical   2nd/4th order               nn_ubs_v   = ', nn_ubs_v
189         WRITE(numout,*) '      QUICKEST scheme                           ln_trcadv_qck = ', ln_trcadv_qck
190      ENDIF
191      !
192      !                                !==  Parameter control & set nadv ==!
193      ioptio = 0
194      IF( ln_trcadv_OFF ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_NO_adv   ;   ENDIF
195      IF( ln_trcadv_cen ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_CEN      ;   ENDIF
196      IF( ln_trcadv_fct ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_FCT      ;   ENDIF
197      IF( ln_trcadv_mus ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_MUS      ;   ENDIF
198      IF( ln_trcadv_ubs ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_UBS      ;   ENDIF
199      IF( ln_trcadv_qck ) THEN   ;   ioptio = ioptio + 1   ;   nadv = np_QCK      ;   ENDIF
200      !
201      IF( ioptio /= 1 )   CALL ctl_stop( 'trc_adv_ini: Choose ONE advection option in namelist namtrc_adv' )
202      !
203      IF( ln_trcadv_cen .AND. ( nn_cen_h /= 2 .AND. nn_cen_h /= 4 )   &
204                        .AND. ( nn_cen_v /= 2 .AND. nn_cen_v /= 4 )   ) THEN
205        CALL ctl_stop( 'trc_adv_ini: CEN scheme, choose 2nd or 4th order' )
206      ENDIF
207      IF( ln_trcadv_fct .AND. ( nn_fct_h /= 2 .AND. nn_fct_h /= 4 )   &
208                        .AND. ( nn_fct_v /= 2 .AND. nn_fct_v /= 4 )   ) THEN
209        CALL ctl_stop( 'trc_adv_ini: FCT scheme, choose 2nd or 4th order' )
210      ENDIF
211      IF( ln_trcadv_ubs .AND. ( nn_ubs_v /= 2 .AND. nn_ubs_v /= 4 )   ) THEN
212        CALL ctl_stop( 'trc_adv_ini: UBS scheme, choose 2nd or 4th order' )
213      ENDIF
214      IF( ln_trcadv_ubs .AND. nn_ubs_v == 4 ) THEN
215         CALL ctl_warn( 'trc_adv_ini: UBS scheme, only 2nd FCT scheme available on the vertical. It will be used' )
216      ENDIF
217      IF( ln_isfcav ) THEN                                                       ! ice-shelf cavities
218         IF(  ln_trcadv_cen .AND. nn_cen_v == 4    .OR.   &                            ! NO 4th order with ISF
219            & ln_trcadv_fct .AND. nn_fct_v == 4   )   CALL ctl_stop( 'tra_adv_ini: 4th order COMPACT scheme not allowed with ISF' )
220      ENDIF
221      !
222      !                                !==  Print the choice  ==! 
223      IF(lwp) THEN
224         WRITE(numout,*)
225         SELECT CASE ( nadv )
226         CASE( np_NO_adv  )   ;   WRITE(numout,*) '      ===>>   NO passive tracer advection'
227         CASE( np_CEN     )   ;   WRITE(numout,*) '      ===>>   CEN      scheme is used. Horizontal order: ', nn_cen_h,   &
228            &                                                                     ' Vertical   order: ', nn_cen_v
229         CASE( np_FCT     )   ;   WRITE(numout,*) '      ===>>   FCT      scheme is used. Horizontal order: ', nn_fct_h,   &
230            &                                                                      ' Vertical   order: ', nn_fct_v
231         CASE( np_MUS     )   ;   WRITE(numout,*) '      ===>>   MUSCL    scheme is used'
232         CASE( np_UBS     )   ;   WRITE(numout,*) '      ===>>   UBS      scheme is used'
233         CASE( np_QCK     )   ;   WRITE(numout,*) '      ===>>   QUICKEST scheme is used'
234         END SELECT
235      ENDIF
236      !
237   END SUBROUTINE trc_adv_ini
238   
239#endif
240
241  !!======================================================================
242END MODULE trcadv
Note: See TracBrowser for help on using the repository browser.