1 | MODULE traadv_tvd |
---|
2 | !!============================================================================== |
---|
3 | !! *** MODULE traadv_tvd *** |
---|
4 | !! Ocean tracers: horizontal & vertical advective trend |
---|
5 | !!============================================================================== |
---|
6 | !! History : OPA ! 1995-12 (L. Mortier) Original code |
---|
7 | !! ! 2000-01 (H. Loukos) adapted to ORCA |
---|
8 | !! ! 2000-10 (MA Foujols E.Kestenare) include file not routine |
---|
9 | !! ! 2000-12 (E. Kestenare M. Levy) fix bug in trtrd indexes |
---|
10 | !! ! 2001-07 (E. Durand G. Madec) adaptation to ORCA config |
---|
11 | !! 8.5 ! 2002-06 (G. Madec) F90: Free form and module |
---|
12 | !! NEMO 1.0 ! 2004-01 (A. de Miranda, G. Madec, J.M. Molines ): advective bbl |
---|
13 | !! 2.0 ! 2008-04 (S. Cravatte) add the i-, j- & k- trends computation |
---|
14 | !! - ! 2009-11 (V. Garnier) Surface pressure gradient organization |
---|
15 | !! 3.3 ! 2010-05 (C. Ethe, G. Madec) merge TRC-TRA + switch from velocity to transport |
---|
16 | !!---------------------------------------------------------------------- |
---|
17 | |
---|
18 | !!---------------------------------------------------------------------- |
---|
19 | !! tra_adv_tvd : update the tracer trend with the 3D advection trends using a TVD scheme |
---|
20 | !! nonosc : compute monotonic tracer fluxes by a non-oscillatory algorithm |
---|
21 | !!---------------------------------------------------------------------- |
---|
22 | USE oce ! ocean dynamics and active tracers |
---|
23 | USE dom_oce ! ocean space and time domain |
---|
24 | USE trc_oce ! share passive tracers/Ocean variables |
---|
25 | USE trd_oce ! trends: ocean variables |
---|
26 | USE trdtra ! tracers trends |
---|
27 | USE dynspg_oce ! choice/control of key cpp for surface pressure gradient |
---|
28 | USE diaptr ! poleward transport diagnostics |
---|
29 | ! |
---|
30 | USE lib_mpp ! MPP library |
---|
31 | USE lbclnk ! ocean lateral boundary condition (or mpp link) |
---|
32 | USE in_out_manager ! I/O manager |
---|
33 | USE wrk_nemo ! Memory Allocation |
---|
34 | USE timing ! Timing |
---|
35 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
36 | USE iom |
---|
37 | |
---|
38 | IMPLICIT NONE |
---|
39 | PRIVATE |
---|
40 | |
---|
41 | PUBLIC tra_adv_tvd ! routine called by traadv.F90 |
---|
42 | PUBLIC tra_adv_tvd_zts ! routine called by traadv.F90 |
---|
43 | |
---|
44 | LOGICAL :: l_trd ! flag to compute trends |
---|
45 | LOGICAL :: l_trans ! flag to output vertically integrated transports |
---|
46 | |
---|
47 | !! * Substitutions |
---|
48 | # include "domzgr_substitute.h90" |
---|
49 | # include "vectopt_loop_substitute.h90" |
---|
50 | !!---------------------------------------------------------------------- |
---|
51 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
52 | !! $Id$ |
---|
53 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
54 | !!---------------------------------------------------------------------- |
---|
55 | CONTAINS |
---|
56 | |
---|
57 | SUBROUTINE tra_adv_tvd ( kt, kit000, cdtype, p2dt, pun, pvn, pwn, & |
---|
58 | & ptb, ptn, pta, kjpt ) |
---|
59 | !!---------------------------------------------------------------------- |
---|
60 | !! *** ROUTINE tra_adv_tvd *** |
---|
61 | !! |
---|
62 | !! ** Purpose : Compute the now trend due to total advection of |
---|
63 | !! tracers and add it to the general trend of tracer equations |
---|
64 | !! |
---|
65 | !! ** Method : TVD scheme, i.e. 2nd order centered scheme with |
---|
66 | !! corrected flux (monotonic correction) |
---|
67 | !! note: - this advection scheme needs a leap-frog time scheme |
---|
68 | !! |
---|
69 | !! ** Action : - update (pta) with the now advective tracer trends |
---|
70 | !! - save the trends |
---|
71 | !!---------------------------------------------------------------------- |
---|
72 | USE oce , ONLY: zwx => ua , zwy => va ! (ua,va) used as workspace |
---|
73 | ! |
---|
74 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
75 | INTEGER , INTENT(in ) :: kit000 ! first time step index |
---|
76 | CHARACTER(len=3) , INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) |
---|
77 | INTEGER , INTENT(in ) :: kjpt ! number of tracers |
---|
78 | REAL(wp), DIMENSION( jpk ), INTENT(in ) :: p2dt ! vertical profile of tracer time-step |
---|
79 | REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT(in ) :: pun, pvn, pwn ! 3 ocean velocity components |
---|
80 | REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in ) :: ptb, ptn ! before and now tracer fields |
---|
81 | REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) :: pta ! tracer trend |
---|
82 | ! |
---|
83 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
84 | INTEGER :: ik |
---|
85 | REAL(wp) :: z2dtt, zbtr, ztra ! local scalar |
---|
86 | REAL(wp) :: zfp_ui, zfp_vj, zfp_wk ! - - |
---|
87 | REAL(wp) :: zfm_ui, zfm_vj, zfm_wk ! - - |
---|
88 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zwi, zwz |
---|
89 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz, zptry |
---|
90 | REAL(wp), POINTER, DIMENSION(:,:) :: z2d |
---|
91 | !!---------------------------------------------------------------------- |
---|
92 | ! |
---|
93 | IF( nn_timing == 1 ) CALL timing_start('tra_adv_tvd') |
---|
94 | ! |
---|
95 | CALL wrk_alloc( jpi, jpj, jpk, zwi, zwz ) |
---|
96 | ! |
---|
97 | IF( kt == kit000 ) THEN |
---|
98 | IF(lwp) WRITE(numout,*) |
---|
99 | IF(lwp) WRITE(numout,*) 'tra_adv_tvd : TVD advection scheme on ', cdtype |
---|
100 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' |
---|
101 | ! |
---|
102 | l_trd = .FALSE. |
---|
103 | l_trans = .FALSE. |
---|
104 | IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE. |
---|
105 | IF( cdtype == 'TRA' .AND. (iom_use("uadv_heattr") .OR. iom_use("vadv_heattr") ) ) l_trans = .TRUE. |
---|
106 | ENDIF |
---|
107 | ! |
---|
108 | IF( l_trd .OR. l_trans ) THEN |
---|
109 | CALL wrk_alloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) |
---|
110 | ztrdx(:,:,:) = 0.e0 ; ztrdy(:,:,:) = 0.e0 ; ztrdz(:,:,:) = 0.e0 |
---|
111 | CALL wrk_alloc( jpi, jpj, z2d ) |
---|
112 | ENDIF |
---|
113 | ! |
---|
114 | IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN |
---|
115 | CALL wrk_alloc( jpi, jpj, jpk, zptry ) |
---|
116 | zptry(:,:,:) = 0._wp |
---|
117 | ENDIF |
---|
118 | ! |
---|
119 | zwi(:,:,:) = 0.e0 ; |
---|
120 | ! |
---|
121 | ! ! =========== |
---|
122 | DO jn = 1, kjpt ! tracer loop |
---|
123 | ! ! =========== |
---|
124 | ! 1. Bottom and k=1 value : flux set to zero |
---|
125 | ! ---------------------------------- |
---|
126 | zwx(:,:,jpk) = 0.e0 ; zwz(:,:,jpk) = 0.e0 |
---|
127 | zwy(:,:,jpk) = 0.e0 ; zwi(:,:,jpk) = 0.e0 |
---|
128 | |
---|
129 | zwz(:,:,1 ) = 0._wp |
---|
130 | ! 2. upstream advection with initial mass fluxes & intermediate update |
---|
131 | ! -------------------------------------------------------------------- |
---|
132 | ! upstream tracer flux in the i and j direction |
---|
133 | DO jk = 1, jpkm1 |
---|
134 | DO jj = 1, jpjm1 |
---|
135 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
136 | ! upstream scheme |
---|
137 | zfp_ui = pun(ji,jj,jk) + ABS( pun(ji,jj,jk) ) |
---|
138 | zfm_ui = pun(ji,jj,jk) - ABS( pun(ji,jj,jk) ) |
---|
139 | zfp_vj = pvn(ji,jj,jk) + ABS( pvn(ji,jj,jk) ) |
---|
140 | zfm_vj = pvn(ji,jj,jk) - ABS( pvn(ji,jj,jk) ) |
---|
141 | zwx(ji,jj,jk) = 0.5 * ( zfp_ui * ptb(ji,jj,jk,jn) + zfm_ui * ptb(ji+1,jj ,jk,jn) ) |
---|
142 | zwy(ji,jj,jk) = 0.5 * ( zfp_vj * ptb(ji,jj,jk,jn) + zfm_vj * ptb(ji ,jj+1,jk,jn) ) |
---|
143 | END DO |
---|
144 | END DO |
---|
145 | END DO |
---|
146 | |
---|
147 | ! upstream tracer flux in the k direction |
---|
148 | ! Interior value |
---|
149 | DO jk = 2, jpkm1 |
---|
150 | DO jj = 1, jpj |
---|
151 | DO ji = 1, jpi |
---|
152 | zfp_wk = pwn(ji,jj,jk) + ABS( pwn(ji,jj,jk) ) |
---|
153 | zfm_wk = pwn(ji,jj,jk) - ABS( pwn(ji,jj,jk) ) |
---|
154 | zwz(ji,jj,jk) = 0.5 * ( zfp_wk * ptb(ji,jj,jk,jn) + zfm_wk * ptb(ji,jj,jk-1,jn) ) * wmask(ji,jj,jk) |
---|
155 | END DO |
---|
156 | END DO |
---|
157 | END DO |
---|
158 | ! Surface value |
---|
159 | IF( lk_vvl ) THEN |
---|
160 | IF ( ln_isfcav ) THEN |
---|
161 | DO jj = 1, jpj |
---|
162 | DO ji = 1, jpi |
---|
163 | zwz(ji,jj, mikt(ji,jj) ) = 0.e0 ! volume variable |
---|
164 | END DO |
---|
165 | END DO |
---|
166 | ELSE |
---|
167 | zwz(:,:,1) = 0.e0 ! volume variable |
---|
168 | END IF |
---|
169 | ELSE |
---|
170 | IF ( ln_isfcav ) THEN |
---|
171 | DO jj = 1, jpj |
---|
172 | DO ji = 1, jpi |
---|
173 | zwz(ji,jj, mikt(ji,jj) ) = pwn(ji,jj,mikt(ji,jj)) * ptb(ji,jj,mikt(ji,jj),jn) ! linear free surface |
---|
174 | END DO |
---|
175 | END DO |
---|
176 | ELSE |
---|
177 | zwz(:,:,1) = pwn(:,:,1) * ptb(:,:,1,jn) ! linear free surface |
---|
178 | END IF |
---|
179 | ENDIF |
---|
180 | |
---|
181 | ! total advective trend |
---|
182 | DO jk = 1, jpkm1 |
---|
183 | z2dtt = p2dt(jk) |
---|
184 | DO jj = 2, jpjm1 |
---|
185 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
186 | ! total intermediate advective trends |
---|
187 | ztra = - ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) & |
---|
188 | & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk ) & |
---|
189 | & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) / e1e2t(ji,jj) |
---|
190 | ! update and guess with monotonic sheme |
---|
191 | pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra / fse3t_n(ji,jj,jk) * tmask(ji,jj,jk) |
---|
192 | zwi(ji,jj,jk) = ( fse3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + z2dtt * ztra ) / fse3t_a(ji,jj,jk) * tmask(ji,jj,jk) |
---|
193 | END DO |
---|
194 | END DO |
---|
195 | END DO |
---|
196 | ! ! Lateral boundary conditions on zwi (unchanged sign) |
---|
197 | CALL lbc_lnk( zwi, 'T', 1. ) |
---|
198 | |
---|
199 | ! ! trend diagnostics (contribution of upstream fluxes) |
---|
200 | IF( l_trd .OR. l_trans ) THEN |
---|
201 | ! store intermediate advective trends |
---|
202 | ztrdx(:,:,:) = zwx(:,:,:) ; ztrdy(:,:,:) = zwy(:,:,:) ; ztrdz(:,:,:) = zwz(:,:,:) |
---|
203 | END IF |
---|
204 | ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) |
---|
205 | IF( cdtype == 'TRA' .AND. ln_diaptr ) zptry(:,:,:) = zwy(:,:,:) |
---|
206 | |
---|
207 | ! 3. antidiffusive flux : high order minus low order |
---|
208 | ! -------------------------------------------------- |
---|
209 | ! antidiffusive flux on i and j |
---|
210 | DO jk = 1, jpkm1 |
---|
211 | DO jj = 1, jpjm1 |
---|
212 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
213 | zwx(ji,jj,jk) = 0.5 * pun(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji+1,jj,jk,jn) ) - zwx(ji,jj,jk) |
---|
214 | zwy(ji,jj,jk) = 0.5 * pvn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj+1,jk,jn) ) - zwy(ji,jj,jk) |
---|
215 | END DO |
---|
216 | END DO |
---|
217 | END DO |
---|
218 | |
---|
219 | ! antidiffusive flux on k |
---|
220 | ! Interior value |
---|
221 | DO jk = 2, jpkm1 |
---|
222 | DO jj = 1, jpj |
---|
223 | DO ji = 1, jpi |
---|
224 | zwz(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj,jk-1,jn) ) - zwz(ji,jj,jk) |
---|
225 | END DO |
---|
226 | END DO |
---|
227 | END DO |
---|
228 | ! surface value |
---|
229 | IF ( ln_isfcav ) THEN |
---|
230 | DO jj = 1, jpj |
---|
231 | DO ji = 1, jpi |
---|
232 | zwz(ji,jj,mikt(ji,jj)) = 0.e0 |
---|
233 | END DO |
---|
234 | END DO |
---|
235 | ELSE |
---|
236 | zwz(:,:,1) = 0.e0 |
---|
237 | END IF |
---|
238 | CALL lbc_lnk( zwx, 'U', -1. ) ; CALL lbc_lnk( zwy, 'V', -1. ) ! Lateral bondary conditions |
---|
239 | CALL lbc_lnk( zwz, 'W', 1. ) |
---|
240 | |
---|
241 | ! 4. monotonicity algorithm |
---|
242 | ! ------------------------- |
---|
243 | CALL nonosc( ptb(:,:,:,jn), zwx, zwy, zwz, zwi, p2dt ) |
---|
244 | |
---|
245 | |
---|
246 | ! 5. final trend with corrected fluxes |
---|
247 | ! ------------------------------------ |
---|
248 | DO jk = 1, jpkm1 |
---|
249 | DO jj = 2, jpjm1 |
---|
250 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
251 | zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) ) |
---|
252 | ! total advective trends |
---|
253 | ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) & |
---|
254 | & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk ) & |
---|
255 | & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) |
---|
256 | ! add them to the general tracer trends |
---|
257 | pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra * tmask(ji,jj,jk) |
---|
258 | END DO |
---|
259 | END DO |
---|
260 | END DO |
---|
261 | |
---|
262 | ! ! trend diagnostics (contribution of upstream fluxes) |
---|
263 | IF( l_trd .OR. l_trans ) THEN |
---|
264 | ztrdx(:,:,:) = ztrdx(:,:,:) + zwx(:,:,:) ! <<< Add to previously computed |
---|
265 | ztrdy(:,:,:) = ztrdy(:,:,:) + zwy(:,:,:) ! <<< Add to previously computed |
---|
266 | ztrdz(:,:,:) = ztrdz(:,:,:) + zwz(:,:,:) ! <<< Add to previously computed |
---|
267 | ENDIF |
---|
268 | |
---|
269 | IF( l_trd ) THEN |
---|
270 | CALL trd_tra( kt, cdtype, jn, jptra_xad, ztrdx, pun, ptn(:,:,:,jn) ) |
---|
271 | CALL trd_tra( kt, cdtype, jn, jptra_yad, ztrdy, pvn, ptn(:,:,:,jn) ) |
---|
272 | CALL trd_tra( kt, cdtype, jn, jptra_zad, ztrdz, pwn, ptn(:,:,:,jn) ) |
---|
273 | END IF |
---|
274 | |
---|
275 | IF( l_trans .AND. jn==jp_tem ) THEN |
---|
276 | z2d(:,:) = 0._wp |
---|
277 | DO jk = 1, jpkm1 |
---|
278 | DO jj = 2, jpjm1 |
---|
279 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
280 | z2d(ji,jj) = z2d(ji,jj) + ztrdx(ji,jj,jk) |
---|
281 | END DO |
---|
282 | END DO |
---|
283 | END DO |
---|
284 | CALL lbc_lnk( z2d, 'U', -1. ) |
---|
285 | CALL iom_put( "uadv_heattr", rau0_rcp * z2d ) ! heat transport in i-direction |
---|
286 | ! |
---|
287 | z2d(:,:) = 0._wp |
---|
288 | DO jk = 1, jpkm1 |
---|
289 | DO jj = 2, jpjm1 |
---|
290 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
291 | z2d(ji,jj) = z2d(ji,jj) + ztrdy(ji,jj,jk) |
---|
292 | END DO |
---|
293 | END DO |
---|
294 | END DO |
---|
295 | CALL lbc_lnk( z2d, 'V', -1. ) |
---|
296 | CALL iom_put( "vadv_heattr", rau0_rcp * z2d ) ! heat transport in j-direction |
---|
297 | ENDIF |
---|
298 | ! "Poleward" heat and salt transports (contribution of upstream fluxes) |
---|
299 | IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN |
---|
300 | zptry(:,:,:) = zptry(:,:,:) + zwy(:,:,:) ! <<< Add to previously computed |
---|
301 | CALL dia_ptr_ohst_components( jn, 'adv', zptry(:,:,:) ) |
---|
302 | ENDIF |
---|
303 | ! |
---|
304 | END DO |
---|
305 | ! |
---|
306 | CALL wrk_dealloc( jpi, jpj, jpk, zwi, zwz ) |
---|
307 | IF( l_trd .OR. l_trans ) THEN |
---|
308 | CALL wrk_dealloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) |
---|
309 | CALL wrk_dealloc( jpi, jpj, z2d ) |
---|
310 | ENDIF |
---|
311 | IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL wrk_dealloc( jpi, jpj, jpk, zptry ) |
---|
312 | ! |
---|
313 | IF( nn_timing == 1 ) CALL timing_stop('tra_adv_tvd') |
---|
314 | ! |
---|
315 | END SUBROUTINE tra_adv_tvd |
---|
316 | |
---|
317 | SUBROUTINE tra_adv_tvd_zts ( kt, kit000, cdtype, p2dt, pun, pvn, pwn, & |
---|
318 | & ptb, ptn, pta, kjpt ) |
---|
319 | !!---------------------------------------------------------------------- |
---|
320 | !! *** ROUTINE tra_adv_tvd_zts *** |
---|
321 | !! |
---|
322 | !! ** Purpose : Compute the now trend due to total advection of |
---|
323 | !! tracers and add it to the general trend of tracer equations |
---|
324 | !! |
---|
325 | !! ** Method : TVD ZTS scheme, i.e. 2nd order centered scheme with |
---|
326 | !! corrected flux (monotonic correction). This version use sub- |
---|
327 | !! timestepping for the vertical advection which increases stability |
---|
328 | !! when vertical metrics are small. |
---|
329 | !! note: - this advection scheme needs a leap-frog time scheme |
---|
330 | !! |
---|
331 | !! ** Action : - update (pta) with the now advective tracer trends |
---|
332 | !! - save the trends |
---|
333 | !!---------------------------------------------------------------------- |
---|
334 | USE oce , ONLY: zwx => ua , zwy => va ! (ua,va) used as workspace |
---|
335 | ! |
---|
336 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
337 | INTEGER , INTENT(in ) :: kit000 ! first time step index |
---|
338 | CHARACTER(len=3) , INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) |
---|
339 | INTEGER , INTENT(in ) :: kjpt ! number of tracers |
---|
340 | REAL(wp), DIMENSION( jpk ), INTENT(in ) :: p2dt ! vertical profile of tracer time-step |
---|
341 | REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT(in ) :: pun, pvn, pwn ! 3 ocean velocity components |
---|
342 | REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in ) :: ptb, ptn ! before and now tracer fields |
---|
343 | REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) :: pta ! tracer trend |
---|
344 | ! |
---|
345 | REAL(wp), DIMENSION( jpk ) :: zts ! length of sub-timestep for vertical advection |
---|
346 | REAL(wp), DIMENSION( jpk ) :: zr_p2dt ! reciprocal of tracer timestep |
---|
347 | INTEGER :: ji, jj, jk, jl, jn ! dummy loop indices |
---|
348 | INTEGER :: jnzts = 5 ! number of sub-timesteps for vertical advection |
---|
349 | INTEGER :: jtb, jtn, jta ! sub timestep pointers for leap-frog/euler forward steps |
---|
350 | INTEGER :: jtaken ! toggle for collecting appropriate fluxes from sub timesteps |
---|
351 | REAL(wp) :: z_rzts ! Fractional length of Euler forward sub-timestep for vertical advection |
---|
352 | REAL(wp) :: z2dtt, zbtr, ztra ! local scalar |
---|
353 | REAL(wp) :: zfp_ui, zfp_vj, zfp_wk ! - - |
---|
354 | REAL(wp) :: zfm_ui, zfm_vj, zfm_wk ! - - |
---|
355 | REAL(wp), POINTER, DIMENSION(:,: ) :: zwx_sav , zwy_sav |
---|
356 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zwi, zwz, zhdiv, zwz_sav, zwzts |
---|
357 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz |
---|
358 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zptry |
---|
359 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrs |
---|
360 | !!---------------------------------------------------------------------- |
---|
361 | ! |
---|
362 | IF( nn_timing == 1 ) CALL timing_start('tra_adv_tvd_zts') |
---|
363 | ! |
---|
364 | CALL wrk_alloc( jpi, jpj, zwx_sav, zwy_sav ) |
---|
365 | CALL wrk_alloc( jpi, jpj, jpk, zwi, zwz , zhdiv, zwz_sav, zwzts ) |
---|
366 | CALL wrk_alloc( jpi, jpj, jpk, kjpt+1, ztrs ) |
---|
367 | ! |
---|
368 | IF( kt == kit000 ) THEN |
---|
369 | IF(lwp) WRITE(numout,*) |
---|
370 | IF(lwp) WRITE(numout,*) 'tra_adv_tvd_zts : TVD ZTS advection scheme on ', cdtype |
---|
371 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' |
---|
372 | ENDIF |
---|
373 | ! |
---|
374 | l_trd = .FALSE. |
---|
375 | IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE. |
---|
376 | ! |
---|
377 | IF( l_trd ) THEN |
---|
378 | CALL wrk_alloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) |
---|
379 | ztrdx(:,:,:) = 0._wp ; ztrdy(:,:,:) = 0._wp ; ztrdz(:,:,:) = 0._wp |
---|
380 | ENDIF |
---|
381 | ! |
---|
382 | IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN |
---|
383 | CALL wrk_alloc( jpi, jpj,jpk, zptry ) |
---|
384 | zptry(:,:,:) = 0._wp |
---|
385 | ENDIF |
---|
386 | ! |
---|
387 | zwi(:,:,:) = 0._wp |
---|
388 | z_rzts = 1._wp / REAL( jnzts, wp ) |
---|
389 | zr_p2dt(:) = 1._wp / p2dt(:) |
---|
390 | ! |
---|
391 | ! ! =========== |
---|
392 | DO jn = 1, kjpt ! tracer loop |
---|
393 | ! ! =========== |
---|
394 | ! 1. Bottom value : flux set to zero |
---|
395 | ! ---------------------------------- |
---|
396 | zwx(:,:,jpk) = 0._wp ; zwz(:,:,jpk) = 0._wp |
---|
397 | zwy(:,:,jpk) = 0._wp ; zwi(:,:,jpk) = 0._wp |
---|
398 | |
---|
399 | ! 2. upstream advection with initial mass fluxes & intermediate update |
---|
400 | ! -------------------------------------------------------------------- |
---|
401 | ! upstream tracer flux in the i and j direction |
---|
402 | DO jk = 1, jpkm1 |
---|
403 | DO jj = 1, jpjm1 |
---|
404 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
405 | ! upstream scheme |
---|
406 | zfp_ui = pun(ji,jj,jk) + ABS( pun(ji,jj,jk) ) |
---|
407 | zfm_ui = pun(ji,jj,jk) - ABS( pun(ji,jj,jk) ) |
---|
408 | zfp_vj = pvn(ji,jj,jk) + ABS( pvn(ji,jj,jk) ) |
---|
409 | zfm_vj = pvn(ji,jj,jk) - ABS( pvn(ji,jj,jk) ) |
---|
410 | zwx(ji,jj,jk) = 0.5_wp * ( zfp_ui * ptb(ji,jj,jk,jn) + zfm_ui * ptb(ji+1,jj ,jk,jn) ) |
---|
411 | zwy(ji,jj,jk) = 0.5_wp * ( zfp_vj * ptb(ji,jj,jk,jn) + zfm_vj * ptb(ji ,jj+1,jk,jn) ) |
---|
412 | END DO |
---|
413 | END DO |
---|
414 | END DO |
---|
415 | |
---|
416 | ! upstream tracer flux in the k direction |
---|
417 | ! Interior value |
---|
418 | DO jk = 2, jpkm1 |
---|
419 | DO jj = 1, jpj |
---|
420 | DO ji = 1, jpi |
---|
421 | zfp_wk = pwn(ji,jj,jk) + ABS( pwn(ji,jj,jk) ) |
---|
422 | zfm_wk = pwn(ji,jj,jk) - ABS( pwn(ji,jj,jk) ) |
---|
423 | zwz(ji,jj,jk) = 0.5_wp * ( zfp_wk * ptb(ji,jj,jk,jn) + zfm_wk * ptb(ji,jj,jk-1,jn) ) |
---|
424 | END DO |
---|
425 | END DO |
---|
426 | END DO |
---|
427 | ! Surface value |
---|
428 | IF( lk_vvl ) THEN |
---|
429 | IF ( ln_isfcav ) THEN |
---|
430 | DO jj = 1, jpj |
---|
431 | DO ji = 1, jpi |
---|
432 | zwz(ji,jj, mikt(ji,jj) ) = 0.e0 ! volume variable + isf |
---|
433 | END DO |
---|
434 | END DO |
---|
435 | ELSE |
---|
436 | zwz(:,:,1) = 0.e0 ! volume variable + no isf |
---|
437 | END IF |
---|
438 | ELSE |
---|
439 | IF ( ln_isfcav ) THEN |
---|
440 | DO jj = 1, jpj |
---|
441 | DO ji = 1, jpi |
---|
442 | zwz(ji,jj, mikt(ji,jj) ) = pwn(ji,jj,mikt(ji,jj)) * ptb(ji,jj,mikt(ji,jj),jn) ! linear free surface + isf |
---|
443 | END DO |
---|
444 | END DO |
---|
445 | ELSE |
---|
446 | zwz(:,:,1) = pwn(:,:,1) * ptb(:,:,1,jn) ! linear free surface + no isf |
---|
447 | END IF |
---|
448 | ENDIF |
---|
449 | |
---|
450 | ! total advective trend |
---|
451 | DO jk = 1, jpkm1 |
---|
452 | z2dtt = p2dt(jk) |
---|
453 | DO jj = 2, jpjm1 |
---|
454 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
455 | ! total intermediate advective trends |
---|
456 | ztra = - ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) & |
---|
457 | & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk ) & |
---|
458 | & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) / e1e2t(ji,jj) |
---|
459 | ! update and guess with monotonic sheme |
---|
460 | pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra / fse3t_n(ji,jj,jk) * tmask(ji,jj,jk) |
---|
461 | zwi(ji,jj,jk) = ( fse3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + z2dtt * ztra ) / fse3t_a(ji,jj,jk) * tmask(ji,jj,jk) |
---|
462 | END DO |
---|
463 | END DO |
---|
464 | END DO |
---|
465 | ! ! Lateral boundary conditions on zwi (unchanged sign) |
---|
466 | CALL lbc_lnk( zwi, 'T', 1. ) |
---|
467 | |
---|
468 | ! ! trend diagnostics (contribution of upstream fluxes) |
---|
469 | IF( l_trd ) THEN |
---|
470 | ! store intermediate advective trends |
---|
471 | ztrdx(:,:,:) = zwx(:,:,:) ; ztrdy(:,:,:) = zwy(:,:,:) ; ztrdz(:,:,:) = zwz(:,:,:) |
---|
472 | END IF |
---|
473 | ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) |
---|
474 | IF( cdtype == 'TRA' .AND. ln_diaptr ) zptry(:,:,:) = zwy(:,:,:) |
---|
475 | |
---|
476 | ! 3. antidiffusive flux : high order minus low order |
---|
477 | ! -------------------------------------------------- |
---|
478 | ! antidiffusive flux on i and j |
---|
479 | ! |
---|
480 | DO jk = 1, jpkm1 |
---|
481 | ! |
---|
482 | DO jj = 1, jpjm1 |
---|
483 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
484 | zwx_sav(ji,jj) = zwx(ji,jj,jk) |
---|
485 | zwy_sav(ji,jj) = zwy(ji,jj,jk) |
---|
486 | |
---|
487 | zwx(ji,jj,jk) = 0.5_wp * pun(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji+1,jj,jk,jn) ) |
---|
488 | zwy(ji,jj,jk) = 0.5_wp * pvn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj+1,jk,jn) ) |
---|
489 | END DO |
---|
490 | END DO |
---|
491 | |
---|
492 | DO jj = 2, jpjm1 ! partial horizontal divergence |
---|
493 | DO ji = fs_2, fs_jpim1 |
---|
494 | zhdiv(ji,jj,jk) = ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk) & |
---|
495 | & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk) ) |
---|
496 | END DO |
---|
497 | END DO |
---|
498 | |
---|
499 | DO jj = 1, jpjm1 |
---|
500 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
501 | zwx(ji,jj,jk) = zwx(ji,jj,jk) - zwx_sav(ji,jj) |
---|
502 | zwy(ji,jj,jk) = zwy(ji,jj,jk) - zwy_sav(ji,jj) |
---|
503 | END DO |
---|
504 | END DO |
---|
505 | END DO |
---|
506 | |
---|
507 | ! antidiffusive flux on k |
---|
508 | zwz(:,:,1) = 0._wp ! Surface value |
---|
509 | zwz_sav(:,:,:) = zwz(:,:,:) |
---|
510 | ! |
---|
511 | ztrs(:,:,:,1) = ptb(:,:,:,jn) |
---|
512 | ztrs(:,:,1,2) = ptb(:,:,1,jn) |
---|
513 | ztrs(:,:,1,3) = ptb(:,:,1,jn) |
---|
514 | zwzts(:,:,:) = 0._wp |
---|
515 | |
---|
516 | DO jl = 1, jnzts ! Start of sub timestepping loop |
---|
517 | |
---|
518 | IF( jl == 1 ) THEN ! Euler forward to kick things off |
---|
519 | jtb = 1 ; jtn = 1 ; jta = 2 |
---|
520 | zts(:) = p2dt(:) * z_rzts |
---|
521 | jtaken = MOD( jnzts + 1 , 2) ! Toggle to collect every second flux |
---|
522 | ! starting at jl =1 if jnzts is odd; |
---|
523 | ! starting at jl =2 otherwise |
---|
524 | ELSEIF( jl == 2 ) THEN ! First leapfrog step |
---|
525 | jtb = 1 ; jtn = 2 ; jta = 3 |
---|
526 | zts(:) = 2._wp * p2dt(:) * z_rzts |
---|
527 | ELSE ! Shuffle pointers for subsequent leapfrog steps |
---|
528 | jtb = MOD(jtb,3) + 1 |
---|
529 | jtn = MOD(jtn,3) + 1 |
---|
530 | jta = MOD(jta,3) + 1 |
---|
531 | ENDIF |
---|
532 | DO jk = 2, jpkm1 ! Interior value |
---|
533 | DO jj = 2, jpjm1 |
---|
534 | DO ji = fs_2, fs_jpim1 |
---|
535 | zwz(ji,jj,jk) = 0.5_wp * pwn(ji,jj,jk) * ( ztrs(ji,jj,jk,jtn) + ztrs(ji,jj,jk-1,jtn) ) |
---|
536 | IF( jtaken == 0 ) zwzts(ji,jj,jk) = zwzts(ji,jj,jk) + zwz(ji,jj,jk)*zts(jk) ! Accumulate time-weighted vertcal flux |
---|
537 | END DO |
---|
538 | END DO |
---|
539 | END DO |
---|
540 | |
---|
541 | jtaken = MOD( jtaken + 1 , 2 ) |
---|
542 | |
---|
543 | DO jk = 2, jpkm1 ! Interior value |
---|
544 | DO jj = 2, jpjm1 |
---|
545 | DO ji = fs_2, fs_jpim1 |
---|
546 | zbtr = 1._wp / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) ) |
---|
547 | ! total advective trends |
---|
548 | ztra = - zbtr * ( zhdiv(ji,jj,jk) + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) |
---|
549 | ztrs(ji,jj,jk,jta) = ztrs(ji,jj,jk,jtb) + zts(jk) * ztra |
---|
550 | END DO |
---|
551 | END DO |
---|
552 | END DO |
---|
553 | |
---|
554 | END DO |
---|
555 | |
---|
556 | DO jk = 2, jpkm1 ! Anti-diffusive vertical flux using average flux from the sub-timestepping |
---|
557 | DO jj = 2, jpjm1 |
---|
558 | DO ji = fs_2, fs_jpim1 |
---|
559 | zwz(ji,jj,jk) = zwzts(ji,jj,jk) * zr_p2dt(jk) - zwz_sav(ji,jj,jk) |
---|
560 | END DO |
---|
561 | END DO |
---|
562 | END DO |
---|
563 | CALL lbc_lnk( zwx, 'U', -1. ) ; CALL lbc_lnk( zwy, 'V', -1. ) ! Lateral bondary conditions |
---|
564 | CALL lbc_lnk( zwz, 'W', 1. ) |
---|
565 | |
---|
566 | ! 4. monotonicity algorithm |
---|
567 | ! ------------------------- |
---|
568 | CALL nonosc( ptb(:,:,:,jn), zwx, zwy, zwz, zwi, p2dt ) |
---|
569 | |
---|
570 | |
---|
571 | ! 5. final trend with corrected fluxes |
---|
572 | ! ------------------------------------ |
---|
573 | DO jk = 1, jpkm1 |
---|
574 | DO jj = 2, jpjm1 |
---|
575 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
576 | zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) ) |
---|
577 | ! total advective trends |
---|
578 | ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) & |
---|
579 | & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk ) & |
---|
580 | & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) |
---|
581 | ! add them to the general tracer trends |
---|
582 | pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra |
---|
583 | END DO |
---|
584 | END DO |
---|
585 | END DO |
---|
586 | |
---|
587 | ! ! trend diagnostics (contribution of upstream fluxes) |
---|
588 | IF( l_trd ) THEN |
---|
589 | ztrdx(:,:,:) = ztrdx(:,:,:) + zwx(:,:,:) ! <<< Add to previously computed |
---|
590 | ztrdy(:,:,:) = ztrdy(:,:,:) + zwy(:,:,:) ! <<< Add to previously computed |
---|
591 | ztrdz(:,:,:) = ztrdz(:,:,:) + zwz(:,:,:) ! <<< Add to previously computed |
---|
592 | |
---|
593 | CALL trd_tra( kt, cdtype, jn, jptra_xad, ztrdx, pun, ptn(:,:,:,jn) ) |
---|
594 | CALL trd_tra( kt, cdtype, jn, jptra_yad, ztrdy, pvn, ptn(:,:,:,jn) ) |
---|
595 | CALL trd_tra( kt, cdtype, jn, jptra_zad, ztrdz, pwn, ptn(:,:,:,jn) ) |
---|
596 | END IF |
---|
597 | ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) |
---|
598 | IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN |
---|
599 | zptry(:,:,:) = zptry(:,:,:) + zwy(:,:,:) |
---|
600 | CALL dia_ptr_ohst_components( jn, 'adv', zptry(:,:,:) ) |
---|
601 | ENDIF |
---|
602 | ! |
---|
603 | END DO |
---|
604 | ! |
---|
605 | CALL wrk_dealloc( jpi, jpj, jpk, zwi, zwz, zhdiv, zwz_sav, zwzts ) |
---|
606 | CALL wrk_dealloc( jpi, jpj, jpk, kjpt+1, ztrs ) |
---|
607 | CALL wrk_dealloc( jpi, jpj, zwx_sav, zwy_sav ) |
---|
608 | IF( l_trd ) CALL wrk_dealloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) |
---|
609 | IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL wrk_dealloc( jpi, jpj, jpk, zptry ) |
---|
610 | ! |
---|
611 | IF( nn_timing == 1 ) CALL timing_stop('tra_adv_tvd_zts') |
---|
612 | ! |
---|
613 | END SUBROUTINE tra_adv_tvd_zts |
---|
614 | |
---|
615 | |
---|
616 | SUBROUTINE nonosc( pbef, paa, pbb, pcc, paft, p2dt ) |
---|
617 | !!--------------------------------------------------------------------- |
---|
618 | !! *** ROUTINE nonosc *** |
---|
619 | !! |
---|
620 | !! ** Purpose : compute monotonic tracer fluxes from the upstream |
---|
621 | !! scheme and the before field by a nonoscillatory algorithm |
---|
622 | !! |
---|
623 | !! ** Method : ... ??? |
---|
624 | !! warning : pbef and paft must be masked, but the boundaries |
---|
625 | !! conditions on the fluxes are not necessary zalezak (1979) |
---|
626 | !! drange (1995) multi-dimensional forward-in-time and upstream- |
---|
627 | !! in-space based differencing for fluid |
---|
628 | !!---------------------------------------------------------------------- |
---|
629 | REAL(wp), DIMENSION(jpk) , INTENT(in ) :: p2dt ! vertical profile of tracer time-step |
---|
630 | REAL(wp), DIMENSION (jpi,jpj,jpk), INTENT(in ) :: pbef, paft ! before & after field |
---|
631 | REAL(wp), DIMENSION (jpi,jpj,jpk), INTENT(inout) :: paa, pbb, pcc ! monotonic fluxes in the 3 directions |
---|
632 | ! |
---|
633 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
634 | INTEGER :: ikm1 ! local integer |
---|
635 | REAL(wp) :: zpos, zneg, zbt, za, zb, zc, zbig, zrtrn, z2dtt ! local scalars |
---|
636 | REAL(wp) :: zau, zbu, zcu, zav, zbv, zcv, zup, zdo ! - - |
---|
637 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zbetup, zbetdo, zbup, zbdo |
---|
638 | !!---------------------------------------------------------------------- |
---|
639 | ! |
---|
640 | IF( nn_timing == 1 ) CALL timing_start('nonosc') |
---|
641 | ! |
---|
642 | CALL wrk_alloc( jpi, jpj, jpk, zbetup, zbetdo, zbup, zbdo ) |
---|
643 | ! |
---|
644 | zbig = 1.e+40_wp |
---|
645 | zrtrn = 1.e-15_wp |
---|
646 | zbetup(:,:,:) = 0._wp ; zbetdo(:,:,:) = 0._wp |
---|
647 | |
---|
648 | ! Search local extrema |
---|
649 | ! -------------------- |
---|
650 | ! max/min of pbef & paft with large negative/positive value (-/+zbig) inside land |
---|
651 | zbup = MAX( pbef * tmask - zbig * ( 1._wp - tmask ), & |
---|
652 | & paft * tmask - zbig * ( 1._wp - tmask ) ) |
---|
653 | zbdo = MIN( pbef * tmask + zbig * ( 1._wp - tmask ), & |
---|
654 | & paft * tmask + zbig * ( 1._wp - tmask ) ) |
---|
655 | |
---|
656 | DO jk = 1, jpkm1 |
---|
657 | ikm1 = MAX(jk-1,1) |
---|
658 | z2dtt = p2dt(jk) |
---|
659 | DO jj = 2, jpjm1 |
---|
660 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
661 | |
---|
662 | ! search maximum in neighbourhood |
---|
663 | zup = MAX( zbup(ji ,jj ,jk ), & |
---|
664 | & zbup(ji-1,jj ,jk ), zbup(ji+1,jj ,jk ), & |
---|
665 | & zbup(ji ,jj-1,jk ), zbup(ji ,jj+1,jk ), & |
---|
666 | & zbup(ji ,jj ,ikm1), zbup(ji ,jj ,jk+1) ) |
---|
667 | |
---|
668 | ! search minimum in neighbourhood |
---|
669 | zdo = MIN( zbdo(ji ,jj ,jk ), & |
---|
670 | & zbdo(ji-1,jj ,jk ), zbdo(ji+1,jj ,jk ), & |
---|
671 | & zbdo(ji ,jj-1,jk ), zbdo(ji ,jj+1,jk ), & |
---|
672 | & zbdo(ji ,jj ,ikm1), zbdo(ji ,jj ,jk+1) ) |
---|
673 | |
---|
674 | ! positive part of the flux |
---|
675 | zpos = MAX( 0., paa(ji-1,jj ,jk ) ) - MIN( 0., paa(ji ,jj ,jk ) ) & |
---|
676 | & + MAX( 0., pbb(ji ,jj-1,jk ) ) - MIN( 0., pbb(ji ,jj ,jk ) ) & |
---|
677 | & + MAX( 0., pcc(ji ,jj ,jk+1) ) - MIN( 0., pcc(ji ,jj ,jk ) ) |
---|
678 | |
---|
679 | ! negative part of the flux |
---|
680 | zneg = MAX( 0., paa(ji ,jj ,jk ) ) - MIN( 0., paa(ji-1,jj ,jk ) ) & |
---|
681 | & + MAX( 0., pbb(ji ,jj ,jk ) ) - MIN( 0., pbb(ji ,jj-1,jk ) ) & |
---|
682 | & + MAX( 0., pcc(ji ,jj ,jk ) ) - MIN( 0., pcc(ji ,jj ,jk+1) ) |
---|
683 | |
---|
684 | ! up & down beta terms |
---|
685 | zbt = e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) / z2dtt |
---|
686 | zbetup(ji,jj,jk) = ( zup - paft(ji,jj,jk) ) / ( zpos + zrtrn ) * zbt |
---|
687 | zbetdo(ji,jj,jk) = ( paft(ji,jj,jk) - zdo ) / ( zneg + zrtrn ) * zbt |
---|
688 | END DO |
---|
689 | END DO |
---|
690 | END DO |
---|
691 | CALL lbc_lnk( zbetup, 'T', 1. ) ; CALL lbc_lnk( zbetdo, 'T', 1. ) ! lateral boundary cond. (unchanged sign) |
---|
692 | |
---|
693 | ! 3. monotonic flux in the i & j direction (paa & pbb) |
---|
694 | ! ---------------------------------------- |
---|
695 | DO jk = 1, jpkm1 |
---|
696 | DO jj = 2, jpjm1 |
---|
697 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
698 | zau = MIN( 1._wp, zbetdo(ji,jj,jk), zbetup(ji+1,jj,jk) ) |
---|
699 | zbu = MIN( 1._wp, zbetup(ji,jj,jk), zbetdo(ji+1,jj,jk) ) |
---|
700 | zcu = ( 0.5 + SIGN( 0.5 , paa(ji,jj,jk) ) ) |
---|
701 | paa(ji,jj,jk) = paa(ji,jj,jk) * ( zcu * zau + ( 1._wp - zcu) * zbu ) |
---|
702 | |
---|
703 | zav = MIN( 1._wp, zbetdo(ji,jj,jk), zbetup(ji,jj+1,jk) ) |
---|
704 | zbv = MIN( 1._wp, zbetup(ji,jj,jk), zbetdo(ji,jj+1,jk) ) |
---|
705 | zcv = ( 0.5 + SIGN( 0.5 , pbb(ji,jj,jk) ) ) |
---|
706 | pbb(ji,jj,jk) = pbb(ji,jj,jk) * ( zcv * zav + ( 1._wp - zcv) * zbv ) |
---|
707 | |
---|
708 | ! monotonic flux in the k direction, i.e. pcc |
---|
709 | ! ------------------------------------------- |
---|
710 | za = MIN( 1., zbetdo(ji,jj,jk+1), zbetup(ji,jj,jk) ) |
---|
711 | zb = MIN( 1., zbetup(ji,jj,jk+1), zbetdo(ji,jj,jk) ) |
---|
712 | zc = ( 0.5 + SIGN( 0.5 , pcc(ji,jj,jk+1) ) ) |
---|
713 | pcc(ji,jj,jk+1) = pcc(ji,jj,jk+1) * ( zc * za + ( 1._wp - zc) * zb ) |
---|
714 | END DO |
---|
715 | END DO |
---|
716 | END DO |
---|
717 | CALL lbc_lnk( paa, 'U', -1. ) ; CALL lbc_lnk( pbb, 'V', -1. ) ! lateral boundary condition (changed sign) |
---|
718 | ! |
---|
719 | CALL wrk_dealloc( jpi, jpj, jpk, zbetup, zbetdo, zbup, zbdo ) |
---|
720 | ! |
---|
721 | IF( nn_timing == 1 ) CALL timing_stop('nonosc') |
---|
722 | ! |
---|
723 | END SUBROUTINE nonosc |
---|
724 | |
---|
725 | !!====================================================================== |
---|
726 | END MODULE traadv_tvd |
---|