1 SUBROUTINE g_stuff_bdy ( g_data3d , g_space_bdy_xs, g_space_bdy_xe, g_space_bdy_ys, g_space_bdy_ye, &
4 ids, ide, jds, jde, kds, kde , &
5 ims, ime, jms, jme, kms, kme , &
6 its, ite, jts, jte, kts, kte )
8 !-------------------------------------------------------------------------
9 ! Derived from share/module_bc.F
10 ! Author: Xin Zhang, 10/3/2010
11 !-------------------------------------------------------------------------
12 ! This routine puts the data in the 3d arrays into the proper locations
13 ! for the lateral boundary arrays.
17 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
18 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
19 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
20 INTEGER , INTENT(IN) :: spec_bdy_width
21 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(IN) :: g_data3d
22 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(OUT) :: g_space_bdy_xs, g_space_bdy_xe
23 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(OUT) :: g_space_bdy_ys, g_space_bdy_ye
24 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
26 INTEGER :: i , ii , j , jj , k
28 ! There are four lateral boundary locations that are stored.
32 IF ( char_stagger .EQ. 'W' ) THEN
34 DO j = MAX(jds,jts) , MIN(jde-1,jte)
35 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
36 g_space_bdy_xs(j,k,i) = g_data3d(i,j,k)
40 ELSE IF ( char_stagger .EQ. 'M' ) THEN
42 DO j = MAX(jds,jts) , MIN(jde-1,jte)
43 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
44 g_space_bdy_xs(j,k,i) = g_data3d(i,j,k)
48 ELSE IF ( char_stagger .EQ. 'V' ) THEN
50 DO j = MAX(jds,jts) , MIN(jde,jte)
51 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
52 g_space_bdy_xs(j,k,i) = g_data3d(i,j,k)
58 DO j = MAX(jds,jts) , MIN(jde-1,jte)
59 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
60 g_space_bdy_xs(j,k,i) = g_data3d(i,j,k)
68 IF ( char_stagger .EQ. 'U' ) THEN
70 DO j = MAX(jds,jts) , MIN(jde-1,jte)
71 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
73 g_space_bdy_xe(j,k,ii) = g_data3d(i,j,k)
77 ELSE IF ( char_stagger .EQ. 'V' ) THEN
79 DO j = MAX(jds,jts) , MIN(jde,jte)
80 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
82 g_space_bdy_xe(j,k,ii) = g_data3d(i,j,k)
86 ELSE IF ( char_stagger .EQ. 'W' ) THEN
88 DO j = MAX(jds,jts) , MIN(jde-1,jte)
89 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
91 g_space_bdy_xe(j,k,ii) = g_data3d(i,j,k)
95 ELSE IF ( char_stagger .EQ. 'M' ) THEN
97 DO j = MAX(jds,jts) , MIN(jde-1,jte)
98 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
100 g_space_bdy_xe(j,k,ii) = g_data3d(i,j,k)
106 DO j = MAX(jds,jts) , MIN(jde-1,jte)
107 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
109 g_space_bdy_xe(j,k,ii) = g_data3d(i,j,k)
117 IF ( char_stagger .EQ. 'W' ) THEN
119 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
120 DO i = MAX(ids,its) , MIN(ide-1,ite)
121 g_space_bdy_ys(i,k,j) = g_data3d(i,j,k)
125 ELSE IF ( char_stagger .EQ. 'M' ) THEN
127 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
128 DO i = MAX(ids,its) , MIN(ide-1,ite)
129 g_space_bdy_ys(i,k,j) = g_data3d(i,j,k)
133 ELSE IF ( char_stagger .EQ. 'U' ) THEN
135 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
136 DO i = MAX(ids,its) , MIN(ide,ite)
137 g_space_bdy_ys(i,k,j) = g_data3d(i,j,k)
143 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
144 DO i = MAX(ids,its) , MIN(ide-1,ite)
145 g_space_bdy_ys(i,k,j) = g_data3d(i,j,k)
153 IF ( char_stagger .EQ. 'V' ) THEN
155 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
156 DO i = MAX(ids,its) , MIN(ide-1,ite)
158 g_space_bdy_ye(i,k,jj) = g_data3d(i,j,k)
162 ELSE IF ( char_stagger .EQ. 'U' ) THEN
164 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
165 DO i = MAX(ids,its) , MIN(ide,ite)
167 g_space_bdy_ye(i,k,jj) = g_data3d(i,j,k)
171 ELSE IF ( char_stagger .EQ. 'W' ) THEN
173 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
174 DO i = MAX(ids,its) , MIN(ide-1,ite)
176 g_space_bdy_ye(i,k,jj) = g_data3d(i,j,k)
180 ELSE IF ( char_stagger .EQ. 'M' ) THEN
182 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
183 DO i = MAX(ids,its) , MIN(ide-1,ite)
185 g_space_bdy_ye(i,k,jj) = g_data3d(i,j,k)
191 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
192 DO i = MAX(ids,its) , MIN(ide-1,ite)
194 g_space_bdy_ye(i,k,jj) = g_data3d(i,j,k)
200 END SUBROUTINE g_stuff_bdy
202 SUBROUTINE a_stuff_bdy ( a_data3d , a_space_bdy_xs, a_space_bdy_xe, a_space_bdy_ys, a_space_bdy_ye, &
205 ids, ide, jds, jde, kds, kde , &
206 ims, ime, jms, jme, kms, kme , &
207 its, ite, jts, jte, kts, kte )
209 !-------------------------------------------------------------------------
210 ! Derived from share/module_bc.F
211 ! Author: Xin Zhang, 10/3/2010
212 !-------------------------------------------------------------------------
213 ! This routine puts the data in the 3d arrays into the proper locations
214 ! for the lateral boundary arrays.
218 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
219 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
220 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
221 INTEGER , INTENT(IN) :: spec_bdy_width
222 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(INOUT) :: a_data3d
223 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(INOUT) :: a_space_bdy_xs, a_space_bdy_xe
224 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(INOUT) :: a_space_bdy_ys, a_space_bdy_ye
225 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
227 INTEGER :: i , ii , j , jj , k
229 ! There are four lateral boundary locations that are stored.
233 IF ( char_stagger .EQ. 'W' ) THEN
235 DO j = MAX(jds,jts) , MIN(jde-1,jte)
236 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
237 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xs(j,k,i)
238 a_space_bdy_xs(j,k,i) = 0.0
242 ELSE IF ( char_stagger .EQ. 'M' ) THEN
244 DO j = MAX(jds,jts) , MIN(jde-1,jte)
245 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
246 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xs(j,k,i)
247 a_space_bdy_xs(j,k,i) = 0.0
251 ELSE IF ( char_stagger .EQ. 'V' ) THEN
253 DO j = MAX(jds,jts) , MIN(jde,jte)
254 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
255 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xs(j,k,i)
256 a_space_bdy_xs(j,k,i) = 0.0
262 DO j = MAX(jds,jts) , MIN(jde-1,jte)
263 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
264 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xs(j,k,i)
265 a_space_bdy_xs(j,k,i) = 0.0
273 IF ( char_stagger .EQ. 'U' ) THEN
275 DO j = MAX(jds,jts) , MIN(jde-1,jte)
276 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
278 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xe(j,k,ii)
279 a_space_bdy_xe(j,k,ii) = 0.0
283 ELSE IF ( char_stagger .EQ. 'V' ) THEN
285 DO j = MAX(jds,jts) , MIN(jde,jte)
286 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
288 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xe(j,k,ii)
289 a_space_bdy_xe(j,k,ii) = 0.0
293 ELSE IF ( char_stagger .EQ. 'W' ) THEN
295 DO j = MAX(jds,jts) , MIN(jde-1,jte)
296 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
298 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xe(j,k,ii)
299 a_space_bdy_xe(j,k,ii) = 0.0
303 ELSE IF ( char_stagger .EQ. 'M' ) THEN
305 DO j = MAX(jds,jts) , MIN(jde-1,jte)
306 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
308 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xe(j,k,ii)
309 a_space_bdy_xe(j,k,ii) = 0.0
315 DO j = MAX(jds,jts) , MIN(jde-1,jte)
316 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
318 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_xe(j,k,ii)
319 a_space_bdy_xe(j,k,ii) = 0.0
327 IF ( char_stagger .EQ. 'W' ) THEN
329 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
330 DO i = MAX(ids,its) , MIN(ide-1,ite)
331 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ys(i,k,j)
332 a_space_bdy_ys(i,k,j) = 0.0
336 ELSE IF ( char_stagger .EQ. 'M' ) THEN
338 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
339 DO i = MAX(ids,its) , MIN(ide-1,ite)
340 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ys(i,k,j)
341 a_space_bdy_ys(i,k,j) = 0.0
345 ELSE IF ( char_stagger .EQ. 'U' ) THEN
347 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
348 DO i = MAX(ids,its) , MIN(ide,ite)
349 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ys(i,k,j)
350 a_space_bdy_ys(i,k,j) = 0.0
356 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
357 DO i = MAX(ids,its) , MIN(ide-1,ite)
358 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ys(i,k,j)
359 a_space_bdy_ys(i,k,j) = 0.0
367 IF ( char_stagger .EQ. 'V' ) THEN
369 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
370 DO i = MAX(ids,its) , MIN(ide-1,ite)
372 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ye(i,k,jj)
373 a_space_bdy_ye(i,k,jj) = 0.0
377 ELSE IF ( char_stagger .EQ. 'U' ) THEN
379 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
380 DO i = MAX(ids,its) , MIN(ide,ite)
382 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ye(i,k,jj)
383 a_space_bdy_ye(i,k,jj) = 0.0
387 ELSE IF ( char_stagger .EQ. 'W' ) THEN
389 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
390 DO i = MAX(ids,its) , MIN(ide-1,ite)
392 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ye(i,k,jj)
393 a_space_bdy_ye(i,k,jj) = 0.0
397 ELSE IF ( char_stagger .EQ. 'M' ) THEN
399 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
400 DO i = MAX(ids,its) , MIN(ide-1,ite)
402 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ye(i,k,jj)
403 a_space_bdy_ye(i,k,jj) = 0.0
409 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
410 DO i = MAX(ids,its) , MIN(ide-1,ite)
412 a_data3d(i,j,k) = a_data3d(i,j,k) + a_space_bdy_ye(i,k,jj)
413 a_space_bdy_ye(i,k,jj) = 0.0
419 END SUBROUTINE a_stuff_bdy
421 SUBROUTINE g_stuff_bdytend ( g_data3dnew , g_data3dold , time_diff , &
422 g_space_bdy_xs, g_space_bdy_xe, g_space_bdy_ys, g_space_bdy_ye, &
425 ids, ide, jds, jde, kds, kde , &
426 ims, ime, jms, jme, kms, kme , &
427 its, ite, jts, jte, kts, kte )
429 !-------------------------------------------------------------------------
430 ! Derived from share/module_bc.F
431 ! Author: Xin Zhang, 10/3/2010
432 !-------------------------------------------------------------------------
433 ! This routine puts the tendency data into the proper locations
434 ! for the lateral boundary arrays.
438 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
439 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
440 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
441 INTEGER , INTENT(IN) :: spec_bdy_width
442 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(IN) :: g_data3dnew , g_data3dold
443 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(OUT) :: g_space_bdy_xs, g_space_bdy_xe
444 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(OUT) :: g_space_bdy_ys, g_space_bdy_ye
445 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
446 REAL , INTENT(IN) :: time_diff ! seconds
448 INTEGER :: i , ii , j , jj , k
450 ! There are four lateral boundary locations that are stored.
454 IF ( char_stagger .EQ. 'W' ) THEN
456 DO j = MAX(jds,jts) , MIN(jde-1,jte)
457 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
458 g_space_bdy_xs(j,k,i) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
462 ELSE IF ( char_stagger .EQ. 'M' ) THEN
464 DO j = MAX(jds,jts) , MIN(jde-1,jte)
465 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
466 g_space_bdy_xs(j,k,i) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
470 ELSE IF ( char_stagger .EQ. 'V' ) THEN
472 DO j = MAX(jds,jts) , MIN(jde,jte)
473 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
474 g_space_bdy_xs(j,k,i) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
480 DO j = MAX(jds,jts) , MIN(jde-1,jte)
481 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
482 g_space_bdy_xs(j,k,i) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
490 IF ( char_stagger .EQ. 'U' ) THEN
492 DO j = MAX(jds,jts) , MIN(jde-1,jte)
493 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
495 g_space_bdy_xe(j,k,ii) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
499 ELSE IF ( char_stagger .EQ. 'V' ) THEN
501 DO j = MAX(jds,jts) , MIN(jde,jte)
502 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
504 g_space_bdy_xe(j,k,ii) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
508 ELSE IF ( char_stagger .EQ. 'W' ) THEN
510 DO j = MAX(jds,jts) , MIN(jde-1,jte)
511 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
513 g_space_bdy_xe(j,k,ii) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
517 ELSE IF ( char_stagger .EQ. 'M' ) THEN
519 DO j = MAX(jds,jts) , MIN(jde-1,jte)
520 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
522 g_space_bdy_xe(j,k,ii) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
528 DO j = MAX(jds,jts) , MIN(jde-1,jte)
529 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
531 g_space_bdy_xe(j,k,ii) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
539 IF ( char_stagger .EQ. 'W' ) THEN
541 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
542 DO i = MAX(ids,its) , MIN(ide-1,ite)
543 g_space_bdy_ys(i,k,j) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
547 ELSE IF ( char_stagger .EQ. 'M' ) THEN
548 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
550 DO i = MAX(ids,its) , MIN(ide-1,ite)
551 g_space_bdy_ys(i,k,j) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
555 ELSE IF ( char_stagger .EQ. 'U' ) THEN
557 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
558 DO i = MAX(ids,its) , MIN(ide,ite)
559 g_space_bdy_ys(i,k,j) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
565 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
566 DO i = MAX(ids,its) , MIN(ide-1,ite)
567 g_space_bdy_ys(i,k,j) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
575 IF ( char_stagger .EQ. 'V' ) THEN
577 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
578 DO i = MAX(ids,its) , MIN(ide-1,ite)
580 g_space_bdy_ye(i,k,jj) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
584 ELSE IF ( char_stagger .EQ. 'U' ) THEN
586 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
587 DO i = MAX(ids,its) , MIN(ide,ite)
589 g_space_bdy_ye(i,k,jj) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
593 ELSE IF ( char_stagger .EQ. 'W' ) THEN
595 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
596 DO i = MAX(ids,its) , MIN(ide-1,ite)
598 g_space_bdy_ye(i,k,jj) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
602 ELSE IF ( char_stagger .EQ. 'M' ) THEN
604 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
605 DO i = MAX(ids,its) , MIN(ide-1,ite)
607 g_space_bdy_ye(i,k,jj) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
613 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
614 DO i = MAX(ids,its) , MIN(ide-1,ite)
616 g_space_bdy_ye(i,k,jj) = ( g_data3dnew(i,j,k) - g_data3dold(i,j,k) ) / time_diff
622 END SUBROUTINE g_stuff_bdytend
624 SUBROUTINE a_stuff_bdytend_new ( a_data3dnew , time_diff , &
625 a_space_bdy_xs, a_space_bdy_xe, a_space_bdy_ys, a_space_bdy_ye, &
628 ids, ide, jds, jde, kds, kde , &
629 ims, ime, jms, jme, kms, kme , &
630 its, ite, jts, jte, kts, kte )
632 !-------------------------------------------------------------------------
633 ! Derived from share/module_bc.F
634 ! Author: Xin Zhang, 10/3/2010
635 !-------------------------------------------------------------------------
636 ! This routine puts the tendency data into the proper locations
637 ! for the lateral boundary arrays.
641 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
642 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
643 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
644 INTEGER , INTENT(IN) :: spec_bdy_width
645 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(INOUT) :: a_data3dnew
646 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(IN) :: a_space_bdy_xs, a_space_bdy_xe
647 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(IN) :: a_space_bdy_ys, a_space_bdy_ye
648 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
649 REAL , INTENT(IN) :: time_diff ! seconds
651 INTEGER :: i , ii , j , jj , k
653 ! There are four lateral boundary locations that are stored.
657 IF ( char_stagger .EQ. 'W' ) THEN
659 DO j = MAX(jds,jts) , MIN(jde-1,jte)
660 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
661 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xs(j,k,i) / time_diff
665 ELSE IF ( char_stagger .EQ. 'M' ) THEN
667 DO j = MAX(jds,jts) , MIN(jde-1,jte)
668 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
669 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xs(j,k,i) / time_diff
673 ELSE IF ( char_stagger .EQ. 'V' ) THEN
675 DO j = MAX(jds,jts) , MIN(jde,jte)
676 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
677 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xs(j,k,i) / time_diff
683 DO j = MAX(jds,jts) , MIN(jde-1,jte)
684 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
685 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xs(j,k,i) / time_diff
693 IF ( char_stagger .EQ. 'U' ) THEN
695 DO j = MAX(jds,jts) , MIN(jde-1,jte)
696 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
698 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xe(j,k,ii) / time_diff
702 ELSE IF ( char_stagger .EQ. 'V' ) THEN
704 DO j = MAX(jds,jts) , MIN(jde,jte)
705 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
707 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xe(j,k,ii) / time_diff
711 ELSE IF ( char_stagger .EQ. 'W' ) THEN
713 DO j = MAX(jds,jts) , MIN(jde-1,jte)
714 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
716 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xe(j,k,ii) / time_diff
720 ELSE IF ( char_stagger .EQ. 'M' ) THEN
722 DO j = MAX(jds,jts) , MIN(jde-1,jte)
723 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
725 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xe(j,k,ii) / time_diff
731 DO j = MAX(jds,jts) , MIN(jde-1,jte)
732 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
734 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_xe(j,k,ii) / time_diff
742 IF ( char_stagger .EQ. 'W' ) THEN
744 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
745 DO i = MAX(ids,its) , MIN(ide-1,ite)
746 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ys(i,k,j) / time_diff
750 ELSE IF ( char_stagger .EQ. 'M' ) THEN
751 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
753 DO i = MAX(ids,its) , MIN(ide-1,ite)
754 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ys(i,k,j) / time_diff
758 ELSE IF ( char_stagger .EQ. 'U' ) THEN
760 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
761 DO i = MAX(ids,its) , MIN(ide,ite)
762 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ys(i,k,j) / time_diff
768 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
769 DO i = MAX(ids,its) , MIN(ide-1,ite)
770 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ys(i,k,j) / time_diff
778 IF ( char_stagger .EQ. 'V' ) THEN
780 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
781 DO i = MAX(ids,its) , MIN(ide-1,ite)
783 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ye(i,k,jj) / time_diff
787 ELSE IF ( char_stagger .EQ. 'U' ) THEN
789 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
790 DO i = MAX(ids,its) , MIN(ide,ite)
792 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ye(i,k,jj) / time_diff
796 ELSE IF ( char_stagger .EQ. 'W' ) THEN
798 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
799 DO i = MAX(ids,its) , MIN(ide-1,ite)
801 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ye(i,k,jj) / time_diff
805 ELSE IF ( char_stagger .EQ. 'M' ) THEN
807 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
808 DO i = MAX(ids,its) , MIN(ide-1,ite)
810 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ye(i,k,jj) / time_diff
816 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
817 DO i = MAX(ids,its) , MIN(ide-1,ite)
819 a_data3dnew(i,j,k) = a_data3dnew(i,j,k) + a_space_bdy_ye(i,k,jj) / time_diff
825 END SUBROUTINE a_stuff_bdytend_new
827 SUBROUTINE a_stuff_bdytend_old ( a_data3dold , time_diff , &
828 a_space_bdy_xs, a_space_bdy_xe, a_space_bdy_ys, a_space_bdy_ye, &
831 ids, ide, jds, jde, kds, kde , &
832 ims, ime, jms, jme, kms, kme , &
833 its, ite, jts, jte, kts, kte )
835 !-------------------------------------------------------------------------
836 ! Derived from share/module_bc.F
837 ! Author: Xin Zhang, 10/3/2010
838 !-------------------------------------------------------------------------
839 ! This routine puts the tendency data into the proper locations
840 ! for the lateral boundary arrays.
844 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
845 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
846 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
847 INTEGER , INTENT(IN) :: spec_bdy_width
848 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(INOUT) :: a_data3dold
849 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(INOUT) :: a_space_bdy_xs, a_space_bdy_xe
850 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(INOUT) :: a_space_bdy_ys, a_space_bdy_ye
851 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
852 REAL , INTENT(IN) :: time_diff ! seconds
854 INTEGER :: i , ii , j , jj , k
856 ! There are four lateral boundary locations that are stored.
860 IF ( char_stagger .EQ. 'W' ) THEN
862 DO j = MAX(jds,jts) , MIN(jde-1,jte)
863 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
864 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xs(j,k,i) / time_diff
865 a_space_bdy_xs(j,k,i) = 0.0
869 ELSE IF ( char_stagger .EQ. 'M' ) THEN
871 DO j = MAX(jds,jts) , MIN(jde-1,jte)
872 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
873 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xs(j,k,i) / time_diff
874 a_space_bdy_xs(j,k,i) = 0.0
878 ELSE IF ( char_stagger .EQ. 'V' ) THEN
880 DO j = MAX(jds,jts) , MIN(jde,jte)
881 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
882 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xs(j,k,i) / time_diff
883 a_space_bdy_xs(j,k,i) = 0.0
889 DO j = MAX(jds,jts) , MIN(jde-1,jte)
890 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
891 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xs(j,k,i) / time_diff
892 a_space_bdy_xs(j,k,i) = 0.0
900 IF ( char_stagger .EQ. 'U' ) THEN
902 DO j = MAX(jds,jts) , MIN(jde-1,jte)
903 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
905 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xe(j,k,ii) / time_diff
906 a_space_bdy_xe(j,k,ii) = 0.0
910 ELSE IF ( char_stagger .EQ. 'V' ) THEN
912 DO j = MAX(jds,jts) , MIN(jde,jte)
913 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
915 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xe(j,k,ii) / time_diff
916 a_space_bdy_xe(j,k,ii) = 0.0
920 ELSE IF ( char_stagger .EQ. 'W' ) THEN
922 DO j = MAX(jds,jts) , MIN(jde-1,jte)
923 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
925 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xe(j,k,ii) / time_diff
926 a_space_bdy_xe(j,k,ii) = 0.0
930 ELSE IF ( char_stagger .EQ. 'M' ) THEN
932 DO j = MAX(jds,jts) , MIN(jde-1,jte)
933 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
935 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xe(j,k,ii) / time_diff
936 a_space_bdy_xe(j,k,ii) = 0.0
942 DO j = MAX(jds,jts) , MIN(jde-1,jte)
943 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
945 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_xe(j,k,ii) / time_diff
946 a_space_bdy_xe(j,k,ii) = 0.0
954 IF ( char_stagger .EQ. 'W' ) THEN
956 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
957 DO i = MAX(ids,its) , MIN(ide-1,ite)
958 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ys(i,k,j) / time_diff
959 a_space_bdy_ys(i,k,j) = 0.0
963 ELSE IF ( char_stagger .EQ. 'M' ) THEN
964 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
966 DO i = MAX(ids,its) , MIN(ide-1,ite)
967 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ys(i,k,j) / time_diff
968 a_space_bdy_ys(i,k,j) = 0.0
972 ELSE IF ( char_stagger .EQ. 'U' ) THEN
974 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
975 DO i = MAX(ids,its) , MIN(ide,ite)
976 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ys(i,k,j) / time_diff
977 a_space_bdy_ys(i,k,j) = 0.0
983 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
984 DO i = MAX(ids,its) , MIN(ide-1,ite)
985 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ys(i,k,j) / time_diff
986 a_space_bdy_ys(i,k,j) = 0.0
994 IF ( char_stagger .EQ. 'V' ) THEN
996 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
997 DO i = MAX(ids,its) , MIN(ide-1,ite)
999 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ye(i,k,jj) / time_diff
1000 a_space_bdy_ye(i,k,jj) = 0.0
1004 ELSE IF ( char_stagger .EQ. 'U' ) THEN
1005 DO k = kds , kde - 1
1006 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1007 DO i = MAX(ids,its) , MIN(ide,ite)
1009 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ye(i,k,jj) / time_diff
1010 a_space_bdy_ye(i,k,jj) = 0.0
1014 ELSE IF ( char_stagger .EQ. 'W' ) THEN
1016 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1017 DO i = MAX(ids,its) , MIN(ide-1,ite)
1019 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ye(i,k,jj) / time_diff
1020 a_space_bdy_ye(i,k,jj) = 0.0
1024 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1026 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1027 DO i = MAX(ids,its) , MIN(ide-1,ite)
1029 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ye(i,k,jj) / time_diff
1030 a_space_bdy_ye(i,k,jj) = 0.0
1035 DO k = kds , kde - 1
1036 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1037 DO i = MAX(ids,its) , MIN(ide-1,ite)
1039 a_data3dold(i,j,k) = a_data3dold(i,j,k) - a_space_bdy_ye(i,k,jj) / time_diff
1040 a_space_bdy_ye(i,k,jj) = 0.0
1046 END SUBROUTINE a_stuff_bdytend_old
1048 SUBROUTINE g_couple ( config_flags, mu, g_mu, mub, g_rfield, field, &
1049 g_field, name, msf, &
1050 ids, ide, jds, jde, kds, kde, &
1051 ims, ime, jms, jme, kms, kme, &
1052 its, ite, jts, jte, kts, kte )
1054 !-------------------------------------------------------------------------
1055 ! Derived from dyn_em/module_big_step_utilities_em.F
1056 ! Author: Xin Zhang, 10/2/2010
1057 !-------------------------------------------------------------------------
1062 TYPE(grid_config_rec_type ) , INTENT(IN ) :: config_flags
1064 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
1065 ims, ime, jms, jme, kms, kme, &
1066 its, ite, jts, jte, kts, kte
1068 CHARACTER(LEN=1) , INTENT(IN ) :: name
1070 REAL , DIMENSION( ims:ime , jms:jme , kms:kme ) , INTENT( OUT) :: g_rfield
1072 REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(IN ) :: mu, g_mu, mub, msf
1074 REAL , DIMENSION( ims:ime , jms:jme , kms:kme ) , INTENT(IN ) :: field, g_field
1078 INTEGER :: i, j, k, itf, jtf, ktf
1079 REAL , DIMENSION(ims:ime,jms:jme) :: muu , muv
1080 REAL , DIMENSION(ims:ime,jms:jme) :: g_muu , g_muv
1084 ! subroutine couple couples the input variable with the dry-air
1091 IF (name .EQ. 'u')THEN
1098 CALL g_calc_mu_uv ( config_flags, mu, g_mu, mub, &
1099 muu, g_muu, muv, g_muv, &
1100 ids, ide, jds, jde, kds, kde, &
1101 ims, ime, jms, jme, kms, kme, &
1102 its, ite, jts, jte, kts, kte )
1110 g_rfield(i,j,k)=g_field(i,j,k)*muu(i,j)/msf(i,j) + &
1111 field(i,j,k)*g_muu(i,j)/msf(i,j)
1116 ELSE IF (name .EQ. 'v')THEN
1123 CALL g_calc_mu_uv ( config_flags, mu, g_mu, mub, &
1124 muu, g_muu, muv, g_muv, &
1125 ids, ide, jds, jde, kds, kde, &
1126 ims, ime, jms, jme, kms, kme, &
1127 its, ite, jts, jte, kts, kte )
1136 g_rfield(i,j,k)=g_field(i,j,k)*muv(i,j)/msf(i,j) + &
1137 field(i,j,k)*g_muv(i,j)/msf(i,j)
1142 ELSE IF (name .EQ. 'w')THEN
1148 g_rfield(i,j,k)=g_field(i,j,k)*(mu(i,j)+mub(i,j))/msf(i,j) + &
1149 field(i,j,k)*g_mu(i,j)/msf(i,j)
1154 ELSE IF (name .EQ. 'h')THEN
1160 g_rfield(i,j,k)=g_field(i,j,k)*(mu(i,j)+mub(i,j)) + &
1161 field(i,j,k)*g_mu(i,j)
1172 g_rfield(i,j,k)=g_field(i,j,k)*(mu(i,j)+mub(i,j)) + &
1173 field(i,j,k)*g_mu(i,j)
1180 END SUBROUTINE g_couple
1182 SUBROUTINE a_couple ( config_flags, mu, a_mu, mub, a_rfield, field, &
1183 a_field, name, msf, &
1184 ids, ide, jds, jde, kds, kde, &
1185 ims, ime, jms, jme, kms, kme, &
1186 its, ite, jts, jte, kts, kte )
1188 !-------------------------------------------------------------------------
1189 ! Derived from dyn_em/module_big_step_utilities_em.F
1190 ! Author: Xin Zhang, 10/2/2010
1191 !-------------------------------------------------------------------------
1196 TYPE(grid_config_rec_type ) , INTENT(IN ) :: config_flags
1198 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
1199 ims, ime, jms, jme, kms, kme, &
1200 its, ite, jts, jte, kts, kte
1202 CHARACTER(LEN=1) , INTENT(IN ) :: name
1204 REAL , DIMENSION( ims:ime , jms:jme , kms:kme ) , INTENT(INOUT) :: a_rfield
1206 REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(IN ) :: mu, mub, msf
1207 REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(INOUT) :: a_mu
1209 REAL , DIMENSION( ims:ime , jms:jme , kms:kme ) , INTENT(IN ) :: field
1210 REAL , DIMENSION( ims:ime , jms:jme , kms:kme ) , INTENT(INOUT) :: a_field
1214 INTEGER :: i, j, k, itf, jtf, ktf
1215 REAL , DIMENSION(ims:ime,jms:jme) :: muu , muv
1216 REAL , DIMENSION(ims:ime,jms:jme) :: a_muu , a_muv
1220 ! subroutine couple couples the input variable with the dry-air
1227 IF (name .EQ. 'u')THEN
1234 CALL calc_mu_uv ( config_flags, &
1235 mu, mub, muu, muv, &
1236 ids, ide, jds, jde, kds, kde, &
1237 ims, ime, jms, jme, kms, kme, &
1238 its, ite, jts, jte, kts, kte )
1246 a_field(i,j,k)=a_field(i,j,k) + a_rfield(i,j,k)*muu(i,j)/msf(i,j)
1247 a_muu(i,j)=a_muu(i,j) + a_rfield(i,j,k)*field(i,j,k)/msf(i,j)
1248 a_rfield(i,j,k) = 0.0
1253 CALL a_calc_mu_uv ( config_flags, &
1254 a_mu, a_muu, a_muv, &
1255 ids, ide, jds, jde, kds, kde, &
1256 ims, ime, jms, jme, kms, kme, &
1257 its, ite, jts, jte, kts, kte )
1259 ELSE IF (name .EQ. 'v')THEN
1266 CALL calc_mu_uv ( config_flags, &
1267 mu, mub, muu, muv, &
1268 ids, ide, jds, jde, kds, kde, &
1269 ims, ime, jms, jme, kms, kme, &
1270 its, ite, jts, jte, kts, kte )
1279 a_field(i,j,k)=a_field(i,j,k) + a_rfield(i,j,k)*muv(i,j)/msf(i,j)
1280 a_muv(i,j)=a_muv(i,j) + a_rfield(i,j,k)*field(i,j,k)/msf(i,j)
1281 a_rfield(i,j,k) = 0.0
1286 CALL a_calc_mu_uv ( config_flags, &
1287 a_mu, a_muu, a_muv, &
1288 ids, ide, jds, jde, kds, kde, &
1289 ims, ime, jms, jme, kms, kme, &
1290 its, ite, jts, jte, kts, kte )
1292 ELSE IF (name .EQ. 'w')THEN
1298 a_field(i,j,k)=a_field(i,j,k) + a_rfield(i,j,k)*(mu(i,j)+mub(i,j))/msf(i,j)
1299 a_mu(i,j)=a_mu(i,j) + a_rfield(i,j,k)*field(i,j,k)/msf(i,j)
1300 a_rfield(i,j,k) = 0.0
1305 ELSE IF (name .EQ. 'h')THEN
1311 a_field(i,j,k)=a_field(i,j,k) + a_rfield(i,j,k)*(mu(i,j)+mub(i,j))
1312 a_mu(i,j)=a_mu(i,j) + a_rfield(i,j,k)*field(i,j,k)
1313 a_rfield(i,j,k) = 0.0
1324 a_field(i,j,k)=a_field(i,j,k) + a_rfield(i,j,k)*(mu(i,j)+mub(i,j))
1325 a_mu(i,j)=a_mu(i,j) + a_rfield(i,j,k)*field(i,j,k)
1326 a_rfield(i,j,k) = 0.0
1333 END SUBROUTINE a_couple
1335 SUBROUTINE da_calc_2nd_fg ( data3d , space_bdy_xs, space_bdy_xe, space_bdy_ys, space_bdy_ye, &
1336 space_bdy_txs, space_bdy_txe, space_bdy_tys, space_bdy_tye, &
1337 time_diff, char_stagger , &
1339 ids, ide, jds, jde, kds, kde , &
1340 ims, ime, jms, jme, kms, kme , &
1341 its, ite, jts, jte, kts, kte )
1343 !-------------------------------------------------------------------------
1344 ! Calculate the first guess at the end of thr time window
1345 ! Author: Xin Zhang, 10/7/2010
1346 !-------------------------------------------------------------------------
1350 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
1351 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
1352 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
1353 INTEGER , INTENT(IN) :: spec_bdy_width
1354 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(INOUT) :: data3d
1355 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(IN) :: space_bdy_xs, space_bdy_xe
1356 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(IN) :: space_bdy_ys, space_bdy_ye
1357 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(IN) :: space_bdy_txs, space_bdy_txe
1358 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(IN) :: space_bdy_tys, space_bdy_tye
1359 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
1360 REAL , INTENT(IN) :: time_diff
1362 INTEGER :: i , ii , j , jj , k
1364 ! There are four lateral boundary locations that are stored.
1368 IF ( char_stagger .EQ. 'W' ) THEN
1370 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1371 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1372 data3d(i,j,k) = space_bdy_xs(j,k,i) + time_diff * space_bdy_txs(j,k,i)
1376 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1378 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1379 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1380 data3d(i,j,k) = space_bdy_xs(j,k,i) + time_diff * space_bdy_txs(j,k,i)
1384 ELSE IF ( char_stagger .EQ. 'V' ) THEN
1385 DO k = kds , kde - 1
1386 DO j = MAX(jds,jts) , MIN(jde,jte)
1387 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1388 data3d(i,j,k) = space_bdy_xs(j,k,i) + time_diff * space_bdy_txs(j,k,i)
1393 DO k = kds , kde - 1
1394 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1395 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1396 data3d(i,j,k) = space_bdy_xs(j,k,i) + time_diff * space_bdy_txs(j,k,i)
1404 IF ( char_stagger .EQ. 'U' ) THEN
1405 DO k = kds , kde - 1
1406 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1407 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
1409 data3d(i,j,k) = space_bdy_xe(j,k,ii) + time_diff * space_bdy_txe(j,k,ii)
1413 ELSE IF ( char_stagger .EQ. 'V' ) THEN
1414 DO k = kds , kde - 1
1415 DO j = MAX(jds,jts) , MIN(jde,jte)
1416 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1418 data3d(i,j,k) = space_bdy_xe(j,k,ii) + time_diff * space_bdy_txe(j,k,ii)
1422 ELSE IF ( char_stagger .EQ. 'W' ) THEN
1424 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1425 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1427 data3d(i,j,k) = space_bdy_xe(j,k,ii) + time_diff * space_bdy_txe(j,k,ii)
1431 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1433 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1434 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1436 data3d(i,j,k) = space_bdy_xe(j,k,ii) + time_diff * space_bdy_txe(j,k,ii)
1441 DO k = kds , kde - 1
1442 DO j = MAX(jds,jts) , MIN(jde-1,jte)
1443 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1445 data3d(i,j,k) = space_bdy_xe(j,k,ii) + time_diff * space_bdy_txe(j,k,ii)
1453 IF ( char_stagger .EQ. 'W' ) THEN
1455 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1456 DO i = MAX(ids,its) , MIN(ide-1,ite)
1457 data3d(i,j,k) = space_bdy_ys(i,k,j) + time_diff * space_bdy_tys(i,k,j)
1461 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1463 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1464 DO i = MAX(ids,its) , MIN(ide-1,ite)
1465 data3d(i,j,k) = space_bdy_ys(i,k,j) + time_diff * space_bdy_tys(i,k,j)
1469 ELSE IF ( char_stagger .EQ. 'U' ) THEN
1470 DO k = kds , kde - 1
1471 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1472 DO i = MAX(ids,its) , MIN(ide,ite)
1473 data3d(i,j,k) = space_bdy_ys(i,k,j) + time_diff * space_bdy_tys(i,k,j)
1478 DO k = kds , kde - 1
1479 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1480 DO i = MAX(ids,its) , MIN(ide-1,ite)
1481 data3d(i,j,k) = space_bdy_ys(i,k,j) + time_diff * space_bdy_tys(i,k,j)
1489 IF ( char_stagger .EQ. 'V' ) THEN
1490 DO k = kds , kde - 1
1491 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
1492 DO i = MAX(ids,its) , MIN(ide-1,ite)
1494 data3d(i,j,k) = space_bdy_ye(i,k,jj) + time_diff * space_bdy_tye(i,k,jj)
1498 ELSE IF ( char_stagger .EQ. 'U' ) THEN
1499 DO k = kds , kde - 1
1500 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1501 DO i = MAX(ids,its) , MIN(ide,ite)
1503 data3d(i,j,k) = space_bdy_ye(i,k,jj) + time_diff * space_bdy_tye(i,k,jj)
1507 ELSE IF ( char_stagger .EQ. 'W' ) THEN
1509 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1510 DO i = MAX(ids,its) , MIN(ide-1,ite)
1512 data3d(i,j,k) = space_bdy_ye(i,k,jj) + time_diff * space_bdy_tye(i,k,jj)
1516 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1518 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1519 DO i = MAX(ids,its) , MIN(ide-1,ite)
1521 data3d(i,j,k) = space_bdy_ye(i,k,jj) + time_diff * space_bdy_tye(i,k,jj)
1526 DO k = kds , kde - 1
1527 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1528 DO i = MAX(ids,its) , MIN(ide-1,ite)
1530 data3d(i,j,k) = space_bdy_ye(i,k,jj) + time_diff * space_bdy_tye(i,k,jj)
1536 END SUBROUTINE da_calc_2nd_fg
1538 SUBROUTINE decouple ( mu, mub, field, name, &
1540 ids, ide, jds, jde, kds, kde, &
1541 ims, ime, jms, jme, kms, kme, &
1542 its, ite, jts, jte, kts, kte )
1544 !-------------------------------------------------------------------------
1545 ! Decouple variables
1546 ! Author: Xin Zhang, 10/7/2010
1547 !-------------------------------------------------------------------------
1552 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
1553 ims, ime, jms, jme, kms, kme, &
1554 its, ite, jts, jte, kts, kte
1556 CHARACTER(LEN=1) , INTENT(IN ) :: name
1558 REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(IN ) :: mu, mub, msf
1559 REAL , DIMENSION( ims:ime , jms:jme , kms:kme ) , INTENT(INOUT) :: field
1563 INTEGER :: i, j, k, itf, jtf, ktf
1564 REAL , DIMENSION(ims:ime,jms:jme) :: muu , muv
1568 ! subroutine couple couples the input variable with the dry-air
1576 IF (name .EQ. 'u')THEN
1578 CALL calc_mu_uv ( config_flags, &
1579 mu, mub, muu, muv, &
1580 ids, ide, jds, jde, kds, kde, &
1581 ims, ime, jms, jme, kms, kme, &
1582 its, ite, jts, jte, kts, kte )
1590 field(i,j,k)=field(i,j,k)/muu(i,j)*msf(i,j)
1595 ELSE IF (name .EQ. 'v')THEN
1597 CALL calc_mu_uv ( config_flags, &
1598 mu, mub, muu, muv, &
1599 ids, ide, jds, jde, kds, kde, &
1600 ims, ime, jms, jme, kms, kme, &
1601 its, ite, jts, jte, kts, kte )
1610 field(i,j,k)=field(i,j,k)/muv(i,j)*msf(i,j)
1615 ELSE IF (name .EQ. 'w')THEN
1621 field(i,j,k)=field(i,j,k)/(mu(i,j)+mub(i,j))*msf(i,j)
1626 ELSE IF (name .EQ. 'h')THEN
1632 field(i,j,k)=field(i,j,k)/(mu(i,j)+mub(i,j))
1643 field(i,j,k)=field(i,j,k)/(mu(i,j)+mub(i,j))
1650 END SUBROUTINE decouple
1652 SUBROUTINE da_model_lbc_off
1654 CALL nl_set_io_form_boundary( head_grid%id, 0 )
1656 END SUBROUTINE da_model_lbc_off
1658 SUBROUTINE da_bdy_fields_halo (data3du, data3dv, data3dt, data3dph, data3dmu, &
1659 data3dm, dir, xy, spec_bdy_width, &
1660 u_bxs, u_bxe, u_bys, u_bye, &
1661 v_bxs, v_bxe, v_bys, v_bye, &
1662 t_bxs, t_bxe, t_bys, t_bye, &
1663 ph_bxs, ph_bxe, ph_bys, ph_bye, &
1664 mu_bxs, mu_bxe, mu_bys, mu_bye, &
1665 moist_bxs, moist_bxe, moist_bys, moist_bye, &
1666 ids, ide, jds, jde, kds, kde , &
1667 ims, ime, jms, jme, kms, kme , &
1668 its, ite, jts, jte, kts, kte )
1670 USE module_state_description
1674 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
1675 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
1676 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
1677 INTEGER , INTENT(IN) :: spec_bdy_width
1678 INTEGER , INTENT(IN) :: dir ! 0----pack ; 1----unpack
1679 INTEGER , INTENT(IN) :: xy ! 0----X ; 1----Y
1680 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(INOUT) :: data3du , data3dv, data3dt, &
1682 REAL , DIMENSION(ims:ime,jms:jme) , INTENT(INOUT) :: data3dmu
1683 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(INOUT) :: u_bxs, u_bxe, v_bxs, v_bxe, &
1684 t_bxs, t_bxe, ph_bxs, ph_bxe, &
1685 moist_bxs, moist_bxe
1686 REAL , DIMENSION(jms:jme,1:1,spec_bdy_width) , INTENT(INOUT) :: mu_bxs, mu_bxe
1687 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(INOUT) :: u_bys, u_bye, v_bys, v_bye, &
1688 t_bys, t_bye, ph_bys, ph_bye, &
1689 moist_bys, moist_bye
1690 REAL , DIMENSION(ims:ime,1:1,spec_bdy_width) , INTENT(INOUT) :: mu_bys, mu_bye
1692 CALL da_bdy_fields_pack ( data3du, u_bxs, u_bxe, u_bys, u_bye, &
1693 'U' , dir, xy, spec_bdy_width, &
1694 ids, ide, jds, jde, kds, kde, &
1695 ims, ime, jms, jme, kms, kme, &
1696 its, ite, jts, jte, kts, kte )
1698 CALL da_bdy_fields_pack ( data3dv, v_bxs, v_bxe, v_bys, v_bye, &
1699 'V' , dir, xy, spec_bdy_width, &
1700 ids, ide, jds, jde, kds, kde, &
1701 ims, ime, jms, jme, kms, kme, &
1702 its, ite, jts, jte, kts, kte )
1704 CALL da_bdy_fields_pack ( data3dt , t_bxs, t_bxe, t_bys, t_bye, &
1705 'T' , dir, xy, spec_bdy_width, &
1706 ids, ide, jds, jde, kds, kde, &
1707 ims, ime, jms, jme, kms, kme, &
1708 its, ite, jts, jte, kts, kte )
1710 CALL da_bdy_fields_pack ( data3dph , ph_bxs, ph_bxe, ph_bys, ph_bye, &
1711 'W' , dir, xy, spec_bdy_width, &
1712 ids, ide, jds, jde, kds, kde, &
1713 ims, ime, jms, jme, kms, kme, &
1714 its, ite, jts, jte, kts, kte )
1716 CALL da_bdy_fields_pack ( data3dmu , mu_bxs, mu_bxe, mu_bys, mu_bye, &
1717 'M' , dir, xy, spec_bdy_width , &
1718 ids, ide, jds, jde, 1 , 1 , &
1719 ims, ime, jms, jme, 1 , 1 , &
1720 its, ite, jts, jte, 1 , 1 )
1722 CALL da_bdy_fields_pack ( data3dm , moist_bxs, moist_bxe, moist_bys, moist_bye, &
1723 'T' , dir, xy, spec_bdy_width, &
1724 ids, ide, jds, jde, kds, kde, &
1725 ims, ime, jms, jme, kms, kme, &
1726 its, ite, jts, jte, kts, kte )
1729 END SUBROUTINE da_bdy_fields_halo
1731 SUBROUTINE da_bdy_fields_pack ( data3d , space_bdy_xs, space_bdy_xe, space_bdy_ys, space_bdy_ye, &
1732 char_stagger , dir , xy ,&
1734 ids, ide, jds, jde, kds, kde , &
1735 ims, ime, jms, jme, kms, kme , &
1736 its, ite, jts, jte, kts, kte )
1738 !-------------------------------------------------------------------------
1739 ! Calculate the first guess at the end of thr time window
1740 ! Author: Xin Zhang, 10/7/2010
1741 !-------------------------------------------------------------------------
1745 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde
1746 INTEGER , INTENT(IN) :: ims, ime, jms, jme, kms, kme
1747 INTEGER , INTENT(IN) :: its, ite, jts, jte, kts, kte
1748 INTEGER , INTENT(IN) :: spec_bdy_width
1749 REAL , DIMENSION(ims:ime,jms:jme,kms:kme) , INTENT(INOUT) :: data3d
1750 REAL , DIMENSION(jms:jme,kds:kde,spec_bdy_width) , INTENT(INOUT) :: space_bdy_xs, space_bdy_xe
1751 REAL , DIMENSION(ims:ime,kds:kde,spec_bdy_width) , INTENT(INOUT) :: space_bdy_ys, space_bdy_ye
1752 CHARACTER (LEN=1) , INTENT(IN) :: char_stagger
1753 INTEGER , INTENT(IN) :: dir ! 0----pack ; 1----unpack
1754 INTEGER , INTENT(IN) :: xy ! 0----X ; 1----Y
1756 INTEGER :: i , ii , j , jj , k
1758 ! There are four lateral boundary locations that are stored.
1760 IF (dir == 0 ) THEN ! ----Pack
1761 IF ( xy == 0 ) THEN ! ----X
1765 IF ( char_stagger .EQ. 'W' ) THEN
1768 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1769 data3d(i,j,k) = space_bdy_xs(j,k,i)
1773 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1776 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1777 data3d(i,j,k) = space_bdy_xs(j,k,i)
1781 ELSE IF ( char_stagger .EQ. 'V' ) THEN
1782 DO k = kds , kde - 1
1784 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1785 data3d(i,j,k) = space_bdy_xs(j,k,i)
1790 DO k = kds , kde - 1
1792 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1793 data3d(i,j,k) = space_bdy_xs(j,k,i)
1801 IF ( char_stagger .EQ. 'U' ) THEN
1802 DO k = kds , kde - 1
1804 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
1806 data3d(i,j,k) = space_bdy_xe(j,k,ii)
1810 ELSE IF ( char_stagger .EQ. 'V' ) THEN
1811 DO k = kds , kde - 1
1813 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1815 data3d(i,j,k) = space_bdy_xe(j,k,ii)
1819 ELSE IF ( char_stagger .EQ. 'W' ) THEN
1822 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1824 data3d(i,j,k) = space_bdy_xe(j,k,ii)
1828 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1831 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1833 data3d(i,j,k) = space_bdy_xe(j,k,ii)
1838 DO k = kds , kde - 1
1840 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1842 data3d(i,j,k) = space_bdy_xe(j,k,ii)
1851 IF ( char_stagger .EQ. 'W' ) THEN
1853 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1855 data3d(i,j,k) = space_bdy_ys(i,k,j)
1859 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1861 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1863 data3d(i,j,k) = space_bdy_ys(i,k,j)
1867 ELSE IF ( char_stagger .EQ. 'U' ) THEN
1868 DO k = kds , kde - 1
1869 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1871 data3d(i,j,k) = space_bdy_ys(i,k,j)
1876 DO k = kds , kde - 1
1877 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
1879 data3d(i,j,k) = space_bdy_ys(i,k,j)
1887 IF ( char_stagger .EQ. 'V' ) THEN
1888 DO k = kds , kde - 1
1889 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
1892 data3d(i,j,k) = space_bdy_ye(i,k,jj)
1896 ELSE IF ( char_stagger .EQ. 'U' ) THEN
1897 DO k = kds , kde - 1
1898 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1901 data3d(i,j,k) = space_bdy_ye(i,k,jj)
1905 ELSE IF ( char_stagger .EQ. 'W' ) THEN
1907 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1910 data3d(i,j,k) = space_bdy_ye(i,k,jj)
1914 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1916 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1919 data3d(i,j,k) = space_bdy_ye(i,k,jj)
1924 DO k = kds , kde - 1
1925 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
1928 data3d(i,j,k) = space_bdy_ye(i,k,jj)
1937 IF ( dir == 1 ) THEN ! ---- Unpack
1938 IF ( xy == 0 ) THEN !----- X
1942 IF ( char_stagger .EQ. 'W' ) THEN
1945 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1946 space_bdy_xs(j,k,i) = data3d(i,j,k)
1950 ELSE IF ( char_stagger .EQ. 'M' ) THEN
1953 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1954 space_bdy_xs(j,k,i) = data3d(i,j,k)
1958 ELSE IF ( char_stagger .EQ. 'V' ) THEN
1959 DO k = kds , kde - 1
1961 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1962 space_bdy_xs(j,k,i) = data3d(i,j,k)
1967 DO k = kds , kde - 1
1969 DO i = MAX(ids,its) , MIN(ids + spec_bdy_width - 1,ite)
1970 space_bdy_xs(j,k,i) = data3d(i,j,k)
1978 IF ( char_stagger .EQ. 'U' ) THEN
1979 DO k = kds , kde - 1
1981 DO i = MIN(ide,ite) , MAX(ide - spec_bdy_width + 1,its) , -1
1983 space_bdy_xe(j,k,ii) = data3d(i,j,k)
1987 ELSE IF ( char_stagger .EQ. 'V' ) THEN
1988 DO k = kds , kde - 1
1990 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
1992 space_bdy_xe(j,k,ii) = data3d(i,j,k)
1996 ELSE IF ( char_stagger .EQ. 'W' ) THEN
1999 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
2001 space_bdy_xe(j,k,ii) = data3d(i,j,k)
2005 ELSE IF ( char_stagger .EQ. 'M' ) THEN
2008 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
2010 space_bdy_xe(j,k,ii) = data3d(i,j,k)
2015 DO k = kds , kde - 1
2017 DO i = MIN(ide - 1,ite) , MAX(ide - spec_bdy_width,its) , -1
2019 space_bdy_xe(j,k,ii) = data3d(i,j,k)
2028 IF ( char_stagger .EQ. 'W' ) THEN
2030 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
2032 space_bdy_ys(i,k,j) = data3d(i,j,k)
2036 ELSE IF ( char_stagger .EQ. 'M' ) THEN
2038 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
2040 space_bdy_ys(i,k,j) = data3d(i,j,k)
2044 ELSE IF ( char_stagger .EQ. 'U' ) THEN
2045 DO k = kds , kde - 1
2046 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
2048 space_bdy_ys(i,k,j) = data3d(i,j,k)
2053 DO k = kds , kde - 1
2054 DO j = MAX(jds,jts) , MIN(jds + spec_bdy_width - 1,jte)
2056 space_bdy_ys(i,k,j) = data3d(i,j,k)
2064 IF ( char_stagger .EQ. 'V' ) THEN
2065 DO k = kds , kde - 1
2066 DO j = MIN(jde,jte) , MAX(jde - spec_bdy_width + 1,jts) , -1
2069 space_bdy_ye(i,k,jj) = data3d(i,j,k)
2073 ELSE IF ( char_stagger .EQ. 'U' ) THEN
2074 DO k = kds , kde - 1
2075 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
2078 space_bdy_ye(i,k,jj) = data3d(i,j,k)
2082 ELSE IF ( char_stagger .EQ. 'W' ) THEN
2084 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
2087 space_bdy_ye(i,k,jj) = data3d(i,j,k)
2091 ELSE IF ( char_stagger .EQ. 'M' ) THEN
2093 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
2096 space_bdy_ye(i,k,jj) = data3d(i,j,k)
2101 DO k = kds , kde - 1
2102 DO j = MIN(jde-1,jte) , MAX(jde - spec_bdy_width,jts) , -1
2105 space_bdy_ye(i,k,jj) = data3d(i,j,k)
2114 END SUBROUTINE da_bdy_fields_pack