1 | MODULE 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_oce ! 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 | !!---------------------------------------------------------------------- |
---|
48 | CONTAINS |
---|
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 | !! |
---|
71 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
72 | ! |
---|
73 | INTEGER :: jk |
---|
74 | CHARACTER (len=22) :: charout |
---|
75 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn ! effective velocity |
---|
76 | !!---------------------------------------------------------------------- |
---|
77 | ! |
---|
78 | IF( nn_timing == 1 ) CALL timing_start('trc_adv') |
---|
79 | ! |
---|
80 | CALL wrk_alloc( jpi, jpj, jpk, zun, zvn, zwn ) |
---|
81 | ! |
---|
82 | |
---|
83 | IF( kt == nittrc000 ) CALL trc_adv_ctl ! initialisation & control of options |
---|
84 | |
---|
85 | IF( ln_top_euler) THEN |
---|
86 | r2dt(:) = rdttrc(:) ! = rdttrc (use Euler time stepping) |
---|
87 | ELSE |
---|
88 | IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! at nittrc000 |
---|
89 | r2dt(:) = rdttrc(:) ! = rdttrc (restarting with Euler time stepping) |
---|
90 | ELSEIF( kt <= nittrc000 + 1 ) THEN ! at nittrc000 or nittrc000+1 |
---|
91 | r2dt(:) = 2. * rdttrc(:) ! = 2 rdttrc (leapfrog) |
---|
92 | ENDIF |
---|
93 | ENDIF |
---|
94 | |
---|
95 | ! ! effective transport |
---|
96 | DO jk = 1, jpkm1 |
---|
97 | ! ! eulerian transport only |
---|
98 | zun(:,:,jk) = e2u (:,:) * fse3u(:,:,jk) * un(:,:,jk) |
---|
99 | zvn(:,:,jk) = e1v (:,:) * fse3v(:,:,jk) * vn(:,:,jk) |
---|
100 | zwn(:,:,jk) = e1e2t(:,:) * wn(:,:,jk) |
---|
101 | ! |
---|
102 | END DO |
---|
103 | ! |
---|
104 | IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN |
---|
105 | zun(:,:,:) = zun(:,:,:) + un_td(:,:,:) |
---|
106 | zvn(:,:,:) = zvn(:,:,:) + vn_td(:,:,:) |
---|
107 | ENDIF |
---|
108 | ! |
---|
109 | zun(:,:,jpk) = 0._wp ! no transport trough the bottom |
---|
110 | zvn(:,:,jpk) = 0._wp ! no transport trough the bottom |
---|
111 | zwn(:,:,jpk) = 0._wp ! no transport trough the bottom |
---|
112 | |
---|
113 | IF( lk_traldf_eiv .AND. .NOT. ln_traldf_grif ) & ! add the eiv transport (if necessary) |
---|
114 | & CALL tra_adv_eiv( kt, nittrc000, zun, zvn, zwn, 'TRC' ) |
---|
115 | ! |
---|
116 | IF( ln_mle ) CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' ) ! add the mle transport (if necessary) |
---|
117 | ! |
---|
118 | SELECT CASE ( nadv ) !== compute advection trend and add it to general trend ==! |
---|
119 | CASE ( 1 ) ; CALL tra_adv_cen2 ( kt, nittrc000, 'TRC', zun, zvn, zwn, trb, trn, tra, jptra ) ! 2nd order centered |
---|
120 | CASE ( 2 ) ; CALL tra_adv_tvd ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! TVD |
---|
121 | CASE ( 3 ) ; CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, tra, jptra, ln_trcadv_msc_ups ) ! MUSCL |
---|
122 | CASE ( 4 ) ; CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! MUSCL2 |
---|
123 | CASE ( 5 ) ; CALL tra_adv_ubs ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! UBS |
---|
124 | CASE ( 6 ) ; CALL tra_adv_qck ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! QUICKEST |
---|
125 | ! |
---|
126 | CASE (-1 ) !== esopa: test all possibility with control print ==! |
---|
127 | CALL tra_adv_cen2 ( kt, nittrc000, 'TRC', zun, zvn, zwn, trb, trn, tra, jptra ) |
---|
128 | WRITE(charout, FMT="('adv1')") ; CALL prt_ctl_trc_info(charout) |
---|
129 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') |
---|
130 | CALL tra_adv_tvd ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) |
---|
131 | WRITE(charout, FMT="('adv2')") ; CALL prt_ctl_trc_info(charout) |
---|
132 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') |
---|
133 | CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, tra, jptra, ln_trcadv_msc_ups ) |
---|
134 | WRITE(charout, FMT="('adv3')") ; CALL prt_ctl_trc_info(charout) |
---|
135 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') |
---|
136 | CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) |
---|
137 | WRITE(charout, FMT="('adv4')") ; CALL prt_ctl_trc_info(charout) |
---|
138 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') |
---|
139 | CALL tra_adv_ubs ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) |
---|
140 | WRITE(charout, FMT="('adv5')") ; CALL prt_ctl_trc_info(charout) |
---|
141 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') |
---|
142 | CALL tra_adv_qck ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) |
---|
143 | WRITE(charout, FMT="('adv6')") ; CALL prt_ctl_trc_info(charout) |
---|
144 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') |
---|
145 | ! |
---|
146 | END SELECT |
---|
147 | |
---|
148 | ! ! print mean trends (used for debugging) |
---|
149 | IF( ln_ctl ) THEN |
---|
150 | WRITE(charout, FMT="('adv ')") ; CALL prt_ctl_trc_info(charout) |
---|
151 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
152 | END IF |
---|
153 | ! |
---|
154 | CALL wrk_dealloc( jpi, jpj, jpk, zun, zvn, zwn ) |
---|
155 | ! |
---|
156 | IF( nn_timing == 1 ) CALL timing_stop('trc_adv') |
---|
157 | ! |
---|
158 | END SUBROUTINE trc_adv |
---|
159 | |
---|
160 | |
---|
161 | SUBROUTINE trc_adv_ctl |
---|
162 | !!--------------------------------------------------------------------- |
---|
163 | !! *** ROUTINE trc_adv_ctl *** |
---|
164 | !! |
---|
165 | !! ** Purpose : Control the consistency between namelist options for |
---|
166 | !! passive tracer advection schemes and set nadv |
---|
167 | !!---------------------------------------------------------------------- |
---|
168 | INTEGER :: ioptio |
---|
169 | !!---------------------------------------------------------------------- |
---|
170 | |
---|
171 | ioptio = 0 ! Parameter control |
---|
172 | IF( ln_trcadv_cen2 ) ioptio = ioptio + 1 |
---|
173 | IF( ln_trcadv_tvd ) ioptio = ioptio + 1 |
---|
174 | IF( ln_trcadv_muscl ) ioptio = ioptio + 1 |
---|
175 | IF( ln_trcadv_muscl2 ) ioptio = ioptio + 1 |
---|
176 | IF( ln_trcadv_ubs ) ioptio = ioptio + 1 |
---|
177 | IF( ln_trcadv_qck ) ioptio = ioptio + 1 |
---|
178 | IF( lk_esopa ) ioptio = 1 |
---|
179 | |
---|
180 | IF( ioptio /= 1 ) CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' ) |
---|
181 | |
---|
182 | ! ! Set nadv |
---|
183 | IF( ln_trcadv_cen2 ) nadv = 1 |
---|
184 | IF( ln_trcadv_tvd ) nadv = 2 |
---|
185 | IF( ln_trcadv_muscl ) nadv = 3 |
---|
186 | IF( ln_trcadv_muscl2 ) nadv = 4 |
---|
187 | IF( ln_trcadv_ubs ) nadv = 5 |
---|
188 | IF( ln_trcadv_qck ) nadv = 6 |
---|
189 | IF( lk_esopa ) nadv = -1 |
---|
190 | |
---|
191 | IF(lwp) THEN ! Print the choice |
---|
192 | WRITE(numout,*) |
---|
193 | IF( nadv == 1 ) WRITE(numout,*) ' 2nd order scheme is used' |
---|
194 | IF( nadv == 2 ) WRITE(numout,*) ' TVD scheme is used' |
---|
195 | IF( nadv == 3 ) WRITE(numout,*) ' MUSCL scheme is used' |
---|
196 | IF( nadv == 4 ) WRITE(numout,*) ' MUSCL2 scheme is used' |
---|
197 | IF( nadv == 5 ) WRITE(numout,*) ' UBS scheme is used' |
---|
198 | IF( nadv == 6 ) WRITE(numout,*) ' QUICKEST scheme is used' |
---|
199 | IF( nadv == -1 ) WRITE(numout,*) ' esopa test: use all advection scheme' |
---|
200 | ENDIF |
---|
201 | ! |
---|
202 | END SUBROUTINE trc_adv_ctl |
---|
203 | |
---|
204 | #else |
---|
205 | !!---------------------------------------------------------------------- |
---|
206 | !! Default option Empty module |
---|
207 | !!---------------------------------------------------------------------- |
---|
208 | CONTAINS |
---|
209 | SUBROUTINE trc_adv( kt ) |
---|
210 | INTEGER, INTENT(in) :: kt |
---|
211 | WRITE(*,*) 'trc_adv: You should not have seen this print! error?', kt |
---|
212 | END SUBROUTINE trc_adv |
---|
213 | #endif |
---|
214 | |
---|
215 | !!====================================================================== |
---|
216 | END MODULE trcadv |
---|