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_crs.F90 in branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv_crs.F90 @ 7215

Last change on this file since 7215 was 6772, checked in by cbricaud, 8 years ago

clean in coarsening branch

  • Property svn:executable set to *
File size: 8.8 KB
Line 
1MODULE trcadv_crs
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 oce_trc, ONLY: un,vn,wn
18   USE trc             ! ocean passive tracers variables
19   USE trcnam_trp      ! passive tracers transport namelist variables
20   USE traadv_cen2     ! 2nd order centered scheme (tra_adv_cen2   routine)
21   USE traadv_tvd_crs  ! TVD      scheme           (tra_adv_tvd    routine)
22   USE traadv_muscl    ! MUSCL    scheme           (tra_adv_muscl  routine)
23   USE traadv_muscl2   ! MUSCL2   scheme           (tra_adv_muscl2 routine)
24   USE traadv_ubs      ! UBS      scheme           (tra_adv_ubs    routine)
25   USE traadv_qck      ! QUICKEST scheme           (tra_adv_qck    routine)
26   USE traadv_eiv      ! eddy induced velocity     (tra_adv_eiv    routine)
27   USE ldftra_oce      ! lateral diffusion coefficient on tracers
28   USE prtctl_trc      ! Print control
29   USE crs , ONLY : e2e3u_msk , e1e3v_msk , e1e2w_msk,jpi_crs,jpj_crs
30   USE timing
31   USE iom, ONLY: iom_put,iom_swap
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   trc_adv_crs          ! routine called by step module
37   PUBLIC   trc_adv_alloc_crs   ! routine called by nemogcm module
38
39   INTEGER ::   nadv   ! choice of the type of advection scheme
40   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra
41   !                                                    ! except at nitrrc000 (=rdttra) if neuler=0
42
43   !! * Substitutions
44#  include "domzgr_substitute.h90"
45#  include "vectopt_loop_substitute.h90"
46   !!----------------------------------------------------------------------
47   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
48   !! $Id: trcadv.F90 3294 2012-01-28 16:44:18Z rblod $
49   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
50   !!----------------------------------------------------------------------
51CONTAINS
52
53   INTEGER FUNCTION trc_adv_alloc_crs()
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE trc_adv_alloc  ***
56      !!----------------------------------------------------------------------
57
58      ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc_crs )
59
60      IF( trc_adv_alloc_crs /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.')
61
62   END FUNCTION trc_adv_alloc_crs
63
64
65   SUBROUTINE trc_adv_crs( kt )
66      !!----------------------------------------------------------------------
67      !!                  ***  ROUTINE trc_adv  ***
68      !!
69      !! ** Purpose :   compute the ocean tracer advection trend.
70      !!
71      !! ** Method  : - Update the tracer with the advection term following nadv
72      !!----------------------------------------------------------------------
73      !!
74      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
75      !
76      INTEGER ::   jk 
77      INTEGER ::   ji,jj
78      CHARACTER (len=22) ::   charout
79      REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn  ! effective velocity
80      !!----------------------------------------------------------------------
81      !
82     
83      IF( nn_timing == 1 )  CALL timing_start('trc_adv')
84      !
85      CALL wrk_alloc( jpi, jpj, jpk, zun, zvn, zwn )
86      !
87
88      IF( kt == nittrc000 )   CALL trc_adv_ctl_crs          ! initialisation & control of options
89
90#if ! defined key_pisces
91      IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
92         r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
93      ELSEIF( kt <= nittrc000 + 1 ) THEN          ! at nittrc000 or nittrc000+1
94         r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
95      ENDIF
96#else
97      r2dt(:) =  rdttrc(:)              ! = rdttrc (for PISCES use Euler time stepping)
98#endif
99
100      DO jk = 1, jpkm1
101         !                                                ! eulerian transport only
102         zun(:,:,jk) = e2e3u_msk(:,:,jk) * un(:,:,jk)
103         zvn(:,:,jk) = e1e3v_msk(:,:,jk) * vn(:,:,jk)
104         zwn(:,:,jk) = e1e2w_msk(:,:,jk) * wn(:,:,jk)
105         !
106      END DO
107
108      zwn(:,:,jpk) = 0.e0                                 ! no transport trough the bottom
109
110      IF( lk_traldf_eiv .AND. .NOT. ln_traldf_grif )   &  ! add the eiv transport (if necessary)
111         &              CALL tra_adv_eiv( kt, nittrc000, zun, zvn, zwn, 'TRC' )
112      !
113      SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==!
114      CASE ( 2 )   ;    CALL tra_adv_tvd_crs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )   !  TVD
115      !
116      CASE (-1 )                                      !==  esopa: test all possibility with control print  ==!
117         CALL tra_adv_tvd_crs   ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra )         
118         WRITE(charout, FMT="('adv2')")  ; CALL prt_ctl_trc_info(charout)
119                                           CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd')
120         !
121      END SELECT
122
123      !                                              ! print mean trends (used for debugging)
124      IF( ln_ctl )   THEN
125         WRITE(charout, FMT="('adv ')")  ;  CALL prt_ctl_trc_info(charout)
126                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
127      END IF
128      !
129      CALL wrk_dealloc( jpi, jpj, jpk, zun, zvn, zwn )
130      !
131      IF( nn_timing == 1 )  CALL timing_stop('trc_adv')
132      !
133   END SUBROUTINE trc_adv_crs
134
135
136   SUBROUTINE trc_adv_ctl_crs
137      !!---------------------------------------------------------------------
138      !!                  ***  ROUTINE trc_adv_ctl  ***
139      !!               
140      !! ** Purpose : Control the consistency between namelist options for
141      !!              passive tracer advection schemes and set nadv
142      !!----------------------------------------------------------------------
143      INTEGER ::   ioptio
144      !!----------------------------------------------------------------------
145
146      ioptio = 0                      ! Parameter control
147      IF( ln_trcadv_cen2   )   ioptio = ioptio + 1
148      IF( ln_trcadv_tvd    )   ioptio = ioptio + 1
149      IF( ln_trcadv_muscl  )   ioptio = ioptio + 1
150      IF( ln_trcadv_muscl2 )   ioptio = ioptio + 1
151      IF( ln_trcadv_ubs    )   ioptio = ioptio + 1
152      IF( ln_trcadv_qck    )   ioptio = ioptio + 1
153      IF( lk_esopa         )   ioptio =          1
154
155      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' )
156
157      !                              ! Set nadv
158      IF( ln_trcadv_cen2   )   nadv =  1
159      IF( ln_trcadv_tvd    )   nadv =  2
160      IF( ln_trcadv_muscl  )   nadv =  3
161      IF( ln_trcadv_muscl2 )   nadv =  4
162      IF( ln_trcadv_ubs    )   nadv =  5
163      IF( ln_trcadv_qck    )   nadv =  6
164      IF( lk_esopa         )   nadv = -1
165
166      IF(lwp) THEN                   ! Print the choice
167         WRITE(numout,*)
168         IF( nadv ==  1 )   WRITE(numout,*) '         2nd order scheme is used'
169         IF( nadv ==  2 )   WRITE(numout,*) '         TVD       scheme is used'
170         IF( nadv ==  3 )   WRITE(numout,*) '         MUSCL     scheme is used'
171         IF( nadv ==  4 )   WRITE(numout,*) '         MUSCL2    scheme is used'
172         IF( nadv ==  5 )   WRITE(numout,*) '         UBS       scheme is used'
173         IF( nadv ==  6 )   WRITE(numout,*) '         QUICKEST  scheme is used'
174         IF( nadv == -1 )   WRITE(numout,*) '         esopa test: use all advection scheme'
175      ENDIF
176      !
177   END SUBROUTINE trc_adv_ctl_crs
178   
179#else
180   !!----------------------------------------------------------------------
181   !!   Default option                                         Empty module
182   !!----------------------------------------------------------------------
183CONTAINS
184   SUBROUTINE trc_adv_crs( kt )
185      INTEGER, INTENT(in) :: kt
186      WRITE(*,*) 'trc_adv: You should not have seen this print! error?', kt
187   END SUBROUTINE trc_adv_crs
188#endif
189
190  !!======================================================================
191END MODULE trcadv_crs
Note: See TracBrowser for help on using the repository browser.