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

source: branches/2015/dev_r5721_CNRS9_NOC3_LDF/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90 @ 5758

Last change on this file since 5758 was 5758, checked in by gm, 9 years ago

#1593: LDF-ADV, step II.1: phasing the improvements/simplifications of diffusive trend (see wiki)

  • Property svn:keywords set to Id
File size: 9.0 KB
Line 
1MODULE trcadv
2   !!==============================================================================
3   !!                       ***  MODULE  trcadv  ***
4   !! Ocean passive tracers:  advection trend
5   !!==============================================================================
6   !! History :  2.0  !  05-11  (G. Madec)  Original code
7   !!            3.0  !  10-06  (C. Ethe)   Adapted to passive tracers
8   !!----------------------------------------------------------------------
9#if defined key_top
10   !!----------------------------------------------------------------------
11   !!   'key_top'                                                TOP models
12   !!----------------------------------------------------------------------
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          ! lateral diffusion coefficient on tracers
28   USE prtctl_trc      ! Print control
29
30   IMPLICIT NONE
31   PRIVATE
32
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
37   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra
38   !                                                    ! except at nitrrc000 (=rdttra) if neuler=0
39
40   !! * Substitutions
41#  include "domzgr_substitute.h90"
42#  include "vectopt_loop_substitute.h90"
43   !!----------------------------------------------------------------------
44   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
45   !! $Id$
46   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
47   !!----------------------------------------------------------------------
48CONTAINS
49
50   INTEGER FUNCTION trc_adv_alloc()
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE trc_adv_alloc  ***
53      !!----------------------------------------------------------------------
54
55      ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc )
56
57      IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.')
58
59   END FUNCTION trc_adv_alloc
60
61
62   SUBROUTINE trc_adv( kt )
63      !!----------------------------------------------------------------------
64      !!                  ***  ROUTINE trc_adv  ***
65      !!
66      !! ** Purpose :   compute the ocean tracer advection trend.
67      !!
68      !! ** Method  : - Update the tracer with the advection term following nadv
69      !!----------------------------------------------------------------------
70      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
71      !
72      INTEGER ::   jk 
73      CHARACTER (len=22) ::   charout
74      REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn  ! effective velocity
75      !!----------------------------------------------------------------------
76      !
77      IF( nn_timing == 1 )   CALL timing_start('trc_adv')
78      !
79      CALL wrk_alloc( jpi,jpj,jpk,   zun, zvn, zwn )
80      !
81
82      IF( kt == nittrc000 )   CALL trc_adv_ctl          ! initialisation & control of options
83
84      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000
85         r2dt(:) =  rdttrc(:)           ! = rdttrc (use or restarting with Euler time stepping)
86      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1
87         r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
88      ENDIF
89      !                                               !==  effective transport  ==!
90      zun(:,:,jpk) = 0._wp                                                       ! no transport trough the bottom
91      zvn(:,:,jpk) = 0._wp
92      zwn(:,:,jpk) = 0._wp
93      DO jk = 1, jpkm1
94         zun(:,:,jk) = e2u  (:,:) * fse3u(:,:,jk) * un(:,:,jk)                   ! eulerian transport
95         zvn(:,:,jk) = e1v  (:,:) * fse3v(:,:,jk) * vn(:,:,jk)
96         zwn(:,:,jk) = e1e2t(:,:)                 * wn(:,:,jk)
97      END DO
98      !
99      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN                                 ! add z-tilde and/or vvl corrections
100         zun(:,:,:) = zun(:,:,:) + un_td(:,:,:)
101         zvn(:,:,:) = zvn(:,:,:) + vn_td(:,:,:)
102      ENDIF
103      !
104      IF( ln_ldfeiv .AND. .NOT. ln_traldf_triad )   & 
105         &              CALL ldf_eiv_trp( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the eiv transport
106      !
107      IF( ln_mle    )   CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' )  ! add the mle transport
108      !
109      !
110      SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==!
111      !
112      CASE ( 1 )   ;    CALL tra_adv_cen2  ( kt, nittrc000, 'TRC',       zun, zvn, zwn, trb, trn, tra, jptra )   !  2nd order centered
113      CASE ( 2 )   ;    CALL tra_adv_tvd   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  TVD
114      CASE ( 3 )   ;    CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb,      tra, jptra, ln_trcadv_msc_ups )   !  MUSCL
115      CASE ( 4 )   ;    CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  MUSCL2
116      CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  UBS
117      CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  QUICKEST
118      !
119      END SELECT
120      !                 
121      IF( ln_ctl )   THEN                             !== print mean trends (used for debugging)
122         WRITE(charout, FMT="('adv ')")  ;  CALL prt_ctl_trc_info(charout)
123                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
124      END IF
125      !
126      CALL wrk_dealloc( jpi,jpj,jpk,   zun, zvn, zwn )
127      !
128      IF( nn_timing == 1 )  CALL timing_stop('trc_adv')
129      !
130   END SUBROUTINE trc_adv
131
132
133   SUBROUTINE trc_adv_ctl
134      !!---------------------------------------------------------------------
135      !!                  ***  ROUTINE trc_adv_ctl  ***
136      !!               
137      !! ** Purpose : Control the consistency between namelist options for
138      !!              passive tracer advection schemes and set nadv
139      !!----------------------------------------------------------------------
140      INTEGER ::   ioptio
141      !!----------------------------------------------------------------------
142      !
143      ioptio = 0                      ! Parameter control
144      IF( ln_trcadv_cen2   )   ioptio = ioptio + 1
145      IF( ln_trcadv_tvd    )   ioptio = ioptio + 1
146      IF( ln_trcadv_muscl  )   ioptio = ioptio + 1
147      IF( ln_trcadv_muscl2 )   ioptio = ioptio + 1
148      IF( ln_trcadv_ubs    )   ioptio = ioptio + 1
149      IF( ln_trcadv_qck    )   ioptio = ioptio + 1
150      !
151      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' )
152      !
153      !                              ! Set nadv
154      IF( ln_trcadv_cen2   )   nadv =  1
155      IF( ln_trcadv_tvd    )   nadv =  2
156      IF( ln_trcadv_muscl  )   nadv =  3
157      IF( ln_trcadv_muscl2 )   nadv =  4
158      IF( ln_trcadv_ubs    )   nadv =  5
159      IF( ln_trcadv_qck    )   nadv =  6
160      !
161      IF(lwp) THEN                   ! Print the choice
162         WRITE(numout,*)
163         IF( nadv ==  1 )   WRITE(numout,*) '         2nd order scheme is used'
164         IF( nadv ==  2 )   WRITE(numout,*) '         TVD       scheme is used'
165         IF( nadv ==  3 )   WRITE(numout,*) '         MUSCL     scheme is used'
166         IF( nadv ==  4 )   WRITE(numout,*) '         MUSCL2    scheme is used'
167         IF( nadv ==  5 )   WRITE(numout,*) '         UBS       scheme is used'
168         IF( nadv ==  6 )   WRITE(numout,*) '         QUICKEST  scheme is used'
169      ENDIF
170      !
171   END SUBROUTINE trc_adv_ctl
172   
173#else
174   !!----------------------------------------------------------------------
175   !!   Default option                                         Empty module
176   !!----------------------------------------------------------------------
177CONTAINS
178   SUBROUTINE trc_adv( kt )
179      INTEGER, INTENT(in) :: kt
180      WRITE(*,*) 'trc_adv: You should not have seen this print! error?', kt
181   END SUBROUTINE trc_adv
182#endif
183
184  !!======================================================================
185END MODULE trcadv
Note: See TracBrowser for help on using the repository browser.