1 | MODULE icedyn_adv_umx |
---|
2 | !!============================================================================== |
---|
3 | !! *** MODULE icedyn_adv_umx *** |
---|
4 | !! sea-ice : advection using the ULTIMATE-MACHO scheme |
---|
5 | !!============================================================================== |
---|
6 | !! History : 3.6 ! 2014-11 (C. Rousset, G. Madec) Original code |
---|
7 | !! 4.0 ! 2018 (many people) SI3 [aka Sea Ice cube] |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | #if defined key_si3 |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! 'key_si3' SI3 sea-ice model |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! ice_dyn_adv_umx : update the tracer trend with the 3D advection trends using a TVD scheme |
---|
14 | !! ultimate_x(_y) : compute a tracer value at velocity points using ULTIMATE scheme at various orders |
---|
15 | !! macho : ??? |
---|
16 | !! nonosc_2d : compute monotonic tracer fluxes by a non-oscillatory algorithm |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | USE phycst ! physical constant |
---|
19 | USE dom_oce ! ocean domain |
---|
20 | USE sbc_oce , ONLY : nn_fsbc ! update frequency of surface boundary condition |
---|
21 | USE ice ! sea-ice variables |
---|
22 | ! |
---|
23 | USE in_out_manager ! I/O manager |
---|
24 | USE lib_mpp ! MPP library |
---|
25 | USE lib_fortran ! fortran utilities (glob_sum + no signed zero) |
---|
26 | USE lbclnk ! lateral boundary conditions (or mpp links) |
---|
27 | |
---|
28 | IMPLICIT NONE |
---|
29 | PRIVATE |
---|
30 | |
---|
31 | PUBLIC ice_dyn_adv_umx ! called by icedyn_adv.F90 |
---|
32 | |
---|
33 | REAL(wp) :: z1_6 = 1._wp / 6._wp ! =1/6 |
---|
34 | REAL(wp) :: z1_120 = 1._wp / 120._wp ! =1/120 |
---|
35 | |
---|
36 | !! * Substitutions |
---|
37 | # include "vectopt_loop_substitute.h90" |
---|
38 | !!---------------------------------------------------------------------- |
---|
39 | !! NEMO/ICE 4.0 , NEMO Consortium (2018) |
---|
40 | !! $Id: icedyn_adv_umx.F90 4499 2014-02-18 15:14:31Z timgraham $ |
---|
41 | !! Software governed by the CeCILL licence (./LICENSE) |
---|
42 | !!---------------------------------------------------------------------- |
---|
43 | CONTAINS |
---|
44 | |
---|
45 | SUBROUTINE ice_dyn_adv_umx( k_order, kt, pu_ice, pv_ice, & |
---|
46 | & pato_i, pv_i, pv_s, psv_i, poa_i, pa_i, pa_ip, pv_ip, pe_s, pe_i ) |
---|
47 | !!---------------------------------------------------------------------- |
---|
48 | !! *** ROUTINE ice_dyn_adv_umx *** |
---|
49 | !! |
---|
50 | !! ** Purpose : Compute the now trend due to total advection of |
---|
51 | !! tracers and add it to the general trend of tracer equations |
---|
52 | !! using an "Ultimate-Macho" scheme |
---|
53 | !! |
---|
54 | !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. |
---|
55 | !!---------------------------------------------------------------------- |
---|
56 | INTEGER , INTENT(in ) :: k_order ! order of the scheme (1-5 or 20) |
---|
57 | INTEGER , INTENT(in ) :: kt ! time step |
---|
58 | REAL(wp), DIMENSION(:,:) , INTENT(in ) :: pu_ice ! ice i-velocity |
---|
59 | REAL(wp), DIMENSION(:,:) , INTENT(in ) :: pv_ice ! ice j-velocity |
---|
60 | REAL(wp), DIMENSION(:,:) , INTENT(inout) :: pato_i ! open water area |
---|
61 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: pv_i ! ice volume |
---|
62 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: pv_s ! snw volume |
---|
63 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: psv_i ! salt content |
---|
64 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: poa_i ! age content |
---|
65 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: pa_i ! ice concentration |
---|
66 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: pa_ip ! melt pond fraction |
---|
67 | REAL(wp), DIMENSION(:,:,:) , INTENT(inout) :: pv_ip ! melt pond volume |
---|
68 | REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) :: pe_s ! snw heat content |
---|
69 | REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) :: pe_i ! ice heat content |
---|
70 | ! |
---|
71 | INTEGER :: ji, jj, jk, jl, jt ! dummy loop indices |
---|
72 | INTEGER :: initad ! number of sub-timestep for the advection |
---|
73 | REAL(wp) :: zcfl , zusnit, zdt ! - - |
---|
74 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zudy, zvdx, zcu_box, zcv_box |
---|
75 | !!---------------------------------------------------------------------- |
---|
76 | ! |
---|
77 | IF( kt == nit000 .AND. lwp ) WRITE(numout,*) '-- ice_dyn_adv_umx: Ultimate-Macho advection scheme' |
---|
78 | ! |
---|
79 | ALLOCATE( zudy(jpi,jpj) , zvdx(jpi,jpj) , zcu_box(jpi,jpj) , zcv_box(jpi,jpj) ) |
---|
80 | ! |
---|
81 | ! --- If ice drift field is too fast, use an appropriate time step for advection (CFL test for stability) --- ! |
---|
82 | zcfl = MAXVAL( ABS( pu_ice(:,:) ) * rdt_ice * r1_e1u(:,:) ) |
---|
83 | zcfl = MAX( zcfl, MAXVAL( ABS( pv_ice(:,:) ) * rdt_ice * r1_e2v(:,:) ) ) |
---|
84 | IF( lk_mpp ) CALL mpp_max( zcfl ) |
---|
85 | |
---|
86 | IF( zcfl > 0.5 ) THEN ; initad = 2 ; zusnit = 0.5_wp |
---|
87 | ELSE ; initad = 1 ; zusnit = 1.0_wp |
---|
88 | ENDIF |
---|
89 | |
---|
90 | zdt = rdt_ice / REAL(initad) |
---|
91 | |
---|
92 | ! --- transport --- ! |
---|
93 | zudy(:,:) = pu_ice(:,:) * e2u(:,:) |
---|
94 | zvdx(:,:) = pv_ice(:,:) * e1v(:,:) |
---|
95 | |
---|
96 | ! --- define velocity for advection: u*grad(H) --- ! |
---|
97 | DO jj = 2, jpjm1 |
---|
98 | DO ji = fs_2, fs_jpim1 |
---|
99 | IF ( pu_ice(ji,jj) * pu_ice(ji-1,jj) <= 0._wp ) THEN ; zcu_box(ji,jj) = 0._wp |
---|
100 | ELSEIF( pu_ice(ji,jj) > 0._wp ) THEN ; zcu_box(ji,jj) = pu_ice(ji-1,jj) |
---|
101 | ELSE ; zcu_box(ji,jj) = pu_ice(ji ,jj) |
---|
102 | ENDIF |
---|
103 | |
---|
104 | IF ( pv_ice(ji,jj) * pv_ice(ji,jj-1) <= 0._wp ) THEN ; zcv_box(ji,jj) = 0._wp |
---|
105 | ELSEIF( pv_ice(ji,jj) > 0._wp ) THEN ; zcv_box(ji,jj) = pv_ice(ji,jj-1) |
---|
106 | ELSE ; zcv_box(ji,jj) = pv_ice(ji,jj ) |
---|
107 | ENDIF |
---|
108 | END DO |
---|
109 | END DO |
---|
110 | |
---|
111 | !---------------! |
---|
112 | !== advection ==! |
---|
113 | !---------------! |
---|
114 | DO jt = 1, initad |
---|
115 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pato_i(:,:) ) ! Open water area |
---|
116 | DO jl = 1, jpl |
---|
117 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pa_i(:,:,jl) ) ! Ice area |
---|
118 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pv_i(:,:,jl) ) ! Ice volume |
---|
119 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, psv_i(:,:,jl) ) ! Salt content |
---|
120 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, poa_i(:,:,jl) ) ! Age content |
---|
121 | DO jk = 1, nlay_i |
---|
122 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pe_i(:,:,jk,jl) ) ! Ice heat content |
---|
123 | END DO |
---|
124 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pv_s(:,:,jl) ) ! Snow volume |
---|
125 | DO jk = 1, nlay_s |
---|
126 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pe_s(:,:,jk,jl) ) ! Snow heat content |
---|
127 | END DO |
---|
128 | IF ( ln_pnd_H12 ) THEN |
---|
129 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pa_ip(:,:,jl) ) ! Melt pond fraction |
---|
130 | CALL adv_umx( k_order, kt, zdt, zudy, zvdx, zcu_box, zcv_box, pv_ip(:,:,jl) ) ! Melt pond volume |
---|
131 | ENDIF |
---|
132 | END DO |
---|
133 | END DO |
---|
134 | ! |
---|
135 | DEALLOCATE( zudy, zvdx, zcu_box, zcv_box ) |
---|
136 | ! |
---|
137 | END SUBROUTINE ice_dyn_adv_umx |
---|
138 | |
---|
139 | |
---|
140 | SUBROUTINE adv_umx( k_order, kt, pdt, puc, pvc, pubox, pvbox, ptc ) |
---|
141 | !!---------------------------------------------------------------------- |
---|
142 | !! *** ROUTINE adv_umx *** |
---|
143 | !! |
---|
144 | !! ** Purpose : Compute the now trend due to total advection of |
---|
145 | !! tracers and add it to the general trend of tracer equations |
---|
146 | !! |
---|
147 | !! ** Method : TVD scheme, i.e. 2nd order centered scheme with |
---|
148 | !! corrected flux (monotonic correction) |
---|
149 | !! note: - this advection scheme needs a leap-frog time scheme |
---|
150 | !! |
---|
151 | !! ** Action : - pt the after advective tracer |
---|
152 | !!---------------------------------------------------------------------- |
---|
153 | INTEGER , INTENT(in ) :: k_order ! order of the ULTIMATE scheme |
---|
154 | INTEGER , INTENT(in ) :: kt ! number of iteration |
---|
155 | REAL(wp) , INTENT(in ) :: pdt ! tracer time-step |
---|
156 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: puc , pvc ! 2 ice velocity components => u*e2 |
---|
157 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pubox, pvbox ! upstream velocity |
---|
158 | REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: ptc ! tracer content field |
---|
159 | ! |
---|
160 | INTEGER :: ji, jj ! dummy loop indices |
---|
161 | REAL(wp) :: ztra ! local scalar |
---|
162 | REAL(wp), DIMENSION(jpi,jpj) :: zfu_ups, zfu_ho, zt_u, zt_ups |
---|
163 | REAL(wp), DIMENSION(jpi,jpj) :: zfv_ups, zfv_ho, zt_v, ztrd |
---|
164 | !!---------------------------------------------------------------------- |
---|
165 | ! |
---|
166 | ! upstream advection with initial mass fluxes & intermediate update |
---|
167 | ! -------------------------------------------------------------------- |
---|
168 | DO jj = 1, jpjm1 ! upstream tracer flux in the i and j direction |
---|
169 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
170 | zfu_ups(ji,jj) = MAX( puc(ji,jj), 0._wp ) * ptc(ji,jj) + MIN( puc(ji,jj), 0._wp ) * ptc(ji+1,jj) |
---|
171 | zfv_ups(ji,jj) = MAX( pvc(ji,jj), 0._wp ) * ptc(ji,jj) + MIN( pvc(ji,jj), 0._wp ) * ptc(ji,jj+1) |
---|
172 | END DO |
---|
173 | END DO |
---|
174 | |
---|
175 | DO jj = 2, jpjm1 ! total intermediate advective trends |
---|
176 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
177 | ztra = - ( zfu_ups(ji,jj) - zfu_ups(ji-1,jj ) & |
---|
178 | & + zfv_ups(ji,jj) - zfv_ups(ji ,jj-1) ) * r1_e1e2t(ji,jj) |
---|
179 | ! |
---|
180 | ztrd(ji,jj) = ztra ! upstream trend [ -div(uh) or -div(uhT) ] |
---|
181 | zt_ups (ji,jj) = ( ptc(ji,jj) + pdt * ztra ) * tmask(ji,jj,1) ! guess after content field with monotonic scheme |
---|
182 | END DO |
---|
183 | END DO |
---|
184 | CALL lbc_lnk( zt_ups, 'T', 1. ) ! Lateral boundary conditions (unchanged sign) |
---|
185 | |
---|
186 | ! High order (_ho) fluxes |
---|
187 | ! ----------------------- |
---|
188 | SELECT CASE( k_order ) |
---|
189 | CASE ( 20 ) ! centered second order |
---|
190 | DO jj = 1, jpjm1 |
---|
191 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
192 | zfu_ho(ji,jj) = 0.5 * puc(ji,jj) * ( ptc(ji,jj) + ptc(ji+1,jj) ) |
---|
193 | zfv_ho(ji,jj) = 0.5 * pvc(ji,jj) * ( ptc(ji,jj) + ptc(ji,jj+1) ) |
---|
194 | END DO |
---|
195 | END DO |
---|
196 | ! |
---|
197 | CASE ( 1:5 ) ! 1st to 5th order ULTIMATE-MACHO scheme |
---|
198 | CALL macho( k_order, kt, pdt, ptc, puc, pvc, pubox, pvbox, zt_u, zt_v ) |
---|
199 | ! |
---|
200 | DO jj = 1, jpjm1 |
---|
201 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
202 | zfu_ho(ji,jj) = puc(ji,jj) * zt_u(ji,jj) |
---|
203 | zfv_ho(ji,jj) = pvc(ji,jj) * zt_v(ji,jj) |
---|
204 | END DO |
---|
205 | END DO |
---|
206 | ! |
---|
207 | END SELECT |
---|
208 | |
---|
209 | ! antidiffusive flux : high order minus low order |
---|
210 | ! -------------------------------------------------- |
---|
211 | DO jj = 1, jpjm1 |
---|
212 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
213 | zfu_ho(ji,jj) = zfu_ho(ji,jj) - zfu_ups(ji,jj) |
---|
214 | zfv_ho(ji,jj) = zfv_ho(ji,jj) - zfv_ups(ji,jj) |
---|
215 | END DO |
---|
216 | END DO |
---|
217 | |
---|
218 | ! monotonicity algorithm |
---|
219 | ! ------------------------- |
---|
220 | CALL nonosc_2d( ptc, zfu_ho, zfv_ho, zt_ups, pdt ) |
---|
221 | |
---|
222 | ! final trend with corrected fluxes |
---|
223 | ! ------------------------------------ |
---|
224 | DO jj = 2, jpjm1 |
---|
225 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
226 | ztra = ztrd(ji,jj) - ( zfu_ho(ji,jj) - zfu_ho(ji-1,jj ) & |
---|
227 | & + zfv_ho(ji,jj) - zfv_ho(ji ,jj-1) ) * r1_e1e2t(ji,jj) |
---|
228 | ptc(ji,jj) = ( ptc(ji,jj) + pdt * ztra ) * tmask(ji,jj,1) |
---|
229 | END DO |
---|
230 | END DO |
---|
231 | CALL lbc_lnk( ptc, 'T', 1. ) |
---|
232 | ! |
---|
233 | END SUBROUTINE adv_umx |
---|
234 | |
---|
235 | |
---|
236 | SUBROUTINE macho( k_order, kt, pdt, ptc, puc, pvc, pubox, pvbox, pt_u, pt_v ) |
---|
237 | !!--------------------------------------------------------------------- |
---|
238 | !! *** ROUTINE ultimate_x *** |
---|
239 | !! |
---|
240 | !! ** Purpose : compute |
---|
241 | !! |
---|
242 | !! ** Method : ... ??? |
---|
243 | !! TIM = transient interpolation Modeling |
---|
244 | !! |
---|
245 | !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. |
---|
246 | !!---------------------------------------------------------------------- |
---|
247 | INTEGER , INTENT(in ) :: k_order ! order of the ULTIMATE scheme |
---|
248 | INTEGER , INTENT(in ) :: kt ! number of iteration |
---|
249 | REAL(wp) , INTENT(in ) :: pdt ! tracer time-step |
---|
250 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: ptc ! tracer fields |
---|
251 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: puc, pvc ! 2 ice velocity components |
---|
252 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pubox, pvbox ! upstream velocity |
---|
253 | REAL(wp), DIMENSION(jpi,jpj), INTENT( out) :: pt_u, pt_v ! tracer at u- and v-points |
---|
254 | ! |
---|
255 | INTEGER :: ji, jj ! dummy loop indices |
---|
256 | REAL(wp) :: zc_box ! - - |
---|
257 | REAL(wp), DIMENSION(jpi,jpj) :: zzt |
---|
258 | !!---------------------------------------------------------------------- |
---|
259 | ! |
---|
260 | IF( MOD( (kt - 1) / nn_fsbc , 2 ) == 0 ) THEN !== odd ice time step: adv_x then adv_y ==! |
---|
261 | ! |
---|
262 | ! !-- ultimate interpolation of pt at u-point --! |
---|
263 | CALL ultimate_x( k_order, pdt, ptc, puc, pt_u ) |
---|
264 | ! |
---|
265 | ! !-- advective form update in zzt --! |
---|
266 | DO jj = 2, jpjm1 |
---|
267 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
268 | zzt(ji,jj) = ptc(ji,jj) - pubox(ji,jj) * pdt * ( pt_u(ji,jj) - pt_u(ji-1,jj) ) * r1_e1t(ji,jj) & |
---|
269 | & - ptc (ji,jj) * pdt * ( puc (ji,jj) - puc (ji-1,jj) ) * r1_e1e2t(ji,jj) |
---|
270 | zzt(ji,jj) = zzt(ji,jj) * tmask(ji,jj,1) |
---|
271 | END DO |
---|
272 | END DO |
---|
273 | CALL lbc_lnk( zzt, 'T', 1. ) |
---|
274 | ! |
---|
275 | ! !-- ultimate interpolation of pt at v-point --! |
---|
276 | CALL ultimate_y( k_order, pdt, zzt, pvc, pt_v ) |
---|
277 | ! |
---|
278 | ELSE !== even ice time step: adv_y then adv_x ==! |
---|
279 | ! |
---|
280 | ! !-- ultimate interpolation of pt at v-point --! |
---|
281 | CALL ultimate_y( k_order, pdt, ptc, pvc, pt_v ) |
---|
282 | ! |
---|
283 | ! !-- advective form update in zzt --! |
---|
284 | DO jj = 2, jpjm1 |
---|
285 | DO ji = fs_2, fs_jpim1 |
---|
286 | zzt(ji,jj) = ptc(ji,jj) - pvbox(ji,jj) * pdt * ( pt_v(ji,jj) - pt_v(ji,jj-1) ) * r1_e2t(ji,jj) & |
---|
287 | & - ptc (ji,jj) * pdt * ( pvc (ji,jj) - pvc (ji,jj-1) ) * r1_e1e2t(ji,jj) |
---|
288 | zzt(ji,jj) = zzt(ji,jj) * tmask(ji,jj,1) |
---|
289 | END DO |
---|
290 | END DO |
---|
291 | CALL lbc_lnk( zzt, 'T', 1. ) |
---|
292 | ! |
---|
293 | ! !-- ultimate interpolation of pt at u-point --! |
---|
294 | CALL ultimate_x( k_order, pdt, zzt, puc, pt_u ) |
---|
295 | ! |
---|
296 | ENDIF |
---|
297 | ! |
---|
298 | END SUBROUTINE macho |
---|
299 | |
---|
300 | |
---|
301 | SUBROUTINE ultimate_x( k_order, pdt, pt, puc, pt_u ) |
---|
302 | !!--------------------------------------------------------------------- |
---|
303 | !! *** ROUTINE ultimate_x *** |
---|
304 | !! |
---|
305 | !! ** Purpose : compute |
---|
306 | !! |
---|
307 | !! ** Method : ... ??? |
---|
308 | !! TIM = transient interpolation Modeling |
---|
309 | !! |
---|
310 | !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. |
---|
311 | !!---------------------------------------------------------------------- |
---|
312 | INTEGER , INTENT(in ) :: k_order ! ocean time-step index |
---|
313 | REAL(wp) , INTENT(in ) :: pdt ! tracer time-step |
---|
314 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: puc ! ice i-velocity component |
---|
315 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pt ! tracer fields |
---|
316 | REAL(wp), DIMENSION(jpi,jpj), INTENT( out) :: pt_u ! tracer at u-point |
---|
317 | ! |
---|
318 | INTEGER :: ji, jj ! dummy loop indices |
---|
319 | REAL(wp) :: zcu, zdx2, zdx4 ! - - |
---|
320 | REAL(wp), DIMENSION(jpi,jpj) :: ztu1, ztu2, ztu3, ztu4 |
---|
321 | !!---------------------------------------------------------------------- |
---|
322 | ! |
---|
323 | ! !-- Laplacian in i-direction --! |
---|
324 | DO jj = 2, jpjm1 ! First derivative (gradient) |
---|
325 | DO ji = 1, fs_jpim1 |
---|
326 | ztu1(ji,jj) = ( pt(ji+1,jj) - pt(ji,jj) ) * r1_e1u(ji,jj) * umask(ji,jj,1) |
---|
327 | END DO |
---|
328 | ! ! Second derivative (Laplacian) |
---|
329 | DO ji = fs_2, fs_jpim1 |
---|
330 | ztu2(ji,jj) = ( ztu1(ji,jj) - ztu1(ji-1,jj) ) * r1_e1t(ji,jj) |
---|
331 | END DO |
---|
332 | END DO |
---|
333 | CALL lbc_lnk( ztu2, 'T', 1. ) |
---|
334 | ! |
---|
335 | ! !-- BiLaplacian in i-direction --! |
---|
336 | DO jj = 2, jpjm1 ! Third derivative |
---|
337 | DO ji = 1, fs_jpim1 |
---|
338 | ztu3(ji,jj) = ( ztu2(ji+1,jj) - ztu2(ji,jj) ) * r1_e1u(ji,jj) * umask(ji,jj,1) |
---|
339 | END DO |
---|
340 | ! ! Fourth derivative |
---|
341 | DO ji = fs_2, fs_jpim1 |
---|
342 | ztu4(ji,jj) = ( ztu3(ji,jj) - ztu3(ji-1,jj) ) * r1_e1t(ji,jj) |
---|
343 | END DO |
---|
344 | END DO |
---|
345 | CALL lbc_lnk( ztu4, 'T', 1. ) |
---|
346 | ! |
---|
347 | ! |
---|
348 | SELECT CASE (k_order ) |
---|
349 | ! |
---|
350 | CASE( 1 ) !== 1st order central TIM ==! (Eq. 21) |
---|
351 | ! |
---|
352 | DO jj = 2, jpjm1 |
---|
353 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
354 | pt_u(ji,jj) = 0.5_wp * umask(ji,jj,1) * ( pt(ji+1,jj) + pt(ji,jj) & |
---|
355 | & - SIGN( 1._wp, puc(ji,jj) ) * ( pt(ji+1,jj) - pt(ji,jj) ) ) |
---|
356 | END DO |
---|
357 | END DO |
---|
358 | ! |
---|
359 | CASE( 2 ) !== 2nd order central TIM ==! (Eq. 23) |
---|
360 | ! |
---|
361 | DO jj = 2, jpjm1 |
---|
362 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
363 | zcu = puc(ji,jj) * r1_e2u(ji,jj) * pdt * r1_e1u(ji,jj) |
---|
364 | pt_u(ji,jj) = 0.5_wp * umask(ji,jj,1) * ( pt(ji+1,jj) + pt(ji,jj) & |
---|
365 | & - zcu * ( pt(ji+1,jj) - pt(ji,jj) ) ) |
---|
366 | END DO |
---|
367 | END DO |
---|
368 | ! |
---|
369 | CASE( 3 ) !== 3rd order central TIM ==! (Eq. 24) |
---|
370 | ! |
---|
371 | DO jj = 2, jpjm1 |
---|
372 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
373 | zcu = puc(ji,jj) * r1_e2u(ji,jj) * pdt * r1_e1u(ji,jj) |
---|
374 | zdx2 = e1u(ji,jj) * e1u(ji,jj) |
---|
375 | !!rachid zdx2 = e1u(ji,jj) * e1t(ji,jj) |
---|
376 | pt_u(ji,jj) = 0.5_wp * umask(ji,jj,1) * ( ( pt (ji+1,jj) + pt (ji,jj) & |
---|
377 | & - zcu * ( pt (ji+1,jj) - pt (ji,jj) ) ) & |
---|
378 | & + z1_6 * zdx2 * ( zcu*zcu - 1._wp ) * ( ztu2(ji+1,jj) + ztu2(ji,jj) & |
---|
379 | & - SIGN( 1._wp, zcu ) * ( ztu2(ji+1,jj) - ztu2(ji,jj) ) ) ) |
---|
380 | END DO |
---|
381 | END DO |
---|
382 | ! |
---|
383 | CASE( 4 ) !== 4th order central TIM ==! (Eq. 27) |
---|
384 | ! |
---|
385 | DO jj = 2, jpjm1 |
---|
386 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
387 | zcu = puc(ji,jj) * r1_e2u(ji,jj) * pdt * r1_e1u(ji,jj) |
---|
388 | zdx2 = e1u(ji,jj) * e1u(ji,jj) |
---|
389 | !!rachid zdx2 = e1u(ji,jj) * e1t(ji,jj) |
---|
390 | pt_u(ji,jj) = 0.5_wp * umask(ji,jj,1) * ( ( pt (ji+1,jj) + pt (ji,jj) & |
---|
391 | & - zcu * ( pt (ji+1,jj) - pt (ji,jj) ) ) & |
---|
392 | & + z1_6 * zdx2 * ( zcu*zcu - 1._wp ) * ( ztu2(ji+1,jj) + ztu2(ji,jj) & |
---|
393 | & - 0.5_wp * zcu * ( ztu2(ji+1,jj) - ztu2(ji,jj) ) ) ) |
---|
394 | END DO |
---|
395 | END DO |
---|
396 | ! |
---|
397 | CASE( 5 ) !== 5th order central TIM ==! (Eq. 29) |
---|
398 | ! |
---|
399 | DO jj = 2, jpjm1 |
---|
400 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
401 | zcu = puc(ji,jj) * r1_e2u(ji,jj) * pdt * r1_e1u(ji,jj) |
---|
402 | zdx2 = e1u(ji,jj) * e1u(ji,jj) |
---|
403 | !!rachid zdx2 = e1u(ji,jj) * e1t(ji,jj) |
---|
404 | zdx4 = zdx2 * zdx2 |
---|
405 | pt_u(ji,jj) = 0.5_wp * umask(ji,jj,1) * ( ( pt (ji+1,jj) + pt (ji,jj) & |
---|
406 | & - zcu * ( pt (ji+1,jj) - pt (ji,jj) ) ) & |
---|
407 | & + z1_6 * zdx2 * ( zcu*zcu - 1._wp ) * ( ztu2(ji+1,jj) + ztu2(ji,jj) & |
---|
408 | & - 0.5_wp * zcu * ( ztu2(ji+1,jj) - ztu2(ji,jj) ) ) & |
---|
409 | & + z1_120 * zdx4 * ( zcu*zcu - 1._wp ) * ( zcu*zcu - 4._wp ) * ( ztu4(ji+1,jj) + ztu4(ji,jj) & |
---|
410 | & - SIGN( 1._wp, zcu ) * ( ztu4(ji+1,jj) - ztu4(ji,jj) ) ) ) |
---|
411 | END DO |
---|
412 | END DO |
---|
413 | ! |
---|
414 | END SELECT |
---|
415 | ! |
---|
416 | END SUBROUTINE ultimate_x |
---|
417 | |
---|
418 | |
---|
419 | SUBROUTINE ultimate_y( k_order, pdt, pt, pvc, pt_v ) |
---|
420 | !!--------------------------------------------------------------------- |
---|
421 | !! *** ROUTINE ultimate_y *** |
---|
422 | !! |
---|
423 | !! ** Purpose : compute |
---|
424 | !! |
---|
425 | !! ** Method : ... ??? |
---|
426 | !! TIM = transient interpolation Modeling |
---|
427 | !! |
---|
428 | !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. |
---|
429 | !!---------------------------------------------------------------------- |
---|
430 | INTEGER , INTENT(in ) :: k_order ! ocean time-step index |
---|
431 | REAL(wp) , INTENT(in ) :: pdt ! tracer time-step |
---|
432 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pvc ! ice j-velocity component |
---|
433 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pt ! tracer fields |
---|
434 | REAL(wp), DIMENSION(jpi,jpj), INTENT( out) :: pt_v ! tracer at v-point |
---|
435 | ! |
---|
436 | INTEGER :: ji, jj ! dummy loop indices |
---|
437 | REAL(wp) :: zcv, zdy2, zdy4 ! - - |
---|
438 | REAL(wp), DIMENSION(jpi,jpj) :: ztv1, ztv2, ztv3, ztv4 |
---|
439 | !!---------------------------------------------------------------------- |
---|
440 | ! |
---|
441 | ! !-- Laplacian in j-direction --! |
---|
442 | DO jj = 1, jpjm1 ! First derivative (gradient) |
---|
443 | DO ji = fs_2, fs_jpim1 |
---|
444 | ztv1(ji,jj) = ( pt(ji,jj+1) - pt(ji,jj) ) * r1_e2v(ji,jj) * vmask(ji,jj,1) |
---|
445 | END DO |
---|
446 | END DO |
---|
447 | DO jj = 2, jpjm1 ! Second derivative (Laplacian) |
---|
448 | DO ji = fs_2, fs_jpim1 |
---|
449 | ztv2(ji,jj) = ( ztv1(ji,jj) - ztv1(ji,jj-1) ) * r1_e2t(ji,jj) |
---|
450 | END DO |
---|
451 | END DO |
---|
452 | CALL lbc_lnk( ztv2, 'T', 1. ) |
---|
453 | ! |
---|
454 | ! !-- BiLaplacian in j-direction --! |
---|
455 | DO jj = 1, jpjm1 ! First derivative |
---|
456 | DO ji = fs_2, fs_jpim1 |
---|
457 | ztv3(ji,jj) = ( ztv2(ji,jj+1) - ztv2(ji,jj) ) * r1_e2v(ji,jj) * vmask(ji,jj,1) |
---|
458 | END DO |
---|
459 | END DO |
---|
460 | DO jj = 2, jpjm1 ! Second derivative |
---|
461 | DO ji = fs_2, fs_jpim1 |
---|
462 | ztv4(ji,jj) = ( ztv3(ji,jj) - ztv3(ji,jj-1) ) * r1_e2t(ji,jj) |
---|
463 | END DO |
---|
464 | END DO |
---|
465 | CALL lbc_lnk( ztv4, 'T', 1. ) |
---|
466 | ! |
---|
467 | ! |
---|
468 | SELECT CASE (k_order ) |
---|
469 | ! |
---|
470 | CASE( 1 ) !== 1st order central TIM ==! (Eq. 21) |
---|
471 | DO jj = 1, jpjm1 |
---|
472 | DO ji = fs_2, fs_jpim1 |
---|
473 | pt_v(ji,jj) = 0.5_wp * vmask(ji,jj,1) * ( ( pt(ji,jj+1) + pt(ji,jj) ) & |
---|
474 | & - SIGN( 1._wp, pvc(ji,jj) ) * ( pt(ji,jj+1) - pt(ji,jj) ) ) |
---|
475 | END DO |
---|
476 | END DO |
---|
477 | ! |
---|
478 | CASE( 2 ) !== 2nd order central TIM ==! (Eq. 23) |
---|
479 | DO jj = 1, jpjm1 |
---|
480 | DO ji = fs_2, fs_jpim1 |
---|
481 | zcv = pvc(ji,jj) * r1_e1v(ji,jj) * pdt * r1_e2v(ji,jj) |
---|
482 | pt_v(ji,jj) = 0.5_wp * vmask(ji,jj,1) * ( ( pt(ji,jj+1) + pt(ji,jj) ) & |
---|
483 | & - zcv * ( pt(ji,jj+1) - pt(ji,jj) ) ) |
---|
484 | END DO |
---|
485 | END DO |
---|
486 | CALL lbc_lnk( pt_v, 'V', 1. ) |
---|
487 | ! |
---|
488 | CASE( 3 ) !== 3rd order central TIM ==! (Eq. 24) |
---|
489 | DO jj = 1, jpjm1 |
---|
490 | DO ji = fs_2, fs_jpim1 |
---|
491 | zcv = pvc(ji,jj) * r1_e1v(ji,jj) * pdt * r1_e2v(ji,jj) |
---|
492 | zdy2 = e2v(ji,jj) * e2v(ji,jj) |
---|
493 | !!rachid zdy2 = e2v(ji,jj) * e2t(ji,jj) |
---|
494 | pt_v(ji,jj) = 0.5_wp * vmask(ji,jj,1) * ( ( pt (ji,jj+1) + pt (ji,jj) & |
---|
495 | & - zcv * ( pt (ji,jj+1) - pt (ji,jj) ) ) & |
---|
496 | & + z1_6 * zdy2 * ( zcv*zcv - 1._wp ) * ( ztv2(ji,jj+1) + ztv2(ji,jj) & |
---|
497 | & - SIGN( 1._wp, zcv ) * ( ztv2(ji,jj+1) - ztv2(ji,jj) ) ) ) |
---|
498 | END DO |
---|
499 | END DO |
---|
500 | ! |
---|
501 | CASE( 4 ) !== 4th order central TIM ==! (Eq. 27) |
---|
502 | DO jj = 1, jpjm1 |
---|
503 | DO ji = fs_2, fs_jpim1 |
---|
504 | zcv = pvc(ji,jj) * r1_e1v(ji,jj) * pdt * r1_e2v(ji,jj) |
---|
505 | zdy2 = e2v(ji,jj) * e2v(ji,jj) |
---|
506 | !!rachid zdy2 = e2v(ji,jj) * e2t(ji,jj) |
---|
507 | pt_v(ji,jj) = 0.5_wp * vmask(ji,jj,1) * ( ( pt (ji,jj+1) + pt (ji,jj) & |
---|
508 | & - zcv * ( pt (ji,jj+1) - pt (ji,jj) ) ) & |
---|
509 | & + z1_6 * zdy2 * ( zcv*zcv - 1._wp ) * ( ztv2(ji,jj+1) + ztv2(ji,jj) & |
---|
510 | & - 0.5_wp * zcv * ( ztv2(ji,jj+1) - ztv2(ji,jj) ) ) ) |
---|
511 | END DO |
---|
512 | END DO |
---|
513 | ! |
---|
514 | CASE( 5 ) !== 5th order central TIM ==! (Eq. 29) |
---|
515 | DO jj = 1, jpjm1 |
---|
516 | DO ji = fs_2, fs_jpim1 |
---|
517 | zcv = pvc(ji,jj) * r1_e1v(ji,jj) * pdt * r1_e2v(ji,jj) |
---|
518 | zdy2 = e2v(ji,jj) * e2v(ji,jj) |
---|
519 | !!rachid zdy2 = e2v(ji,jj) * e2t(ji,jj) |
---|
520 | zdy4 = zdy2 * zdy2 |
---|
521 | pt_v(ji,jj) = 0.5_wp * vmask(ji,jj,1) * ( ( pt (ji,jj+1) + pt (ji,jj) & |
---|
522 | & - zcv * ( pt (ji,jj+1) - pt (ji,jj) ) ) & |
---|
523 | & + z1_6 * zdy2 * ( zcv*zcv - 1._wp ) * ( ztv2(ji,jj+1) + ztv2(ji,jj) & |
---|
524 | & - 0.5_wp * zcv * ( ztv2(ji,jj+1) - ztv2(ji,jj) ) ) & |
---|
525 | & + z1_120 * zdy4 * ( zcv*zcv - 1._wp ) * ( zcv*zcv - 4._wp ) * ( ztv4(ji,jj+1) + ztv4(ji,jj) & |
---|
526 | & - SIGN( 1._wp, zcv ) * ( ztv4(ji,jj+1) - ztv4(ji,jj) ) ) ) |
---|
527 | END DO |
---|
528 | END DO |
---|
529 | ! |
---|
530 | END SELECT |
---|
531 | ! |
---|
532 | END SUBROUTINE ultimate_y |
---|
533 | |
---|
534 | |
---|
535 | SUBROUTINE nonosc_2d( pbef, paa, pbb, paft, pdt ) |
---|
536 | !!--------------------------------------------------------------------- |
---|
537 | !! *** ROUTINE nonosc *** |
---|
538 | !! |
---|
539 | !! ** Purpose : compute monotonic tracer fluxes from the upstream |
---|
540 | !! scheme and the before field by a nonoscillatory algorithm |
---|
541 | !! |
---|
542 | !! ** Method : ... ??? |
---|
543 | !! warning : pbef and paft must be masked, but the boundaries |
---|
544 | !! conditions on the fluxes are not necessary zalezak (1979) |
---|
545 | !! drange (1995) multi-dimensional forward-in-time and upstream- |
---|
546 | !! in-space based differencing for fluid |
---|
547 | !!---------------------------------------------------------------------- |
---|
548 | REAL(wp) , INTENT(in ) :: pdt ! tracer time-step |
---|
549 | REAL(wp), DIMENSION (jpi,jpj), INTENT(in ) :: pbef, paft ! before & after field |
---|
550 | REAL(wp), DIMENSION (jpi,jpj), INTENT(inout) :: paa, pbb ! monotonic fluxes in the 2 directions |
---|
551 | ! |
---|
552 | INTEGER :: ji, jj ! dummy loop indices |
---|
553 | INTEGER :: ikm1 ! local integer |
---|
554 | REAL(wp) :: zpos, zneg, zbt, za, zb, zc, zbig, zsml, z1_dt ! local scalars |
---|
555 | REAL(wp) :: zau, zbu, zcu, zav, zbv, zcv, zup, zdo ! - - |
---|
556 | REAL(wp), DIMENSION(jpi,jpj) :: zbetup, zbetdo, zbup, zbdo, zmsk, zdiv |
---|
557 | !!---------------------------------------------------------------------- |
---|
558 | ! |
---|
559 | zbig = 1.e+40_wp |
---|
560 | zsml = 1.e-15_wp |
---|
561 | |
---|
562 | ! test on divergence |
---|
563 | DO jj = 2, jpjm1 |
---|
564 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
565 | zdiv(ji,jj) = - ( paa(ji,jj) - paa(ji-1,jj ) & |
---|
566 | & + pbb(ji,jj) - pbb(ji ,jj-1) ) |
---|
567 | END DO |
---|
568 | END DO |
---|
569 | CALL lbc_lnk( zdiv, 'T', 1. ) ! Lateral boundary conditions (unchanged sign) |
---|
570 | |
---|
571 | ! Determine ice masks for before and after tracers |
---|
572 | WHERE( pbef(:,:) == 0._wp .AND. paft(:,:) == 0._wp .AND. zdiv(:,:) == 0._wp ) ; zmsk(:,:) = 0._wp |
---|
573 | ELSEWHERE ; zmsk(:,:) = 1._wp * tmask(:,:,1) |
---|
574 | END WHERE |
---|
575 | |
---|
576 | ! Search local extrema |
---|
577 | ! -------------------- |
---|
578 | ! max/min of pbef & paft with large negative/positive value (-/+zbig) inside land |
---|
579 | ! zbup(:,:) = MAX( pbef(:,:) * tmask(:,:,1) - zbig * ( 1.e0 - tmask(:,:,1) ), & |
---|
580 | ! & paft(:,:) * tmask(:,:,1) - zbig * ( 1.e0 - tmask(:,:,1) ) ) |
---|
581 | ! zbdo(:,:) = MIN( pbef(:,:) * tmask(:,:,1) + zbig * ( 1.e0 - tmask(:,:,1) ), & |
---|
582 | ! & paft(:,:) * tmask(:,:,1) + zbig * ( 1.e0 - tmask(:,:,1) ) ) |
---|
583 | zbup(:,:) = MAX( pbef(:,:) * zmsk(:,:) - zbig * ( 1.e0 - zmsk(:,:) ), & |
---|
584 | & paft(:,:) * zmsk(:,:) - zbig * ( 1.e0 - zmsk(:,:) ) ) |
---|
585 | zbdo(:,:) = MIN( pbef(:,:) * zmsk(:,:) + zbig * ( 1.e0 - zmsk(:,:) ), & |
---|
586 | & paft(:,:) * zmsk(:,:) + zbig * ( 1.e0 - zmsk(:,:) ) ) |
---|
587 | |
---|
588 | z1_dt = 1._wp / pdt |
---|
589 | DO jj = 2, jpjm1 |
---|
590 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
591 | ! |
---|
592 | zup = MAX( zbup(ji,jj), zbup(ji-1,jj ), zbup(ji+1,jj ), & ! search max/min in neighbourhood |
---|
593 | & zbup(ji ,jj-1), zbup(ji ,jj+1) ) |
---|
594 | zdo = MIN( zbdo(ji,jj), zbdo(ji-1,jj ), zbdo(ji+1,jj ), & |
---|
595 | & zbdo(ji ,jj-1), zbdo(ji ,jj+1) ) |
---|
596 | ! |
---|
597 | zpos = MAX( 0., paa(ji-1,jj ) ) - MIN( 0., paa(ji ,jj ) ) & ! positive/negative part of the flux |
---|
598 | & + MAX( 0., pbb(ji ,jj-1) ) - MIN( 0., pbb(ji ,jj ) ) |
---|
599 | zneg = MAX( 0., paa(ji ,jj ) ) - MIN( 0., paa(ji-1,jj ) ) & |
---|
600 | & + MAX( 0., pbb(ji ,jj ) ) - MIN( 0., pbb(ji ,jj-1) ) |
---|
601 | ! |
---|
602 | zbt = e1e2t(ji,jj) * z1_dt ! up & down beta terms |
---|
603 | zbetup(ji,jj) = ( zup - paft(ji,jj) ) / ( zpos + zsml ) * zbt |
---|
604 | zbetdo(ji,jj) = ( paft(ji,jj) - zdo ) / ( zneg + zsml ) * zbt |
---|
605 | END DO |
---|
606 | END DO |
---|
607 | CALL lbc_lnk_multi( zbetup, 'T', 1., zbetdo, 'T', 1. ) ! lateral boundary cond. (unchanged sign) |
---|
608 | |
---|
609 | ! monotonic flux in the i & j direction (paa & pbb) |
---|
610 | ! ------------------------------------- |
---|
611 | DO jj = 2, jpjm1 |
---|
612 | DO ji = 1, fs_jpim1 ! vector opt. |
---|
613 | zau = MIN( 1._wp , zbetdo(ji,jj) , zbetup(ji+1,jj) ) |
---|
614 | zbu = MIN( 1._wp , zbetup(ji,jj) , zbetdo(ji+1,jj) ) |
---|
615 | zcu = 0.5 + SIGN( 0.5 , paa(ji,jj) ) |
---|
616 | ! |
---|
617 | paa(ji,jj) = paa(ji,jj) * ( zcu * zau + ( 1._wp - zcu) * zbu ) |
---|
618 | END DO |
---|
619 | END DO |
---|
620 | ! |
---|
621 | DO jj = 1, jpjm1 |
---|
622 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
623 | zav = MIN( 1._wp , zbetdo(ji,jj) , zbetup(ji,jj+1) ) |
---|
624 | zbv = MIN( 1._wp , zbetup(ji,jj) , zbetdo(ji,jj+1) ) |
---|
625 | zcv = 0.5 + SIGN( 0.5 , pbb(ji,jj) ) |
---|
626 | ! |
---|
627 | pbb(ji,jj) = pbb(ji,jj) * ( zcv * zav + ( 1._wp - zcv) * zbv ) |
---|
628 | END DO |
---|
629 | END DO |
---|
630 | ! |
---|
631 | END SUBROUTINE nonosc_2d |
---|
632 | |
---|
633 | #else |
---|
634 | !!---------------------------------------------------------------------- |
---|
635 | !! Default option Dummy module NO SI3 sea-ice model |
---|
636 | !!---------------------------------------------------------------------- |
---|
637 | #endif |
---|
638 | |
---|
639 | !!====================================================================== |
---|
640 | END MODULE icedyn_adv_umx |
---|