39 real,
parameter::
r3 = 1./3.
51 real,
parameter::
p1 = 7./12.
52 real,
parameter::
p2 = -1./12.
56 real,
parameter::
a1 = 0.5625
57 real,
parameter::
a2 = -0.0625
60 real,
parameter::
c1 = -2./14.
61 real,
parameter::
c2 = 11./14.
62 real,
parameter::
c3 = 5./14.
69 real,
parameter::
b1 = 1./30.
70 real,
parameter::
b2 = -13./60.
71 real,
parameter::
b3 = -13./60.
72 real,
parameter::
b4 = 0.45
73 real,
parameter::
b5 = -0.05
87 SUBROUTINE c_sw_tlm(delpc, delpc_tl, delp, delp_tl, ptc, ptc_tl, pt, &
88 & pt_tl, u, u_tl, v, v_tl, w, w_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, &
89 & va, va_tl, wc, wc_tl, ut, ut_tl, vt, vt_tl, divg_d, divg_d_tl, nord&
90 & , dt2, hydrostatic, dord4, bd, gridstruct, flagstruct)
93 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: u&
95 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
97 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: v&
99 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: &
101 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: delp&
102 & , pt, ua, va, ut, vt
103 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
104 & delp_tl, pt_tl, ua_tl, va_tl, ut_tl, vt_tl
105 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: w
106 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: w_tl
107 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: delpc&
109 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: &
110 & delpc_tl, ptc_tl, wc_tl
111 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
113 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
115 INTEGER,
INTENT(IN) :: nord
116 REAL,
INTENT(IN) :: dt2
117 LOGICAL,
INTENT(IN) :: hydrostatic
118 LOGICAL,
INTENT(IN) :: dord4
122 LOGICAL :: sw_corner, se_corner, ne_corner, nw_corner
123 REAL,
DIMENSION(bd%is-1:bd%ie+1, bd%js-1:bd%je+1) :: vort, ke
124 REAL,
DIMENSION(bd%is-1:bd%ie+1, bd%js-1:bd%je+1) :: vort_tl, ke_tl
125 REAL,
DIMENSION(bd%is-1:bd%ie+2, bd%js-1:bd%je+1) :: fx, fx1, fx2
126 REAL,
DIMENSION(bd%is-1:bd%ie+2, bd%js-1:bd%je+1) :: fx_tl, fx1_tl, &
128 REAL,
DIMENSION(bd%is-1:bd%ie+1, bd%js-1:bd%je+2) :: fy, fy1, fy2
129 REAL,
DIMENSION(bd%is-1:bd%ie+1, bd%js-1:bd%je+2) :: fy_tl, fy1_tl, &
132 INTEGER :: i, j, is2, ie1
133 INTEGER :: iep1, jep1
134 INTEGER :: is, ie, js, je
135 INTEGER :: isd, ied, jsd, jed
138 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg, cos_sg
139 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v
140 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
141 REAL,
DIMENSION(:, :),
POINTER :: dx, dy, dxc, dyc
152 nested = gridstruct%nested
153 sin_sg => gridstruct%sin_sg
154 cos_sg => gridstruct%cos_sg
155 cosa_u => gridstruct%cosa_u
156 cosa_v => gridstruct%cosa_v
157 sina_u => gridstruct%sina_u
158 sina_v => gridstruct%sina_v
161 dxc => gridstruct%dxc
162 dyc => gridstruct%dyc
163 sw_corner = gridstruct%sw_corner
164 se_corner = gridstruct%se_corner
165 nw_corner = gridstruct%nw_corner
166 ne_corner = gridstruct%ne_corner
170 & uc_tl, vc, vc_tl, ut, ut_tl, vt, vt_tl, dord4, &
171 & gridstruct, bd, npx, npy, nested, flagstruct%grid_type&
173 IF (nord .GT. 0)
THEN 176 & , va_tl, divg_d, divg_d_tl, gridstruct&
180 & va_tl, divg_d, divg_d_tl, gridstruct, &
186 IF (ut(i, j) .GT. 0.)
THEN 187 ut_tl(i, j) = dt2*dy(i, j)*sin_sg(i-1, j, 3)*ut_tl(i, j)
188 ut(i, j) = dt2*ut(i, j)*dy(i, j)*sin_sg(i-1, j, 3)
190 ut_tl(i, j) = dt2*dy(i, j)*sin_sg(i, j, 1)*ut_tl(i, j)
191 ut(i, j) = dt2*ut(i, j)*dy(i, j)*sin_sg(i, j, 1)
197 IF (vt(i, j) .GT. 0.)
THEN 198 vt_tl(i, j) = dt2*dx(i, j)*sin_sg(i, j-1, 4)*vt_tl(i, j)
199 vt(i, j) = dt2*vt(i, j)*dx(i, j)*sin_sg(i, j-1, 4)
201 vt_tl(i, j) = dt2*dx(i, j)*sin_sg(i, j, 2)*vt_tl(i, j)
202 vt(i, j) = dt2*vt(i, j)*dx(i, j)*sin_sg(i, j, 2)
210 IF (flagstruct%grid_type .LT. 3 .AND. (.NOT.nested))
CALL &
212 & sw_corner, se_corner, ne_corner, nw_corner)
213 IF (hydrostatic)
THEN 218 IF (ut(i, j) .GT. 0.)
THEN 219 fx1_tl(i, j) = delp_tl(i-1, j)
220 fx1(i, j) = delp(i-1, j)
221 fx_tl(i, j) = pt_tl(i-1, j)
222 fx(i, j) = pt(i-1, j)
224 fx1_tl(i, j) = delp_tl(i, j)
225 fx1(i, j) = delp(i, j)
226 fx_tl(i, j) = pt_tl(i, j)
229 fx1_tl(i, j) = ut_tl(i, j)*fx1(i, j) + ut(i, j)*fx1_tl(i, j)
230 fx1(i, j) = ut(i, j)*fx1(i, j)
231 fx_tl(i, j) = fx1_tl(i, j)*fx(i, j) + fx1(i, j)*fx_tl(i, j)
232 fx(i, j) = fx1(i, j)*fx(i, j)
237 IF (flagstruct%grid_type .LT. 3)
THEN 239 & se_corner, ne_corner, nw_corner)
250 IF (ut(i, j) .GT. 0.)
THEN 251 fx1_tl(i, j) = delp_tl(i-1, j)
252 fx1(i, j) = delp(i-1, j)
253 fx_tl(i, j) = pt_tl(i-1, j)
254 fx(i, j) = pt(i-1, j)
255 fx2_tl(i, j) = w_tl(i-1, j)
256 fx2(i, j) = w(i-1, j)
258 fx1_tl(i, j) = delp_tl(i, j)
259 fx1(i, j) = delp(i, j)
260 fx_tl(i, j) = pt_tl(i, j)
262 fx2_tl(i, j) = w_tl(i, j)
265 fx1_tl(i, j) = ut_tl(i, j)*fx1(i, j) + ut(i, j)*fx1_tl(i, j)
266 fx1(i, j) = ut(i, j)*fx1(i, j)
267 fx_tl(i, j) = fx1_tl(i, j)*fx(i, j) + fx1(i, j)*fx_tl(i, j)
268 fx(i, j) = fx1(i, j)*fx(i, j)
269 fx2_tl(i, j) = fx1_tl(i, j)*fx2(i, j) + fx1(i, j)*fx2_tl(i, j)
270 fx2(i, j) = fx1(i, j)*fx2(i, j)
275 IF (flagstruct%grid_type .LT. 3 .AND. (.NOT.nested))
CALL &
277 & sw_corner, se_corner, ne_corner, nw_corner)
278 IF (hydrostatic)
THEN 283 IF (vt(i, j) .GT. 0.)
THEN 284 fy1_tl(i, j) = delp_tl(i, j-1)
285 fy1(i, j) = delp(i, j-1)
286 fy_tl(i, j) = pt_tl(i, j-1)
287 fy(i, j) = pt(i, j-1)
289 fy1_tl(i, j) = delp_tl(i, j)
290 fy1(i, j) = delp(i, j)
291 fy_tl(i, j) = pt_tl(i, j)
294 fy1_tl(i, j) = vt_tl(i, j)*fy1(i, j) + vt(i, j)*fy1_tl(i, j)
295 fy1(i, j) = vt(i, j)*fy1(i, j)
296 fy_tl(i, j) = fy1_tl(i, j)*fy(i, j) + fy1(i, j)*fy_tl(i, j)
297 fy(i, j) = fy1(i, j)*fy(i, j)
302 delpc_tl(i, j) = delp_tl(i, j) + gridstruct%rarea(i, j)*(&
303 & fx1_tl(i, j)-fx1_tl(i+1, j)+fy1_tl(i, j)-fy1_tl(i, j+1))
304 delpc(i, j) = delp(i, j) + (fx1(i, j)-fx1(i+1, j)+(fy1(i, j)-&
305 & fy1(i, j+1)))*gridstruct%rarea(i, j)
306 ptc_tl(i, j) = ((pt_tl(i, j)*delp(i, j)+pt(i, j)*delp_tl(i, j)&
307 & +gridstruct%rarea(i, j)*(fx_tl(i, j)-fx_tl(i+1, j)+fy_tl(i, &
308 & j)-fy_tl(i, j+1)))*delpc(i, j)-(pt(i, j)*delp(i, j)+(fx(i, j&
309 & )-fx(i+1, j)+(fy(i, j)-fy(i, j+1)))*gridstruct%rarea(i, j))*&
310 & delpc_tl(i, j))/delpc(i, j)**2
311 ptc(i, j) = (pt(i, j)*delp(i, j)+(fx(i, j)-fx(i+1, j)+(fy(i, j&
312 & )-fy(i, j+1)))*gridstruct%rarea(i, j))/delpc(i, j)
316 IF (flagstruct%grid_type .LT. 3)
THEN 318 & se_corner, ne_corner, nw_corner)
329 IF (vt(i, j) .GT. 0.)
THEN 330 fy1_tl(i, j) = delp_tl(i, j-1)
331 fy1(i, j) = delp(i, j-1)
332 fy_tl(i, j) = pt_tl(i, j-1)
333 fy(i, j) = pt(i, j-1)
334 fy2_tl(i, j) = w_tl(i, j-1)
335 fy2(i, j) = w(i, j-1)
337 fy1_tl(i, j) = delp_tl(i, j)
338 fy1(i, j) = delp(i, j)
339 fy_tl(i, j) = pt_tl(i, j)
341 fy2_tl(i, j) = w_tl(i, j)
344 fy1_tl(i, j) = vt_tl(i, j)*fy1(i, j) + vt(i, j)*fy1_tl(i, j)
345 fy1(i, j) = vt(i, j)*fy1(i, j)
346 fy_tl(i, j) = fy1_tl(i, j)*fy(i, j) + fy1(i, j)*fy_tl(i, j)
347 fy(i, j) = fy1(i, j)*fy(i, j)
348 fy2_tl(i, j) = fy1_tl(i, j)*fy2(i, j) + fy1(i, j)*fy2_tl(i, j)
349 fy2(i, j) = fy1(i, j)*fy2(i, j)
354 delpc_tl(i, j) = delp_tl(i, j) + gridstruct%rarea(i, j)*(&
355 & fx1_tl(i, j)-fx1_tl(i+1, j)+fy1_tl(i, j)-fy1_tl(i, j+1))
356 delpc(i, j) = delp(i, j) + (fx1(i, j)-fx1(i+1, j)+(fy1(i, j)-&
357 & fy1(i, j+1)))*gridstruct%rarea(i, j)
358 ptc_tl(i, j) = ((pt_tl(i, j)*delp(i, j)+pt(i, j)*delp_tl(i, j)&
359 & +gridstruct%rarea(i, j)*(fx_tl(i, j)-fx_tl(i+1, j)+fy_tl(i, &
360 & j)-fy_tl(i, j+1)))*delpc(i, j)-(pt(i, j)*delp(i, j)+(fx(i, j&
361 & )-fx(i+1, j)+(fy(i, j)-fy(i, j+1)))*gridstruct%rarea(i, j))*&
362 & delpc_tl(i, j))/delpc(i, j)**2
363 ptc(i, j) = (pt(i, j)*delp(i, j)+(fx(i, j)-fx(i+1, j)+(fy(i, j&
364 & )-fy(i, j+1)))*gridstruct%rarea(i, j))/delpc(i, j)
365 wc_tl(i, j) = ((w_tl(i, j)*delp(i, j)+w(i, j)*delp_tl(i, j)+&
366 & gridstruct%rarea(i, j)*(fx2_tl(i, j)-fx2_tl(i+1, j)+fy2_tl(i&
367 & , j)-fy2_tl(i, j+1)))*delpc(i, j)-(w(i, j)*delp(i, j)+(fx2(i&
368 & , j)-fx2(i+1, j)+(fy2(i, j)-fy2(i, j+1)))*gridstruct%rarea(i&
369 & , j))*delpc_tl(i, j))/delpc(i, j)**2
370 wc(i, j) = (w(i, j)*delp(i, j)+(fx2(i, j)-fx2(i+1, j)+(fy2(i, &
371 & j)-fy2(i, j+1)))*gridstruct%rarea(i, j))/delpc(i, j)
384 IF (nested .OR. flagstruct%grid_type .GE. 3)
THEN 388 IF (ua(i, j) .GT. 0.)
THEN 389 ke_tl(i, j) = uc_tl(i, j)
392 ke_tl(i, j) = uc_tl(i+1, j)
393 ke(i, j) = uc(i+1, j)
400 IF (va(i, j) .GT. 0.)
THEN 401 vort_tl(i, j) = vc_tl(i, j)
402 vort(i, j) = vc(i, j)
404 vort_tl(i, j) = vc_tl(i, j+1)
405 vort(i, j) = vc(i, j+1)
413 IF (ua(i, j) .GT. 0.)
THEN 415 ke_tl(1, j) = sin_sg(1, j, 1)*uc_tl(1, j) + cos_sg(1, j, 1&
417 ke(1, j) = uc(1, j)*sin_sg(1, j, 1) + v(1, j)*cos_sg(1, j&
419 ELSE IF (i .EQ. npx)
THEN 420 ke_tl(i, j) = sin_sg(npx, j, 1)*uc_tl(npx, j) + cos_sg(npx&
421 & , j, 1)*v_tl(npx, j)
422 ke(i, j) = uc(npx, j)*sin_sg(npx, j, 1) + v(npx, j)*cos_sg&
425 ke_tl(i, j) = uc_tl(i, j)
428 ELSE IF (i .EQ. 0)
THEN 429 ke_tl(0, j) = sin_sg(0, j, 3)*uc_tl(1, j) + cos_sg(0, j, 3)*&
431 ke(0, j) = uc(1, j)*sin_sg(0, j, 3) + v(1, j)*cos_sg(0, j, 3&
433 ELSE IF (i .EQ. npx - 1)
THEN 434 ke_tl(i, j) = sin_sg(npx-1, j, 3)*uc_tl(npx, j) + cos_sg(npx&
435 & -1, j, 3)*v_tl(npx, j)
436 ke(i, j) = uc(npx, j)*sin_sg(npx-1, j, 3) + v(npx, j)*cos_sg&
439 ke_tl(i, j) = uc_tl(i+1, j)
440 ke(i, j) = uc(i+1, j)
447 IF (va(i, j) .GT. 0.)
THEN 449 vort_tl(i, 1) = sin_sg(i, 1, 2)*vc_tl(i, 1) + cos_sg(i, 1&
451 vort(i, 1) = vc(i, 1)*sin_sg(i, 1, 2) + u(i, 1)*cos_sg(i, &
453 ELSE IF (j .EQ. npy)
THEN 454 vort_tl(i, j) = sin_sg(i, npy, 2)*vc_tl(i, npy) + cos_sg(i&
455 & , npy, 2)*u_tl(i, npy)
456 vort(i, j) = vc(i, npy)*sin_sg(i, npy, 2) + u(i, npy)*&
459 vort_tl(i, j) = vc_tl(i, j)
460 vort(i, j) = vc(i, j)
462 ELSE IF (j .EQ. 0)
THEN 463 vort_tl(i, 0) = sin_sg(i, 0, 4)*vc_tl(i, 1) + cos_sg(i, 0, 4&
465 vort(i, 0) = vc(i, 1)*sin_sg(i, 0, 4) + u(i, 1)*cos_sg(i, 0&
467 ELSE IF (j .EQ. npy - 1)
THEN 468 vort_tl(i, j) = sin_sg(i, npy-1, 4)*vc_tl(i, npy) + cos_sg(i&
469 & , npy-1, 4)*u_tl(i, npy)
470 vort(i, j) = vc(i, npy)*sin_sg(i, npy-1, 4) + u(i, npy)*&
471 & cos_sg(i, npy-1, 4)
473 vort_tl(i, j) = vc_tl(i, j+1)
474 vort(i, j) = vc(i, j+1)
482 ke_tl(i, j) = dt4*(ua_tl(i, j)*ke(i, j)+ua(i, j)*ke_tl(i, j)+&
483 & va_tl(i, j)*vort(i, j)+va(i, j)*vort_tl(i, j))
484 ke(i, j) = dt4*(ua(i, j)*ke(i, j)+va(i, j)*vort(i, j))
493 fx_tl(i, j) = dxc(i, j)*uc_tl(i, j)
494 fx(i, j) = uc(i, j)*dxc(i, j)
499 fy_tl(i, j) = dyc(i, j)*vc_tl(i, j)
500 fy(i, j) = vc(i, j)*dyc(i, j)
505 vort_tl(i, j) = fx_tl(i, j-1) - fx_tl(i, j) + fy_tl(i, j) - &
507 vort(i, j) = fx(i, j-1) - fx(i, j) + (fy(i, j)-fy(i-1, j))
512 vort_tl(1, 1) = vort_tl(1, 1) + fy_tl(0, 1)
513 vort(1, 1) = vort(1, 1) + fy(0, 1)
516 vort_tl(npx, 1) = vort_tl(npx, 1) - fy_tl(npx, 1)
517 vort(npx, 1) = vort(npx, 1) - fy(npx, 1)
520 vort_tl(npx, npy) = vort_tl(npx, npy) - fy_tl(npx, npy)
521 vort(npx, npy) = vort(npx, npy) - fy(npx, npy)
524 vort_tl(1, npy) = vort_tl(1, npy) + fy_tl(0, npy)
525 vort(1, npy) = vort(1, npy) + fy(0, npy)
532 vort_tl(i, j) = gridstruct%rarea_c(i, j)*vort_tl(i, j)
533 vort(i, j) = gridstruct%fc(i, j) + gridstruct%rarea_c(i, j)*vort&
545 IF (nested .OR. flagstruct%grid_type .GE. 3)
THEN 548 fy1_tl(i, j) = dt2*(v_tl(i, j)-cosa_u(i, j)*uc_tl(i, j))/&
550 fy1(i, j) = dt2*(v(i, j)-uc(i, j)*cosa_u(i, j))/sina_u(i, j)
551 IF (fy1(i, j) .GT. 0.)
THEN 552 fy_tl(i, j) = vort_tl(i, j)
553 fy(i, j) = vort(i, j)
555 fy_tl(i, j) = vort_tl(i, j+1)
556 fy(i, j) = vort(i, j+1)
562 fx1_tl(i, j) = dt2*(u_tl(i, j)-cosa_v(i, j)*vc_tl(i, j))/&
564 fx1(i, j) = dt2*(u(i, j)-vc(i, j)*cosa_v(i, j))/sina_v(i, j)
565 IF (fx1(i, j) .GT. 0.)
THEN 566 fx_tl(i, j) = vort_tl(i, j)
567 fx(i, j) = vort(i, j)
569 fx_tl(i, j) = vort_tl(i+1, j)
570 fx(i, j) = vort(i+1, j)
578 IF (i .EQ. 1 .OR. i .EQ. npx)
THEN 579 fy1_tl(i, j) = dt2*v_tl(i, j)
580 fy1(i, j) = dt2*v(i, j)
582 fy1_tl(i, j) = dt2*(v_tl(i, j)-cosa_u(i, j)*uc_tl(i, j))/&
584 fy1(i, j) = dt2*(v(i, j)-uc(i, j)*cosa_u(i, j))/sina_u(i, j)
586 IF (fy1(i, j) .GT. 0.)
THEN 587 fy_tl(i, j) = vort_tl(i, j)
588 fy(i, j) = vort(i, j)
590 fy_tl(i, j) = vort_tl(i, j+1)
591 fy(i, j) = vort(i, j+1)
596 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 599 fx1_tl(i, j) = dt2*u_tl(i, j)
600 fx1(i, j) = dt2*u(i, j)
601 IF (fx1(i, j) .GT. 0.)
THEN 602 fx_tl(i, j) = vort_tl(i, j)
603 fx(i, j) = vort(i, j)
605 fx_tl(i, j) = vort_tl(i+1, j)
606 fx(i, j) = vort(i+1, j)
612 fx1_tl(i, j) = dt2*(u_tl(i, j)-cosa_v(i, j)*vc_tl(i, j))/&
614 fx1(i, j) = dt2*(u(i, j)-vc(i, j)*cosa_v(i, j))/sina_v(i, j)
615 IF (fx1(i, j) .GT. 0.)
THEN 616 fx_tl(i, j) = vort_tl(i, j)
617 fx(i, j) = vort(i, j)
619 fx_tl(i, j) = vort_tl(i+1, j)
620 fx(i, j) = vort(i+1, j)
629 uc_tl(i, j) = uc_tl(i, j) + fy1_tl(i, j)*fy(i, j) + fy1(i, j)*&
630 & fy_tl(i, j) + gridstruct%rdxc(i, j)*(ke_tl(i-1, j)-ke_tl(i, j)&
632 uc(i, j) = uc(i, j) + fy1(i, j)*fy(i, j) + gridstruct%rdxc(i, j)&
633 & *(ke(i-1, j)-ke(i, j))
638 vc_tl(i, j) = vc_tl(i, j) - fx1_tl(i, j)*fx(i, j) - fx1(i, j)*&
639 & fx_tl(i, j) + gridstruct%rdyc(i, j)*(ke_tl(i, j-1)-ke_tl(i, j)&
641 vc(i, j) = vc(i, j) - fx1(i, j)*fx(i, j) + gridstruct%rdyc(i, j)&
642 & *(ke(i, j-1)-ke(i, j))
646 SUBROUTINE c_sw(delpc, delp, ptc, pt, u, v, w, uc, vc, ua, va, wc, ut&
647 & , vt, divg_d, nord, dt2, hydrostatic, dord4, bd, gridstruct, &
651 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: u&
653 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: v&
655 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: delp&
656 & , pt, ua, va, ut, vt
657 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: w
658 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: delpc&
660 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
662 INTEGER,
INTENT(IN) :: nord
663 REAL,
INTENT(IN) :: dt2
664 LOGICAL,
INTENT(IN) :: hydrostatic
665 LOGICAL,
INTENT(IN) :: dord4
669 LOGICAL :: sw_corner, se_corner, ne_corner, nw_corner
670 REAL,
DIMENSION(bd%is-1:bd%ie+1, bd%js-1:bd%je+1) :: vort, ke
671 REAL,
DIMENSION(bd%is-1:bd%ie+2, bd%js-1:bd%je+1) :: fx, fx1, fx2
672 REAL,
DIMENSION(bd%is-1:bd%ie+1, bd%js-1:bd%je+2) :: fy, fy1, fy2
674 INTEGER :: i, j, is2, ie1
675 INTEGER :: iep1, jep1
676 INTEGER :: is, ie, js, je
677 INTEGER :: isd, ied, jsd, jed
680 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg, cos_sg
681 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v
682 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
683 REAL,
DIMENSION(:, :),
POINTER :: dx, dy, dxc, dyc
694 nested = gridstruct%nested
695 sin_sg => gridstruct%sin_sg
696 cos_sg => gridstruct%cos_sg
697 cosa_u => gridstruct%cosa_u
698 cosa_v => gridstruct%cosa_v
699 sina_u => gridstruct%sina_u
700 sina_v => gridstruct%sina_v
703 dxc => gridstruct%dxc
704 dyc => gridstruct%dyc
705 sw_corner = gridstruct%sw_corner
706 se_corner = gridstruct%se_corner
707 nw_corner = gridstruct%nw_corner
708 ne_corner = gridstruct%ne_corner
711 CALL d2a2c_vect(u, v, ua, va, uc, vc, ut, vt, dord4, gridstruct, bd&
712 & , npx, npy, nested, flagstruct%grid_type)
713 IF (nord .GT. 0)
THEN 724 IF (ut(i, j) .GT. 0.)
THEN 725 ut(i, j) = dt2*ut(i, j)*dy(i, j)*sin_sg(i-1, j, 3)
727 ut(i, j) = dt2*ut(i, j)*dy(i, j)*sin_sg(i, j, 1)
733 IF (vt(i, j) .GT. 0.)
THEN 734 vt(i, j) = dt2*vt(i, j)*dx(i, j)*sin_sg(i, j-1, 4)
736 vt(i, j) = dt2*vt(i, j)*dx(i, j)*sin_sg(i, j, 2)
744 IF (flagstruct%grid_type .LT. 3 .AND. (.NOT.nested))
CALL &
745 &
fill2_4corners(delp, pt, 1, bd, npx, npy, sw_corner, se_corner, &
746 & ne_corner, nw_corner)
747 IF (hydrostatic)
THEN 750 IF (ut(i, j) .GT. 0.)
THEN 751 fx1(i, j) = delp(i-1, j)
752 fx(i, j) = pt(i-1, j)
754 fx1(i, j) = delp(i, j)
757 fx1(i, j) = ut(i, j)*fx1(i, j)
758 fx(i, j) = fx1(i, j)*fx(i, j)
762 IF (flagstruct%grid_type .LT. 3)
CALL fill_4corners(w, 1, bd, npx&
763 & , npy, sw_corner, &
764 & se_corner, ne_corner&
768 IF (ut(i, j) .GT. 0.)
THEN 769 fx1(i, j) = delp(i-1, j)
770 fx(i, j) = pt(i-1, j)
771 fx2(i, j) = w(i-1, j)
773 fx1(i, j) = delp(i, j)
777 fx1(i, j) = ut(i, j)*fx1(i, j)
778 fx(i, j) = fx1(i, j)*fx(i, j)
779 fx2(i, j) = fx1(i, j)*fx2(i, j)
784 IF (flagstruct%grid_type .LT. 3 .AND. (.NOT.nested))
CALL &
785 &
fill2_4corners(delp, pt, 2, bd, npx, npy, sw_corner, se_corner, &
786 & ne_corner, nw_corner)
787 IF (hydrostatic)
THEN 790 IF (vt(i, j) .GT. 0.)
THEN 791 fy1(i, j) = delp(i, j-1)
792 fy(i, j) = pt(i, j-1)
794 fy1(i, j) = delp(i, j)
797 fy1(i, j) = vt(i, j)*fy1(i, j)
798 fy(i, j) = fy1(i, j)*fy(i, j)
803 delpc(i, j) = delp(i, j) + (fx1(i, j)-fx1(i+1, j)+(fy1(i, j)-&
804 & fy1(i, j+1)))*gridstruct%rarea(i, j)
805 ptc(i, j) = (pt(i, j)*delp(i, j)+(fx(i, j)-fx(i+1, j)+(fy(i, j&
806 & )-fy(i, j+1)))*gridstruct%rarea(i, j))/delpc(i, j)
810 IF (flagstruct%grid_type .LT. 3)
CALL fill_4corners(w, 2, bd, npx&
811 & , npy, sw_corner, &
812 & se_corner, ne_corner&
816 IF (vt(i, j) .GT. 0.)
THEN 817 fy1(i, j) = delp(i, j-1)
818 fy(i, j) = pt(i, j-1)
819 fy2(i, j) = w(i, j-1)
821 fy1(i, j) = delp(i, j)
825 fy1(i, j) = vt(i, j)*fy1(i, j)
826 fy(i, j) = fy1(i, j)*fy(i, j)
827 fy2(i, j) = fy1(i, j)*fy2(i, j)
832 delpc(i, j) = delp(i, j) + (fx1(i, j)-fx1(i+1, j)+(fy1(i, j)-&
833 & fy1(i, j+1)))*gridstruct%rarea(i, j)
834 ptc(i, j) = (pt(i, j)*delp(i, j)+(fx(i, j)-fx(i+1, j)+(fy(i, j&
835 & )-fy(i, j+1)))*gridstruct%rarea(i, j))/delpc(i, j)
836 wc(i, j) = (w(i, j)*delp(i, j)+(fx2(i, j)-fx2(i+1, j)+(fy2(i, &
837 & j)-fy2(i, j+1)))*gridstruct%rarea(i, j))/delpc(i, j)
850 IF (nested .OR. flagstruct%grid_type .GE. 3)
THEN 853 IF (ua(i, j) .GT. 0.)
THEN 856 ke(i, j) = uc(i+1, j)
862 IF (va(i, j) .GT. 0.)
THEN 863 vort(i, j) = vc(i, j)
865 vort(i, j) = vc(i, j+1)
872 IF (ua(i, j) .GT. 0.)
THEN 874 ke(1, j) = uc(1, j)*sin_sg(1, j, 1) + v(1, j)*cos_sg(1, j&
876 ELSE IF (i .EQ. npx)
THEN 877 ke(i, j) = uc(npx, j)*sin_sg(npx, j, 1) + v(npx, j)*cos_sg&
882 ELSE IF (i .EQ. 0)
THEN 883 ke(0, j) = uc(1, j)*sin_sg(0, j, 3) + v(1, j)*cos_sg(0, j, 3&
885 ELSE IF (i .EQ. npx - 1)
THEN 886 ke(i, j) = uc(npx, j)*sin_sg(npx-1, j, 3) + v(npx, j)*cos_sg&
889 ke(i, j) = uc(i+1, j)
895 IF (va(i, j) .GT. 0.)
THEN 897 vort(i, 1) = vc(i, 1)*sin_sg(i, 1, 2) + u(i, 1)*cos_sg(i, &
899 ELSE IF (j .EQ. npy)
THEN 900 vort(i, j) = vc(i, npy)*sin_sg(i, npy, 2) + u(i, npy)*&
903 vort(i, j) = vc(i, j)
905 ELSE IF (j .EQ. 0)
THEN 906 vort(i, 0) = vc(i, 1)*sin_sg(i, 0, 4) + u(i, 1)*cos_sg(i, 0&
908 ELSE IF (j .EQ. npy - 1)
THEN 909 vort(i, j) = vc(i, npy)*sin_sg(i, npy-1, 4) + u(i, npy)*&
910 & cos_sg(i, npy-1, 4)
912 vort(i, j) = vc(i, j+1)
920 ke(i, j) = dt4*(ua(i, j)*ke(i, j)+va(i, j)*vort(i, j))
929 fx(i, j) = uc(i, j)*dxc(i, j)
934 fy(i, j) = vc(i, j)*dyc(i, j)
939 vort(i, j) = fx(i, j-1) - fx(i, j) + (fy(i, j)-fy(i-1, j))
943 IF (sw_corner) vort(1, 1) = vort(1, 1) + fy(0, 1)
944 IF (se_corner) vort(npx, 1) = vort(npx, 1) - fy(npx, 1)
945 IF (ne_corner) vort(npx, npy) = vort(npx, npy) - fy(npx, npy)
946 IF (nw_corner) vort(1, npy) = vort(1, npy) + fy(0, npy)
952 vort(i, j) = gridstruct%fc(i, j) + gridstruct%rarea_c(i, j)*vort&
964 IF (nested .OR. flagstruct%grid_type .GE. 3)
THEN 967 fy1(i, j) = dt2*(v(i, j)-uc(i, j)*cosa_u(i, j))/sina_u(i, j)
968 IF (fy1(i, j) .GT. 0.)
THEN 969 fy(i, j) = vort(i, j)
971 fy(i, j) = vort(i, j+1)
977 fx1(i, j) = dt2*(u(i, j)-vc(i, j)*cosa_v(i, j))/sina_v(i, j)
978 IF (fx1(i, j) .GT. 0.)
THEN 979 fx(i, j) = vort(i, j)
981 fx(i, j) = vort(i+1, j)
989 IF (i .EQ. 1 .OR. i .EQ. npx)
THEN 990 fy1(i, j) = dt2*v(i, j)
992 fy1(i, j) = dt2*(v(i, j)-uc(i, j)*cosa_u(i, j))/sina_u(i, j)
994 IF (fy1(i, j) .GT. 0.)
THEN 995 fy(i, j) = vort(i, j)
997 fy(i, j) = vort(i, j+1)
1002 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 1005 fx1(i, j) = dt2*u(i, j)
1006 IF (fx1(i, j) .GT. 0.)
THEN 1007 fx(i, j) = vort(i, j)
1009 fx(i, j) = vort(i+1, j)
1015 fx1(i, j) = dt2*(u(i, j)-vc(i, j)*cosa_v(i, j))/sina_v(i, j)
1016 IF (fx1(i, j) .GT. 0.)
THEN 1017 fx(i, j) = vort(i, j)
1019 fx(i, j) = vort(i+1, j)
1028 uc(i, j) = uc(i, j) + fy1(i, j)*fy(i, j) + gridstruct%rdxc(i, j)&
1029 & *(ke(i-1, j)-ke(i, j))
1034 vc(i, j) = vc(i, j) - fx1(i, j)*fx(i, j) + gridstruct%rdyc(i, j)&
1035 & *(ke(i, j-1)-ke(i, j))
1047 SUBROUTINE d_sw_tlm(delpc, delpc_tl, delp, delp_tl, ptc, ptc_tl, pt, &
1048 & pt_tl, u, u_tl, v, v_tl, w, w_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, &
1049 & va, va_tl, divg_d, divg_d_tl, xflux, xflux_tl, yflux, yflux_tl, cx, &
1050 & cx_tl, cy, cy_tl, crx_adv, crx_adv_tl, cry_adv, cry_adv_tl, xfx_adv&
1051 & , xfx_adv_tl, yfx_adv, yfx_adv_tl, q_con, z_rat, z_rat_tl, kgb, &
1052 & heat_source, heat_source_tl, dpx, dpx_tl, zvir, sphum, nq, q, q_tl, &
1053 & k, km, inline_q, dt, hord_tr, hord_mt, hord_vt, hord_tm, hord_dp, &
1054 & nord, nord_v, nord_w, nord_t, dddmp, d2_bg, d4_bg, damp_v, damp_w, &
1055 & damp_t, d_con, hydrostatic, gridstruct, flagstruct, bd, hord_tr_pert&
1056 & , hord_mt_pert, hord_vt_pert, hord_tm_pert, hord_dp_pert, split_damp&
1057 & , nord_pert, nord_v_pert, nord_w_pert, nord_t_pert, dddmp_pert, &
1058 & d2_bg_pert, d4_bg_pert, damp_v_pert, damp_w_pert, damp_t_pert)
1060 INTEGER,
INTENT(IN) :: hord_tr, hord_mt, hord_vt, hord_tm, hord_dp
1062 INTEGER,
INTENT(IN) :: nord
1064 INTEGER,
INTENT(IN) :: nord_v
1066 INTEGER,
INTENT(IN) :: nord_w
1068 INTEGER,
INTENT(IN) :: nord_t
1069 INTEGER,
INTENT(IN) :: sphum, nq, k, km
1070 REAL,
INTENT(IN) :: dt, dddmp, d2_bg, d4_bg, d_con
1071 REAL,
INTENT(IN) :: zvir
1072 REAL,
INTENT(IN) :: damp_v, damp_w, damp_t, kgb
1074 INTEGER,
INTENT(IN) :: hord_tr_pert, hord_mt_pert, hord_vt_pert, &
1075 & hord_tm_pert, hord_dp_pert, nord_pert, nord_v_pert, nord_w_pert, &
1077 LOGICAL,
INTENT(IN) :: split_damp
1078 REAL,
INTENT(IN) :: dddmp_pert, d2_bg_pert, d4_bg_pert, damp_v_pert&
1079 & , damp_w_pert, damp_t_pert
1081 REAL,
INTENT(INOUT) :: divg_d(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
1082 REAL,
INTENT(INOUT) :: divg_d_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
1083 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: z_rat
1084 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: &
1086 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: delp&
1088 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
1089 & delp_tl, pt_tl, ua_tl, va_tl
1090 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: w
1091 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: w_tl
1092 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
1094 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: u&
1096 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
1098 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: v&
1100 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: &
1102 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed, km, nq)
1103 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed, km, nq)
1104 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: delpc&
1106 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: &
1108 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je),
INTENT(OUT) :: &
1110 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je),
INTENT(OUT) :: &
1112 REAL(kind=8),
DIMENSION(bd%is:bd%ie, bd%js:bd%je),
INTENT(INOUT) :: &
1114 REAL(kind=8),
DIMENSION(bd%is:bd%ie, bd%js:bd%je),
INTENT(INOUT) :: &
1117 REAL,
INTENT(INOUT) :: xflux(bd%is:bd%ie+1, bd%js:bd%je)
1118 REAL,
INTENT(INOUT) :: xflux_tl(bd%is:bd%ie+1, bd%js:bd%je)
1119 REAL,
INTENT(INOUT) :: yflux(bd%is:bd%ie, bd%js:bd%je+1)
1120 REAL,
INTENT(INOUT) :: yflux_tl(bd%is:bd%ie, bd%js:bd%je+1)
1122 REAL,
INTENT(INOUT) :: cx(bd%is:bd%ie+1, bd%jsd:bd%jed)
1123 REAL,
INTENT(INOUT) :: cx_tl(bd%is:bd%ie+1, bd%jsd:bd%jed)
1124 REAL,
INTENT(INOUT) :: cy(bd%isd:bd%ied, bd%js:bd%je+1)
1125 REAL,
INTENT(INOUT) :: cy_tl(bd%isd:bd%ied, bd%js:bd%je+1)
1126 LOGICAL,
INTENT(IN) :: hydrostatic
1127 LOGICAL,
INTENT(IN) :: inline_q
1128 REAL,
DIMENSION(bd%is:bd%ie+1, bd%jsd:bd%jed),
INTENT(OUT) :: &
1130 REAL,
DIMENSION(bd%is:bd%ie+1, bd%jsd:bd%jed),
INTENT(OUT) :: &
1131 & crx_adv_tl, xfx_adv_tl
1132 REAL,
DIMENSION(bd%isd:bd%ied, bd%js:bd%je+1),
INTENT(OUT) :: &
1134 REAL,
DIMENSION(bd%isd:bd%ied, bd%js:bd%je+1),
INTENT(OUT) :: &
1135 & cry_adv_tl, yfx_adv_tl
1139 LOGICAL :: sw_corner, se_corner, ne_corner, nw_corner
1140 REAL :: ut(bd%isd:bd%ied+1, bd%jsd:bd%jed)
1141 REAL :: ut_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed)
1142 REAL :: vt(bd%isd:bd%ied, bd%jsd:bd%jed+1)
1143 REAL :: vt_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1)
1145 REAL :: fx2(bd%isd:bd%ied+1, bd%jsd:bd%jed)
1146 REAL :: fx2_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed)
1147 REAL :: fy2(bd%isd:bd%ied, bd%jsd:bd%jed+1)
1148 REAL :: fy2_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1)
1150 REAL :: dw(bd%is:bd%ie, bd%js:bd%je)
1151 REAL :: dw_tl(bd%is:bd%ie, bd%js:bd%je)
1153 REAL,
DIMENSION(bd%is:bd%ie+1, bd%js:bd%je+1) :: ub, vb
1154 REAL,
DIMENSION(bd%is:bd%ie+1, bd%js:bd%je+1) :: ub_tl, vb_tl
1156 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
1157 REAL :: wk_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
1159 REAL :: ke(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
1160 REAL :: ke_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
1162 REAL :: vort(bd%isd:bd%ied, bd%jsd:bd%jed)
1163 REAL :: vort_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
1165 REAL :: fx(bd%is:bd%ie+1, bd%js:bd%je)
1166 REAL :: fx_tl(bd%is:bd%ie+1, bd%js:bd%je)
1168 REAL :: fy(bd%is:bd%ie, bd%js:bd%je+1)
1169 REAL :: fy_tl(bd%is:bd%ie, bd%js:bd%je+1)
1170 REAL :: ra_x(bd%is:bd%ie, bd%jsd:bd%jed)
1171 REAL :: ra_x_tl(bd%is:bd%ie, bd%jsd:bd%jed)
1172 REAL :: ra_y(bd%isd:bd%ied, bd%js:bd%je)
1173 REAL :: ra_y_tl(bd%isd:bd%ied, bd%js:bd%je)
1174 REAL :: gx(bd%is:bd%ie+1, bd%js:bd%je)
1175 REAL :: gx_tl(bd%is:bd%ie+1, bd%js:bd%je)
1177 REAL :: gy(bd%is:bd%ie, bd%js:bd%je+1)
1178 REAL :: gy_tl(bd%is:bd%ie, bd%js:bd%je+1)
1180 REAL :: dt2, dt4, dt5, dt6
1181 REAL :: damp, damp2, damp4, dd8,
u2, v2, du2, dv2
1182 REAL :: u2_tl, v2_tl, du2_tl, dv2_tl
1184 INTEGER :: i, j, is2, ie1, js2, je1, n, nt, n2, iq
1185 REAL,
DIMENSION(:, :),
POINTER :: area, area_c, rarea
1186 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg
1187 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v, cosa_s
1188 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
1189 REAL,
DIMENSION(:, :),
POINTER :: rsin_u, rsin_v, rsina
1190 REAL,
DIMENSION(:, :),
POINTER ::
f0, rsin2, divg_u, divg_v
1191 REAL,
DIMENSION(:, :),
POINTER :: cosa, dx, dy, dxc, dyc, rdxa, rdya&
1193 INTEGER :: is, ie, js, je
1194 INTEGER :: isd, ied, jsd, jed
1197 REAL :: delp_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
1198 REAL :: pt_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
1199 REAL :: vort_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
1200 REAL :: wk_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
1201 REAL :: delpc_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
1202 REAL :: ptc_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
1203 REAL :: ke_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
1204 REAL :: vc_tj(bd%isd:bd%ied, bd%jsd:bd%jed+1)
1205 REAL :: uc_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed)
1206 REAL :: divg_d_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
1207 REAL :: ut_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed)
1208 REAL :: vt_tj(bd%isd:bd%ied, bd%jsd:bd%jed+1)
1231 npx = flagstruct%npx
1232 npy = flagstruct%npy
1233 nested = gridstruct%nested
1234 area => gridstruct%area
1235 rarea => gridstruct%rarea
1236 sin_sg => gridstruct%sin_sg
1237 cosa_u => gridstruct%cosa_u
1238 cosa_v => gridstruct%cosa_v
1239 cosa_s => gridstruct%cosa_s
1240 sina_u => gridstruct%sina_u
1241 sina_v => gridstruct%sina_v
1242 rsin_u => gridstruct%rsin_u
1243 rsin_v => gridstruct%rsin_v
1244 rsina => gridstruct%rsina
1246 rsin2 => gridstruct%rsin2
1247 divg_u => gridstruct%divg_u
1248 divg_v => gridstruct%divg_v
1249 cosa => gridstruct%cosa
1252 dxc => gridstruct%dxc
1253 dyc => gridstruct%dyc
1254 rdxa => gridstruct%rdxa
1255 rdya => gridstruct%rdya
1256 rdx => gridstruct%rdx
1257 rdy => gridstruct%rdy
1258 sw_corner = gridstruct%sw_corner
1259 se_corner = gridstruct%se_corner
1260 nw_corner = gridstruct%nw_corner
1261 ne_corner = gridstruct%ne_corner
1263 IF (flagstruct%grid_type .LT. 3)
THEN 1269 ut_tl(i, j) = rsin_u(i, j)*(uc_tl(i, j)-0.25*cosa_u(i, j)*(&
1270 & vc_tl(i-1, j)+vc_tl(i, j)+vc_tl(i-1, j+1)+vc_tl(i, j+1)))
1271 ut(i, j) = (uc(i, j)-0.25*cosa_u(i, j)*(vc(i-1, j)+vc(i, j)+&
1272 & vc(i-1, j+1)+vc(i, j+1)))*rsin_u(i, j)
1278 vt_tl(i, j) = rsin_v(i, j)*(vc_tl(i, j)-0.25*cosa_v(i, j)*(&
1279 & uc_tl(i, j-1)+uc_tl(i+1, j-1)+uc_tl(i, j)+uc_tl(i+1, j)))
1280 vt(i, j) = (vc(i, j)-0.25*cosa_v(i, j)*(uc(i, j-1)+uc(i+1, j&
1281 & -1)+uc(i, j)+uc(i+1, j)))*rsin_v(i, j)
1287 IF (j .NE. 0 .AND. j .NE. 1 .AND. j .NE. npy - 1 .AND. j .NE. &
1290 ut_tl(i, j) = rsin_u(i, j)*(uc_tl(i, j)-0.25*cosa_u(i, j)*&
1291 & (vc_tl(i-1, j)+vc_tl(i, j)+vc_tl(i-1, j+1)+vc_tl(i, j+1)&
1293 ut(i, j) = (uc(i, j)-0.25*cosa_u(i, j)*(vc(i-1, j)+vc(i, j&
1294 & )+vc(i-1, j+1)+vc(i, j+1)))*rsin_u(i, j)
1300 IF (j .NE. 1 .AND. j .NE. npy)
THEN 1302 vt_tl(i, j) = rsin_v(i, j)*(vc_tl(i, j)-0.25*cosa_v(i, j)*&
1303 & (uc_tl(i, j-1)+uc_tl(i+1, j-1)+uc_tl(i, j)+uc_tl(i+1, j)&
1305 vt(i, j) = (vc(i, j)-0.25*cosa_v(i, j)*(uc(i, j-1)+uc(i+1&
1306 & , j-1)+uc(i, j)+uc(i+1, j)))*rsin_v(i, j)
1312 IF (.NOT.nested)
THEN 1317 IF (uc(1, j)*dt .GT. 0.)
THEN 1318 ut_tl(1, j) = uc_tl(1, j)/sin_sg(0, j, 3)
1319 ut(1, j) = uc(1, j)/sin_sg(0, j, 3)
1321 ut_tl(1, j) = uc_tl(1, j)/sin_sg(1, j, 1)
1322 ut(1, j) = uc(1, j)/sin_sg(1, j, 1)
1330 IF (npy - 2 .GT. je + 1)
THEN 1336 vt_tl(0, j) = vc_tl(0, j) - 0.25*cosa_v(0, j)*(ut_tl(0, j-1)&
1337 & +ut_tl(1, j-1)+ut_tl(0, j)+ut_tl(1, j))
1338 vt(0, j) = vc(0, j) - 0.25*cosa_v(0, j)*(ut(0, j-1)+ut(1, j-&
1339 & 1)+ut(0, j)+ut(1, j))
1340 vt_tl(1, j) = vc_tl(1, j) - 0.25*cosa_v(1, j)*(ut_tl(1, j-1)&
1341 & +ut_tl(2, j-1)+ut_tl(1, j)+ut_tl(2, j))
1342 vt(1, j) = vc(1, j) - 0.25*cosa_v(1, j)*(ut(1, j-1)+ut(2, j-&
1343 & 1)+ut(1, j)+ut(2, j))
1347 IF (ie + 1 .EQ. npx)
THEN 1349 IF (uc(npx, j)*dt .GT. 0.)
THEN 1350 ut_tl(npx, j) = uc_tl(npx, j)/sin_sg(npx-1, j, 3)
1351 ut(npx, j) = uc(npx, j)/sin_sg(npx-1, j, 3)
1353 ut_tl(npx, j) = uc_tl(npx, j)/sin_sg(npx, j, 1)
1354 ut(npx, j) = uc(npx, j)/sin_sg(npx, j, 1)
1362 IF (npy - 2 .GT. je + 1)
THEN 1368 vt_tl(npx-1, j) = vc_tl(npx-1, j) - 0.25*cosa_v(npx-1, j)*(&
1369 & ut_tl(npx-1, j-1)+ut_tl(npx, j-1)+ut_tl(npx-1, j)+ut_tl(&
1371 vt(npx-1, j) = vc(npx-1, j) - 0.25*cosa_v(npx-1, j)*(ut(npx-&
1372 & 1, j-1)+ut(npx, j-1)+ut(npx-1, j)+ut(npx, j))
1373 vt_tl(npx, j) = vc_tl(npx, j) - 0.25*cosa_v(npx, j)*(ut_tl(&
1374 & npx, j-1)+ut_tl(npx+1, j-1)+ut_tl(npx, j)+ut_tl(npx+1, j))
1375 vt(npx, j) = vc(npx, j) - 0.25*cosa_v(npx, j)*(ut(npx, j-1)+&
1376 & ut(npx+1, j-1)+ut(npx, j)+ut(npx+1, j))
1382 IF (vc(i, 1)*dt .GT. 0.)
THEN 1383 vt_tl(i, 1) = vc_tl(i, 1)/sin_sg(i, 0, 4)
1384 vt(i, 1) = vc(i, 1)/sin_sg(i, 0, 4)
1386 vt_tl(i, 1) = vc_tl(i, 1)/sin_sg(i, 1, 2)
1387 vt(i, 1) = vc(i, 1)/sin_sg(i, 1, 2)
1395 IF (npx - 2 .GT. ie + 1)
THEN 1401 ut_tl(i, 0) = uc_tl(i, 0) - 0.25*cosa_u(i, 0)*(vt_tl(i-1, 0)&
1402 & +vt_tl(i, 0)+vt_tl(i-1, 1)+vt_tl(i, 1))
1403 ut(i, 0) = uc(i, 0) - 0.25*cosa_u(i, 0)*(vt(i-1, 0)+vt(i, 0)&
1404 & +vt(i-1, 1)+vt(i, 1))
1405 ut_tl(i, 1) = uc_tl(i, 1) - 0.25*cosa_u(i, 1)*(vt_tl(i-1, 1)&
1406 & +vt_tl(i, 1)+vt_tl(i-1, 2)+vt_tl(i, 2))
1407 ut(i, 1) = uc(i, 1) - 0.25*cosa_u(i, 1)*(vt(i-1, 1)+vt(i, 1)&
1408 & +vt(i-1, 2)+vt(i, 2))
1412 IF (je + 1 .EQ. npy)
THEN 1414 IF (vc(i, npy)*dt .GT. 0.)
THEN 1415 vt_tl(i, npy) = vc_tl(i, npy)/sin_sg(i, npy-1, 4)
1416 vt(i, npy) = vc(i, npy)/sin_sg(i, npy-1, 4)
1418 vt_tl(i, npy) = vc_tl(i, npy)/sin_sg(i, npy, 2)
1419 vt(i, npy) = vc(i, npy)/sin_sg(i, npy, 2)
1427 IF (npx - 2 .GT. ie + 1)
THEN 1433 ut_tl(i, npy-1) = uc_tl(i, npy-1) - 0.25*cosa_u(i, npy-1)*(&
1434 & vt_tl(i-1, npy-1)+vt_tl(i, npy-1)+vt_tl(i-1, npy)+vt_tl(i&
1436 ut(i, npy-1) = uc(i, npy-1) - 0.25*cosa_u(i, npy-1)*(vt(i-1&
1437 & , npy-1)+vt(i, npy-1)+vt(i-1, npy)+vt(i, npy))
1438 ut_tl(i, npy) = uc_tl(i, npy) - 0.25*cosa_u(i, npy)*(vt_tl(i&
1439 & -1, npy)+vt_tl(i, npy)+vt_tl(i-1, npy+1)+vt_tl(i, npy+1))
1440 ut(i, npy) = uc(i, npy) - 0.25*cosa_u(i, npy)*(vt(i-1, npy)+&
1441 & vt(i, npy)+vt(i-1, npy+1)+vt(i, npy+1))
1453 damp = 1./(1.-0.0625*cosa_u(2, 0)*cosa_v(1, 0))
1454 ut_tl(2, 0) = damp*(uc_tl(2, 0)-0.25*cosa_u(2, 0)*(vt_tl(1, 1)&
1455 & +vt_tl(2, 1)+vt_tl(2, 0)+vc_tl(1, 0)-0.25*cosa_v(1, 0)*(&
1456 & ut_tl(1, 0)+ut_tl(1, -1)+ut_tl(2, -1))))
1457 ut(2, 0) = (uc(2, 0)-0.25*cosa_u(2, 0)*(vt(1, 1)+vt(2, 1)+vt(2&
1458 & , 0)+vc(1, 0)-0.25*cosa_v(1, 0)*(ut(1, 0)+ut(1, -1)+ut(2, -1&
1460 damp = 1./(1.-0.0625*cosa_u(0, 1)*cosa_v(0, 2))
1461 vt_tl(0, 2) = damp*(vc_tl(0, 2)-0.25*cosa_v(0, 2)*(ut_tl(1, 1)&
1462 & +ut_tl(1, 2)+ut_tl(0, 2)+uc_tl(0, 1)-0.25*cosa_u(0, 1)*(&
1463 & vt_tl(0, 1)+vt_tl(-1, 1)+vt_tl(-1, 2))))
1464 vt(0, 2) = (vc(0, 2)-0.25*cosa_v(0, 2)*(ut(1, 1)+ut(1, 2)+ut(0&
1465 & , 2)+uc(0, 1)-0.25*cosa_u(0, 1)*(vt(0, 1)+vt(-1, 1)+vt(-1, 2&
1467 damp = 1./(1.-0.0625*cosa_u(2, 1)*cosa_v(1, 2))
1468 ut_tl(2, 1) = damp*(uc_tl(2, 1)-0.25*cosa_u(2, 1)*(vt_tl(1, 1)&
1469 & +vt_tl(2, 1)+vt_tl(2, 2)+vc_tl(1, 2)-0.25*cosa_v(1, 2)*(&
1470 & ut_tl(1, 1)+ut_tl(1, 2)+ut_tl(2, 2))))
1471 ut(2, 1) = (uc(2, 1)-0.25*cosa_u(2, 1)*(vt(1, 1)+vt(2, 1)+vt(2&
1472 & , 2)+vc(1, 2)-0.25*cosa_v(1, 2)*(ut(1, 1)+ut(1, 2)+ut(2, 2))&
1474 vt_tl(1, 2) = damp*(vc_tl(1, 2)-0.25*cosa_v(1, 2)*(ut_tl(1, 1)&
1475 & +ut_tl(1, 2)+ut_tl(2, 2)+uc_tl(2, 1)-0.25*cosa_u(2, 1)*(&
1476 & vt_tl(1, 1)+vt_tl(2, 1)+vt_tl(2, 2))))
1477 vt(1, 2) = (vc(1, 2)-0.25*cosa_v(1, 2)*(ut(1, 1)+ut(1, 2)+ut(2&
1478 & , 2)+uc(2, 1)-0.25*cosa_u(2, 1)*(vt(1, 1)+vt(2, 1)+vt(2, 2))&
1482 damp = 1./(1.-0.0625*cosa_u(npx-1, 0)*cosa_v(npx-1, 0))
1483 ut_tl(npx-1, 0) = damp*(uc_tl(npx-1, 0)-0.25*cosa_u(npx-1, 0)*&
1484 & (vt_tl(npx-1, 1)+vt_tl(npx-2, 1)+vt_tl(npx-2, 0)+vc_tl(npx-1&
1485 & , 0)-0.25*cosa_v(npx-1, 0)*(ut_tl(npx, 0)+ut_tl(npx, -1)+&
1486 & ut_tl(npx-1, -1))))
1487 ut(npx-1, 0) = (uc(npx-1, 0)-0.25*cosa_u(npx-1, 0)*(vt(npx-1, &
1488 & 1)+vt(npx-2, 1)+vt(npx-2, 0)+vc(npx-1, 0)-0.25*cosa_v(npx-1&
1489 & , 0)*(ut(npx, 0)+ut(npx, -1)+ut(npx-1, -1))))*damp
1490 damp = 1./(1.-0.0625*cosa_u(npx+1, 1)*cosa_v(npx, 2))
1491 vt_tl(npx, 2) = damp*(vc_tl(npx, 2)-0.25*cosa_v(npx, 2)*(ut_tl&
1492 & (npx, 1)+ut_tl(npx, 2)+ut_tl(npx+1, 2)+uc_tl(npx+1, 1)-0.25*&
1493 & cosa_u(npx+1, 1)*(vt_tl(npx, 1)+vt_tl(npx+1, 1)+vt_tl(npx+1&
1495 vt(npx, 2) = (vc(npx, 2)-0.25*cosa_v(npx, 2)*(ut(npx, 1)+ut(&
1496 & npx, 2)+ut(npx+1, 2)+uc(npx+1, 1)-0.25*cosa_u(npx+1, 1)*(vt(&
1497 & npx, 1)+vt(npx+1, 1)+vt(npx+1, 2))))*damp
1498 damp = 1./(1.-0.0625*cosa_u(npx-1, 1)*cosa_v(npx-1, 2))
1499 ut_tl(npx-1, 1) = damp*(uc_tl(npx-1, 1)-0.25*cosa_u(npx-1, 1)*&
1500 & (vt_tl(npx-1, 1)+vt_tl(npx-2, 1)+vt_tl(npx-2, 2)+vc_tl(npx-1&
1501 & , 2)-0.25*cosa_v(npx-1, 2)*(ut_tl(npx, 1)+ut_tl(npx, 2)+&
1502 & ut_tl(npx-1, 2))))
1503 ut(npx-1, 1) = (uc(npx-1, 1)-0.25*cosa_u(npx-1, 1)*(vt(npx-1, &
1504 & 1)+vt(npx-2, 1)+vt(npx-2, 2)+vc(npx-1, 2)-0.25*cosa_v(npx-1&
1505 & , 2)*(ut(npx, 1)+ut(npx, 2)+ut(npx-1, 2))))*damp
1506 vt_tl(npx-1, 2) = damp*(vc_tl(npx-1, 2)-0.25*cosa_v(npx-1, 2)*&
1507 & (ut_tl(npx, 1)+ut_tl(npx, 2)+ut_tl(npx-1, 2)+uc_tl(npx-1, 1)&
1508 & -0.25*cosa_u(npx-1, 1)*(vt_tl(npx-1, 1)+vt_tl(npx-2, 1)+&
1509 & vt_tl(npx-2, 2))))
1510 vt(npx-1, 2) = (vc(npx-1, 2)-0.25*cosa_v(npx-1, 2)*(ut(npx, 1)&
1511 & +ut(npx, 2)+ut(npx-1, 2)+uc(npx-1, 1)-0.25*cosa_u(npx-1, 1)*&
1512 & (vt(npx-1, 1)+vt(npx-2, 1)+vt(npx-2, 2))))*damp
1515 damp = 1./(1.-0.0625*cosa_u(npx-1, npy)*cosa_v(npx-1, npy+1))
1516 ut_tl(npx-1, npy) = damp*(uc_tl(npx-1, npy)-0.25*cosa_u(npx-1&
1517 & , npy)*(vt_tl(npx-1, npy)+vt_tl(npx-2, npy)+vt_tl(npx-2, npy&
1518 & +1)+vc_tl(npx-1, npy+1)-0.25*cosa_v(npx-1, npy+1)*(ut_tl(npx&
1519 & , npy)+ut_tl(npx, npy+1)+ut_tl(npx-1, npy+1))))
1520 ut(npx-1, npy) = (uc(npx-1, npy)-0.25*cosa_u(npx-1, npy)*(vt(&
1521 & npx-1, npy)+vt(npx-2, npy)+vt(npx-2, npy+1)+vc(npx-1, npy+1)&
1522 & -0.25*cosa_v(npx-1, npy+1)*(ut(npx, npy)+ut(npx, npy+1)+ut(&
1523 & npx-1, npy+1))))*damp
1524 damp = 1./(1.-0.0625*cosa_u(npx+1, npy-1)*cosa_v(npx, npy-1))
1525 vt_tl(npx, npy-1) = damp*(vc_tl(npx, npy-1)-0.25*cosa_v(npx, &
1526 & npy-1)*(ut_tl(npx, npy-1)+ut_tl(npx, npy-2)+ut_tl(npx+1, npy&
1527 & -2)+uc_tl(npx+1, npy-1)-0.25*cosa_u(npx+1, npy-1)*(vt_tl(npx&
1528 & , npy)+vt_tl(npx+1, npy)+vt_tl(npx+1, npy-1))))
1529 vt(npx, npy-1) = (vc(npx, npy-1)-0.25*cosa_v(npx, npy-1)*(ut(&
1530 & npx, npy-1)+ut(npx, npy-2)+ut(npx+1, npy-2)+uc(npx+1, npy-1)&
1531 & -0.25*cosa_u(npx+1, npy-1)*(vt(npx, npy)+vt(npx+1, npy)+vt(&
1532 & npx+1, npy-1))))*damp
1533 damp = 1./(1.-0.0625*cosa_u(npx-1, npy-1)*cosa_v(npx-1, npy-1)&
1535 ut_tl(npx-1, npy-1) = damp*(uc_tl(npx-1, npy-1)-0.25*cosa_u(&
1536 & npx-1, npy-1)*(vt_tl(npx-1, npy)+vt_tl(npx-2, npy)+vt_tl(npx&
1537 & -2, npy-1)+vc_tl(npx-1, npy-1)-0.25*cosa_v(npx-1, npy-1)*(&
1538 & ut_tl(npx, npy-1)+ut_tl(npx, npy-2)+ut_tl(npx-1, npy-2))))
1539 ut(npx-1, npy-1) = (uc(npx-1, npy-1)-0.25*cosa_u(npx-1, npy-1)&
1540 & *(vt(npx-1, npy)+vt(npx-2, npy)+vt(npx-2, npy-1)+vc(npx-1, &
1541 & npy-1)-0.25*cosa_v(npx-1, npy-1)*(ut(npx, npy-1)+ut(npx, npy&
1542 & -2)+ut(npx-1, npy-2))))*damp
1543 vt_tl(npx-1, npy-1) = damp*(vc_tl(npx-1, npy-1)-0.25*cosa_v(&
1544 & npx-1, npy-1)*(ut_tl(npx, npy-1)+ut_tl(npx, npy-2)+ut_tl(npx&
1545 & -1, npy-2)+uc_tl(npx-1, npy-1)-0.25*cosa_u(npx-1, npy-1)*(&
1546 & vt_tl(npx-1, npy)+vt_tl(npx-2, npy)+vt_tl(npx-2, npy-1))))
1547 vt(npx-1, npy-1) = (vc(npx-1, npy-1)-0.25*cosa_v(npx-1, npy-1)&
1548 & *(ut(npx, npy-1)+ut(npx, npy-2)+ut(npx-1, npy-2)+uc(npx-1, &
1549 & npy-1)-0.25*cosa_u(npx-1, npy-1)*(vt(npx-1, npy)+vt(npx-2, &
1550 & npy)+vt(npx-2, npy-1))))*damp
1553 damp = 1./(1.-0.0625*cosa_u(2, npy)*cosa_v(1, npy+1))
1554 ut_tl(2, npy) = damp*(uc_tl(2, npy)-0.25*cosa_u(2, npy)*(vt_tl&
1555 & (1, npy)+vt_tl(2, npy)+vt_tl(2, npy+1)+vc_tl(1, npy+1)-0.25*&
1556 & cosa_v(1, npy+1)*(ut_tl(1, npy)+ut_tl(1, npy+1)+ut_tl(2, npy&
1558 ut(2, npy) = (uc(2, npy)-0.25*cosa_u(2, npy)*(vt(1, npy)+vt(2&
1559 & , npy)+vt(2, npy+1)+vc(1, npy+1)-0.25*cosa_v(1, npy+1)*(ut(1&
1560 & , npy)+ut(1, npy+1)+ut(2, npy+1))))*damp
1561 damp = 1./(1.-0.0625*cosa_u(0, npy-1)*cosa_v(0, npy-1))
1562 vt_tl(0, npy-1) = damp*(vc_tl(0, npy-1)-0.25*cosa_v(0, npy-1)*&
1563 & (ut_tl(1, npy-1)+ut_tl(1, npy-2)+ut_tl(0, npy-2)+uc_tl(0, &
1564 & npy-1)-0.25*cosa_u(0, npy-1)*(vt_tl(0, npy)+vt_tl(-1, npy)+&
1565 & vt_tl(-1, npy-1))))
1566 vt(0, npy-1) = (vc(0, npy-1)-0.25*cosa_v(0, npy-1)*(ut(1, npy-&
1567 & 1)+ut(1, npy-2)+ut(0, npy-2)+uc(0, npy-1)-0.25*cosa_u(0, npy&
1568 & -1)*(vt(0, npy)+vt(-1, npy)+vt(-1, npy-1))))*damp
1569 damp = 1./(1.-0.0625*cosa_u(2, npy-1)*cosa_v(1, npy-1))
1570 ut_tl(2, npy-1) = damp*(uc_tl(2, npy-1)-0.25*cosa_u(2, npy-1)*&
1571 & (vt_tl(1, npy)+vt_tl(2, npy)+vt_tl(2, npy-1)+vc_tl(1, npy-1)&
1572 & -0.25*cosa_v(1, npy-1)*(ut_tl(1, npy-1)+ut_tl(1, npy-2)+&
1573 & ut_tl(2, npy-2))))
1574 ut(2, npy-1) = (uc(2, npy-1)-0.25*cosa_u(2, npy-1)*(vt(1, npy)&
1575 & +vt(2, npy)+vt(2, npy-1)+vc(1, npy-1)-0.25*cosa_v(1, npy-1)*&
1576 & (ut(1, npy-1)+ut(1, npy-2)+ut(2, npy-2))))*damp
1577 vt_tl(1, npy-1) = damp*(vc_tl(1, npy-1)-0.25*cosa_v(1, npy-1)*&
1578 & (ut_tl(1, npy-1)+ut_tl(1, npy-2)+ut_tl(2, npy-2)+uc_tl(2, &
1579 & npy-1)-0.25*cosa_u(2, npy-1)*(vt_tl(1, npy)+vt_tl(2, npy)+&
1580 & vt_tl(2, npy-1))))
1581 vt(1, npy-1) = (vc(1, npy-1)-0.25*cosa_v(1, npy-1)*(ut(1, npy-&
1582 & 1)+ut(1, npy-2)+ut(2, npy-2)+uc(2, npy-1)-0.25*cosa_u(2, npy&
1583 & -1)*(vt(1, npy)+vt(2, npy)+vt(2, npy-1))))*damp
1591 ut_tl(i, j) = uc_tl(i, j)
1598 vt_tl(i, j) = vc_tl(i, j)
1605 xfx_adv_tl(i, j) = dt*ut_tl(i, j)
1606 xfx_adv(i, j) = dt*ut(i, j)
1611 yfx_adv_tl(i, j) = dt*vt_tl(i, j)
1612 yfx_adv(i, j) = dt*vt(i, j)
1621 IF (xfx_adv(i, j) .GT. 0.)
THEN 1622 crx_adv_tl(i, j) = rdxa(i-1, j)*xfx_adv_tl(i, j)
1623 crx_adv(i, j) = xfx_adv(i, j)*rdxa(i-1, j)
1624 xfx_adv_tl(i, j) = dy(i, j)*sin_sg(i-1, j, 3)*xfx_adv_tl(i, j)
1625 xfx_adv(i, j) = dy(i, j)*xfx_adv(i, j)*sin_sg(i-1, j, 3)
1627 crx_adv_tl(i, j) = rdxa(i, j)*xfx_adv_tl(i, j)
1628 crx_adv(i, j) = xfx_adv(i, j)*rdxa(i, j)
1629 xfx_adv_tl(i, j) = dy(i, j)*sin_sg(i, j, 1)*xfx_adv_tl(i, j)
1630 xfx_adv(i, j) = dy(i, j)*xfx_adv(i, j)*sin_sg(i, j, 1)
1637 IF (yfx_adv(i, j) .GT. 0.)
THEN 1638 cry_adv_tl(i, j) = rdya(i, j-1)*yfx_adv_tl(i, j)
1639 cry_adv(i, j) = yfx_adv(i, j)*rdya(i, j-1)
1640 yfx_adv_tl(i, j) = dx(i, j)*sin_sg(i, j-1, 4)*yfx_adv_tl(i, j)
1641 yfx_adv(i, j) = dx(i, j)*yfx_adv(i, j)*sin_sg(i, j-1, 4)
1643 cry_adv_tl(i, j) = rdya(i, j)*yfx_adv_tl(i, j)
1644 cry_adv(i, j) = yfx_adv(i, j)*rdya(i, j)
1645 yfx_adv_tl(i, j) = dx(i, j)*sin_sg(i, j, 2)*yfx_adv_tl(i, j)
1646 yfx_adv(i, j) = dx(i, j)*yfx_adv(i, j)*sin_sg(i, j, 2)
1653 ra_x_tl(i, j) = xfx_adv_tl(i, j) - xfx_adv_tl(i+1, j)
1654 ra_x(i, j) = area(i, j) + (xfx_adv(i, j)-xfx_adv(i+1, j))
1660 ra_y_tl(i, j) = yfx_adv_tl(i, j) - yfx_adv_tl(i, j+1)
1661 ra_y(i, j) = area(i, j) + (yfx_adv(i, j)-yfx_adv(i, j+1))
1664 IF (hord_dp .EQ. hord_dp_pert .AND. (.NOT.split_damp))
THEN 1667 CALL fv_tp_2d_tlm(delp, delp_tl, crx_adv, crx_adv_tl, cry_adv, &
1668 & cry_adv_tl, npx, npy, hord_dp, fx, fx_tl, fy, fy_tl&
1669 & , xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
1670 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, nord=&
1671 & nord_v, damp_c=damp_v)
1675 CALL fv_tp_2d_tlm(delp, delp_tl, crx_adv, crx_adv_tl, cry_adv, &
1676 & cry_adv_tl, npx, npy, hord_dp_pert, fx, fx_tl, fy, &
1677 & fy_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
1678 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, nord=&
1679 & nord_v_pert, damp_c=damp_v_pert)
1680 call fv_tp_2d(delp, crx_adv, cry_adv, npx, npy, hord_dp, fx, fy, &
1681 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y, nord=nord_v, damp_c=damp_v)
1686 cx_tl(i, j) = cx_tl(i, j) + crx_adv_tl(i, j)
1687 cx(i, j) = cx(i, j) + crx_adv(i, j)
1692 xflux_tl(i, j) = xflux_tl(i, j) + fx_tl(i, j)
1693 xflux(i, j) = xflux(i, j) + fx(i, j)
1698 cy_tl(i, j) = cy_tl(i, j) + cry_adv_tl(i, j)
1699 cy(i, j) = cy(i, j) + cry_adv(i, j)
1702 yflux_tl(i, j) = yflux_tl(i, j) + fy_tl(i, j)
1703 yflux(i, j) = yflux(i, j) + fy(i, j)
1708 heat_source_tl(i, j) = 0.0
1709 heat_source(i, j) = 0.
1712 IF (.NOT.hydrostatic)
THEN 1713 IF (damp_w .GT. 1.e-5)
THEN 1714 IF (dt .GE. 0.)
THEN 1720 pwx1 = damp_w*gridstruct%da_min_c
1727 & wk_tl, fx2, fx2_tl, fy2, fy2_tl, gridstruct, bd)
1731 dw_tl(i, j) = rarea(i, j)*(fx2_tl(i, j)-fx2_tl(i+1, j)+&
1732 & fy2_tl(i, j)-fy2_tl(i, j+1))
1733 dw(i, j) = (fx2(i, j)-fx2(i+1, j)+(fy2(i, j)-fy2(i, j+1)))*&
1737 heat_source_tl(i, j) = -(dw_tl(i, j)*(w(i, j)+0.5*dw(i, j)))&
1738 & - dw(i, j)*(w_tl(i, j)+0.5*dw_tl(i, j))
1739 heat_source(i, j) = dd8 - dw(i, j)*(w(i, j)+0.5*dw(i, j))
1746 IF (hord_vt .EQ. hord_vt_pert)
THEN 1749 CALL fv_tp_2d_tlm(w, w_tl, crx_adv, crx_adv_tl, cry_adv, &
1750 & cry_adv_tl, npx, npy, hord_vt, gx, gx_tl, gy, &
1751 & gy_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
1752 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, mfx&
1753 & =fx, mfx_tl=fx_tl, mfy=fy, mfy_tl=fy_tl)
1757 CALL fv_tp_2d_tlm(w, w_tl, crx_adv, crx_adv_tl, cry_adv, &
1758 & cry_adv_tl, npx, npy, hord_vt_pert, gx, gx_tl, gy, &
1759 & gy_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
1760 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, mfx=fx&
1761 & , mfx_tl=fx_tl, mfy=fy, mfy_tl=fy_tl)
1762 call fv_tp_2d(w, crx_adv,cry_adv, npx, npy, hord_vt, gx, gy, xfx_adv, yfx_adv, &
1763 gridstruct, bd, ra_x, ra_y, mfx=fx, mfy=fy)
1767 w_tl(i, j) = delp_tl(i, j)*w(i, j) + delp(i, j)*w_tl(i, j) + &
1768 & rarea(i, j)*(gx_tl(i, j)-gx_tl(i+1, j)+gy_tl(i, j)-gy_tl(i, &
1770 w(i, j) = delp(i, j)*w(i, j) + (gx(i, j)-gx(i+1, j)+(gy(i, j)-&
1771 & gy(i, j+1)))*rarea(i, j)
1787 IF (hord_tm .EQ. hord_tm_pert .AND. (.NOT.split_damp))
THEN 1788 CALL fv_tp_2d_tlm(pt, pt_tl, crx_adv, crx_adv_tl, cry_adv, &
1789 & cry_adv_tl, npx, npy, hord_tm, gx, gx_tl, gy, gy_tl&
1790 & , xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
1791 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, mfx=&
1792 & fx, mfx_tl=fx_tl, mfy=fy, mfy_tl=fy_tl, mass=delp, &
1793 & mass_tl=delp_tl, nord=nord_t, damp_c=damp_t)
1795 CALL fv_tp_2d_tlm(pt, pt_tl, crx_adv, crx_adv_tl, cry_adv, &
1796 & cry_adv_tl, npx, npy, hord_tm_pert, gx, gx_tl, gy, &
1797 & gy_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
1798 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, mfx=fx, &
1799 & mfx_tl=fx_tl, mfy=fy, mfy_tl=fy_tl, mass=delp, mass_tl&
1800 & =delp_tl, nord=nord_t_pert, damp_c=damp_t_pert)
1801 call fv_tp_2d(pt, crx_adv,cry_adv, npx, npy, hord_tm, gx, gy, &
1802 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y, &
1803 mfx=fx, mfy=fy, mass=delp, nord=nord_t, damp_c=damp_t)
1808 wk_tl(i, j) = delp_tl(i, j)
1809 wk(i, j) = delp(i, j)
1810 delp_tl(i, j) = wk_tl(i, j) + rarea(i, j)*(fx_tl(i, j)-fx_tl(i&
1811 & +1, j)+fy_tl(i, j)-fy_tl(i, j+1))
1812 delp(i, j) = wk(i, j) + (fx(i, j)-fx(i+1, j)+(fy(i, j)-fy(i, j&
1814 pt_tl(i, j) = ((pt_tl(i, j)*wk(i, j)+pt(i, j)*wk_tl(i, j)+&
1815 & rarea(i, j)*(gx_tl(i, j)-gx_tl(i+1, j)+gy_tl(i, j)-gy_tl(i, &
1816 & j+1)))*delp(i, j)-(pt(i, j)*wk(i, j)+(gx(i, j)-gx(i+1, j)+(&
1817 & gy(i, j)-gy(i, j+1)))*rarea(i, j))*delp_tl(i, j))/delp(i, j)&
1819 pt(i, j) = (pt(i, j)*wk(i, j)+(gx(i, j)-gx(i+1, j)+(gy(i, j)-&
1820 & gy(i, j+1)))*rarea(i, j))/delp(i, j)
1824 IF (hord_tr .EQ. hord_tr_pert)
THEN 1825 CALL fv_tp_2d_tlm(q(isd:ied, jsd:jed, k, iq), q_tl(isd:ied&
1826 & , jsd:jed, k, iq), crx_adv, crx_adv_tl, cry_adv&
1827 & , cry_adv_tl, npx, npy, hord_tr, gx, gx_tl, gy&
1828 & , gy_tl, xfx_adv, xfx_adv_tl, yfx_adv, &
1829 & yfx_adv_tl, gridstruct, bd, ra_x, ra_x_tl, ra_y&
1830 & , ra_y_tl, mfx=fx, mfx_tl=fx_tl, mfy=fy, mfy_tl&
1831 & =fy_tl, mass=delp, mass_tl=delp_tl, nord=nord_t&
1834 CALL fv_tp_2d_tlm(q(isd:ied, jsd:jed, k, iq), q_tl(isd:ied, &
1835 & jsd:jed, k, iq), crx_adv, crx_adv_tl, cry_adv, &
1836 & cry_adv_tl, npx, npy, hord_tr_pert, gx, gx_tl, gy&
1837 & , gy_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl&
1838 & , gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, &
1839 & mfx=fx, mfx_tl=fx_tl, mfy=fy, mfy_tl=fy_tl, mass=&
1840 & delp, mass_tl=delp_tl, nord=nord_t_pert, damp_c=&
1842 call fv_tp_2d(q(isd:ied,jsd:jed,k,iq), crx_adv,cry_adv, npx, npy, hord_tr, gx, gy, &
1843 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y, &
1844 mfx=fx, mfy=fy, mass=delp, nord=nord_t, damp_c=damp_t)
1848 q_tl(i, j, k, iq) = ((q_tl(i, j, k, iq)*wk(i, j)+q(i, j, k, &
1849 & iq)*wk_tl(i, j)+rarea(i, j)*(gx_tl(i, j)-gx_tl(i+1, j)+&
1850 & gy_tl(i, j)-gy_tl(i, j+1)))*delp(i, j)-(q(i, j, k, iq)*wk(&
1851 & i, j)+(gx(i, j)-gx(i+1, j)+(gy(i, j)-gy(i, j+1)))*rarea(i&
1852 & , j))*delp_tl(i, j))/delp(i, j)**2
1853 q(i, j, k, iq) = (q(i, j, k, iq)*wk(i, j)+(gx(i, j)-gx(i+1, &
1854 & j)+(gy(i, j)-gy(i, j+1)))*rarea(i, j))/delp(i, j)
1868 pt_tl(i, j) = pt_tl(i, j)*delp(i, j) + pt(i, j)*delp_tl(i, j) &
1869 & + rarea(i, j)*(gx_tl(i, j)-gx_tl(i+1, j)+gy_tl(i, j)-gy_tl(i&
1871 pt(i, j) = pt(i, j)*delp(i, j) + (gx(i, j)-gx(i+1, j)+(gy(i, j&
1872 & )-gy(i, j+1)))*rarea(i, j)
1873 delp_tl(i, j) = delp_tl(i, j) + rarea(i, j)*(fx_tl(i, j)-fx_tl&
1874 & (i+1, j)+fy_tl(i, j)-fy_tl(i, j+1))
1875 delp(i, j) = delp(i, j) + (fx(i, j)-fx(i+1, j)+(fy(i, j)-fy(i&
1876 & , j+1)))*rarea(i, j)
1877 pt_tl(i, j) = (pt_tl(i, j)*delp(i, j)-pt(i, j)*delp_tl(i, j))/&
1879 pt(i, j) = pt(i, j)/delp(i, j)
1883 IF (
fpp%fpp_overload_r4)
THEN 1886 dpx_tl(i, j) = dpx_tl(i, j) + rarea(i, j)*(fx_tl(i, j)-fx_tl(i&
1887 & +1, j)+fy_tl(i, j)-fy_tl(i, j+1))
1888 dpx(i, j) = dpx(i, j) + (fx(i, j)-fx(i+1, j)+(fy(i, j)-fy(i, j&
1910 IF (npx - 1 .GT. ie + 1)
THEN 1920 IF (npy - 1 .GT. je + 1)
THEN 1927 IF (flagstruct%grid_type .LT. 3)
THEN 1932 vb_tl(i, j) = dt5*rsina(i, j)*(vc_tl(i-1, j)+vc_tl(i, j)-&
1933 & cosa(i, j)*(uc_tl(i, j-1)+uc_tl(i, j)))
1934 vb(i, j) = dt5*(vc(i-1, j)+vc(i, j)-(uc(i, j-1)+uc(i, j))*&
1935 & cosa(i, j))*rsina(i, j)
1943 vb_tl(i, 1) = dt5*(vt_tl(i-1, 1)+vt_tl(i, 1))
1944 vb(i, 1) = dt5*(vt(i-1, 1)+vt(i, 1))
1951 vb_tl(i, j) = dt5*rsina(i, j)*(vc_tl(i-1, j)+vc_tl(i, j)-&
1952 & cosa(i, j)*(uc_tl(i, j-1)+uc_tl(i, j)))
1953 vb(i, j) = dt5*(vc(i-1, j)+vc(i, j)-(uc(i, j-1)+uc(i, j))*&
1954 & cosa(i, j))*rsina(i, j)
1958 vb_tl(1, j) = dt4*(3.*(vt_tl(0, j)+vt_tl(1, j))-vt_tl(-1, j)&
1960 vb(1, j) = dt4*(-vt(-1, j)+3.*(vt(0, j)+vt(1, j))-vt(2, j))
1962 IF (ie + 1 .EQ. npx)
THEN 1964 vb_tl(npx, j) = dt4*(3.*(vt_tl(npx-1, j)+vt_tl(npx, j))-&
1965 & vt_tl(npx-2, j)-vt_tl(npx+1, j))
1966 vb(npx, j) = dt4*(-vt(npx-2, j)+3.*(vt(npx-1, j)+vt(npx, j))&
1970 IF (je + 1 .EQ. npy)
THEN 1973 vb_tl(i, npy) = dt5*(vt_tl(i-1, npy)+vt_tl(i, npy))
1974 vb(i, npy) = dt5*(vt(i-1, npy)+vt(i, npy))
1982 vb_tl(i, j) = dt5*(vc_tl(i-1, j)+vc_tl(i, j))
1983 vb(i, j) = dt5*(vc(i-1, j)+vc(i, j))
1987 IF (hord_mt .EQ. hord_mt_pert)
THEN 1988 CALL ytp_v_tlm(is, ie, js, je, isd, ied, jsd, jed, vb, vb_tl, u&
1989 & , v, v_tl, ub, ub_tl, hord_mt, gridstruct%dy, &
1990 & gridstruct%rdy, npx, npy, flagstruct%grid_type, nested&
1994 CALL ytp_v_tlm(is, ie, js, je, isd, ied, jsd, jed, vb, vb_tl, u, v&
1995 & , v_tl, ub, ub_tl, hord_mt_pert, gridstruct%dy, &
1996 & gridstruct%rdy, npx, npy, flagstruct%grid_type, nested)
1997 call ytp_v(is,ie,js,je,isd,ied,jsd,jed, vb, u, v, ub, hord_mt, gridstruct%dy, gridstruct%rdy, &
1998 npx, npy, flagstruct%grid_type, nested)
2003 ke_tl(i, j) = vb_tl(i, j)*ub(i, j) + vb(i, j)*ub_tl(i, j)
2004 ke(i, j) = vb(i, j)*ub(i, j)
2007 IF (flagstruct%grid_type .LT. 3)
THEN 2011 ub_tl(i, j) = dt5*rsina(i, j)*(uc_tl(i, j-1)+uc_tl(i, j)-&
2012 & cosa(i, j)*(vc_tl(i-1, j)+vc_tl(i, j)))
2013 ub(i, j) = dt5*(uc(i, j-1)+uc(i, j)-(vc(i-1, j)+vc(i, j))*&
2014 & cosa(i, j))*rsina(i, j)
2021 ub_tl(1, j) = dt5*(ut_tl(1, j-1)+ut_tl(1, j))
2022 ub(1, j) = dt5*(ut(1, j-1)+ut(1, j))
2026 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 2029 ub_tl(i, j) = dt4*(3.*(ut_tl(i, j-1)+ut_tl(i, j))-ut_tl(i&
2030 & , j-2)-ut_tl(i, j+1))
2031 ub(i, j) = dt4*(-ut(i, j-2)+3.*(ut(i, j-1)+ut(i, j))-ut(i&
2036 ub_tl(i, j) = dt5*rsina(i, j)*(uc_tl(i, j-1)+uc_tl(i, j)-&
2037 & cosa(i, j)*(vc_tl(i-1, j)+vc_tl(i, j)))
2038 ub(i, j) = dt5*(uc(i, j-1)+uc(i, j)-(vc(i-1, j)+vc(i, j))*&
2039 & cosa(i, j))*rsina(i, j)
2043 IF (ie + 1 .EQ. npx)
THEN 2046 ub_tl(npx, j) = dt5*(ut_tl(npx, j-1)+ut_tl(npx, j))
2047 ub(npx, j) = dt5*(ut(npx, j-1)+ut(npx, j))
2054 ub_tl(i, j) = dt5*(uc_tl(i, j-1)+uc_tl(i, j))
2055 ub(i, j) = dt5*(uc(i, j-1)+uc(i, j))
2059 IF (hord_mt .EQ. hord_mt_pert)
THEN 2060 CALL xtp_u_tlm(is, ie, js, je, isd, ied, jsd, jed, ub, ub_tl, u&
2061 & , u_tl, v, vb, vb_tl, hord_mt, gridstruct%dx, &
2062 & gridstruct%rdx, npx, npy, flagstruct%grid_type, nested&
2065 CALL xtp_u_tlm(is, ie, js, je, isd, ied, jsd, jed, ub, ub_tl, u, &
2066 & u_tl, v, vb, vb_tl, hord_mt_pert, gridstruct%dx, &
2067 & gridstruct%rdx, npx, npy, flagstruct%grid_type, nested)
2068 call xtp_u(is,ie,js,je, isd,ied,jsd,jed, ub, u, v, vb, hord_mt, gridstruct%dx, gridstruct%rdx, &
2069 npx, npy, flagstruct%grid_type, nested)
2073 ke_tl(i, j) = 0.5*(ke_tl(i, j)+ub_tl(i, j)*vb(i, j)+ub(i, j)*&
2075 ke(i, j) = 0.5*(ke(i, j)+ub(i, j)*vb(i, j))
2081 IF (.NOT.nested)
THEN 2084 ke_tl(1, 1) = dt6*((ut_tl(1, 1)+ut_tl(1, 0))*u(1, 1)+(ut(1, 1)+&
2085 & ut(1, 0))*u_tl(1, 1)+(vt_tl(1, 1)+vt_tl(0, 1))*v(1, 1)+(vt(1, &
2086 & 1)+vt(0, 1))*v_tl(1, 1)+(ut_tl(1, 1)+vt_tl(1, 1))*u(0, 1)+(ut(&
2087 & 1, 1)+vt(1, 1))*u_tl(0, 1))
2088 ke(1, 1) = dt6*((ut(1, 1)+ut(1, 0))*u(1, 1)+(vt(1, 1)+vt(0, 1))*&
2089 & v(1, 1)+(ut(1, 1)+vt(1, 1))*u(0, 1))
2093 ke_tl(npx, 1) = dt6*((ut_tl(npx, 1)+ut_tl(npx, 0))*u(npx-1, 1)+(&
2094 & ut(npx, 1)+ut(npx, 0))*u_tl(npx-1, 1)+(vt_tl(npx, 1)+vt_tl(npx&
2095 & -1, 1))*v(npx, 1)+(vt(npx, 1)+vt(npx-1, 1))*v_tl(npx, 1)+(&
2096 & ut_tl(npx, 1)-vt_tl(npx-1, 1))*u(npx, 1)+(ut(npx, 1)-vt(npx-1&
2097 & , 1))*u_tl(npx, 1))
2098 ke(npx, 1) = dt6*((ut(npx, 1)+ut(npx, 0))*u(npx-1, 1)+(vt(npx, 1&
2099 & )+vt(npx-1, 1))*v(npx, 1)+(ut(npx, 1)-vt(npx-1, 1))*u(npx, 1))
2103 ke_tl(npx, npy) = dt6*((ut_tl(npx, npy)+ut_tl(npx, npy-1))*u(npx&
2104 & -1, npy)+(ut(npx, npy)+ut(npx, npy-1))*u_tl(npx-1, npy)+(vt_tl&
2105 & (npx, npy)+vt_tl(npx-1, npy))*v(npx, npy-1)+(vt(npx, npy)+vt(&
2106 & npx-1, npy))*v_tl(npx, npy-1)+(ut_tl(npx, npy-1)+vt_tl(npx-1, &
2107 & npy))*u(npx, npy)+(ut(npx, npy-1)+vt(npx-1, npy))*u_tl(npx, &
2109 ke(npx, npy) = dt6*((ut(npx, npy)+ut(npx, npy-1))*u(npx-1, npy)+&
2110 & (vt(npx, npy)+vt(npx-1, npy))*v(npx, npy-1)+(ut(npx, npy-1)+vt&
2111 & (npx-1, npy))*u(npx, npy))
2115 ke_tl(1, npy) = dt6*((ut_tl(1, npy)+ut_tl(1, npy-1))*u(1, npy)+(&
2116 & ut(1, npy)+ut(1, npy-1))*u_tl(1, npy)+(vt_tl(1, npy)+vt_tl(0, &
2117 & npy))*v(1, npy-1)+(vt(1, npy)+vt(0, npy))*v_tl(1, npy-1)+(&
2118 & ut_tl(1, npy-1)-vt_tl(1, npy))*u(0, npy)+(ut(1, npy-1)-vt(1, &
2119 & npy))*u_tl(0, npy))
2120 ke(1, npy) = dt6*((ut(1, npy)+ut(1, npy-1))*u(1, npy)+(vt(1, npy&
2121 & )+vt(0, npy))*v(1, npy-1)+(ut(1, npy-1)-vt(1, npy))*u(0, npy))
2127 vt_tl(i, j) = dx(i, j)*u_tl(i, j)
2128 vt(i, j) = u(i, j)*dx(i, j)
2133 ut_tl(i, j) = dy(i, j)*v_tl(i, j)
2134 ut(i, j) = v(i, j)*dy(i, j)
2140 wk_tl(i, j) = rarea(i, j)*(vt_tl(i, j)-vt_tl(i, j+1)+ut_tl(i+1, &
2142 wk(i, j) = rarea(i, j)*(vt(i, j)-vt(i, j+1)+(ut(i+1, j)-ut(i, j)&
2146 IF (.NOT.hydrostatic)
THEN 2147 IF (.NOT.flagstruct%do_f3d)
THEN 2150 w_tl(i, j) = (w_tl(i, j)*delp(i, j)-w(i, j)*delp_tl(i, j))/&
2152 w(i, j) = w(i, j)/delp(i, j)
2156 IF (damp_w .GT. 1.e-5)
THEN 2159 w_tl(i, j) = w_tl(i, j) + dw_tl(i, j)
2160 w(i, j) = w(i, j) + dw(i, j)
2341 IF (.NOT.split_damp)
THEN 2343 & dt, vort, vort_tl, ptc, ptc_tl, &
2344 & delpc, delpc_tl, ke, ke_tl, u, &
2345 & u_tl, v, v_tl, uc, uc_tl, vc, &
2346 & vc_tl, ua, ua_tl, va, va_tl, &
2347 & divg_d, divg_d_tl, wk, wk_tl, &
2348 & gridstruct, flagstruct, bd)
2359 & d4_bg_pert, dddmp_pert, dt, vort_tj, &
2360 & vort_tl, ptc_tj, ptc_tl, delpc_tj, &
2361 & delpc_tl, ke_tj, ke_tl, u, u_tl, v, &
2362 & v_tl, uc_tj, uc_tl, vc_tj, vc_tl, ua, &
2363 & ua_tl, va, va_tl, divg_d_tj, divg_d_tl&
2364 & , wk_tj, wk_tl, gridstruct, flagstruct&
2367 vort,ptc,delpc,ke,u,v,uc,vc,ua,va,divg_d,wk, &
2368 gridstruct, flagstruct, bd)
2370 IF (d_con .GT. 1.e-5)
THEN 2373 ub_tl(i, j) = vort_tl(i, j) - vort_tl(i+1, j)
2374 ub(i, j) = vort(i, j) - vort(i+1, j)
2379 vb_tl(i, j) = vort_tl(i, j) - vort_tl(i, j+1)
2380 vb(i, j) = vort(i, j) - vort(i, j+1)
2385 IF (hydrostatic)
THEN 2388 vort_tl(i, j) = wk_tl(i, j)
2389 vort(i, j) = wk(i, j) +
f0(i, j)
2392 ELSE IF (flagstruct%do_f3d)
THEN 2395 vort_tl(i, j) = wk_tl(i, j) +
f0(i, j)*z_rat_tl(i, j)
2396 vort(i, j) = wk(i, j) +
f0(i, j)*z_rat(i, j)
2402 vort_tl(i, j) = wk_tl(i, j)
2403 vort(i, j) = wk(i, j) +
f0(i, j)
2407 IF (hord_vt .EQ. hord_vt_pert)
THEN 2408 CALL fv_tp_2d_tlm(vort, vort_tl, crx_adv, crx_adv_tl, cry_adv, &
2409 & cry_adv_tl, npx, npy, hord_vt, fx, fx_tl, fy, fy_tl&
2410 & , xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
2411 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl)
2413 CALL fv_tp_2d_tlm(vort, vort_tl, crx_adv, crx_adv_tl, cry_adv, &
2414 & cry_adv_tl, npx, npy, hord_vt_pert, fx, fx_tl, fy, &
2415 & fy_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, &
2416 & gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl)
2417 call fv_tp_2d(vort, crx_adv, cry_adv, npx, npy, hord_vt, fx, fy, &
2418 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y)
2422 u_tl(i, j) = vt_tl(i, j) + ke_tl(i, j) - ke_tl(i+1, j) + fy_tl(i&
2424 u(i, j) = vt(i, j) + (ke(i, j)-ke(i+1, j)) + fy(i, j)
2429 v_tl(i, j) = ut_tl(i, j) + ke_tl(i, j) - ke_tl(i, j+1) - fx_tl(i&
2431 v(i, j) = ut(i, j) + (ke(i, j)-ke(i, j+1)) - fx(i, j)
2436 IF (damp_v .GT. 1.e-5)
THEN 2437 pwx1 = damp_v*gridstruct%da_min_c
2440 call del6_vt_flux(nord_v, npx, npy, damp4, wk, vort, ut, vt, gridstruct, bd)
2442 IF (damp_v_pert .GT. 1.e-5)
THEN 2447 pwx1 = damp_v_pert*gridstruct%da_min_c
2448 pwy1 = nord_v_pert + 1
2450 CALL del6_vt_flux_tlm(nord_v_pert, npx, npy, damp4, wk_tj, wk_tl, vort_tj, &
2451 & vort_tl, ut_tj, ut_tl, vt_tj, vt_tl, gridstruct, bd)
2453 IF (d_con .GT. 1.e-5)
THEN 2456 ub_tl(i, j) = rdx(i, j)*(ub_tl(i, j)+vt_tl(i, j))
2457 ub(i, j) = (ub(i, j)+vt(i, j))*rdx(i, j)
2458 fy_tl(i, j) = rdx(i, j)*u_tl(i, j)
2459 fy(i, j) = u(i, j)*rdx(i, j)
2460 gy_tl(i, j) = fy_tl(i, j)*ub(i, j) + fy(i, j)*ub_tl(i, j)
2461 gy(i, j) = fy(i, j)*ub(i, j)
2466 vb_tl(i, j) = rdy(i, j)*(vb_tl(i, j)-ut_tl(i, j))
2467 vb(i, j) = (vb(i, j)-ut(i, j))*rdy(i, j)
2468 fx_tl(i, j) = rdy(i, j)*v_tl(i, j)
2469 fx(i, j) = v(i, j)*rdy(i, j)
2470 gx_tl(i, j) = fx_tl(i, j)*vb(i, j) + fx(i, j)*vb_tl(i, j)
2471 gx(i, j) = fx(i, j)*vb(i, j)
2480 u2_tl = fy_tl(i, j) + fy_tl(i, j+1)
2481 u2 = fy(i, j) + fy(i, j+1)
2482 du2_tl = ub_tl(i, j) + ub_tl(i, j+1)
2483 du2 = ub(i, j) + ub(i, j+1)
2484 v2_tl = fx_tl(i, j) + fx_tl(i+1, j)
2485 v2 = fx(i, j) + fx(i+1, j)
2486 dv2_tl = vb_tl(i, j) + vb_tl(i+1, j)
2487 dv2 = vb(i, j) + vb(i+1, j)
2490 heat_source_tl(i, j) = delp_tl(i, j)*(heat_source(i, j)-damp*&
2491 & rsin2(i, j)*(ub(i, j)**2+ub(i, j+1)**2+vb(i, j)**2+vb(i+1, j&
2492 & )**2+2.*(gy(i, j)+gy(i, j+1)+gx(i, j)+gx(i+1, j))-cosa_s(i, &
2493 & j)*(
u2*dv2+v2*du2+du2*dv2))) + delp(i, j)*(heat_source_tl(i&
2494 & , j)-damp*rsin2(i, j)*(2*ub(i, j)*ub_tl(i, j)+2*ub(i, j+1)*&
2495 & ub_tl(i, j+1)+2*vb(i, j)*vb_tl(i, j)+2*vb(i+1, j)*vb_tl(i+1&
2496 & , j)+2.*(gy_tl(i, j)+gy_tl(i, j+1)+gx_tl(i, j)+gx_tl(i+1, j)&
2497 & )-cosa_s(i, j)*(u2_tl*dv2+
u2*dv2_tl+v2_tl*du2+v2*du2_tl+&
2498 & du2_tl*dv2+du2*dv2_tl)))
2499 heat_source(i, j) = delp(i, j)*(heat_source(i, j)-damp*rsin2(i&
2500 & , j)*(ub(i, j)**2+ub(i, j+1)**2+vb(i, j)**2+vb(i+1, j)**2+2.&
2501 & *(gy(i, j)+gy(i, j+1)+gx(i, j)+gx(i+1, j))-cosa_s(i, j)*(
u2*&
2502 & dv2+v2*du2+du2*dv2)))
2507 IF (damp_v .GT. 1.e-5)
THEN 2510 u(i, j) = u(i, j) + vt(i, j)
2515 v(i, j) = v(i, j) - ut(i, j)
2519 IF (damp_v_pert .GT. 1.e-5)
THEN 2522 u_tl(i, j) = u_tl(i, j) + vt_tl(i, j)
2527 v_tl(i, j) = v_tl(i, j) - ut_tl(i, j)
2533 SUBROUTINE d_sw(delpc, delp, ptc, pt, u, v, w, uc, vc, ua, va, divg_d&
2534 & , xflux, yflux, cx, cy, crx_adv, cry_adv, xfx_adv, yfx_adv, q_con, &
2535 & z_rat, kgb, heat_source, dpx, zvir, sphum, nq, q, k, km, inline_q, &
2536 & dt, hord_tr, hord_mt, hord_vt, hord_tm, hord_dp, nord, nord_v, &
2537 & nord_w, nord_t, dddmp, d2_bg, d4_bg, damp_v, damp_w, damp_t, d_con, &
2538 & hydrostatic, gridstruct, flagstruct, bd, hord_tr_pert, hord_mt_pert&
2539 & , hord_vt_pert, hord_tm_pert, hord_dp_pert, split_damp, nord_pert, &
2540 & nord_v_pert, nord_w_pert, nord_t_pert, dddmp_pert, d2_bg_pert, &
2541 & d4_bg_pert, damp_v_pert, damp_w_pert, damp_t_pert)
2543 INTEGER,
INTENT(IN) :: hord_tr, hord_mt, hord_vt, hord_tm, hord_dp
2545 INTEGER,
INTENT(IN) :: nord
2547 INTEGER,
INTENT(IN) :: nord_v
2549 INTEGER,
INTENT(IN) :: nord_w
2551 INTEGER,
INTENT(IN) :: nord_t
2552 INTEGER,
INTENT(IN) :: sphum, nq, k, km
2553 REAL,
INTENT(IN) :: dt, dddmp, d2_bg, d4_bg, d_con
2554 REAL,
INTENT(IN) :: zvir
2555 REAL,
INTENT(IN) :: damp_v, damp_w, damp_t, kgb
2557 INTEGER,
INTENT(IN) :: hord_tr_pert, hord_mt_pert, hord_vt_pert, &
2558 & hord_tm_pert, hord_dp_pert, nord_pert, nord_v_pert, nord_w_pert, &
2560 LOGICAL,
INTENT(IN) :: split_damp
2561 REAL,
INTENT(IN) :: dddmp_pert, d2_bg_pert, d4_bg_pert, damp_v_pert&
2562 & , damp_w_pert, damp_t_pert
2564 REAL,
INTENT(INOUT) :: divg_d(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
2565 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: z_rat
2566 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: delp&
2568 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: w
2569 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
2571 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: u&
2573 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: v&
2575 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed, km, nq)
2576 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: delpc&
2578 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je),
INTENT(OUT) :: &
2580 REAL(kind=8),
DIMENSION(bd%is:bd%ie, bd%js:bd%je),
INTENT(INOUT) :: &
2583 REAL,
INTENT(INOUT) :: xflux(bd%is:bd%ie+1, bd%js:bd%je)
2584 REAL,
INTENT(INOUT) :: yflux(bd%is:bd%ie, bd%js:bd%je+1)
2586 REAL,
INTENT(INOUT) :: cx(bd%is:bd%ie+1, bd%jsd:bd%jed)
2587 REAL,
INTENT(INOUT) :: cy(bd%isd:bd%ied, bd%js:bd%je+1)
2588 LOGICAL,
INTENT(IN) :: hydrostatic
2589 LOGICAL,
INTENT(IN) :: inline_q
2590 REAL,
DIMENSION(bd%is:bd%ie+1, bd%jsd:bd%jed),
INTENT(OUT) :: &
2592 REAL,
DIMENSION(bd%isd:bd%ied, bd%js:bd%je+1),
INTENT(OUT) :: &
2597 LOGICAL :: sw_corner, se_corner, ne_corner, nw_corner
2598 REAL :: ut(bd%isd:bd%ied+1, bd%jsd:bd%jed)
2599 REAL :: vt(bd%isd:bd%ied, bd%jsd:bd%jed+1)
2601 REAL :: fx2(bd%isd:bd%ied+1, bd%jsd:bd%jed)
2602 REAL :: fy2(bd%isd:bd%ied, bd%jsd:bd%jed+1)
2604 REAL :: dw(bd%is:bd%ie, bd%js:bd%je)
2606 REAL,
DIMENSION(bd%is:bd%ie+1, bd%js:bd%je+1) :: ub, vb
2608 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
2610 REAL :: ke(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
2612 REAL :: vort(bd%isd:bd%ied, bd%jsd:bd%jed)
2614 REAL :: fx(bd%is:bd%ie+1, bd%js:bd%je)
2616 REAL :: fy(bd%is:bd%ie, bd%js:bd%je+1)
2617 REAL :: ra_x(bd%is:bd%ie, bd%jsd:bd%jed)
2618 REAL :: ra_y(bd%isd:bd%ied, bd%js:bd%je)
2619 REAL :: gx(bd%is:bd%ie+1, bd%js:bd%je)
2621 REAL :: gy(bd%is:bd%ie, bd%js:bd%je+1)
2623 REAL :: dt2, dt4, dt5, dt6
2624 REAL :: damp, damp2, damp4, dd8,
u2, v2, du2, dv2
2626 INTEGER :: i, j, is2, ie1, js2, je1, n, nt, n2, iq
2627 REAL,
DIMENSION(:, :),
POINTER :: area, area_c, rarea
2628 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg
2629 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v, cosa_s
2630 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
2631 REAL,
DIMENSION(:, :),
POINTER :: rsin_u, rsin_v, rsina
2632 REAL,
DIMENSION(:, :),
POINTER ::
f0, rsin2, divg_u, divg_v
2633 REAL,
DIMENSION(:, :),
POINTER :: cosa, dx, dy, dxc, dyc, rdxa, rdya&
2635 INTEGER :: is, ie, js, je
2636 INTEGER :: isd, ied, jsd, jed
2639 REAL :: delp_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
2640 REAL :: pt_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
2641 REAL :: vort_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
2642 REAL :: wk_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
2643 REAL :: delpc_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
2644 REAL :: ptc_tj(bd%isd:bd%ied, bd%jsd:bd%jed)
2645 REAL :: ke_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
2646 REAL :: vc_tj(bd%isd:bd%ied, bd%jsd:bd%jed+1)
2647 REAL :: uc_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed)
2648 REAL :: divg_d_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
2649 REAL :: ut_tj(bd%isd:bd%ied+1, bd%jsd:bd%jed)
2650 REAL :: vt_tj(bd%isd:bd%ied, bd%jsd:bd%jed+1)
2673 npx = flagstruct%npx
2674 npy = flagstruct%npy
2675 nested = gridstruct%nested
2676 area => gridstruct%area
2677 rarea => gridstruct%rarea
2678 sin_sg => gridstruct%sin_sg
2679 cosa_u => gridstruct%cosa_u
2680 cosa_v => gridstruct%cosa_v
2681 cosa_s => gridstruct%cosa_s
2682 sina_u => gridstruct%sina_u
2683 sina_v => gridstruct%sina_v
2684 rsin_u => gridstruct%rsin_u
2685 rsin_v => gridstruct%rsin_v
2686 rsina => gridstruct%rsina
2688 rsin2 => gridstruct%rsin2
2689 divg_u => gridstruct%divg_u
2690 divg_v => gridstruct%divg_v
2691 cosa => gridstruct%cosa
2694 dxc => gridstruct%dxc
2695 dyc => gridstruct%dyc
2696 rdxa => gridstruct%rdxa
2697 rdya => gridstruct%rdya
2698 rdx => gridstruct%rdx
2699 rdy => gridstruct%rdy
2700 sw_corner = gridstruct%sw_corner
2701 se_corner = gridstruct%se_corner
2702 nw_corner = gridstruct%nw_corner
2703 ne_corner = gridstruct%ne_corner
2705 IF (flagstruct%grid_type .LT. 3)
THEN 2710 ut(i, j) = (uc(i, j)-0.25*cosa_u(i, j)*(vc(i-1, j)+vc(i, j)+&
2711 & vc(i-1, j+1)+vc(i, j+1)))*rsin_u(i, j)
2716 vt(i, j) = (vc(i, j)-0.25*cosa_v(i, j)*(uc(i, j-1)+uc(i+1, j&
2717 & -1)+uc(i, j)+uc(i+1, j)))*rsin_v(i, j)
2722 IF (j .NE. 0 .AND. j .NE. 1 .AND. j .NE. npy - 1 .AND. j .NE. &
2725 ut(i, j) = (uc(i, j)-0.25*cosa_u(i, j)*(vc(i-1, j)+vc(i, j&
2726 & )+vc(i-1, j+1)+vc(i, j+1)))*rsin_u(i, j)
2731 IF (j .NE. 1 .AND. j .NE. npy)
THEN 2733 vt(i, j) = (vc(i, j)-0.25*cosa_v(i, j)*(uc(i, j-1)+uc(i+1&
2734 & , j-1)+uc(i, j)+uc(i+1, j)))*rsin_v(i, j)
2740 IF (.NOT.nested)
THEN 2745 IF (uc(1, j)*dt .GT. 0.)
THEN 2746 ut(1, j) = uc(1, j)/sin_sg(0, j, 3)
2748 ut(1, j) = uc(1, j)/sin_sg(1, j, 1)
2756 IF (npy - 2 .GT. je + 1)
THEN 2762 vt(0, j) = vc(0, j) - 0.25*cosa_v(0, j)*(ut(0, j-1)+ut(1, j-&
2763 & 1)+ut(0, j)+ut(1, j))
2764 vt(1, j) = vc(1, j) - 0.25*cosa_v(1, j)*(ut(1, j-1)+ut(2, j-&
2765 & 1)+ut(1, j)+ut(2, j))
2769 IF (ie + 1 .EQ. npx)
THEN 2771 IF (uc(npx, j)*dt .GT. 0.)
THEN 2772 ut(npx, j) = uc(npx, j)/sin_sg(npx-1, j, 3)
2774 ut(npx, j) = uc(npx, j)/sin_sg(npx, j, 1)
2782 IF (npy - 2 .GT. je + 1)
THEN 2788 vt(npx-1, j) = vc(npx-1, j) - 0.25*cosa_v(npx-1, j)*(ut(npx-&
2789 & 1, j-1)+ut(npx, j-1)+ut(npx-1, j)+ut(npx, j))
2790 vt(npx, j) = vc(npx, j) - 0.25*cosa_v(npx, j)*(ut(npx, j-1)+&
2791 & ut(npx+1, j-1)+ut(npx, j)+ut(npx+1, j))
2797 IF (vc(i, 1)*dt .GT. 0.)
THEN 2798 vt(i, 1) = vc(i, 1)/sin_sg(i, 0, 4)
2800 vt(i, 1) = vc(i, 1)/sin_sg(i, 1, 2)
2808 IF (npx - 2 .GT. ie + 1)
THEN 2814 ut(i, 0) = uc(i, 0) - 0.25*cosa_u(i, 0)*(vt(i-1, 0)+vt(i, 0)&
2815 & +vt(i-1, 1)+vt(i, 1))
2816 ut(i, 1) = uc(i, 1) - 0.25*cosa_u(i, 1)*(vt(i-1, 1)+vt(i, 1)&
2817 & +vt(i-1, 2)+vt(i, 2))
2821 IF (je + 1 .EQ. npy)
THEN 2823 IF (vc(i, npy)*dt .GT. 0.)
THEN 2824 vt(i, npy) = vc(i, npy)/sin_sg(i, npy-1, 4)
2826 vt(i, npy) = vc(i, npy)/sin_sg(i, npy, 2)
2834 IF (npx - 2 .GT. ie + 1)
THEN 2840 ut(i, npy-1) = uc(i, npy-1) - 0.25*cosa_u(i, npy-1)*(vt(i-1&
2841 & , npy-1)+vt(i, npy-1)+vt(i-1, npy)+vt(i, npy))
2842 ut(i, npy) = uc(i, npy) - 0.25*cosa_u(i, npy)*(vt(i-1, npy)+&
2843 & vt(i, npy)+vt(i-1, npy+1)+vt(i, npy+1))
2855 damp = 1./(1.-0.0625*cosa_u(2, 0)*cosa_v(1, 0))
2856 ut(2, 0) = (uc(2, 0)-0.25*cosa_u(2, 0)*(vt(1, 1)+vt(2, 1)+vt(2&
2857 & , 0)+vc(1, 0)-0.25*cosa_v(1, 0)*(ut(1, 0)+ut(1, -1)+ut(2, -1&
2859 damp = 1./(1.-0.0625*cosa_u(0, 1)*cosa_v(0, 2))
2860 vt(0, 2) = (vc(0, 2)-0.25*cosa_v(0, 2)*(ut(1, 1)+ut(1, 2)+ut(0&
2861 & , 2)+uc(0, 1)-0.25*cosa_u(0, 1)*(vt(0, 1)+vt(-1, 1)+vt(-1, 2&
2863 damp = 1./(1.-0.0625*cosa_u(2, 1)*cosa_v(1, 2))
2864 ut(2, 1) = (uc(2, 1)-0.25*cosa_u(2, 1)*(vt(1, 1)+vt(2, 1)+vt(2&
2865 & , 2)+vc(1, 2)-0.25*cosa_v(1, 2)*(ut(1, 1)+ut(1, 2)+ut(2, 2))&
2867 vt(1, 2) = (vc(1, 2)-0.25*cosa_v(1, 2)*(ut(1, 1)+ut(1, 2)+ut(2&
2868 & , 2)+uc(2, 1)-0.25*cosa_u(2, 1)*(vt(1, 1)+vt(2, 1)+vt(2, 2))&
2872 damp = 1./(1.-0.0625*cosa_u(npx-1, 0)*cosa_v(npx-1, 0))
2873 ut(npx-1, 0) = (uc(npx-1, 0)-0.25*cosa_u(npx-1, 0)*(vt(npx-1, &
2874 & 1)+vt(npx-2, 1)+vt(npx-2, 0)+vc(npx-1, 0)-0.25*cosa_v(npx-1&
2875 & , 0)*(ut(npx, 0)+ut(npx, -1)+ut(npx-1, -1))))*damp
2876 damp = 1./(1.-0.0625*cosa_u(npx+1, 1)*cosa_v(npx, 2))
2877 vt(npx, 2) = (vc(npx, 2)-0.25*cosa_v(npx, 2)*(ut(npx, 1)+ut(&
2878 & npx, 2)+ut(npx+1, 2)+uc(npx+1, 1)-0.25*cosa_u(npx+1, 1)*(vt(&
2879 & npx, 1)+vt(npx+1, 1)+vt(npx+1, 2))))*damp
2880 damp = 1./(1.-0.0625*cosa_u(npx-1, 1)*cosa_v(npx-1, 2))
2881 ut(npx-1, 1) = (uc(npx-1, 1)-0.25*cosa_u(npx-1, 1)*(vt(npx-1, &
2882 & 1)+vt(npx-2, 1)+vt(npx-2, 2)+vc(npx-1, 2)-0.25*cosa_v(npx-1&
2883 & , 2)*(ut(npx, 1)+ut(npx, 2)+ut(npx-1, 2))))*damp
2884 vt(npx-1, 2) = (vc(npx-1, 2)-0.25*cosa_v(npx-1, 2)*(ut(npx, 1)&
2885 & +ut(npx, 2)+ut(npx-1, 2)+uc(npx-1, 1)-0.25*cosa_u(npx-1, 1)*&
2886 & (vt(npx-1, 1)+vt(npx-2, 1)+vt(npx-2, 2))))*damp
2889 damp = 1./(1.-0.0625*cosa_u(npx-1, npy)*cosa_v(npx-1, npy+1))
2890 ut(npx-1, npy) = (uc(npx-1, npy)-0.25*cosa_u(npx-1, npy)*(vt(&
2891 & npx-1, npy)+vt(npx-2, npy)+vt(npx-2, npy+1)+vc(npx-1, npy+1)&
2892 & -0.25*cosa_v(npx-1, npy+1)*(ut(npx, npy)+ut(npx, npy+1)+ut(&
2893 & npx-1, npy+1))))*damp
2894 damp = 1./(1.-0.0625*cosa_u(npx+1, npy-1)*cosa_v(npx, npy-1))
2895 vt(npx, npy-1) = (vc(npx, npy-1)-0.25*cosa_v(npx, npy-1)*(ut(&
2896 & npx, npy-1)+ut(npx, npy-2)+ut(npx+1, npy-2)+uc(npx+1, npy-1)&
2897 & -0.25*cosa_u(npx+1, npy-1)*(vt(npx, npy)+vt(npx+1, npy)+vt(&
2898 & npx+1, npy-1))))*damp
2899 damp = 1./(1.-0.0625*cosa_u(npx-1, npy-1)*cosa_v(npx-1, npy-1)&
2901 ut(npx-1, npy-1) = (uc(npx-1, npy-1)-0.25*cosa_u(npx-1, npy-1)&
2902 & *(vt(npx-1, npy)+vt(npx-2, npy)+vt(npx-2, npy-1)+vc(npx-1, &
2903 & npy-1)-0.25*cosa_v(npx-1, npy-1)*(ut(npx, npy-1)+ut(npx, npy&
2904 & -2)+ut(npx-1, npy-2))))*damp
2905 vt(npx-1, npy-1) = (vc(npx-1, npy-1)-0.25*cosa_v(npx-1, npy-1)&
2906 & *(ut(npx, npy-1)+ut(npx, npy-2)+ut(npx-1, npy-2)+uc(npx-1, &
2907 & npy-1)-0.25*cosa_u(npx-1, npy-1)*(vt(npx-1, npy)+vt(npx-2, &
2908 & npy)+vt(npx-2, npy-1))))*damp
2911 damp = 1./(1.-0.0625*cosa_u(2, npy)*cosa_v(1, npy+1))
2912 ut(2, npy) = (uc(2, npy)-0.25*cosa_u(2, npy)*(vt(1, npy)+vt(2&
2913 & , npy)+vt(2, npy+1)+vc(1, npy+1)-0.25*cosa_v(1, npy+1)*(ut(1&
2914 & , npy)+ut(1, npy+1)+ut(2, npy+1))))*damp
2915 damp = 1./(1.-0.0625*cosa_u(0, npy-1)*cosa_v(0, npy-1))
2916 vt(0, npy-1) = (vc(0, npy-1)-0.25*cosa_v(0, npy-1)*(ut(1, npy-&
2917 & 1)+ut(1, npy-2)+ut(0, npy-2)+uc(0, npy-1)-0.25*cosa_u(0, npy&
2918 & -1)*(vt(0, npy)+vt(-1, npy)+vt(-1, npy-1))))*damp
2919 damp = 1./(1.-0.0625*cosa_u(2, npy-1)*cosa_v(1, npy-1))
2920 ut(2, npy-1) = (uc(2, npy-1)-0.25*cosa_u(2, npy-1)*(vt(1, npy)&
2921 & +vt(2, npy)+vt(2, npy-1)+vc(1, npy-1)-0.25*cosa_v(1, npy-1)*&
2922 & (ut(1, npy-1)+ut(1, npy-2)+ut(2, npy-2))))*damp
2923 vt(1, npy-1) = (vc(1, npy-1)-0.25*cosa_v(1, npy-1)*(ut(1, npy-&
2924 & 1)+ut(1, npy-2)+ut(2, npy-2)+uc(2, npy-1)-0.25*cosa_u(2, npy&
2925 & -1)*(vt(1, npy)+vt(2, npy)+vt(2, npy-1))))*damp
2943 xfx_adv(i, j) = dt*ut(i, j)
2948 yfx_adv(i, j) = dt*vt(i, j)
2957 IF (xfx_adv(i, j) .GT. 0.)
THEN 2958 crx_adv(i, j) = xfx_adv(i, j)*rdxa(i-1, j)
2959 xfx_adv(i, j) = dy(i, j)*xfx_adv(i, j)*sin_sg(i-1, j, 3)
2961 crx_adv(i, j) = xfx_adv(i, j)*rdxa(i, j)
2962 xfx_adv(i, j) = dy(i, j)*xfx_adv(i, j)*sin_sg(i, j, 1)
2969 IF (yfx_adv(i, j) .GT. 0.)
THEN 2970 cry_adv(i, j) = yfx_adv(i, j)*rdya(i, j-1)
2971 yfx_adv(i, j) = dx(i, j)*yfx_adv(i, j)*sin_sg(i, j-1, 4)
2973 cry_adv(i, j) = yfx_adv(i, j)*rdya(i, j)
2974 yfx_adv(i, j) = dx(i, j)*yfx_adv(i, j)*sin_sg(i, j, 2)
2980 ra_x(i, j) = area(i, j) + (xfx_adv(i, j)-xfx_adv(i+1, j))
2985 ra_y(i, j) = area(i, j) + (yfx_adv(i, j)-yfx_adv(i, j+1))
2988 IF (hord_dp .EQ. hord_dp_pert .AND. (.NOT.split_damp))
THEN 2989 CALL fv_tp_2d(delp, crx_adv, cry_adv, npx, npy, hord_dp, fx, fy&
2990 & , xfx_adv, yfx_adv, gridstruct, bd, ra_x, ra_y, nord=&
2991 & nord_v, damp_c=damp_v)
2993 call fv_tp_2d(delp, crx_adv, cry_adv, npx, npy, hord_dp, fx, fy, &
2994 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y, nord=nord_v, damp_c=damp_v)
2999 cx(i, j) = cx(i, j) + crx_adv(i, j)
3004 xflux(i, j) = xflux(i, j) + fx(i, j)
3009 cy(i, j) = cy(i, j) + cry_adv(i, j)
3012 yflux(i, j) = yflux(i, j) + fy(i, j)
3017 heat_source(i, j) = 0.
3020 IF (.NOT.hydrostatic)
THEN 3021 IF (damp_w .GT. 1.e-5)
THEN 3022 IF (dt .GE. 0.)
THEN 3028 pwx1 = damp_w*gridstruct%da_min_c
3031 CALL del6_vt_flux(nord_w, npx, npy, damp4, w, wk, fx2, fy2, &
3035 dw(i, j) = (fx2(i, j)-fx2(i+1, j)+(fy2(i, j)-fy2(i, j+1)))*&
3039 heat_source(i, j) = dd8 - dw(i, j)*(w(i, j)+0.5*dw(i, j))
3043 IF (hord_vt .EQ. hord_vt_pert)
THEN 3044 CALL fv_tp_2d(w, crx_adv, cry_adv, npx, npy, hord_vt, gx, gy&
3045 & , xfx_adv, yfx_adv, gridstruct, bd, ra_x, ra_y, mfx=&
3048 call fv_tp_2d(w, crx_adv,cry_adv, npx, npy, hord_vt, gx, gy, xfx_adv, yfx_adv, &
3049 gridstruct, bd, ra_x, ra_y, mfx=fx, mfy=fy)
3053 w(i, j) = delp(i, j)*w(i, j) + (gx(i, j)-gx(i+1, j)+(gy(i, j)-&
3054 & gy(i, j+1)))*rarea(i, j)
3065 IF (hord_tm .EQ. hord_tm_pert .AND. (.NOT.split_damp))
THEN 3066 CALL fv_tp_2d(pt, crx_adv, cry_adv, npx, npy, hord_tm, gx, gy, &
3067 & xfx_adv, yfx_adv, gridstruct, bd, ra_x, ra_y, fx, fy, &
3068 & delp, nord_t, damp_t)
3070 call fv_tp_2d(pt, crx_adv,cry_adv, npx, npy, hord_tm, gx, gy, &
3071 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y, &
3072 mfx=fx, mfy=fy, mass=delp, nord=nord_t, damp_c=damp_t)
3077 wk(i, j) = delp(i, j)
3078 delp(i, j) = wk(i, j) + (fx(i, j)-fx(i+1, j)+(fy(i, j)-fy(i, j&
3080 pt(i, j) = (pt(i, j)*wk(i, j)+(gx(i, j)-gx(i+1, j)+(gy(i, j)-&
3081 & gy(i, j+1)))*rarea(i, j))/delp(i, j)
3085 IF (hord_tr .EQ. hord_tr_pert)
THEN 3086 CALL fv_tp_2d(q(isd:ied, jsd:jed, k, iq), crx_adv, cry_adv&
3087 & , npx, npy, hord_tr, gx, gy, xfx_adv, yfx_adv, &
3088 & gridstruct, bd, ra_x, ra_y, fx, fy, delp, nord_t, &
3091 call fv_tp_2d(q(isd:ied,jsd:jed,k,iq), crx_adv,cry_adv, npx, npy, hord_tr, gx, gy, &
3092 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y, &
3093 mfx=fx, mfy=fy, mass=delp, nord=nord_t, damp_c=damp_t)
3097 q(i, j, k, iq) = (q(i, j, k, iq)*wk(i, j)+(gx(i, j)-gx(i+1, &
3098 & j)+(gy(i, j)-gy(i, j+1)))*rarea(i, j))/delp(i, j)
3112 pt(i, j) = pt(i, j)*delp(i, j) + (gx(i, j)-gx(i+1, j)+(gy(i, j&
3113 & )-gy(i, j+1)))*rarea(i, j)
3114 delp(i, j) = delp(i, j) + (fx(i, j)-fx(i+1, j)+(fy(i, j)-fy(i&
3115 & , j+1)))*rarea(i, j)
3116 pt(i, j) = pt(i, j)/delp(i, j)
3120 IF (
fpp%fpp_overload_r4)
THEN 3123 dpx(i, j) = dpx(i, j) + (fx(i, j)-fx(i+1, j)+(fy(i, j)-fy(i, j&
3145 IF (npx - 1 .GT. ie + 1)
THEN 3155 IF (npy - 1 .GT. je + 1)
THEN 3162 IF (flagstruct%grid_type .LT. 3)
THEN 3166 vb(i, j) = dt5*(vc(i-1, j)+vc(i, j)-(uc(i, j-1)+uc(i, j))*&
3167 & cosa(i, j))*rsina(i, j)
3174 vb(i, 1) = dt5*(vt(i-1, 1)+vt(i, 1))
3179 vb(i, j) = dt5*(vc(i-1, j)+vc(i, j)-(uc(i, j-1)+uc(i, j))*&
3180 & cosa(i, j))*rsina(i, j)
3182 IF (is .EQ. 1) vb(1, j) = dt4*(-vt(-1, j)+3.*(vt(0, j)+vt(1, j&
3185 IF (ie + 1 .EQ. npx) vb(npx, j) = dt4*(-vt(npx-2, j)+3.*(vt(&
3186 & npx-1, j)+vt(npx, j))-vt(npx+1, j))
3189 IF (je + 1 .EQ. npy)
THEN 3192 vb(i, npy) = dt5*(vt(i-1, npy)+vt(i, npy))
3199 vb(i, j) = dt5*(vc(i-1, j)+vc(i, j))
3203 IF (hord_mt .EQ. hord_mt_pert)
THEN 3204 CALL ytp_v(is, ie, js, je, isd, ied, jsd, jed, vb, u, v, ub, &
3205 & hord_mt, gridstruct%dy, gridstruct%rdy, npx, npy, &
3206 & flagstruct%grid_type, nested)
3208 call ytp_v(is,ie,js,je,isd,ied,jsd,jed, vb, u, v, ub, hord_mt, gridstruct%dy, gridstruct%rdy, &
3209 npx, npy, flagstruct%grid_type, nested)
3213 ke(i, j) = vb(i, j)*ub(i, j)
3216 IF (flagstruct%grid_type .LT. 3)
THEN 3220 ub(i, j) = dt5*(uc(i, j-1)+uc(i, j)-(vc(i-1, j)+vc(i, j))*&
3221 & cosa(i, j))*rsina(i, j)
3228 ub(1, j) = dt5*(ut(1, j-1)+ut(1, j))
3232 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 3235 ub(i, j) = dt4*(-ut(i, j-2)+3.*(ut(i, j-1)+ut(i, j))-ut(i&
3240 ub(i, j) = dt5*(uc(i, j-1)+uc(i, j)-(vc(i-1, j)+vc(i, j))*&
3241 & cosa(i, j))*rsina(i, j)
3245 IF (ie + 1 .EQ. npx)
THEN 3248 ub(npx, j) = dt5*(ut(npx, j-1)+ut(npx, j))
3255 ub(i, j) = dt5*(uc(i, j-1)+uc(i, j))
3259 IF (hord_mt .EQ. hord_mt_pert)
THEN 3260 CALL xtp_u(is, ie, js, je, isd, ied, jsd, jed, ub, u, v, vb, &
3261 & hord_mt, gridstruct%dx, gridstruct%rdx, npx, npy, &
3262 & flagstruct%grid_type, nested)
3264 call xtp_u(is,ie,js,je, isd,ied,jsd,jed, ub, u, v, vb, hord_mt, gridstruct%dx, gridstruct%rdx, &
3265 npx, npy, flagstruct%grid_type, nested)
3269 ke(i, j) = 0.5*(ke(i, j)+ub(i, j)*vb(i, j))
3275 IF (.NOT.nested)
THEN 3277 IF (sw_corner) ke(1, 1) = dt6*((ut(1, 1)+ut(1, 0))*u(1, 1)+(vt(1, &
3278 & 1)+vt(0, 1))*v(1, 1)+(ut(1, 1)+vt(1, 1))*u(0, 1))
3279 IF (se_corner) ke(npx, 1) = dt6*((ut(npx, 1)+ut(npx, 0))*u(npx-1, &
3280 & 1)+(vt(npx, 1)+vt(npx-1, 1))*v(npx, 1)+(ut(npx, 1)-vt(npx-1, 1&
3283 IF (ne_corner) ke(npx, npy) = dt6*((ut(npx, npy)+ut(npx, npy-1))*u&
3284 & (npx-1, npy)+(vt(npx, npy)+vt(npx-1, npy))*v(npx, npy-1)+(ut(&
3285 & npx, npy-1)+vt(npx-1, npy))*u(npx, npy))
3287 IF (nw_corner) ke(1, npy) = dt6*((ut(1, npy)+ut(1, npy-1))*u(1, &
3288 & npy)+(vt(1, npy)+vt(0, npy))*v(1, npy-1)+(ut(1, npy-1)-vt(1, &
3295 vt(i, j) = u(i, j)*dx(i, j)
3300 ut(i, j) = v(i, j)*dy(i, j)
3306 wk(i, j) = rarea(i, j)*(vt(i, j)-vt(i, j+1)+(ut(i+1, j)-ut(i, j)&
3310 IF (.NOT.hydrostatic)
THEN 3311 IF (.NOT.flagstruct%do_f3d)
THEN 3314 w(i, j) = w(i, j)/delp(i, j)
3318 IF (damp_w .GT. 1.e-5)
THEN 3321 w(i, j) = w(i, j) + dw(i, j)
3502 IF (.NOT.split_damp)
THEN 3504 & vort, ptc, delpc, ke, u, v, uc, vc, &
3505 & ua, va, divg_d, wk, gridstruct, &
3509 vort,ptc,delpc,ke,u,v,uc,vc,ua,va,divg_d,wk, &
3510 gridstruct, flagstruct, bd)
3512 IF (d_con .GT. 1.e-5)
THEN 3515 ub(i, j) = vort(i, j) - vort(i+1, j)
3520 vb(i, j) = vort(i, j) - vort(i, j+1)
3525 IF (hydrostatic)
THEN 3528 vort(i, j) = wk(i, j) +
f0(i, j)
3531 ELSE IF (flagstruct%do_f3d)
THEN 3534 vort(i, j) = wk(i, j) +
f0(i, j)*z_rat(i, j)
3540 vort(i, j) = wk(i, j) +
f0(i, j)
3544 IF (hord_vt .EQ. hord_vt_pert)
THEN 3545 CALL fv_tp_2d(vort, crx_adv, cry_adv, npx, npy, hord_vt, fx, fy&
3546 & , xfx_adv, yfx_adv, gridstruct, bd, ra_x, ra_y)
3548 call fv_tp_2d(vort, crx_adv, cry_adv, npx, npy, hord_vt, fx, fy, &
3549 xfx_adv,yfx_adv, gridstruct, bd, ra_x, ra_y)
3553 u(i, j) = vt(i, j) + (ke(i, j)-ke(i+1, j)) + fy(i, j)
3558 v(i, j) = ut(i, j) + (ke(i, j)-ke(i, j+1)) - fx(i, j)
3563 IF (damp_v .GT. 1.e-5)
THEN 3564 pwx1 = damp_v*gridstruct%da_min_c
3567 CALL del6_vt_flux(nord_v, npx, npy, damp4, wk, vort, ut, vt, &
3570 IF (d_con .GT. 1.e-5)
THEN 3573 ub(i, j) = (ub(i, j)+vt(i, j))*rdx(i, j)
3574 fy(i, j) = u(i, j)*rdx(i, j)
3575 gy(i, j) = fy(i, j)*ub(i, j)
3580 vb(i, j) = (vb(i, j)-ut(i, j))*rdy(i, j)
3581 fx(i, j) = v(i, j)*rdy(i, j)
3582 gx(i, j) = fx(i, j)*vb(i, j)
3591 u2 = fy(i, j) + fy(i, j+1)
3592 du2 = ub(i, j) + ub(i, j+1)
3593 v2 = fx(i, j) + fx(i+1, j)
3594 dv2 = vb(i, j) + vb(i+1, j)
3597 heat_source(i, j) = delp(i, j)*(heat_source(i, j)-damp*rsin2(i&
3598 & , j)*(ub(i, j)**2+ub(i, j+1)**2+vb(i, j)**2+vb(i+1, j)**2+2.&
3599 & *(gy(i, j)+gy(i, j+1)+gx(i, j)+gx(i+1, j))-cosa_s(i, j)*(
u2*&
3600 & dv2+v2*du2+du2*dv2)))
3605 IF (damp_v .GT. 1.e-5)
THEN 3608 u(i, j) = u(i, j) + vt(i, j)
3613 v(i, j) = v(i, j) - ut(i, j)
3622 & fx2, fx2_tl, fy2, fy2_tl, gridstruct, bd)
3631 INTEGER,
INTENT(IN) :: nord, npx, npy
3632 REAL,
INTENT(IN) :: damp
3635 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
3636 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
3639 REAL,
INTENT(OUT) :: d2(bd%isd:bd%ied, bd%jsd:bd%jed)
3640 REAL,
INTENT(OUT) :: d2_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
3641 REAL,
INTENT(OUT) :: fx2(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy2(bd%isd&
3642 & :bd%ied, bd%jsd:bd%jed+1)
3643 REAL,
INTENT(OUT) :: fx2_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy2_tl(&
3644 & bd%isd:bd%ied, bd%jsd:bd%jed+1)
3645 INTEGER :: i, j, nt, n, i1, i2, j1, j2
3647 INTEGER :: is, ie, js, je
3648 nested = gridstruct%nested
3659 d2_tl(i, j) = damp*q_tl(i, j)
3660 d2(i, j) = damp*q(i, j)
3664 & nested, bd, gridstruct%sw_corner, &
3665 & gridstruct%se_corner, gridstruct%&
3666 & nw_corner, gridstruct%ne_corner)
3667 DO j=js-nord,je+nord
3668 DO i=is-nord,ie+nord+1
3669 fx2_tl(i, j) = gridstruct%del6_v(i, j)*(d2_tl(i-1, j)-d2_tl(i, j&
3671 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i-1, j)-d2(i, j))
3675 & nested, bd, gridstruct%sw_corner, &
3676 & gridstruct%se_corner, gridstruct%&
3677 & nw_corner, gridstruct%ne_corner)
3678 DO j=js-nord,je+nord+1
3679 DO i=is-nord,ie+nord
3680 fy2_tl(i, j) = gridstruct%del6_u(i, j)*(d2_tl(i, j-1)-d2_tl(i, j&
3682 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j-1)-d2(i, j))
3685 IF (nord .GT. 0)
THEN 3688 DO j=js-nt-1,je+nt+1
3689 DO i=is-nt-1,ie+nt+1
3690 d2_tl(i, j) = gridstruct%rarea(i, j)*(fx2_tl(i, j)-fx2_tl(i+&
3691 & 1, j)+fy2_tl(i, j)-fy2_tl(i, j+1))
3692 d2(i, j) = (fx2(i, j)-fx2(i+1, j)+(fy2(i, j)-fy2(i, j+1)))*&
3693 & gridstruct%rarea(i, j)
3697 & gridstruct%sw_corner, gridstruct%se_corner, &
3698 & gridstruct%nw_corner, gridstruct%ne_corner)
3701 fx2_tl(i, j) = gridstruct%del6_v(i, j)*(d2_tl(i, j)-d2_tl(i-&
3703 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i, j)-d2(i-1, j))
3707 & gridstruct%sw_corner, gridstruct%se_corner, &
3708 & gridstruct%nw_corner, gridstruct%ne_corner)
3711 fy2_tl(i, j) = gridstruct%del6_u(i, j)*(d2_tl(i, j)-d2_tl(i&
3713 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j)-d2(i, j-1))
3719 SUBROUTINE del6_vt_flux(nord, npx, npy, damp, q, d2, fx2, fy2, &
3729 INTEGER,
INTENT(IN) :: nord, npx, npy
3730 REAL,
INTENT(IN) :: damp
3733 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
3736 REAL,
INTENT(OUT) :: d2(bd%isd:bd%ied, bd%jsd:bd%jed)
3737 REAL,
INTENT(OUT) :: fx2(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy2(bd%isd&
3738 & :bd%ied, bd%jsd:bd%jed+1)
3739 INTEGER :: i, j, nt, n, i1, i2, j1, j2
3741 INTEGER :: is, ie, js, je
3742 nested = gridstruct%nested
3753 d2(i, j) = damp*q(i, j)
3756 IF (nord .GT. 0)
CALL copy_corners(d2, npx, npy, 1, nested, bd, &
3757 & gridstruct%sw_corner, gridstruct%&
3758 & se_corner, gridstruct%nw_corner, &
3759 & gridstruct%ne_corner)
3760 DO j=js-nord,je+nord
3761 DO i=is-nord,ie+nord+1
3762 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i-1, j)-d2(i, j))
3765 IF (nord .GT. 0)
CALL copy_corners(d2, npx, npy, 2, nested, bd, &
3766 & gridstruct%sw_corner, gridstruct%&
3767 & se_corner, gridstruct%nw_corner, &
3768 & gridstruct%ne_corner)
3769 DO j=js-nord,je+nord+1
3770 DO i=is-nord,ie+nord
3771 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j-1)-d2(i, j))
3774 IF (nord .GT. 0)
THEN 3777 DO j=js-nt-1,je+nt+1
3778 DO i=is-nt-1,ie+nt+1
3779 d2(i, j) = (fx2(i, j)-fx2(i+1, j)+(fy2(i, j)-fy2(i, j+1)))*&
3780 & gridstruct%rarea(i, j)
3783 CALL copy_corners(d2, npx, npy, 1, nested, bd, gridstruct%&
3784 & sw_corner, gridstruct%se_corner, gridstruct%&
3785 & nw_corner, gridstruct%ne_corner)
3788 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i, j)-d2(i-1, j))
3791 CALL copy_corners(d2, npx, npy, 2, nested, bd, gridstruct%&
3792 & sw_corner, gridstruct%se_corner, gridstruct%&
3793 & nw_corner, gridstruct%ne_corner)
3796 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j)-d2(i, j-1))
3806 & va_tl, divg_d, divg_d_tl, gridstruct, flagstruct, bd)
3809 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
3810 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u_tl
3811 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
3812 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v_tl
3813 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
3814 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua_tl, &
3816 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
3818 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
3823 REAL :: uf(bd%is-2:bd%ie+2, bd%js-1:bd%je+2)
3824 REAL :: uf_tl(bd%is-2:bd%ie+2, bd%js-1:bd%je+2)
3825 REAL :: vf(bd%is-1:bd%ie+2, bd%js-2:bd%je+2)
3826 REAL :: vf_tl(bd%is-1:bd%ie+2, bd%js-2:bd%je+2)
3829 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg, cos_sg
3830 REAL,
DIMENSION(:, :),
POINTER :: dxc, dyc
3831 INTEGER :: is, ie, js, je
3840 npx = flagstruct%npx
3841 npy = flagstruct%npy
3842 nested = gridstruct%nested
3843 sin_sg => gridstruct%sin_sg
3844 cos_sg => gridstruct%cos_sg
3845 dxc => gridstruct%dxc
3846 dyc => gridstruct%dyc
3856 IF (npx - 1 .GT. ie + 1)
THEN 3862 IF (flagstruct%grid_type .EQ. 4)
THEN 3866 uf_tl(i, j) = dyc(i, j)*u_tl(i, j)
3867 uf(i, j) = u(i, j)*dyc(i, j)
3873 vf_tl(i, j) = dxc(i, j)*v_tl(i, j)
3874 vf(i, j) = v(i, j)*dxc(i, j)
3879 divg_d_tl(i, j) = gridstruct%rarea_c(i, j)*(vf_tl(i, j-1)-&
3880 & vf_tl(i, j)+uf_tl(i-1, j)-uf_tl(i, j))
3881 divg_d(i, j) = gridstruct%rarea_c(i, j)*(vf(i, j-1)-vf(i, j)+(&
3882 & uf(i-1, j)-uf(i, j)))
3893 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 3895 uf_tl(i, j) = dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+sin_sg(i, j, &
3897 uf(i, j) = u(i, j)*dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+sin_sg(i&
3902 uf_tl(i, j) = dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+sin_sg(i, j, &
3903 & 2))*(u_tl(i, j)-0.25*(cos_sg(i, j-1, 4)+cos_sg(i, j, 2))*(&
3904 & va_tl(i, j-1)+va_tl(i, j)))
3905 uf(i, j) = (u(i, j)-0.25*(va(i, j-1)+va(i, j))*(cos_sg(i, j-&
3906 & 1, 4)+cos_sg(i, j, 2)))*dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+&
3914 vf_tl(i, j) = dxc(i, j)*0.5*(sin_sg(i-1, j, 3)+sin_sg(i, j, 1)&
3915 & )*(v_tl(i, j)-0.25*(cos_sg(i-1, j, 3)+cos_sg(i, j, 1))*(&
3916 & ua_tl(i-1, j)+ua_tl(i, j)))
3917 vf(i, j) = (v(i, j)-0.25*(ua(i-1, j)+ua(i, j))*(cos_sg(i-1, j&
3918 & , 3)+cos_sg(i, j, 1)))*dxc(i, j)*0.5*(sin_sg(i-1, j, 3)+&
3922 vf_tl(1, j) = dxc(1, j)*0.5*(sin_sg(0, j, 3)+sin_sg(1, j, 1))*&
3924 vf(1, j) = v(1, j)*dxc(1, j)*0.5*(sin_sg(0, j, 3)+sin_sg(1, j&
3927 IF (ie + 1 .EQ. npx)
THEN 3928 vf_tl(npx, j) = dxc(npx, j)*0.5*(sin_sg(npx-1, j, 3)+sin_sg(&
3929 & npx, j, 1))*v_tl(npx, j)
3930 vf(npx, j) = v(npx, j)*dxc(npx, j)*0.5*(sin_sg(npx-1, j, 3)+&
3931 & sin_sg(npx, j, 1))
3936 divg_d_tl(i, j) = vf_tl(i, j-1) - vf_tl(i, j) + uf_tl(i-1, j) &
3938 divg_d(i, j) = vf(i, j-1) - vf(i, j) + (uf(i-1, j)-uf(i, j))
3942 IF (gridstruct%sw_corner)
THEN 3943 divg_d_tl(1, 1) = divg_d_tl(1, 1) - vf_tl(1, 0)
3944 divg_d(1, 1) = divg_d(1, 1) - vf(1, 0)
3946 IF (gridstruct%se_corner)
THEN 3947 divg_d_tl(npx, 1) = divg_d_tl(npx, 1) - vf_tl(npx, 0)
3948 divg_d(npx, 1) = divg_d(npx, 1) - vf(npx, 0)
3950 IF (gridstruct%ne_corner)
THEN 3951 divg_d_tl(npx, npy) = divg_d_tl(npx, npy) + vf_tl(npx, npy)
3952 divg_d(npx, npy) = divg_d(npx, npy) + vf(npx, npy)
3954 IF (gridstruct%nw_corner)
THEN 3955 divg_d_tl(1, npy) = divg_d_tl(1, npy) + vf_tl(1, npy)
3956 divg_d(1, npy) = divg_d(1, npy) + vf(1, npy)
3960 divg_d_tl(i, j) = gridstruct%rarea_c(i, j)*divg_d_tl(i, j)
3961 divg_d(i, j) = gridstruct%rarea_c(i, j)*divg_d(i, j)
3970 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
3971 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
3972 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
3973 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
3978 REAL :: uf(bd%is-2:bd%ie+2, bd%js-1:bd%je+2)
3979 REAL :: vf(bd%is-1:bd%ie+2, bd%js-2:bd%je+2)
3982 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg, cos_sg
3983 REAL,
DIMENSION(:, :),
POINTER :: dxc, dyc
3984 INTEGER :: is, ie, js, je
3993 npx = flagstruct%npx
3994 npy = flagstruct%npy
3995 nested = gridstruct%nested
3996 sin_sg => gridstruct%sin_sg
3997 cos_sg => gridstruct%cos_sg
3998 dxc => gridstruct%dxc
3999 dyc => gridstruct%dyc
4009 IF (npx - 1 .GT. ie + 1)
THEN 4015 IF (flagstruct%grid_type .EQ. 4)
THEN 4018 uf(i, j) = u(i, j)*dyc(i, j)
4023 vf(i, j) = v(i, j)*dxc(i, j)
4028 divg_d(i, j) = gridstruct%rarea_c(i, j)*(vf(i, j-1)-vf(i, j)+(&
4029 & uf(i-1, j)-uf(i, j)))
4039 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 4041 uf(i, j) = u(i, j)*dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+sin_sg(i&
4046 uf(i, j) = (u(i, j)-0.25*(va(i, j-1)+va(i, j))*(cos_sg(i, j-&
4047 & 1, 4)+cos_sg(i, j, 2)))*dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+&
4054 vf(i, j) = (v(i, j)-0.25*(ua(i-1, j)+ua(i, j))*(cos_sg(i-1, j&
4055 & , 3)+cos_sg(i, j, 1)))*dxc(i, j)*0.5*(sin_sg(i-1, j, 3)+&
4058 IF (is .EQ. 1) vf(1, j) = v(1, j)*dxc(1, j)*0.5*(sin_sg(0, j, 3)&
4060 IF (ie + 1 .EQ. npx) vf(npx, j) = v(npx, j)*dxc(npx, j)*0.5*(&
4061 & sin_sg(npx-1, j, 3)+sin_sg(npx, j, 1))
4065 divg_d(i, j) = vf(i, j-1) - vf(i, j) + (uf(i-1, j)-uf(i, j))
4069 IF (gridstruct%sw_corner) divg_d(1, 1) = divg_d(1, 1) - vf(1, 0)
4070 IF (gridstruct%se_corner) divg_d(npx, 1) = divg_d(npx, 1) - vf(npx&
4072 IF (gridstruct%ne_corner) divg_d(npx, npy) = divg_d(npx, npy) + vf&
4074 IF (gridstruct%nw_corner) divg_d(1, npy) = divg_d(1, npy) + vf(1, &
4078 divg_d(i, j) = gridstruct%rarea_c(i, j)*divg_d(i, j)
4087 & , va_tl, divg_d, divg_d_tl, gridstruct, flagstruct, bd)
4109 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
4110 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u_tl
4111 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
4112 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v_tl
4113 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
4114 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua_tl, &
4116 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
4118 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
4123 REAL :: uf(bd%isd:bd%ied, bd%jsd:bd%jed+1)
4124 REAL :: uf_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1)
4125 REAL :: vf(bd%isd:bd%ied+1, bd%jsd:bd%jed)
4126 REAL :: vf_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed)
4128 REAL,
DIMENSION(:, :),
POINTER :: rarea_c
4129 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg, cos_sg
4130 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v
4131 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
4132 REAL,
DIMENSION(:, :),
POINTER :: dxc, dyc
4133 INTEGER :: isd, ied, jsd, jed
4140 npx = flagstruct%npx
4141 npy = flagstruct%npy
4142 nested = gridstruct%nested
4143 rarea_c => gridstruct%rarea_c
4144 sin_sg => gridstruct%sin_sg
4145 cos_sg => gridstruct%cos_sg
4146 cosa_u => gridstruct%cosa_u
4147 cosa_v => gridstruct%cosa_v
4148 sina_u => gridstruct%sina_u
4149 sina_v => gridstruct%sina_v
4150 dxc => gridstruct%dxc
4151 dyc => gridstruct%dyc
4153 IF (flagstruct%grid_type .EQ. 4)
THEN 4157 uf_tl(i, j) = dyc(i, j)*u_tl(i, j)
4158 uf(i, j) = u(i, j)*dyc(i, j)
4164 vf_tl(i, j) = dxc(i, j)*v_tl(i, j)
4165 vf(i, j) = v(i, j)*dxc(i, j)
4171 divg_d_tl(i, j) = rarea_c(i, j)*(vf_tl(i, j-1)-vf_tl(i, j)+&
4172 & uf_tl(i-1, j)-uf_tl(i, j))
4173 divg_d(i, j) = rarea_c(i, j)*(vf(i, j-1)-vf(i, j)+(uf(i-1, j)-&
4181 uf_tl(i, j) = dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+sin_sg(i, j, 2)&
4182 & )*(u_tl(i, j)-0.25*(cos_sg(i, j-1, 4)+cos_sg(i, j, 2))*(&
4183 & va_tl(i, j-1)+va_tl(i, j)))
4184 uf(i, j) = (u(i, j)-0.25*(va(i, j-1)+va(i, j))*(cos_sg(i, j-1&
4185 & , 4)+cos_sg(i, j, 2)))*dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+&
4192 vf_tl(i, j) = dxc(i, j)*0.5*(sin_sg(i-1, j, 3)+sin_sg(i, j, 1)&
4193 & )*(v_tl(i, j)-0.25*(cos_sg(i-1, j, 3)+cos_sg(i, j, 1))*(&
4194 & ua_tl(i-1, j)+ua_tl(i, j)))
4195 vf(i, j) = (v(i, j)-0.25*(ua(i-1, j)+ua(i, j))*(cos_sg(i-1, j&
4196 & , 3)+cos_sg(i, j, 1)))*dxc(i, j)*0.5*(sin_sg(i-1, j, 3)+&
4203 divg_d_tl(i, j) = rarea_c(i, j)*(vf_tl(i, j-1)-vf_tl(i, j)+&
4204 & uf_tl(i-1, j)-uf_tl(i, j))
4205 divg_d(i, j) = (vf(i, j-1)-vf(i, j)+(uf(i-1, j)-uf(i, j)))*&
4234 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
4235 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
4236 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
4237 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
4242 REAL :: uf(bd%isd:bd%ied, bd%jsd:bd%jed+1)
4243 REAL :: vf(bd%isd:bd%ied+1, bd%jsd:bd%jed)
4245 REAL,
DIMENSION(:, :),
POINTER :: rarea_c
4246 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg, cos_sg
4247 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v
4248 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
4249 REAL,
DIMENSION(:, :),
POINTER :: dxc, dyc
4250 INTEGER :: isd, ied, jsd, jed
4257 npx = flagstruct%npx
4258 npy = flagstruct%npy
4259 nested = gridstruct%nested
4260 rarea_c => gridstruct%rarea_c
4261 sin_sg => gridstruct%sin_sg
4262 cos_sg => gridstruct%cos_sg
4263 cosa_u => gridstruct%cosa_u
4264 cosa_v => gridstruct%cosa_v
4265 sina_u => gridstruct%sina_u
4266 sina_v => gridstruct%sina_v
4267 dxc => gridstruct%dxc
4268 dyc => gridstruct%dyc
4270 IF (flagstruct%grid_type .EQ. 4)
THEN 4273 uf(i, j) = u(i, j)*dyc(i, j)
4278 vf(i, j) = v(i, j)*dxc(i, j)
4283 divg_d(i, j) = rarea_c(i, j)*(vf(i, j-1)-vf(i, j)+(uf(i-1, j)-&
4290 uf(i, j) = (u(i, j)-0.25*(va(i, j-1)+va(i, j))*(cos_sg(i, j-1&
4291 & , 4)+cos_sg(i, j, 2)))*dyc(i, j)*0.5*(sin_sg(i, j-1, 4)+&
4297 vf(i, j) = (v(i, j)-0.25*(ua(i-1, j)+ua(i, j))*(cos_sg(i-1, j&
4298 & , 3)+cos_sg(i, j, 1)))*dxc(i, j)*0.5*(sin_sg(i-1, j, 3)+&
4304 divg_d(i, j) = (vf(i, j-1)-vf(i, j)+(uf(i-1, j)-uf(i, j)))*&
4310 SUBROUTINE xtp_u(is, ie, js, je, isd, ied, jsd, jed, c, u, v, flux, &
4311 & iord, dx, rdx, npx, npy, grid_type, nested)
4313 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed
4314 REAL,
INTENT(IN) :: u(isd:ied, jsd:jed+1)
4315 REAL,
INTENT(IN) :: v(isd:ied+1, jsd:jed)
4316 REAL,
INTENT(IN) :: c(is:ie+1, js:je+1)
4317 REAL,
INTENT(OUT) :: flux(is:ie+1, js:je+1)
4318 REAL,
INTENT(IN) :: dx(isd:ied, jsd:jed+1)
4319 REAL,
INTENT(IN) :: rdx(isd:ied, jsd:jed+1)
4320 INTEGER,
INTENT(IN) :: iord, npx, npy, grid_type
4321 LOGICAL,
INTENT(IN) :: nested
4323 REAL,
DIMENSION(is-1:ie+1) :: bl, br, b0
4324 LOGICAL,
DIMENSION(is-1:ie+1) :: smt5, smt6
4325 REAL :: fx0(is:ie+1)
4326 REAL :: al(is-1:ie+2), dm(is-2:ie+2)
4327 REAL :: dq(is-3:ie+2)
4328 REAL :: dl, dr, xt, pmp, lac, cfl
4329 REAL :: pmp_1, lac_1, pmp_2, lac_2
4330 REAL :: x0, x1, x0l, x0r
4385 IF (3 .LT. is - 1)
THEN 4390 IF (npx - 3 .GT. ie + 1)
THEN 4396 IF (iord .EQ. 1)
THEN 4399 IF (c(i, j) .GT. 0.)
THEN 4400 flux(i, j) = u(i-1, j)
4402 flux(i, j) = u(i, j)
4406 ELSE IF (iord .LT. 8)
THEN 4410 al(i) =
p1*(u(i-1, j)+u(i, j)) +
p2*(u(i-2, j)+u(i+1, j))
4413 bl(i) = al(i) - u(i, j)
4414 br(i) = al(i+1) - u(i, j)
4416 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 4418 xt =
c3*u(1, j) +
c2*u(2, j) +
c1*u(3, j)
4419 br(1) = xt - u(1, j)
4420 bl(2) = xt - u(2, j)
4421 br(2) = al(3) - u(2, j)
4422 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 4432 bl(0) =
c1*u(-2, j) +
c2*u(-1, j) +
c3*u(0, j) - u(0, j)
4433 xt = 0.5*(((2.*dx(0, j)+dx(-1, j))*u(0, j)-dx(0, j)*u(-1, &
4434 & j))/(dx(0, j)+dx(-1, j))+((2.*dx(1, j)+dx(2, j))*u(1, j)&
4435 & -dx(1, j)*u(2, j))/(dx(1, j)+dx(2, j)))
4436 br(0) = xt - u(0, j)
4437 bl(1) = xt - u(1, j)
4441 IF (ie + 1 .EQ. npx)
THEN 4442 bl(npx-2) = al(npx-2) - u(npx-2, j)
4443 xt =
c1*u(npx-3, j) +
c2*u(npx-2, j) +
c3*u(npx-1, j)
4444 br(npx-2) = xt - u(npx-2, j)
4445 bl(npx-1) = xt - u(npx-1, j)
4446 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 4456 xt = 0.5*(((2.*dx(npx-1, j)+dx(npx-2, j))*u(npx-1, j)-dx(&
4457 & npx-1, j)*u(npx-2, j))/(dx(npx-1, j)+dx(npx-2, j))+((2.*&
4458 & dx(npx, j)+dx(npx+1, j))*u(npx, j)-dx(npx, j)*u(npx+1, j&
4459 & ))/(dx(npx, j)+dx(npx+1, j)))
4460 br(npx-1) = xt - u(npx-1, j)
4461 bl(npx) = xt - u(npx, j)
4462 br(npx) =
c3*u(npx, j) +
c2*u(npx+1, j) +
c1*u(npx+2, j) -&
4469 b0(i) = bl(i) + br(i)
4471 IF (iord .EQ. 2)
THEN 4475 IF (c(i, j) .GT. 0.)
THEN 4476 cfl = c(i, j)*rdx(i-1, j)
4477 flux(i, j) = u(i-1, j) + (1.-cfl)*(br(i-1)-cfl*b0(i-1))
4479 cfl = c(i, j)*rdx(i, j)
4480 flux(i, j) = u(i, j) + (1.+cfl)*(bl(i)+cfl*b0(i))
4483 ELSE IF (iord .EQ. 3)
THEN 4485 IF (b0(i) .GE. 0.)
THEN 4490 IF (bl(i) - br(i) .GE. 0.)
THEN 4495 smt5(i) = x0 .LT. x1
4496 smt6(i) = 3.*x0 .LT. x1
4502 IF (c(i, j) .GT. 0.)
THEN 4503 cfl = c(i, j)*rdx(i-1, j)
4504 IF (smt6(i-1) .OR. smt5(i))
THEN 4505 fx0(i) = br(i-1) - cfl*b0(i-1)
4506 ELSE IF (smt5(i-1))
THEN 4507 IF (bl(i-1) .GE. 0.)
THEN 4512 IF (br(i-1) .GE. 0.)
THEN 4517 IF (x2 .GT. y1)
THEN 4522 fx0(i) = sign(min1, br(i-1))
4524 flux(i, j) = u(i-1, j) + (1.-cfl)*fx0(i)
4526 cfl = c(i, j)*rdx(i, j)
4527 IF (smt6(i) .OR. smt5(i-1))
THEN 4528 fx0(i) = bl(i) + cfl*b0(i)
4529 ELSE IF (smt5(i))
THEN 4530 IF (bl(i) .GE. 0.)
THEN 4535 IF (br(i) .GE. 0.)
THEN 4540 IF (x3 .GT. y2)
THEN 4545 fx0(i) = sign(min2, bl(i))
4547 flux(i, j) = u(i, j) + (1.+cfl)*fx0(i)
4550 ELSE IF (iord .EQ. 4)
THEN 4553 IF (b0(i) .GE. 0.)
THEN 4558 IF (bl(i) - br(i) .GE. 0.)
THEN 4563 smt5(i) = x0 .LT. x1
4565 smt6(i) = 3.*x0 .LT. x1
4568 IF (c(i, j) .GT. 0.)
THEN 4569 IF (smt6(i-1) .OR. smt5(i))
THEN 4570 cfl = c(i, j)*rdx(i-1, j)
4571 flux(i, j) = u(i-1, j) + (1.-cfl)*(br(i-1)-cfl*b0(i-1))
4574 flux(i, j) = u(i-1, j)
4576 ELSE IF (smt6(i) .OR. smt5(i-1))
THEN 4577 cfl = c(i, j)*rdx(i, j)
4578 flux(i, j) = u(i, j) + (1.+cfl)*(bl(i)+cfl*b0(i))
4580 flux(i, j) = u(i, j)
4585 IF (iord .EQ. 5)
THEN 4587 smt5(i) = bl(i)*br(i) .LT. 0.
4591 IF (3.*b0(i) .GE. 0.)
THEN 4596 IF (bl(i) - br(i) .GE. 0.)
THEN 4597 abs4 = bl(i) - br(i)
4599 abs4 = -(bl(i)-br(i))
4601 smt5(i) = abs0 .LT. abs4
4606 IF (c(i, j) .GT. 0.)
THEN 4607 cfl = c(i, j)*rdx(i-1, j)
4608 fx0(i) = (1.-cfl)*(br(i-1)-cfl*b0(i-1))
4609 flux(i, j) = u(i-1, j)
4611 cfl = c(i, j)*rdx(i, j)
4612 fx0(i) = (1.+cfl)*(bl(i)+cfl*b0(i))
4613 flux(i, j) = u(i, j)
4615 IF (smt5(i-1) .OR. smt5(i)) flux(i, j) = flux(i, j) + fx0(i)
4623 xt = 0.25*(u(i+1, j)-u(i-1, j))
4624 IF (xt .GE. 0.)
THEN 4629 IF (u(i-1, j) .LT. u(i, j))
THEN 4630 IF (u(i, j) .LT. u(i+1, j))
THEN 4635 ELSE IF (u(i-1, j) .LT. u(i+1, j))
THEN 4641 IF (u(i-1, j) .GT. u(i, j))
THEN 4642 IF (u(i, j) .GT. u(i+1, j))
THEN 4647 ELSE IF (u(i-1, j) .GT. u(i+1, j))
THEN 4653 IF (x4 .GT. y3)
THEN 4654 IF (y3 .GT. z1)
THEN 4659 ELSE IF (x4 .GT. z1)
THEN 4664 dm(i) = sign(min3, xt)
4667 dq(i) = u(i+1, j) - u(i, j)
4671 al(i) = 0.5*(u(i-1, j)+u(i, j)) +
r3*(dm(i-1)-dm(i))
4674 IF (iord .EQ. 8)
THEN 4677 IF (xt .GE. 0.)
THEN 4682 IF (al(i) - u(i, j) .GE. 0.)
THEN 4683 y4 = al(i) - u(i, j)
4685 y4 = -(al(i)-u(i, j))
4687 IF (x5 .GT. y4)
THEN 4692 bl(i) = -sign(min4, xt)
4693 IF (xt .GE. 0.)
THEN 4698 IF (al(i+1) - u(i, j) .GE. 0.)
THEN 4699 y5 = al(i+1) - u(i, j)
4701 y5 = -(al(i+1)-u(i, j))
4703 IF (x6 .GT. y5)
THEN 4708 br(i) = sign(min5, xt)
4710 ELSE IF (iord .EQ. 9)
THEN 4713 lac_1 = pmp_1 + 1.5*dq(i+1)
4714 IF (0. .LT. pmp_1)
THEN 4715 IF (pmp_1 .LT. lac_1)
THEN 4720 ELSE IF (0. .LT. lac_1)
THEN 4725 IF (0. .GT. pmp_1)
THEN 4726 IF (pmp_1 .GT. lac_1)
THEN 4731 ELSE IF (0. .GT. lac_1)
THEN 4736 IF (al(i) - u(i, j) .LT. y12)
THEN 4739 y6 = al(i) - u(i, j)
4741 IF (x7 .GT. y6)
THEN 4747 lac_2 = pmp_2 - 1.5*dq(i-2)
4748 IF (0. .LT. pmp_2)
THEN 4749 IF (pmp_2 .LT. lac_2)
THEN 4754 ELSE IF (0. .LT. lac_2)
THEN 4759 IF (0. .GT. pmp_2)
THEN 4760 IF (pmp_2 .GT. lac_2)
THEN 4765 ELSE IF (0. .GT. lac_2)
THEN 4770 IF (al(i+1) - u(i, j) .LT. y13)
THEN 4773 y7 = al(i+1) - u(i, j)
4775 IF (x8 .GT. y7)
THEN 4781 ELSE IF (iord .EQ. 10)
THEN 4783 bl(i) = al(i) - u(i, j)
4784 br(i) = al(i+1) - u(i, j)
4785 IF (dm(i) .GE. 0.)
THEN 4792 IF (dm(i-1) .GE. 0.)
THEN 4797 IF (dm(i+1) .GE. 0.)
THEN 4808 IF (3.*(bl(i)+br(i)) .GE. 0.)
THEN 4809 abs3 = 3.*(bl(i)+br(i))
4811 abs3 = -(3.*(bl(i)+br(i)))
4813 IF (bl(i) - br(i) .GE. 0.)
THEN 4814 abs6 = bl(i) - br(i)
4816 abs6 = -(bl(i)-br(i))
4818 IF (abs3 .GT. abs6)
THEN 4820 lac_1 = pmp_1 + 1.5*dq(i+1)
4821 IF (0. .LT. pmp_1)
THEN 4822 IF (pmp_1 .LT. lac_1)
THEN 4827 ELSE IF (0. .LT. lac_1)
THEN 4832 IF (0. .GT. pmp_1)
THEN 4833 IF (pmp_1 .GT. lac_1)
THEN 4838 ELSE IF (0. .GT. lac_1)
THEN 4843 IF (bl(i) .LT. y14)
THEN 4848 IF (x9 .GT. y8)
THEN 4854 lac_2 = pmp_2 - 1.5*dq(i-2)
4855 IF (0. .LT. pmp_2)
THEN 4856 IF (pmp_2 .LT. lac_2)
THEN 4861 ELSE IF (0. .LT. lac_2)
THEN 4866 IF (0. .GT. pmp_2)
THEN 4867 IF (pmp_2 .GT. lac_2)
THEN 4872 ELSE IF (0. .GT. lac_2)
THEN 4877 IF (br(i) .LT. y15)
THEN 4882 IF (x10 .GT. y9)
THEN 4893 bl(i) = al(i) - u(i, j)
4894 br(i) = al(i+1) - u(i, j)
4901 IF (is .EQ. 1 .AND. (.NOT.nested))
THEN 4902 br(2) = al(3) - u(2, j)
4903 xt =
s15*u(1, j) +
s11*u(2, j) -
s14*dm(2)
4904 bl(2) = xt - u(2, j)
4905 br(1) = xt - u(1, j)
4906 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 4916 bl(0) =
s14*dm(-1) -
s11*dq(-1)
4917 x0l = 0.5*((2.*dx(0, j)+dx(-1, j))*u(0, j)-dx(0, j)*u(-1, &
4918 & j))/(dx(0, j)+dx(-1, j))
4919 x0r = 0.5*((2.*dx(1, j)+dx(2, j))*u(1, j)-dx(1, j)*u(2, j)&
4920 & )/(dx(1, j)+dx(2, j))
4922 br(0) = xt - u(0, j)
4923 bl(1) = xt - u(1, j)
4925 CALL pert_ppm(1, u(2:2, j), bl(2:2), br(2:2), -1)
4927 IF (ie + 1 .EQ. npx .AND. (.NOT.nested))
THEN 4928 bl(npx-2) = al(npx-2) - u(npx-2, j)
4929 xt =
s15*u(npx-1, j) +
s11*u(npx-2, j) +
s14*dm(npx-2)
4930 br(npx-2) = xt - u(npx-2, j)
4931 bl(npx-1) = xt - u(npx-1, j)
4932 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 4942 br(npx) =
s11*dq(npx) -
s14*dm(npx+1)
4943 x0l = 0.5*((2.*dx(npx-1, j)+dx(npx-2, j))*u(npx-1, j)-dx(&
4944 & npx-1, j)*u(npx-2, j))/(dx(npx-1, j)+dx(npx-2, j))
4945 x0r = 0.5*((2.*dx(npx, j)+dx(npx+1, j))*u(npx, j)-dx(npx, &
4946 & j)*u(npx+1, j))/(dx(npx, j)+dx(npx+1, j))
4948 br(npx-1) = xt - u(npx-1, j)
4949 bl(npx) = xt - u(npx, j)
4951 CALL pert_ppm(1, u(npx-2:npx-2, j), bl(npx-2:npx-2), br(npx-&
4957 al(i) = 0.5*(u(i-1, j)+u(i, j)) +
r3*(dm(i-1)-dm(i))
4961 lac = pmp + 1.5*dq(i+1)
4962 IF (0. .LT. pmp)
THEN 4963 IF (pmp .LT. lac)
THEN 4968 ELSE IF (0. .LT. lac)
THEN 4973 IF (0. .GT. pmp)
THEN 4974 IF (pmp .GT. lac)
THEN 4979 ELSE IF (0. .GT. lac)
THEN 4984 IF (al(i) - u(i, j) .LT. y16)
THEN 4987 y10 = al(i) - u(i, j)
4989 IF (x11 .GT. y10)
THEN 4995 lac = pmp - 1.5*dq(i-2)
4996 IF (0. .LT. pmp)
THEN 4997 IF (pmp .LT. lac)
THEN 5002 ELSE IF (0. .LT. lac)
THEN 5007 IF (0. .GT. pmp)
THEN 5008 IF (pmp .GT. lac)
THEN 5013 ELSE IF (0. .GT. lac)
THEN 5018 IF (al(i+1) - u(i, j) .LT. y17)
THEN 5021 y11 = al(i+1) - u(i, j)
5023 IF (x12 .GT. y11)
THEN 5031 IF (c(i, j) .GT. 0.)
THEN 5032 cfl = c(i, j)*rdx(i-1, j)
5033 flux(i, j) = u(i-1, j) + (1.-cfl)*(br(i-1)-cfl*(bl(i-1)+br(i&
5036 cfl = c(i, j)*rdx(i, j)
5037 flux(i, j) = u(i, j) + (1.+cfl)*(bl(i)+cfl*(bl(i)+br(i)))
5042 END SUBROUTINE xtp_u 5043 SUBROUTINE ytp_v(is, ie, js, je, isd, ied, jsd, jed, c, u, v, flux, &
5044 & jord, dy, rdy, npx, npy, grid_type, nested)
5046 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed
5047 INTEGER,
INTENT(IN) :: jord
5048 REAL,
INTENT(IN) :: u(isd:ied, jsd:jed+1)
5049 REAL,
INTENT(IN) :: v(isd:ied+1, jsd:jed)
5051 REAL,
INTENT(IN) :: c(is:ie+1, js:je+1)
5052 REAL,
INTENT(OUT) :: flux(is:ie+1, js:je+1)
5053 REAL,
INTENT(IN) :: dy(isd:ied+1, jsd:jed)
5054 REAL,
INTENT(IN) :: rdy(isd:ied+1, jsd:jed)
5055 INTEGER,
INTENT(IN) :: npx, npy, grid_type
5056 LOGICAL,
INTENT(IN) :: nested
5058 LOGICAL,
DIMENSION(is:ie+1, js-1:je+1) :: smt5, smt6
5059 REAL :: fx0(is:ie+1)
5060 REAL :: dm(is:ie+1, js-2:je+2)
5061 REAL :: al(is:ie+1, js-1:je+2)
5062 REAL,
DIMENSION(is:ie+1, js-1:je+1) :: bl, br, b0
5063 REAL :: dq(is:ie+1, js-3:je+2)
5064 REAL :: xt, dl, dr, pmp, lac, cfl
5065 REAL :: pmp_1, lac_1, pmp_2, lac_2
5066 REAL :: x0, x1, x0r, x0l
5067 INTEGER :: i, j, is1, ie1, js3, je3
5119 IF (3 .LT. js - 1)
THEN 5124 IF (npy - 3 .GT. je + 1)
THEN 5130 IF (jord .EQ. 1)
THEN 5133 IF (c(i, j) .GT. 0.)
THEN 5134 flux(i, j) = v(i, j-1)
5136 flux(i, j) = v(i, j)
5140 ELSE IF (jord .LT. 8)
THEN 5144 al(i, j) =
p1*(v(i, j-1)+v(i, j)) +
p2*(v(i, j-2)+v(i, j+1))
5149 bl(i, j) = al(i, j) - v(i, j)
5150 br(i, j) = al(i, j+1) - v(i, j)
5153 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 5156 bl(i, 0) =
c1*v(i, -2) +
c2*v(i, -1) +
c3*v(i, 0) - v(i, 0)
5157 xt = 0.5*(((2.*dy(i, 0)+dy(i, -1))*v(i, 0)-dy(i, 0)*v(i, -1)&
5158 & )/(dy(i, 0)+dy(i, -1))+((2.*dy(i, 1)+dy(i, 2))*v(i, 1)-dy(&
5159 & i, 1)*v(i, 2))/(dy(i, 1)+dy(i, 2)))
5160 br(i, 0) = xt - v(i, 0)
5161 bl(i, 1) = xt - v(i, 1)
5162 xt =
c3*v(i, 1) +
c2*v(i, 2) +
c1*v(i, 3)
5163 br(i, 1) = xt - v(i, 1)
5164 bl(i, 2) = xt - v(i, 2)
5165 br(i, 2) = al(i, 3) - v(i, 2)
5177 IF (ie + 1 .EQ. npx)
THEN 5190 IF (je + 1 .EQ. npy)
THEN 5192 bl(i, npy-2) = al(i, npy-2) - v(i, npy-2)
5193 xt =
c1*v(i, npy-3) +
c2*v(i, npy-2) +
c3*v(i, npy-1)
5194 br(i, npy-2) = xt - v(i, npy-2)
5195 bl(i, npy-1) = xt - v(i, npy-1)
5196 xt = 0.5*(((2.*dy(i, npy-1)+dy(i, npy-2))*v(i, npy-1)-dy(i, &
5197 & npy-1)*v(i, npy-2))/(dy(i, npy-1)+dy(i, npy-2))+((2.*dy(i&
5198 & , npy)+dy(i, npy+1))*v(i, npy)-dy(i, npy)*v(i, npy+1))/(dy&
5199 & (i, npy)+dy(i, npy+1)))
5200 br(i, npy-1) = xt - v(i, npy-1)
5201 bl(i, npy) = xt - v(i, npy)
5202 br(i, npy) =
c3*v(i, npy) +
c2*v(i, npy+1) +
c1*v(i, npy+2) &
5215 IF (ie + 1 .EQ. npx)
THEN 5231 b0(i, j) = bl(i, j) + br(i, j)
5234 IF (jord .EQ. 2)
THEN 5239 IF (c(i, j) .GT. 0.)
THEN 5240 cfl = c(i, j)*rdy(i, j-1)
5241 flux(i, j) = v(i, j-1) + (1.-cfl)*(br(i, j-1)-cfl*b0(i, j-&
5244 cfl = c(i, j)*rdy(i, j)
5245 flux(i, j) = v(i, j) + (1.+cfl)*(bl(i, j)+cfl*b0(i, j))
5249 ELSE IF (jord .EQ. 3)
THEN 5252 IF (b0(i, j) .GE. 0.)
THEN 5257 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 5258 x1 = bl(i, j) - br(i, j)
5260 x1 = -(bl(i, j)-br(i, j))
5262 smt5(i, j) = x0 .LT. x1
5263 smt6(i, j) = 3.*x0 .LT. x1
5271 IF (c(i, j) .GT. 0.)
THEN 5272 cfl = c(i, j)*rdy(i, j-1)
5273 IF (smt6(i, j-1) .OR. smt5(i, j))
THEN 5274 fx0(i) = br(i, j-1) - cfl*b0(i, j-1)
5275 ELSE IF (smt5(i, j-1))
THEN 5276 IF (bl(i, j-1) .GE. 0.)
THEN 5281 IF (br(i, j-1) .GE. 0.)
THEN 5286 IF (x2 .GT. y1)
THEN 5292 fx0(i) = sign(min1, br(i, j-1))
5294 flux(i, j) = v(i, j-1) + (1.-cfl)*fx0(i)
5296 cfl = c(i, j)*rdy(i, j)
5297 IF (smt6(i, j) .OR. smt5(i, j-1))
THEN 5298 fx0(i) = bl(i, j) + cfl*b0(i, j)
5299 ELSE IF (smt5(i, j))
THEN 5300 IF (bl(i, j) .GE. 0.)
THEN 5305 IF (br(i, j) .GE. 0.)
THEN 5310 IF (x3 .GT. y2)
THEN 5315 fx0(i) = sign(min2, bl(i, j))
5317 flux(i, j) = v(i, j) + (1.+cfl)*fx0(i)
5321 ELSE IF (jord .EQ. 4)
THEN 5324 IF (b0(i, j) .GE. 0.)
THEN 5329 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 5330 x1 = bl(i, j) - br(i, j)
5332 x1 = -(bl(i, j)-br(i, j))
5334 smt5(i, j) = x0 .LT. x1
5335 smt6(i, j) = 3.*x0 .LT. x1
5340 IF (c(i, j) .GT. 0.)
THEN 5341 IF (smt6(i, j-1) .OR. smt5(i, j))
THEN 5342 cfl = c(i, j)*rdy(i, j-1)
5343 flux(i, j) = v(i, j-1) + (1.-cfl)*(br(i, j-1)-cfl*b0(i, &
5346 flux(i, j) = v(i, j-1)
5348 ELSE IF (smt6(i, j) .OR. smt5(i, j-1))
THEN 5349 cfl = c(i, j)*rdy(i, j)
5350 flux(i, j) = v(i, j) + (1.+cfl)*(bl(i, j)+cfl*b0(i, j))
5352 flux(i, j) = v(i, j)
5359 IF (jord .EQ. 5)
THEN 5362 smt5(i, j) = bl(i, j)*br(i, j) .LT. 0.
5369 IF (3.*b0(i, j) .GE. 0.)
THEN 5372 abs0 = -(3.*b0(i, j))
5374 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 5375 abs4 = bl(i, j) - br(i, j)
5377 abs4 = -(bl(i, j)-br(i, j))
5379 smt5(i, j) = abs0 .LT. abs4
5386 IF (c(i, j) .GT. 0.)
THEN 5387 cfl = c(i, j)*rdy(i, j-1)
5388 fx0(i) = (1.-cfl)*(br(i, j-1)-cfl*b0(i, j-1))
5389 flux(i, j) = v(i, j-1)
5391 cfl = c(i, j)*rdy(i, j)
5392 fx0(i) = (1.+cfl)*(bl(i, j)+cfl*b0(i, j))
5393 flux(i, j) = v(i, j)
5395 IF (smt5(i, j-1) .OR. smt5(i, j)) flux(i, j) = flux(i, j) + &
5404 xt = 0.25*(v(i, j+1)-v(i, j-1))
5405 IF (xt .GE. 0.)
THEN 5410 IF (v(i, j-1) .LT. v(i, j))
THEN 5411 IF (v(i, j) .LT. v(i, j+1))
THEN 5416 ELSE IF (v(i, j-1) .LT. v(i, j+1))
THEN 5422 IF (v(i, j-1) .GT. v(i, j))
THEN 5423 IF (v(i, j) .GT. v(i, j+1))
THEN 5428 ELSE IF (v(i, j-1) .GT. v(i, j+1))
THEN 5434 IF (x4 .GT. y3)
THEN 5435 IF (y3 .GT. z1)
THEN 5440 ELSE IF (x4 .GT. z1)
THEN 5445 dm(i, j) = sign(min3, xt)
5450 dq(i, j) = v(i, j+1) - v(i, j)
5456 al(i, j) = 0.5*(v(i, j-1)+v(i, j)) +
r3*(dm(i, j-1)-dm(i, j)&
5460 IF (jord .EQ. 8)
THEN 5464 IF (xt .GE. 0.)
THEN 5469 IF (al(i, j) - v(i, j) .GE. 0.)
THEN 5470 y4 = al(i, j) - v(i, j)
5472 y4 = -(al(i, j)-v(i, j))
5474 IF (x5 .GT. y4)
THEN 5479 bl(i, j) = -sign(min4, xt)
5480 IF (xt .GE. 0.)
THEN 5485 IF (al(i, j+1) - v(i, j) .GE. 0.)
THEN 5486 y5 = al(i, j+1) - v(i, j)
5488 y5 = -(al(i, j+1)-v(i, j))
5490 IF (x6 .GT. y5)
THEN 5495 br(i, j) = sign(min5, xt)
5498 ELSE IF (jord .EQ. 9)
THEN 5501 pmp_1 = -(2.*dq(i, j))
5502 lac_1 = pmp_1 + 1.5*dq(i, j+1)
5503 IF (0. .LT. pmp_1)
THEN 5504 IF (pmp_1 .LT. lac_1)
THEN 5509 ELSE IF (0. .LT. lac_1)
THEN 5514 IF (0. .GT. pmp_1)
THEN 5515 IF (pmp_1 .GT. lac_1)
THEN 5520 ELSE IF (0. .GT. lac_1)
THEN 5525 IF (al(i, j) - v(i, j) .LT. y12)
THEN 5528 y6 = al(i, j) - v(i, j)
5530 IF (x7 .GT. y6)
THEN 5535 pmp_2 = 2.*dq(i, j-1)
5536 lac_2 = pmp_2 - 1.5*dq(i, j-2)
5537 IF (0. .LT. pmp_2)
THEN 5538 IF (pmp_2 .LT. lac_2)
THEN 5543 ELSE IF (0. .LT. lac_2)
THEN 5548 IF (0. .GT. pmp_2)
THEN 5549 IF (pmp_2 .GT. lac_2)
THEN 5554 ELSE IF (0. .GT. lac_2)
THEN 5559 IF (al(i, j+1) - v(i, j) .LT. y13)
THEN 5562 y7 = al(i, j+1) - v(i, j)
5564 IF (x8 .GT. y7)
THEN 5571 ELSE IF (jord .EQ. 10)
THEN 5574 bl(i, j) = al(i, j) - v(i, j)
5575 br(i, j) = al(i, j+1) - v(i, j)
5576 IF (dm(i, j) .GE. 0.)
THEN 5583 IF (dm(i, j-1) .GE. 0.)
THEN 5588 IF (dm(i, j+1) .GE. 0.)
THEN 5598 IF (3.*(bl(i, j)+br(i, j)) .GE. 0.)
THEN 5599 abs3 = 3.*(bl(i, j)+br(i, j))
5601 abs3 = -(3.*(bl(i, j)+br(i, j)))
5603 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 5604 abs6 = bl(i, j) - br(i, j)
5606 abs6 = -(bl(i, j)-br(i, j))
5608 IF (abs3 .GT. abs6)
THEN 5609 pmp_1 = -(2.*dq(i, j))
5610 lac_1 = pmp_1 + 1.5*dq(i, j+1)
5611 IF (0. .LT. pmp_1)
THEN 5612 IF (pmp_1 .LT. lac_1)
THEN 5617 ELSE IF (0. .LT. lac_1)
THEN 5622 IF (0. .GT. pmp_1)
THEN 5623 IF (pmp_1 .GT. lac_1)
THEN 5628 ELSE IF (0. .GT. lac_1)
THEN 5633 IF (bl(i, j) .LT. y14)
THEN 5638 IF (x9 .GT. y8)
THEN 5643 pmp_2 = 2.*dq(i, j-1)
5644 lac_2 = pmp_2 - 1.5*dq(i, j-2)
5645 IF (0. .LT. pmp_2)
THEN 5646 IF (pmp_2 .LT. lac_2)
THEN 5651 ELSE IF (0. .LT. lac_2)
THEN 5656 IF (0. .GT. pmp_2)
THEN 5657 IF (pmp_2 .GT. lac_2)
THEN 5662 ELSE IF (0. .GT. lac_2)
THEN 5667 IF (br(i, j) .LT. y15)
THEN 5672 IF (x10 .GT. y9)
THEN 5685 bl(i, j) = al(i, j) - v(i, j)
5686 br(i, j) = al(i, j+1) - v(i, j)
5693 IF (js .EQ. 1 .AND. (.NOT.nested))
THEN 5695 br(i, 2) = al(i, 3) - v(i, 2)
5696 xt =
s15*v(i, 1) +
s11*v(i, 2) -
s14*dm(i, 2)
5697 br(i, 1) = xt - v(i, 1)
5698 bl(i, 2) = xt - v(i, 2)
5699 bl(i, 0) =
s14*dm(i, -1) -
s11*dq(i, -1)
5700 x0l = 0.5*((2.*dy(i, 0)+dy(i, -1))*v(i, 0)-dy(i, 0)*v(i, -1)&
5701 & )/(dy(i, 0)+dy(i, -1))
5702 x0r = 0.5*((2.*dy(i, 1)+dy(i, 2))*v(i, 1)-dy(i, 1)*v(i, 2))/&
5703 & (dy(i, 1)+dy(i, 2))
5705 bl(i, 1) = xt - v(i, 1)
5706 br(i, 0) = xt - v(i, 0)
5718 IF (ie + 1 .EQ. npx)
THEN 5729 CALL pert_ppm(ie - is + 2, v(is:ie+1, j), bl(is:ie+1, j), br(&
5732 IF (je + 1 .EQ. npy .AND. (.NOT.nested))
THEN 5734 bl(i, npy-2) = al(i, npy-2) - v(i, npy-2)
5735 xt =
s15*v(i, npy-1) +
s11*v(i, npy-2) +
s14*dm(i, npy-2)
5736 br(i, npy-2) = xt - v(i, npy-2)
5737 bl(i, npy-1) = xt - v(i, npy-1)
5738 br(i, npy) =
s11*dq(i, npy) -
s14*dm(i, npy+1)
5739 x0l = 0.5*((2.*dy(i, npy-1)+dy(i, npy-2))*v(i, npy-1)-dy(i, &
5740 & npy-1)*v(i, npy-2))/(dy(i, npy-1)+dy(i, npy-2))
5741 x0r = 0.5*((2.*dy(i, npy)+dy(i, npy+1))*v(i, npy)-dy(i, npy)&
5742 & *v(i, npy+1))/(dy(i, npy)+dy(i, npy+1))
5744 br(i, npy-1) = xt - v(i, npy-1)
5745 bl(i, npy) = xt - v(i, npy)
5757 IF (ie + 1 .EQ. npx)
THEN 5768 CALL pert_ppm(ie - is + 2, v(is:ie+1, j), bl(is:ie+1, j), br(&
5774 al(i, j) = 0.5*(v(i, j-1)+v(i, j)) +
r3*(dm(i, j-1)-dm(i, j)&
5781 lac = pmp - 1.5*dq(i, j-2)
5782 IF (0. .LT. pmp)
THEN 5783 IF (pmp .LT. lac)
THEN 5788 ELSE IF (0. .LT. lac)
THEN 5793 IF (0. .GT. pmp)
THEN 5794 IF (pmp .GT. lac)
THEN 5799 ELSE IF (0. .GT. lac)
THEN 5804 IF (al(i, j+1) - v(i, j) .LT. y16)
THEN 5807 y10 = al(i, j+1) - v(i, j)
5809 IF (x11 .GT. y10)
THEN 5814 pmp = -(2.*dq(i, j))
5815 lac = pmp + 1.5*dq(i, j+1)
5816 IF (0. .LT. pmp)
THEN 5817 IF (pmp .LT. lac)
THEN 5822 ELSE IF (0. .LT. lac)
THEN 5827 IF (0. .GT. pmp)
THEN 5828 IF (pmp .GT. lac)
THEN 5833 ELSE IF (0. .GT. lac)
THEN 5838 IF (al(i, j) - v(i, j) .LT. y17)
THEN 5841 y11 = al(i, j) - v(i, j)
5843 IF (x12 .GT. y11)
THEN 5853 IF (c(i, j) .GT. 0.)
THEN 5854 cfl = c(i, j)*rdy(i, j-1)
5855 flux(i, j) = v(i, j-1) + (1.-cfl)*(br(i, j-1)-cfl*(bl(i, j-1&
5858 cfl = c(i, j)*rdy(i, j)
5859 flux(i, j) = v(i, j) + (1.+cfl)*(bl(i, j)+cfl*(bl(i, j)+br(i&
5865 END SUBROUTINE ytp_v 5874 SUBROUTINE d2a2c_vect_tlm(u, u_tl, v, v_tl, ua, ua_tl, va, va_tl, uc, &
5875 & uc_tl, vc, vc_tl, ut, ut_tl, vt, vt_tl, dord4, gridstruct, bd, npx, &
5876 & npy, nested, grid_type)
5879 LOGICAL,
INTENT(IN) :: dord4
5880 REAL,
INTENT(IN) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1)
5881 REAL,
INTENT(IN) :: u_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1)
5882 REAL,
INTENT(IN) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed)
5883 REAL,
INTENT(IN) :: v_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed)
5884 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(OUT) :: uc
5885 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(OUT) :: &
5887 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(OUT) :: vc
5888 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(OUT) :: &
5890 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: ua, va&
5892 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: ua_tl&
5893 & , va_tl, ut_tl, vt_tl
5894 INTEGER,
INTENT(IN) :: npx, npy,
grid_type 5895 LOGICAL,
INTENT(IN) :: nested
5898 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: utmp, vtmp
5899 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: utmp_tl, vtmp_tl
5900 INTEGER :: npt, i, j, ifirst, ilast, id
5901 INTEGER :: is, ie, js, je
5902 INTEGER :: isd, ied, jsd, jed
5903 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg
5904 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v, cosa_s
5905 REAL,
DIMENSION(:, :),
POINTER :: rsin_u, rsin_v, rsin2
5906 REAL,
DIMENSION(:, :),
POINTER :: dxa, dya
5929 sin_sg => gridstruct%sin_sg
5930 cosa_u => gridstruct%cosa_u
5931 cosa_v => gridstruct%cosa_v
5932 cosa_s => gridstruct%cosa_s
5933 rsin_u => gridstruct%rsin_u
5934 rsin_v => gridstruct%rsin_v
5935 rsin2 => gridstruct%rsin2
5936 dxa => gridstruct%dxa
5937 dya => gridstruct%dya
5943 IF (
grid_type .LT. 3 .AND. (.NOT.nested))
THEN 5955 utmp_tl(i, j) =
a2*(u_tl(i, j-1)+u_tl(i, j+2)) +
a1*(u_tl(i, j&
5957 utmp(i, j) =
a2*(u(i, j-1)+u(i, j+2)) +
a1*(u(i, j)+u(i, j+1))
5962 utmp_tl(i, jsd) = 0.5*(u_tl(i, jsd)+u_tl(i, jsd+1))
5963 utmp(i, jsd) = 0.5*(u(i, jsd)+u(i, jsd+1))
5965 utmp_tl(i, jed) = 0.5*(u_tl(i, jed)+u_tl(i, jed+1))
5966 utmp(i, jed) = 0.5*(u(i, jed)+u(i, jed+1))
5971 vtmp_tl(i, j) =
a2*(v_tl(i-1, j)+v_tl(i+2, j)) +
a1*(v_tl(i, j&
5973 vtmp(i, j) =
a2*(v(i-1, j)+v(i+2, j)) +
a1*(v(i, j)+v(i+1, j))
5976 vtmp_tl(isd, j) = 0.5*(v_tl(isd, j)+v_tl(isd+1, j))
5977 vtmp(isd, j) = 0.5*(v(isd, j)+v(isd+1, j))
5979 vtmp_tl(ied, j) = 0.5*(v_tl(ied, j)+v_tl(ied+1, j))
5980 vtmp(ied, j) = 0.5*(v(ied, j)+v(ied+1, j))
5984 ua_tl(i, j) = rsin2(i, j)*(utmp_tl(i, j)-cosa_s(i, j)*vtmp_tl(&
5986 ua(i, j) = (utmp(i, j)-vtmp(i, j)*cosa_s(i, j))*rsin2(i, j)
5987 va_tl(i, j) = rsin2(i, j)*(vtmp_tl(i, j)-cosa_s(i, j)*utmp_tl(&
5989 va(i, j) = (vtmp(i, j)-utmp(i, j)*cosa_s(i, j))*rsin2(i, j)
5993 IF (npt .LT. js - 1)
THEN 5998 IF (npy - npt .GT. je + 1)
THEN 6009 IF (npt .LT. isd)
THEN 6014 IF (npx - npt .GT. ied)
THEN 6020 utmp_tl(i, j) =
a2*(u_tl(i, j-1)+u_tl(i, j+2)) +
a1*(u_tl(i, j&
6022 utmp(i, j) =
a2*(u(i, j-1)+u(i, j+2)) +
a1*(u(i, j)+u(i, j+1))
6025 IF (npt .LT. jsd)
THEN 6030 IF (npy - npt .GT. jed)
THEN 6038 IF (npt .LT. is - 1)
THEN 6043 IF (npx - npt .GT. ie + 1)
THEN 6049 vtmp_tl(i, j) =
a2*(v_tl(i-1, j)+v_tl(i+2, j)) +
a1*(v_tl(i, j&
6051 vtmp(i, j) =
a2*(v(i-1, j)+v(i+2, j)) +
a1*(v(i, j)+v(i+1, j))
6058 IF (js .EQ. 1 .OR. jsd .LT. npt)
THEN 6061 utmp_tl(i, j) = 0.5*(u_tl(i, j)+u_tl(i, j+1))
6062 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6063 vtmp_tl(i, j) = 0.5*(v_tl(i, j)+v_tl(i+1, j))
6064 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6068 IF (je + 1 .EQ. npy .OR. jed .GE. npy - npt)
THEN 6071 utmp_tl(i, j) = 0.5*(u_tl(i, j)+u_tl(i, j+1))
6072 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6073 vtmp_tl(i, j) = 0.5*(v_tl(i, j)+v_tl(i+1, j))
6074 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6078 IF (is .EQ. 1 .OR. isd .LT. npt)
THEN 6079 IF (npt .LT. jsd)
THEN 6084 IF (npy - npt .GT. jed)
THEN 6091 utmp_tl(i, j) = 0.5*(u_tl(i, j)+u_tl(i, j+1))
6092 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6093 vtmp_tl(i, j) = 0.5*(v_tl(i, j)+v_tl(i+1, j))
6094 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6098 IF (ie + 1 .EQ. npx .OR. ied .GE. npx - npt)
THEN 6099 IF (npt .LT. jsd)
THEN 6104 IF (npy - npt .GT. jed)
THEN 6111 utmp_tl(i, j) = 0.5*(u_tl(i, j)+u_tl(i, j+1))
6112 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6113 vtmp_tl(i, j) = 0.5*(v_tl(i, j)+v_tl(i+1, j))
6114 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6120 DO j=js-1-id,je+1+id
6121 DO i=is-1-id,ie+1+id
6122 ua_tl(i, j) = rsin2(i, j)*(utmp_tl(i, j)-cosa_s(i, j)*vtmp_tl(&
6124 ua(i, j) = (utmp(i, j)-vtmp(i, j)*cosa_s(i, j))*rsin2(i, j)
6125 va_tl(i, j) = rsin2(i, j)*(vtmp_tl(i, j)-cosa_s(i, j)*utmp_tl(&
6127 va(i, j) = (vtmp(i, j)-utmp(i, j)*cosa_s(i, j))*rsin2(i, j)
6136 IF (gridstruct%sw_corner)
THEN 6138 utmp_tl(i, 0) = -vtmp_tl(0, 1-i)
6139 utmp(i, 0) = -vtmp(0, 1-i)
6142 IF (gridstruct%se_corner)
THEN 6144 utmp_tl(npx+i, 0) = vtmp_tl(npx, i+1)
6145 utmp(npx+i, 0) = vtmp(npx, i+1)
6148 IF (gridstruct%ne_corner)
THEN 6150 utmp_tl(npx+i, npy) = -vtmp_tl(npx, je-i)
6151 utmp(npx+i, npy) = -vtmp(npx, je-i)
6154 IF (gridstruct%nw_corner)
THEN 6156 utmp_tl(i, npy) = vtmp_tl(0, je+i)
6157 utmp(i, npy) = vtmp(0, je+i)
6160 IF (
grid_type .LT. 3 .AND. (.NOT.nested))
THEN 6161 IF (3 .LT. is - 1)
THEN 6166 IF (npx - 2 .GT. ie + 2)
THEN 6180 uc_tl(i, j) =
a2*(utmp_tl(i-2, j)+utmp_tl(i+1, j)) +
a1*(utmp_tl&
6181 & (i-1, j)+utmp_tl(i, j))
6182 uc(i, j) =
a2*(utmp(i-2, j)+utmp(i+1, j)) +
a1*(utmp(i-1, j)+&
6184 ut_tl(i, j) = rsin_u(i, j)*(uc_tl(i, j)-cosa_u(i, j)*v_tl(i, j))
6185 ut(i, j) = (uc(i, j)-v(i, j)*cosa_u(i, j))*rsin_u(i, j)
6190 IF (gridstruct%sw_corner)
THEN 6191 ua_tl(-1, 0) = -va_tl(0, 2)
6192 ua(-1, 0) = -va(0, 2)
6193 ua_tl(0, 0) = -va_tl(0, 1)
6194 ua(0, 0) = -va(0, 1)
6196 IF (gridstruct%se_corner)
THEN 6197 ua_tl(npx, 0) = va_tl(npx, 1)
6198 ua(npx, 0) = va(npx, 1)
6199 ua_tl(npx+1, 0) = va_tl(npx, 2)
6200 ua(npx+1, 0) = va(npx, 2)
6202 IF (gridstruct%ne_corner)
THEN 6203 ua_tl(npx, npy) = -va_tl(npx, npy-1)
6204 ua(npx, npy) = -va(npx, npy-1)
6205 ua_tl(npx+1, npy) = -va_tl(npx, npy-2)
6206 ua(npx+1, npy) = -va(npx, npy-2)
6208 IF (gridstruct%nw_corner)
THEN 6209 ua_tl(-1, npy) = va_tl(0, npy-2)
6210 ua(-1, npy) = va(0, npy-2)
6211 ua_tl(0, npy) = va_tl(0, npy-1)
6212 ua(0, npy) = va(0, npy-1)
6214 IF (is .EQ. 1 .AND. (.NOT.nested))
THEN 6216 uc_tl(0, j) =
c1*utmp_tl(-2, j) +
c2*utmp_tl(-1, j) +
c3*&
6218 uc(0, j) =
c1*utmp(-2, j) +
c2*utmp(-1, j) +
c3*utmp(0, j)
6220 & ), dxa(-1:2, j), ut(1, j))
6222 IF (ut(1, j) .GT. 0.)
THEN 6223 uc_tl(1, j) = sin_sg(0, j, 3)*ut_tl(1, j)
6224 uc(1, j) = ut(1, j)*sin_sg(0, j, 3)
6226 uc_tl(1, j) = sin_sg(1, j, 1)*ut_tl(1, j)
6227 uc(1, j) = ut(1, j)*sin_sg(1, j, 1)
6229 uc_tl(2, j) =
c1*utmp_tl(3, j) +
c2*utmp_tl(2, j) +
c3*utmp_tl&
6231 uc(2, j) =
c1*utmp(3, j) +
c2*utmp(2, j) +
c3*utmp(1, j)
6232 ut_tl(0, j) = rsin_u(0, j)*(uc_tl(0, j)-cosa_u(0, j)*v_tl(0, j&
6234 ut(0, j) = (uc(0, j)-v(0, j)*cosa_u(0, j))*rsin_u(0, j)
6235 ut_tl(2, j) = rsin_u(2, j)*(uc_tl(2, j)-cosa_u(2, j)*v_tl(2, j&
6237 ut(2, j) = (uc(2, j)-v(2, j)*cosa_u(2, j))*rsin_u(2, j)
6240 IF (ie + 1 .EQ. npx .AND. (.NOT.nested))
THEN 6242 uc_tl(npx-1, j) =
c1*utmp_tl(npx-3, j) +
c2*utmp_tl(npx-2, j) &
6243 & +
c3*utmp_tl(npx-1, j)
6244 uc(npx-1, j) =
c1*utmp(npx-3, j) +
c2*utmp(npx-2, j) +
c3*utmp&
6247 & ua_tl(npx-2:npx+1, j), dxa(npx-2:npx+1, j), ut(npx, j))
6248 IF (ut(npx, j) .GT. 0.)
THEN 6249 uc_tl(npx, j) = sin_sg(npx-1, j, 3)*ut_tl(npx, j)
6250 uc(npx, j) = ut(npx, j)*sin_sg(npx-1, j, 3)
6252 uc_tl(npx, j) = sin_sg(npx, j, 1)*ut_tl(npx, j)
6253 uc(npx, j) = ut(npx, j)*sin_sg(npx, j, 1)
6255 uc_tl(npx+1, j) =
c3*utmp_tl(npx, j) +
c2*utmp_tl(npx+1, j) + &
6256 &
c1*utmp_tl(npx+2, j)
6257 uc(npx+1, j) =
c3*utmp(npx, j) +
c2*utmp(npx+1, j) +
c1*utmp(&
6259 ut_tl(npx-1, j) = rsin_u(npx-1, j)*(uc_tl(npx-1, j)-cosa_u(npx&
6260 & -1, j)*v_tl(npx-1, j))
6261 ut(npx-1, j) = (uc(npx-1, j)-v(npx-1, j)*cosa_u(npx-1, j))*&
6263 ut_tl(npx+1, j) = rsin_u(npx+1, j)*(uc_tl(npx+1, j)-cosa_u(npx&
6264 & +1, j)*v_tl(npx+1, j))
6265 ut(npx+1, j) = (uc(npx+1, j)-v(npx+1, j)*cosa_u(npx+1, j))*&
6273 IF (gridstruct%sw_corner)
THEN 6275 vtmp_tl(0, j) = -utmp_tl(1-j, 0)
6276 vtmp(0, j) = -utmp(1-j, 0)
6279 IF (gridstruct%nw_corner)
THEN 6281 vtmp_tl(0, npy+j) = utmp_tl(j+1, npy)
6282 vtmp(0, npy+j) = utmp(j+1, npy)
6285 IF (gridstruct%se_corner)
THEN 6287 vtmp_tl(npx, j) = utmp_tl(ie+j, 0)
6288 vtmp(npx, j) = utmp(ie+j, 0)
6291 IF (gridstruct%ne_corner)
THEN 6293 vtmp_tl(npx, npy+j) = -utmp_tl(ie-j, npy)
6294 vtmp(npx, npy+j) = -utmp(ie-j, npy)
6297 IF (gridstruct%sw_corner)
THEN 6298 va_tl(0, -1) = -ua_tl(2, 0)
6299 va(0, -1) = -ua(2, 0)
6300 va_tl(0, 0) = -ua_tl(1, 0)
6301 va(0, 0) = -ua(1, 0)
6303 IF (gridstruct%se_corner)
THEN 6304 va_tl(npx, 0) = ua_tl(npx-1, 0)
6305 va(npx, 0) = ua(npx-1, 0)
6306 va_tl(npx, -1) = ua_tl(npx-2, 0)
6307 va(npx, -1) = ua(npx-2, 0)
6309 IF (gridstruct%ne_corner)
THEN 6310 va_tl(npx, npy) = -ua_tl(npx-1, npy)
6311 va(npx, npy) = -ua(npx-1, npy)
6312 va_tl(npx, npy+1) = -ua_tl(npx-2, npy)
6313 va(npx, npy+1) = -ua(npx-2, npy)
6315 IF (gridstruct%nw_corner)
THEN 6316 va_tl(0, npy) = ua_tl(1, npy)
6317 va(0, npy) = ua(1, npy)
6318 va_tl(0, npy+1) = ua_tl(2, npy)
6319 va(0, npy+1) = ua(2, npy)
6323 IF (j .EQ. 1 .AND. (.NOT.nested))
THEN 6326 & :2), dya(i, -1:2), vt(i, j))
6327 IF (vt(i, j) .GT. 0.)
THEN 6328 vc_tl(i, j) = sin_sg(i, j-1, 4)*vt_tl(i, j)
6329 vc(i, j) = vt(i, j)*sin_sg(i, j-1, 4)
6331 vc_tl(i, j) = sin_sg(i, j, 2)*vt_tl(i, j)
6332 vc(i, j) = vt(i, j)*sin_sg(i, j, 2)
6335 ELSE IF (j .EQ. 0 .OR. (j .EQ. npy - 1 .AND. (.NOT.nested))) &
6338 vc_tl(i, j) =
c1*vtmp_tl(i, j-2) +
c2*vtmp_tl(i, j-1) +
c3*&
6340 vc(i, j) =
c1*vtmp(i, j-2) +
c2*vtmp(i, j-1) +
c3*vtmp(i, j)
6341 vt_tl(i, j) = rsin_v(i, j)*(vc_tl(i, j)-cosa_v(i, j)*u_tl(i&
6343 vt(i, j) = (vc(i, j)-u(i, j)*cosa_v(i, j))*rsin_v(i, j)
6345 ELSE IF (j .EQ. 2 .OR. (j .EQ. npy + 1 .AND. (.NOT.nested))) &
6348 vc_tl(i, j) =
c1*vtmp_tl(i, j+1) +
c2*vtmp_tl(i, j) +
c3*&
6350 vc(i, j) =
c1*vtmp(i, j+1) +
c2*vtmp(i, j) +
c3*vtmp(i, j-1)
6351 vt_tl(i, j) = rsin_v(i, j)*(vc_tl(i, j)-cosa_v(i, j)*u_tl(i&
6353 vt(i, j) = (vc(i, j)-u(i, j)*cosa_v(i, j))*rsin_v(i, j)
6355 ELSE IF (j .EQ. npy .AND. (.NOT.nested))
THEN 6358 & , j-2:j+1), dya(i, j-2:j+1), vt(i, j))
6359 IF (vt(i, j) .GT. 0.)
THEN 6360 vc_tl(i, j) = sin_sg(i, j-1, 4)*vt_tl(i, j)
6361 vc(i, j) = vt(i, j)*sin_sg(i, j-1, 4)
6363 vc_tl(i, j) = sin_sg(i, j, 2)*vt_tl(i, j)
6364 vc(i, j) = vt(i, j)*sin_sg(i, j, 2)
6370 vc_tl(i, j) =
a2*(vtmp_tl(i, j-2)+vtmp_tl(i, j+1)) +
a1*(&
6371 & vtmp_tl(i, j-1)+vtmp_tl(i, j))
6372 vc(i, j) =
a2*(vtmp(i, j-2)+vtmp(i, j+1)) +
a1*(vtmp(i, j-1)&
6374 vt_tl(i, j) = rsin_v(i, j)*(vc_tl(i, j)-cosa_v(i, j)*u_tl(i&
6376 vt(i, j) = (vc(i, j)-u(i, j)*cosa_v(i, j))*rsin_v(i, j)
6384 vc_tl(i, j) =
a2*(vtmp_tl(i, j-2)+vtmp_tl(i, j+1)) +
a1*(&
6385 & vtmp_tl(i, j-1)+vtmp_tl(i, j))
6386 vc(i, j) =
a2*(vtmp(i, j-2)+vtmp(i, j+1)) +
a1*(vtmp(i, j-1)+&
6388 vt_tl(i, j) = vc_tl(i, j)
6399 SUBROUTINE d2a2c_vect(u, v, ua, va, uc, vc, ut, vt, dord4, gridstruct&
6400 & , bd, npx, npy, nested, grid_type)
6403 LOGICAL,
INTENT(IN) :: dord4
6404 REAL,
INTENT(IN) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1)
6405 REAL,
INTENT(IN) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed)
6406 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(OUT) :: uc
6407 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(OUT) :: vc
6408 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: ua, va&
6410 INTEGER,
INTENT(IN) :: npx, npy,
grid_type 6411 LOGICAL,
INTENT(IN) :: nested
6414 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: utmp, vtmp
6415 INTEGER :: npt, i, j, ifirst, ilast, id
6416 INTEGER :: is, ie, js, je
6417 INTEGER :: isd, ied, jsd, jed
6418 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg
6419 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v, cosa_s
6420 REAL,
DIMENSION(:, :),
POINTER :: rsin_u, rsin_v, rsin2
6421 REAL,
DIMENSION(:, :),
POINTER :: dxa, dya
6444 sin_sg => gridstruct%sin_sg
6445 cosa_u => gridstruct%cosa_u
6446 cosa_v => gridstruct%cosa_v
6447 cosa_s => gridstruct%cosa_s
6448 rsin_u => gridstruct%rsin_u
6449 rsin_v => gridstruct%rsin_v
6450 rsin2 => gridstruct%rsin2
6451 dxa => gridstruct%dxa
6452 dya => gridstruct%dya
6458 IF (
grid_type .LT. 3 .AND. (.NOT.nested))
THEN 6469 utmp(i, j) =
a2*(u(i, j-1)+u(i, j+2)) +
a1*(u(i, j)+u(i, j+1))
6474 utmp(i, jsd) = 0.5*(u(i, jsd)+u(i, jsd+1))
6476 utmp(i, jed) = 0.5*(u(i, jed)+u(i, jed+1))
6480 vtmp(i, j) =
a2*(v(i-1, j)+v(i+2, j)) +
a1*(v(i, j)+v(i+1, j))
6483 vtmp(isd, j) = 0.5*(v(isd, j)+v(isd+1, j))
6485 vtmp(ied, j) = 0.5*(v(ied, j)+v(ied+1, j))
6489 ua(i, j) = (utmp(i, j)-vtmp(i, j)*cosa_s(i, j))*rsin2(i, j)
6490 va(i, j) = (vtmp(i, j)-utmp(i, j)*cosa_s(i, j))*rsin2(i, j)
6494 IF (npt .LT. js - 1)
THEN 6499 IF (npy - npt .GT. je + 1)
THEN 6508 IF (npt .LT. isd)
THEN 6513 IF (npx - npt .GT. ied)
THEN 6519 utmp(i, j) =
a2*(u(i, j-1)+u(i, j+2)) +
a1*(u(i, j)+u(i, j+1))
6522 IF (npt .LT. jsd)
THEN 6527 IF (npy - npt .GT. jed)
THEN 6533 IF (npt .LT. is - 1)
THEN 6538 IF (npx - npt .GT. ie + 1)
THEN 6544 vtmp(i, j) =
a2*(v(i-1, j)+v(i+2, j)) +
a1*(v(i, j)+v(i+1, j))
6551 IF (js .EQ. 1 .OR. jsd .LT. npt)
THEN 6554 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6555 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6559 IF (je + 1 .EQ. npy .OR. jed .GE. npy - npt)
THEN 6562 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6563 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6567 IF (is .EQ. 1 .OR. isd .LT. npt)
THEN 6568 IF (npt .LT. jsd)
THEN 6573 IF (npy - npt .GT. jed)
THEN 6580 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6581 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6585 IF (ie + 1 .EQ. npx .OR. ied .GE. npx - npt)
THEN 6586 IF (npt .LT. jsd)
THEN 6591 IF (npy - npt .GT. jed)
THEN 6598 utmp(i, j) = 0.5*(u(i, j)+u(i, j+1))
6599 vtmp(i, j) = 0.5*(v(i, j)+v(i+1, j))
6605 DO j=js-1-id,je+1+id
6606 DO i=is-1-id,ie+1+id
6607 ua(i, j) = (utmp(i, j)-vtmp(i, j)*cosa_s(i, j))*rsin2(i, j)
6608 va(i, j) = (vtmp(i, j)-utmp(i, j)*cosa_s(i, j))*rsin2(i, j)
6617 IF (gridstruct%sw_corner)
THEN 6619 utmp(i, 0) = -vtmp(0, 1-i)
6622 IF (gridstruct%se_corner)
THEN 6624 utmp(npx+i, 0) = vtmp(npx, i+1)
6627 IF (gridstruct%ne_corner)
THEN 6629 utmp(npx+i, npy) = -vtmp(npx, je-i)
6632 IF (gridstruct%nw_corner)
THEN 6634 utmp(i, npy) = vtmp(0, je+i)
6637 IF (
grid_type .LT. 3 .AND. (.NOT.nested))
THEN 6638 IF (3 .LT. is - 1)
THEN 6643 IF (npx - 2 .GT. ie + 2)
THEN 6657 uc(i, j) =
a2*(utmp(i-2, j)+utmp(i+1, j)) +
a1*(utmp(i-1, j)+&
6659 ut(i, j) = (uc(i, j)-v(i, j)*cosa_u(i, j))*rsin_u(i, j)
6664 IF (gridstruct%sw_corner)
THEN 6665 ua(-1, 0) = -va(0, 2)
6666 ua(0, 0) = -va(0, 1)
6668 IF (gridstruct%se_corner)
THEN 6669 ua(npx, 0) = va(npx, 1)
6670 ua(npx+1, 0) = va(npx, 2)
6672 IF (gridstruct%ne_corner)
THEN 6673 ua(npx, npy) = -va(npx, npy-1)
6674 ua(npx+1, npy) = -va(npx, npy-2)
6676 IF (gridstruct%nw_corner)
THEN 6677 ua(-1, npy) = va(0, npy-2)
6678 ua(0, npy) = va(0, npy-1)
6680 IF (is .EQ. 1 .AND. (.NOT.nested))
THEN 6682 uc(0, j) =
c1*utmp(-2, j) +
c2*utmp(-1, j) +
c3*utmp(0, j)
6685 IF (ut(1, j) .GT. 0.)
THEN 6686 uc(1, j) = ut(1, j)*sin_sg(0, j, 3)
6688 uc(1, j) = ut(1, j)*sin_sg(1, j, 1)
6690 uc(2, j) =
c1*utmp(3, j) +
c2*utmp(2, j) +
c3*utmp(1, j)
6691 ut(0, j) = (uc(0, j)-v(0, j)*cosa_u(0, j))*rsin_u(0, j)
6692 ut(2, j) = (uc(2, j)-v(2, j)*cosa_u(2, j))*rsin_u(2, j)
6695 IF (ie + 1 .EQ. npx .AND. (.NOT.nested))
THEN 6697 uc(npx-1, j) =
c1*utmp(npx-3, j) +
c2*utmp(npx-2, j) +
c3*utmp&
6701 IF (ut(npx, j) .GT. 0.)
THEN 6702 uc(npx, j) = ut(npx, j)*sin_sg(npx-1, j, 3)
6704 uc(npx, j) = ut(npx, j)*sin_sg(npx, j, 1)
6706 uc(npx+1, j) =
c3*utmp(npx, j) +
c2*utmp(npx+1, j) +
c1*utmp(&
6708 ut(npx-1, j) = (uc(npx-1, j)-v(npx-1, j)*cosa_u(npx-1, j))*&
6710 ut(npx+1, j) = (uc(npx+1, j)-v(npx+1, j)*cosa_u(npx+1, j))*&
6718 IF (gridstruct%sw_corner)
THEN 6720 vtmp(0, j) = -utmp(1-j, 0)
6723 IF (gridstruct%nw_corner)
THEN 6725 vtmp(0, npy+j) = utmp(j+1, npy)
6728 IF (gridstruct%se_corner)
THEN 6730 vtmp(npx, j) = utmp(ie+j, 0)
6733 IF (gridstruct%ne_corner)
THEN 6735 vtmp(npx, npy+j) = -utmp(ie-j, npy)
6738 IF (gridstruct%sw_corner)
THEN 6739 va(0, -1) = -ua(2, 0)
6740 va(0, 0) = -ua(1, 0)
6742 IF (gridstruct%se_corner)
THEN 6743 va(npx, 0) = ua(npx-1, 0)
6744 va(npx, -1) = ua(npx-2, 0)
6746 IF (gridstruct%ne_corner)
THEN 6747 va(npx, npy) = -ua(npx-1, npy)
6748 va(npx, npy+1) = -ua(npx-2, npy)
6750 IF (gridstruct%nw_corner)
THEN 6751 va(0, npy) = ua(1, npy)
6752 va(0, npy+1) = ua(2, npy)
6756 IF (j .EQ. 1 .AND. (.NOT.nested))
THEN 6759 IF (vt(i, j) .GT. 0.)
THEN 6760 vc(i, j) = vt(i, j)*sin_sg(i, j-1, 4)
6762 vc(i, j) = vt(i, j)*sin_sg(i, j, 2)
6765 ELSE IF (j .EQ. 0 .OR. (j .EQ. npy - 1 .AND. (.NOT.nested))) &
6768 vc(i, j) =
c1*vtmp(i, j-2) +
c2*vtmp(i, j-1) +
c3*vtmp(i, j)
6769 vt(i, j) = (vc(i, j)-u(i, j)*cosa_v(i, j))*rsin_v(i, j)
6771 ELSE IF (j .EQ. 2 .OR. (j .EQ. npy + 1 .AND. (.NOT.nested))) &
6774 vc(i, j) =
c1*vtmp(i, j+1) +
c2*vtmp(i, j) +
c3*vtmp(i, j-1)
6775 vt(i, j) = (vc(i, j)-u(i, j)*cosa_v(i, j))*rsin_v(i, j)
6777 ELSE IF (j .EQ. npy .AND. (.NOT.nested))
THEN 6781 IF (vt(i, j) .GT. 0.)
THEN 6782 vc(i, j) = vt(i, j)*sin_sg(i, j-1, 4)
6784 vc(i, j) = vt(i, j)*sin_sg(i, j, 2)
6790 vc(i, j) =
a2*(vtmp(i, j-2)+vtmp(i, j+1)) +
a1*(vtmp(i, j-1)&
6792 vt(i, j) = (vc(i, j)-u(i, j)*cosa_v(i, j))*rsin_v(i, j)
6800 vc(i, j) =
a2*(vtmp(i, j-2)+vtmp(i, j+1)) +
a1*(vtmp(i, j-1)+&
6812 REAL,
INTENT(IN) :: ua(4)
6813 REAL,
INTENT(IN) :: ua_tl(4)
6814 REAL,
INTENT(IN) :: dxa(4)
6817 t1 = dxa(1) + dxa(2)
6818 t2 = dxa(3) + dxa(4)
6820 & t1+((t2+dxa(3))*ua_tl(3)-dxa(3)*ua_tl(4))/t2)
6822 & dxa(3))*ua(3)-dxa(3)*ua(4))/t2)
6826 REAL,
INTENT(IN) :: ua(4)
6827 REAL,
INTENT(IN) :: dxa(4)
6829 t1 = dxa(1) + dxa(2)
6830 t2 = dxa(3) + dxa(4)
6832 & dxa(3))*ua(3)-dxa(3)*ua(4))/t2)
6834 SUBROUTINE fill3_4corners(q1, q2, q3, dir, bd, npx, npy, sw_corner, &
6835 & se_corner, ne_corner, nw_corner)
6837 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
6840 INTEGER,
INTENT(IN) :: dir
6841 REAL,
INTENT(INOUT) :: q1(bd%isd:bd%ied, bd%jsd:bd%jed)
6842 REAL,
INTENT(INOUT) :: q2(bd%isd:bd%ied, bd%jsd:bd%jed)
6843 REAL,
INTENT(INOUT) :: q3(bd%isd:bd%ied, bd%jsd:bd%jed)
6844 LOGICAL,
INTENT(IN) :: sw_corner, se_corner, ne_corner, nw_corner
6845 INTEGER,
INTENT(IN) :: npx, npy
6847 INTEGER :: is, ie, js, je
6848 INTEGER :: isd, ied, jsd, jed
6860 q1(-1, 0) = q1(0, 2)
6862 q1(0, -1) = q1(-1, 1)
6863 q2(-1, 0) = q2(0, 2)
6865 q2(0, -1) = q2(-1, 1)
6866 q3(-1, 0) = q3(0, 2)
6868 q3(0, -1) = q3(-1, 1)
6871 q1(npx+1, 0) = q1(npx, 2)
6872 q1(npx, 0) = q1(npx, 1)
6873 q1(npx, -1) = q1(npx+1, 1)
6874 q2(npx+1, 0) = q2(npx, 2)
6875 q2(npx, 0) = q2(npx, 1)
6876 q2(npx, -1) = q2(npx+1, 1)
6877 q3(npx+1, 0) = q3(npx, 2)
6878 q3(npx, 0) = q3(npx, 1)
6879 q3(npx, -1) = q3(npx+1, 1)
6882 q1(npx, npy) = q1(npx, npy-1)
6883 q1(npx+1, npy) = q1(npx, npy-2)
6884 q1(npx, npy+1) = q1(npx+1, npy-1)
6885 q2(npx, npy) = q2(npx, npy-1)
6886 q2(npx+1, npy) = q2(npx, npy-2)
6887 q2(npx, npy+1) = q2(npx+1, npy-1)
6888 q3(npx, npy) = q3(npx, npy-1)
6889 q3(npx+1, npy) = q3(npx, npy-2)
6890 q3(npx, npy+1) = q3(npx+1, npy-1)
6893 q1(0, npy) = q1(0, npy-1)
6894 q1(-1, npy) = q1(0, npy-2)
6895 q1(0, npy+1) = q1(-1, npy-1)
6896 q2(0, npy) = q2(0, npy-1)
6897 q2(-1, npy) = q2(0, npy-2)
6898 q2(0, npy+1) = q2(-1, npy-1)
6899 q3(0, npy) = q3(0, npy-1)
6900 q3(-1, npy) = q3(0, npy-2)
6901 q3(0, npy+1) = q3(-1, npy-1)
6906 q1(0, -1) = q1(2, 0)
6907 q1(-1, 0) = q1(1, -1)
6909 q2(0, -1) = q2(2, 0)
6910 q2(-1, 0) = q2(1, -1)
6912 q3(0, -1) = q3(2, 0)
6913 q3(-1, 0) = q3(1, -1)
6916 q1(npx, 0) = q1(npx-1, 0)
6917 q1(npx, -1) = q1(npx-2, 0)
6918 q1(npx+1, 0) = q1(npx-1, -1)
6919 q2(npx, 0) = q2(npx-1, 0)
6920 q2(npx, -1) = q2(npx-2, 0)
6921 q2(npx+1, 0) = q2(npx-1, -1)
6922 q3(npx, 0) = q3(npx-1, 0)
6923 q3(npx, -1) = q3(npx-2, 0)
6924 q3(npx+1, 0) = q3(npx-1, -1)
6927 q1(npx, npy) = q1(npx-1, npy)
6928 q1(npx, npy+1) = q1(npx-2, npy)
6929 q1(npx+1, npy) = q1(npx-1, npy+1)
6930 q2(npx, npy) = q2(npx-1, npy)
6931 q2(npx, npy+1) = q2(npx-2, npy)
6932 q2(npx+1, npy) = q2(npx-1, npy+1)
6933 q3(npx, npy) = q3(npx-1, npy)
6934 q3(npx, npy+1) = q3(npx-2, npy)
6935 q3(npx+1, npy) = q3(npx-1, npy+1)
6938 q1(0, npy) = q1(1, npy)
6939 q1(0, npy+1) = q1(2, npy)
6940 q1(-1, npy) = q1(1, npy+1)
6941 q2(0, npy) = q2(1, npy)
6942 q2(0, npy+1) = q2(2, npy)
6943 q2(-1, npy) = q2(1, npy+1)
6944 q3(0, npy) = q3(1, npy)
6945 q3(0, npy+1) = q3(2, npy)
6946 q3(-1, npy) = q3(1, npy+1)
6954 & , sw_corner, se_corner, ne_corner, nw_corner)
6956 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
6959 INTEGER,
INTENT(IN) :: dir
6960 REAL,
INTENT(INOUT) :: q1(bd%isd:bd%ied, bd%jsd:bd%jed)
6961 REAL,
INTENT(INOUT) :: q1_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
6962 REAL,
INTENT(INOUT) :: q2(bd%isd:bd%ied, bd%jsd:bd%jed)
6963 REAL,
INTENT(INOUT) :: q2_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
6964 LOGICAL,
INTENT(IN) :: sw_corner, se_corner, ne_corner, nw_corner
6965 INTEGER,
INTENT(IN) :: npx, npy
6966 INTEGER :: is, ie, js, je
6967 INTEGER :: isd, ied, jsd, jed
6979 q1_tl(-1, 0) = q1_tl(0, 2)
6980 q1(-1, 0) = q1(0, 2)
6981 q1_tl(0, 0) = q1_tl(0, 1)
6983 q2_tl(-1, 0) = q2_tl(0, 2)
6984 q2(-1, 0) = q2(0, 2)
6985 q2_tl(0, 0) = q2_tl(0, 1)
6989 q1_tl(npx+1, 0) = q1_tl(npx, 2)
6990 q1(npx+1, 0) = q1(npx, 2)
6991 q1_tl(npx, 0) = q1_tl(npx, 1)
6992 q1(npx, 0) = q1(npx, 1)
6993 q2_tl(npx+1, 0) = q2_tl(npx, 2)
6994 q2(npx+1, 0) = q2(npx, 2)
6995 q2_tl(npx, 0) = q2_tl(npx, 1)
6996 q2(npx, 0) = q2(npx, 1)
6999 q1_tl(0, npy) = q1_tl(0, npy-1)
7000 q1(0, npy) = q1(0, npy-1)
7001 q1_tl(-1, npy) = q1_tl(0, npy-2)
7002 q1(-1, npy) = q1(0, npy-2)
7003 q2_tl(0, npy) = q2_tl(0, npy-1)
7004 q2(0, npy) = q2(0, npy-1)
7005 q2_tl(-1, npy) = q2_tl(0, npy-2)
7006 q2(-1, npy) = q2(0, npy-2)
7009 q1_tl(npx, npy) = q1_tl(npx, npy-1)
7010 q1(npx, npy) = q1(npx, npy-1)
7011 q1_tl(npx+1, npy) = q1_tl(npx, npy-2)
7012 q1(npx+1, npy) = q1(npx, npy-2)
7013 q2_tl(npx, npy) = q2_tl(npx, npy-1)
7014 q2(npx, npy) = q2(npx, npy-1)
7015 q2_tl(npx+1, npy) = q2_tl(npx, npy-2)
7016 q2(npx+1, npy) = q2(npx, npy-2)
7020 q1_tl(0, 0) = q1_tl(1, 0)
7022 q1_tl(0, -1) = q1_tl(2, 0)
7023 q1(0, -1) = q1(2, 0)
7024 q2_tl(0, 0) = q2_tl(1, 0)
7026 q2_tl(0, -1) = q2_tl(2, 0)
7027 q2(0, -1) = q2(2, 0)
7030 q1_tl(npx, 0) = q1_tl(npx-1, 0)
7031 q1(npx, 0) = q1(npx-1, 0)
7032 q1_tl(npx, -1) = q1_tl(npx-2, 0)
7033 q1(npx, -1) = q1(npx-2, 0)
7034 q2_tl(npx, 0) = q2_tl(npx-1, 0)
7035 q2(npx, 0) = q2(npx-1, 0)
7036 q2_tl(npx, -1) = q2_tl(npx-2, 0)
7037 q2(npx, -1) = q2(npx-2, 0)
7040 q1_tl(0, npy) = q1_tl(1, npy)
7041 q1(0, npy) = q1(1, npy)
7042 q1_tl(0, npy+1) = q1_tl(2, npy)
7043 q1(0, npy+1) = q1(2, npy)
7044 q2_tl(0, npy) = q2_tl(1, npy)
7045 q2(0, npy) = q2(1, npy)
7046 q2_tl(0, npy+1) = q2_tl(2, npy)
7047 q2(0, npy+1) = q2(2, npy)
7050 q1_tl(npx, npy) = q1_tl(npx-1, npy)
7051 q1(npx, npy) = q1(npx-1, npy)
7052 q1_tl(npx, npy+1) = q1_tl(npx-2, npy)
7053 q1(npx, npy+1) = q1(npx-2, npy)
7054 q2_tl(npx, npy) = q2_tl(npx-1, npy)
7055 q2(npx, npy) = q2(npx-1, npy)
7056 q2_tl(npx, npy+1) = q2_tl(npx-2, npy)
7057 q2(npx, npy+1) = q2(npx-2, npy)
7061 SUBROUTINE fill2_4corners(q1, q2, dir, bd, npx, npy, sw_corner, &
7062 & se_corner, ne_corner, nw_corner)
7064 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
7067 INTEGER,
INTENT(IN) :: dir
7068 REAL,
INTENT(INOUT) :: q1(bd%isd:bd%ied, bd%jsd:bd%jed)
7069 REAL,
INTENT(INOUT) :: q2(bd%isd:bd%ied, bd%jsd:bd%jed)
7070 LOGICAL,
INTENT(IN) :: sw_corner, se_corner, ne_corner, nw_corner
7071 INTEGER,
INTENT(IN) :: npx, npy
7072 INTEGER :: is, ie, js, je
7073 INTEGER :: isd, ied, jsd, jed
7085 q1(-1, 0) = q1(0, 2)
7087 q2(-1, 0) = q2(0, 2)
7091 q1(npx+1, 0) = q1(npx, 2)
7092 q1(npx, 0) = q1(npx, 1)
7093 q2(npx+1, 0) = q2(npx, 2)
7094 q2(npx, 0) = q2(npx, 1)
7097 q1(0, npy) = q1(0, npy-1)
7098 q1(-1, npy) = q1(0, npy-2)
7099 q2(0, npy) = q2(0, npy-1)
7100 q2(-1, npy) = q2(0, npy-2)
7103 q1(npx, npy) = q1(npx, npy-1)
7104 q1(npx+1, npy) = q1(npx, npy-2)
7105 q2(npx, npy) = q2(npx, npy-1)
7106 q2(npx+1, npy) = q2(npx, npy-2)
7111 q1(0, -1) = q1(2, 0)
7113 q2(0, -1) = q2(2, 0)
7116 q1(npx, 0) = q1(npx-1, 0)
7117 q1(npx, -1) = q1(npx-2, 0)
7118 q2(npx, 0) = q2(npx-1, 0)
7119 q2(npx, -1) = q2(npx-2, 0)
7122 q1(0, npy) = q1(1, npy)
7123 q1(0, npy+1) = q1(2, npy)
7124 q2(0, npy) = q2(1, npy)
7125 q2(0, npy+1) = q2(2, npy)
7128 q1(npx, npy) = q1(npx-1, npy)
7129 q1(npx, npy+1) = q1(npx-2, npy)
7130 q2(npx, npy) = q2(npx-1, npy)
7131 q2(npx, npy+1) = q2(npx-2, npy)
7139 & se_corner, ne_corner, nw_corner)
7144 INTEGER,
INTENT(IN) :: dir
7145 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
7146 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
7147 LOGICAL,
INTENT(IN) :: sw_corner, se_corner, ne_corner, nw_corner
7148 INTEGER,
INTENT(IN) :: npx, npy
7149 INTEGER :: is, ie, js, je
7150 INTEGER :: isd, ied, jsd, jed
7162 q_tl(-1, 0) = q_tl(0, 2)
7164 q_tl(0, 0) = q_tl(0, 1)
7168 q_tl(npx+1, 0) = q_tl(npx, 2)
7169 q(npx+1, 0) = q(npx, 2)
7170 q_tl(npx, 0) = q_tl(npx, 1)
7171 q(npx, 0) = q(npx, 1)
7174 q_tl(0, npy) = q_tl(0, npy-1)
7175 q(0, npy) = q(0, npy-1)
7176 q_tl(-1, npy) = q_tl(0, npy-2)
7177 q(-1, npy) = q(0, npy-2)
7180 q_tl(npx, npy) = q_tl(npx, npy-1)
7181 q(npx, npy) = q(npx, npy-1)
7182 q_tl(npx+1, npy) = q_tl(npx, npy-2)
7183 q(npx+1, npy) = q(npx, npy-2)
7187 q_tl(0, 0) = q_tl(1, 0)
7189 q_tl(0, -1) = q_tl(2, 0)
7193 q_tl(npx, 0) = q_tl(npx-1, 0)
7194 q(npx, 0) = q(npx-1, 0)
7195 q_tl(npx, -1) = q_tl(npx-2, 0)
7196 q(npx, -1) = q(npx-2, 0)
7199 q_tl(0, npy) = q_tl(1, npy)
7200 q(0, npy) = q(1, npy)
7201 q_tl(0, npy+1) = q_tl(2, npy)
7202 q(0, npy+1) = q(2, npy)
7205 q_tl(npx, npy) = q_tl(npx-1, npy)
7206 q(npx, npy) = q(npx-1, npy)
7207 q_tl(npx, npy+1) = q_tl(npx-2, npy)
7208 q(npx, npy+1) = q(npx-2, npy)
7212 SUBROUTINE fill_4corners(q, dir, bd, npx, npy, sw_corner, se_corner, &
7213 & ne_corner, nw_corner)
7218 INTEGER,
INTENT(IN) :: dir
7219 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
7220 LOGICAL,
INTENT(IN) :: sw_corner, se_corner, ne_corner, nw_corner
7221 INTEGER,
INTENT(IN) :: npx, npy
7222 INTEGER :: is, ie, js, je
7223 INTEGER :: isd, ied, jsd, jed
7239 q(npx+1, 0) = q(npx, 2)
7240 q(npx, 0) = q(npx, 1)
7243 q(0, npy) = q(0, npy-1)
7244 q(-1, npy) = q(0, npy-2)
7247 q(npx, npy) = q(npx, npy-1)
7248 q(npx+1, npy) = q(npx, npy-2)
7256 q(npx, 0) = q(npx-1, 0)
7257 q(npx, -1) = q(npx-2, 0)
7260 q(0, npy) = q(1, npy)
7261 q(0, npy+1) = q(2, npy)
7264 q(npx, npy) = q(npx-1, npy)
7265 q(npx, npy+1) = q(npx-2, npy)
7272 SUBROUTINE xtp_u_tlm(is, ie, js, je, isd, ied, jsd, jed, c, c_tl, u&
7273 & , u_tl, v, flux, flux_tl, iord, dx, rdx, npx, npy, grid_type, nested&
7276 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed
7277 REAL,
INTENT(IN) :: u(isd:ied, jsd:jed+1)
7278 REAL,
INTENT(IN) :: u_tl(isd:ied, jsd:jed+1)
7279 REAL,
INTENT(IN) :: v(isd:ied+1, jsd:jed)
7280 REAL,
INTENT(IN) :: c(is:ie+1, js:je+1)
7281 REAL,
INTENT(IN) :: c_tl(is:ie+1, js:je+1)
7282 REAL,
INTENT(OUT) :: flux(is:ie+1, js:je+1)
7283 REAL,
INTENT(OUT) :: flux_tl(is:ie+1, js:je+1)
7284 REAL,
INTENT(IN) :: dx(isd:ied, jsd:jed+1)
7285 REAL,
INTENT(IN) :: rdx(isd:ied, jsd:jed+1)
7286 INTEGER,
INTENT(IN) :: iord, npx, npy, grid_type
7287 LOGICAL,
INTENT(IN) :: nested
7289 REAL,
DIMENSION(is-1:ie+1) :: bl, br, b0
7290 REAL,
DIMENSION(is-1:ie+1) :: bl_tl, br_tl, b0_tl
7291 LOGICAL,
DIMENSION(is-1:ie+1) :: smt5, smt6
7292 REAL :: fx0(is:ie+1)
7293 REAL :: al(is-1:ie+2), dm(is-2:ie+2)
7294 REAL :: al_tl(is-1:ie+2)
7295 REAL :: dq(is-3:ie+2)
7296 REAL :: dl, dr, xt, pmp, lac, cfl
7297 REAL :: xt_tl, cfl_tl
7298 REAL :: pmp_1, lac_1, pmp_2, lac_2
7299 REAL :: x0, x1, x0l, x0r
7309 IF (3 .LT. is - 1)
THEN 7314 IF (npx - 3 .GT. ie + 1)
THEN 7320 IF (iord .EQ. 1)
THEN 7323 IF (c(i, j) .GT. 0.)
THEN 7324 flux_tl(i, j) = u_tl(i-1, j)
7325 flux(i, j) = u(i-1, j)
7327 flux_tl(i, j) = u_tl(i, j)
7328 flux(i, j) = u(i, j)
7332 ELSE IF (iord .EQ. 333)
THEN 7335 IF (c(i, j) .GT. 0.)
THEN 7336 flux_tl(i, j) = (2.0*u_tl(i, j)+5.0*u_tl(i-1, j)-u_tl(i-2, j&
7337 & ))/6.0 - 0.5*rdx(i-1, j)*(c_tl(i, j)*(u(i, j)-u(i-1, j))+c&
7338 & (i, j)*(u_tl(i, j)-u_tl(i-1, j))) + rdx(i-1, j)**2*(c_tl(i&
7339 & , j)*c(i, j)+c(i, j)*c_tl(i, j))*(u(i, j)-2.0*u(i-1, j)+u(&
7340 & i-2, j))/6.0 + c(i, j)**2*rdx(i-1, j)**2*(u_tl(i, j)-2.0*&
7341 & u_tl(i-1, j)+u_tl(i-2, j))/6.0
7342 flux(i, j) = (2.0*u(i, j)+5.0*u(i-1, j)-u(i-2, j))/6.0 - 0.5&
7343 & *c(i, j)*rdx(i-1, j)*(u(i, j)-u(i-1, j)) + c(i, j)*rdx(i-1&
7344 & , j)*c(i, j)*rdx(i-1, j)/6.0*(u(i, j)-2.0*u(i-1, j)+u(i-2&
7347 flux_tl(i, j) = (2.0*u_tl(i-1, j)+5.0*u_tl(i, j)-u_tl(i+1, j&
7348 & ))/6.0 - 0.5*rdx(i, j)*(c_tl(i, j)*(u(i, j)-u(i-1, j))+c(i&
7349 & , j)*(u_tl(i, j)-u_tl(i-1, j))) + rdx(i, j)**2*(c_tl(i, j)&
7350 & *c(i, j)+c(i, j)*c_tl(i, j))*(u(i+1, j)-2.0*u(i, j)+u(i-1&
7351 & , j))/6.0 + c(i, j)**2*rdx(i, j)**2*(u_tl(i+1, j)-2.0*u_tl&
7352 & (i, j)+u_tl(i-1, j))/6.0
7353 flux(i, j) = (2.0*u(i-1, j)+5.0*u(i, j)-u(i+1, j))/6.0 - 0.5&
7354 & *c(i, j)*rdx(i, j)*(u(i, j)-u(i-1, j)) + c(i, j)*rdx(i, j)&
7355 & *c(i, j)*rdx(i, j)/6.0*(u(i+1, j)-2.0*u(i, j)+u(i-1, j))
7359 ELSE IF (iord .LT. 8)
THEN 7367 al_tl(i) =
p1*(u_tl(i-1, j)+u_tl(i, j)) +
p2*(u_tl(i-2, j)+&
7369 al(i) =
p1*(u(i-1, j)+u(i, j)) +
p2*(u(i-2, j)+u(i+1, j))
7372 bl_tl(i) = al_tl(i) - u_tl(i, j)
7373 bl(i) = al(i) - u(i, j)
7374 br_tl(i) = al_tl(i+1) - u_tl(i, j)
7375 br(i) = al(i+1) - u(i, j)
7377 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 7379 xt_tl =
c3*u_tl(1, j) +
c2*u_tl(2, j) +
c1*u_tl(3, j)
7380 xt =
c3*u(1, j) +
c2*u(2, j) +
c1*u(3, j)
7381 br_tl(1) = xt_tl - u_tl(1, j)
7382 br(1) = xt - u(1, j)
7383 bl_tl(2) = xt_tl - u_tl(2, j)
7384 bl(2) = xt - u(2, j)
7385 br_tl(2) = al_tl(3) - u_tl(2, j)
7386 br(2) = al(3) - u(2, j)
7387 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 7401 bl_tl(0) =
c1*u_tl(-2, j) +
c2*u_tl(-1, j) +
c3*u_tl(0, j)&
7403 bl(0) =
c1*u(-2, j) +
c2*u(-1, j) +
c3*u(0, j) - u(0, j)
7404 xt_tl = 0.5*(((2.*dx(0, j)+dx(-1, j))*u_tl(0, j)-dx(0, j)*&
7405 & u_tl(-1, j))/(dx(0, j)+dx(-1, j))+((2.*dx(1, j)+dx(2, j)&
7406 & )*u_tl(1, j)-dx(1, j)*u_tl(2, j))/(dx(1, j)+dx(2, j)))
7407 xt = 0.5*(((2.*dx(0, j)+dx(-1, j))*u(0, j)-dx(0, j)*u(-1, &
7408 & j))/(dx(0, j)+dx(-1, j))+((2.*dx(1, j)+dx(2, j))*u(1, j)&
7409 & -dx(1, j)*u(2, j))/(dx(1, j)+dx(2, j)))
7410 br_tl(0) = xt_tl - u_tl(0, j)
7411 br(0) = xt - u(0, j)
7412 bl_tl(1) = xt_tl - u_tl(1, j)
7413 bl(1) = xt - u(1, j)
7417 IF (ie + 1 .EQ. npx)
THEN 7418 bl_tl(npx-2) = al_tl(npx-2) - u_tl(npx-2, j)
7419 bl(npx-2) = al(npx-2) - u(npx-2, j)
7420 xt_tl =
c1*u_tl(npx-3, j) +
c2*u_tl(npx-2, j) +
c3*u_tl(npx-&
7422 xt =
c1*u(npx-3, j) +
c2*u(npx-2, j) +
c3*u(npx-1, j)
7423 br_tl(npx-2) = xt_tl - u_tl(npx-2, j)
7424 br(npx-2) = xt - u(npx-2, j)
7425 bl_tl(npx-1) = xt_tl - u_tl(npx-1, j)
7426 bl(npx-1) = xt - u(npx-1, j)
7427 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 7441 xt_tl = 0.5*(((2.*dx(npx-1, j)+dx(npx-2, j))*u_tl(npx-1, j&
7442 & )-dx(npx-1, j)*u_tl(npx-2, j))/(dx(npx-1, j)+dx(npx-2, j&
7443 & ))+((2.*dx(npx, j)+dx(npx+1, j))*u_tl(npx, j)-dx(npx, j)&
7444 & *u_tl(npx+1, j))/(dx(npx, j)+dx(npx+1, j)))
7445 xt = 0.5*(((2.*dx(npx-1, j)+dx(npx-2, j))*u(npx-1, j)-dx(&
7446 & npx-1, j)*u(npx-2, j))/(dx(npx-1, j)+dx(npx-2, j))+((2.*&
7447 & dx(npx, j)+dx(npx+1, j))*u(npx, j)-dx(npx, j)*u(npx+1, j&
7448 & ))/(dx(npx, j)+dx(npx+1, j)))
7449 br_tl(npx-1) = xt_tl - u_tl(npx-1, j)
7450 br(npx-1) = xt - u(npx-1, j)
7451 bl_tl(npx) = xt_tl - u_tl(npx, j)
7452 bl(npx) = xt - u(npx, j)
7453 br_tl(npx) =
c3*u_tl(npx, j) +
c2*u_tl(npx+1, j) +
c1*u_tl&
7454 & (npx+2, j) - u_tl(npx, j)
7455 br(npx) =
c3*u(npx, j) +
c2*u(npx+1, j) +
c1*u(npx+2, j) -&
7462 b0_tl(i) = bl_tl(i) + br_tl(i)
7463 b0(i) = bl(i) + br(i)
7465 IF (iord .EQ. 2)
THEN 7469 IF (c(i, j) .GT. 0.)
THEN 7470 cfl_tl = rdx(i-1, j)*c_tl(i, j)
7471 cfl = c(i, j)*rdx(i-1, j)
7472 flux_tl(i, j) = u_tl(i-1, j) + (1.-cfl)*(br_tl(i-1)-cfl_tl&
7473 & *b0(i-1)-cfl*b0_tl(i-1)) - cfl_tl*(br(i-1)-cfl*b0(i-1))
7474 flux(i, j) = u(i-1, j) + (1.-cfl)*(br(i-1)-cfl*b0(i-1))
7476 cfl_tl = rdx(i, j)*c_tl(i, j)
7477 cfl = c(i, j)*rdx(i, j)
7478 flux_tl(i, j) = u_tl(i, j) + cfl_tl*(bl(i)+cfl*b0(i)) + (&
7479 & 1.+cfl)*(bl_tl(i)+cfl_tl*b0(i)+cfl*b0_tl(i))
7480 flux(i, j) = u(i, j) + (1.+cfl)*(bl(i)+cfl*b0(i))
7490 SUBROUTINE ytp_v_tlm(is, ie, js, je, isd, ied, jsd, jed, c, c_tl, u&
7491 & , v, v_tl, flux, flux_tl, jord, dy, rdy, npx, npy, grid_type, nested&
7494 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed
7495 INTEGER,
INTENT(IN) :: jord
7496 REAL,
INTENT(IN) :: u(isd:ied, jsd:jed+1)
7497 REAL,
INTENT(IN) :: v(isd:ied+1, jsd:jed)
7498 REAL,
INTENT(IN) :: v_tl(isd:ied+1, jsd:jed)
7500 REAL,
INTENT(IN) :: c(is:ie+1, js:je+1)
7501 REAL,
INTENT(IN) :: c_tl(is:ie+1, js:je+1)
7502 REAL,
INTENT(OUT) :: flux(is:ie+1, js:je+1)
7503 REAL,
INTENT(OUT) :: flux_tl(is:ie+1, js:je+1)
7504 REAL,
INTENT(IN) :: dy(isd:ied+1, jsd:jed)
7505 REAL,
INTENT(IN) :: rdy(isd:ied+1, jsd:jed)
7506 INTEGER,
INTENT(IN) :: npx, npy, grid_type
7507 LOGICAL,
INTENT(IN) :: nested
7509 LOGICAL,
DIMENSION(is:ie+1, js-1:je+1) :: smt5, smt6
7510 REAL :: fx0(is:ie+1)
7511 REAL :: dm(is:ie+1, js-2:je+2)
7512 REAL :: al(is:ie+1, js-1:je+2)
7513 REAL :: al_tl(is:ie+1, js-1:je+2)
7514 REAL,
DIMENSION(is:ie+1, js-1:je+1) :: bl, br, b0
7515 REAL,
DIMENSION(is:ie+1, js-1:je+1) :: bl_tl, br_tl, b0_tl
7516 REAL :: dq(is:ie+1, js-3:je+2)
7517 REAL :: xt, dl, dr, pmp, lac, cfl
7518 REAL :: xt_tl, cfl_tl
7519 REAL :: pmp_1, lac_1, pmp_2, lac_2
7520 REAL :: x0, x1, x0r, x0l
7521 INTEGER :: i, j, is1, ie1, js3, je3
7528 IF (3 .LT. js - 1)
THEN 7533 IF (npy - 3 .GT. je + 1)
THEN 7539 IF (jord .EQ. 1)
THEN 7543 IF (c(i, j) .GT. 0.)
THEN 7544 flux_tl(i, j) = v_tl(i, j-1)
7545 flux(i, j) = v(i, j-1)
7547 flux_tl(i, j) = v_tl(i, j)
7548 flux(i, j) = v(i, j)
7552 ELSE IF (jord .EQ. 333)
THEN 7556 IF (c(i, j) .GT. 0.)
THEN 7557 flux_tl(i, j) = (2.0*v_tl(i, j)+5.0*v_tl(i, j-1)-v_tl(i, j-2&
7558 & ))/6.0 - 0.5*rdy(i, j-1)*(c_tl(i, j)*(v(i, j)-v(i, j-1))+c&
7559 & (i, j)*(v_tl(i, j)-v_tl(i, j-1))) + rdy(i, j-1)**2*(c_tl(i&
7560 & , j)*c(i, j)+c(i, j)*c_tl(i, j))*(v(i, j)-2.0*v(i, j-1)+v(&
7561 & i, j-2))/6.0 + c(i, j)**2*rdy(i, j-1)**2*(v_tl(i, j)-2.0*&
7562 & v_tl(i, j-1)+v_tl(i, j-2))/6.0
7563 flux(i, j) = (2.0*v(i, j)+5.0*v(i, j-1)-v(i, j-2))/6.0 - 0.5&
7564 & *c(i, j)*rdy(i, j-1)*(v(i, j)-v(i, j-1)) + c(i, j)*rdy(i, &
7565 & j-1)*c(i, j)*rdy(i, j-1)/6.0*(v(i, j)-2.0*v(i, j-1)+v(i, j&
7568 flux_tl(i, j) = (2.0*v_tl(i, j-1)+5.0*v_tl(i, j)-v_tl(i, j+1&
7569 & ))/6.0 - 0.5*rdy(i, j)*(c_tl(i, j)*(v(i, j)-v(i, j-1))+c(i&
7570 & , j)*(v_tl(i, j)-v_tl(i, j-1))) + rdy(i, j)**2*(c_tl(i, j)&
7571 & *c(i, j)+c(i, j)*c_tl(i, j))*(v(i, j+1)-2.0*v(i, j)+v(i, j&
7572 & -1))/6.0 + c(i, j)**2*rdy(i, j)**2*(v_tl(i, j+1)-2.0*v_tl(&
7573 & i, j)+v_tl(i, j-1))/6.0
7574 flux(i, j) = (2.0*v(i, j-1)+5.0*v(i, j)-v(i, j+1))/6.0 - 0.5&
7575 & *c(i, j)*rdy(i, j)*(v(i, j)-v(i, j-1)) + c(i, j)*rdy(i, j)&
7576 & *c(i, j)*rdy(i, j)/6.0*(v(i, j+1)-2.0*v(i, j)+v(i, j-1))
7580 ELSE IF (jord .LT. 8)
THEN 7585 al_tl(i, j) =
p1*(v_tl(i, j-1)+v_tl(i, j)) +
p2*(v_tl(i, j-2)+&
7587 al(i, j) =
p1*(v(i, j-1)+v(i, j)) +
p2*(v(i, j-2)+v(i, j+1))
7594 bl_tl(i, j) = al_tl(i, j) - v_tl(i, j)
7595 bl(i, j) = al(i, j) - v(i, j)
7596 br_tl(i, j) = al_tl(i, j+1) - v_tl(i, j)
7597 br(i, j) = al(i, j+1) - v(i, j)
7600 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 7603 bl_tl(i, 0) =
c1*v_tl(i, -2) +
c2*v_tl(i, -1) +
c3*v_tl(i, 0&
7605 bl(i, 0) =
c1*v(i, -2) +
c2*v(i, -1) +
c3*v(i, 0) - v(i, 0)
7606 xt_tl = 0.5*(((2.*dy(i, 0)+dy(i, -1))*v_tl(i, 0)-dy(i, 0)*&
7607 & v_tl(i, -1))/(dy(i, 0)+dy(i, -1))+((2.*dy(i, 1)+dy(i, 2))*&
7608 & v_tl(i, 1)-dy(i, 1)*v_tl(i, 2))/(dy(i, 1)+dy(i, 2)))
7609 xt = 0.5*(((2.*dy(i, 0)+dy(i, -1))*v(i, 0)-dy(i, 0)*v(i, -1)&
7610 & )/(dy(i, 0)+dy(i, -1))+((2.*dy(i, 1)+dy(i, 2))*v(i, 1)-dy(&
7611 & i, 1)*v(i, 2))/(dy(i, 1)+dy(i, 2)))
7612 br_tl(i, 0) = xt_tl - v_tl(i, 0)
7613 br(i, 0) = xt - v(i, 0)
7614 bl_tl(i, 1) = xt_tl - v_tl(i, 1)
7615 bl(i, 1) = xt - v(i, 1)
7616 xt_tl =
c3*v_tl(i, 1) +
c2*v_tl(i, 2) +
c1*v_tl(i, 3)
7617 xt =
c3*v(i, 1) +
c2*v(i, 2) +
c1*v(i, 3)
7618 br_tl(i, 1) = xt_tl - v_tl(i, 1)
7619 br(i, 1) = xt - v(i, 1)
7620 bl_tl(i, 2) = xt_tl - v_tl(i, 2)
7621 bl(i, 2) = xt - v(i, 2)
7622 br_tl(i, 2) = al_tl(i, 3) - v_tl(i, 2)
7623 br(i, 2) = al(i, 3) - v(i, 2)
7639 IF (ie + 1 .EQ. npx)
THEN 7656 IF (je + 1 .EQ. npy)
THEN 7658 bl_tl(i, npy-2) = al_tl(i, npy-2) - v_tl(i, npy-2)
7659 bl(i, npy-2) = al(i, npy-2) - v(i, npy-2)
7660 xt_tl =
c1*v_tl(i, npy-3) +
c2*v_tl(i, npy-2) +
c3*v_tl(i, &
7662 xt =
c1*v(i, npy-3) +
c2*v(i, npy-2) +
c3*v(i, npy-1)
7663 br_tl(i, npy-2) = xt_tl - v_tl(i, npy-2)
7664 br(i, npy-2) = xt - v(i, npy-2)
7665 bl_tl(i, npy-1) = xt_tl - v_tl(i, npy-1)
7666 bl(i, npy-1) = xt - v(i, npy-1)
7667 xt_tl = 0.5*(((2.*dy(i, npy-1)+dy(i, npy-2))*v_tl(i, npy-1)-&
7668 & dy(i, npy-1)*v_tl(i, npy-2))/(dy(i, npy-1)+dy(i, npy-2))+(&
7669 & (2.*dy(i, npy)+dy(i, npy+1))*v_tl(i, npy)-dy(i, npy)*v_tl(&
7670 & i, npy+1))/(dy(i, npy)+dy(i, npy+1)))
7671 xt = 0.5*(((2.*dy(i, npy-1)+dy(i, npy-2))*v(i, npy-1)-dy(i, &
7672 & npy-1)*v(i, npy-2))/(dy(i, npy-1)+dy(i, npy-2))+((2.*dy(i&
7673 & , npy)+dy(i, npy+1))*v(i, npy)-dy(i, npy)*v(i, npy+1))/(dy&
7674 & (i, npy)+dy(i, npy+1)))
7675 br_tl(i, npy-1) = xt_tl - v_tl(i, npy-1)
7676 br(i, npy-1) = xt - v(i, npy-1)
7677 bl_tl(i, npy) = xt_tl - v_tl(i, npy)
7678 bl(i, npy) = xt - v(i, npy)
7679 br_tl(i, npy) =
c3*v_tl(i, npy) +
c2*v_tl(i, npy+1) +
c1*&
7680 & v_tl(i, npy+2) - v_tl(i, npy)
7681 br(i, npy) =
c3*v(i, npy) +
c2*v(i, npy+1) +
c1*v(i, npy+2) &
7686 bl_tl(1, npy-1) = 0.0
7689 br_tl(1, npy-1) = 0.0
7698 IF (ie + 1 .EQ. npx)
THEN 7700 bl_tl(npx, npy-1) = 0.0
7703 br_tl(npx, npy-1) = 0.0
7706 bl_tl(npx, npy) = 0.0
7709 br_tl(npx, npy) = 0.0
7725 b0_tl(i, j) = bl_tl(i, j) + br_tl(i, j)
7726 b0(i, j) = bl(i, j) + br(i, j)
7729 IF (jord .EQ. 2)
THEN 7735 IF (c(i, j) .GT. 0.)
THEN 7736 cfl_tl = rdy(i, j-1)*c_tl(i, j)
7737 cfl = c(i, j)*rdy(i, j-1)
7738 flux_tl(i, j) = v_tl(i, j-1) + (1.-cfl)*(br_tl(i, j-1)-&
7739 & cfl_tl*b0(i, j-1)-cfl*b0_tl(i, j-1)) - cfl_tl*(br(i, j-1&
7741 flux(i, j) = v(i, j-1) + (1.-cfl)*(br(i, j-1)-cfl*b0(i, j-&
7744 cfl_tl = rdy(i, j)*c_tl(i, j)
7745 cfl = c(i, j)*rdy(i, j)
7746 flux_tl(i, j) = v_tl(i, j) + cfl_tl*(bl(i, j)+cfl*b0(i, j)&
7747 & ) + (1.+cfl)*(bl_tl(i, j)+cfl_tl*b0(i, j)+cfl*b0_tl(i, j&
7749 flux(i, j) = v(i, j) + (1.+cfl)*(bl(i, j)+cfl*b0(i, j))
7761 & vort, ptc, delpc, ke, u, v, uc, vc, ua, va, divg_d, wk, gridstruct, &
7765 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
7766 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
7767 TYPE(FV_FLAGS_TYPE),
INTENT(IN),
TARGET :: flagstruct
7768 INTEGER,
INTENT(IN) :: nord
7769 REAL,
INTENT(IN) :: d2_bg, d4_bg, dddmp, dt
7770 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
7771 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
7772 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
7774 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: wk
7775 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: vort
7776 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
7778 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
7780 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: vc
7781 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: uc
7782 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
7785 REAL :: damp, dd8, damp2, da_min, da_min_c, absdt
7786 INTEGER :: is, ie, js, je, npx, npy, is2, ie1
7787 LOGICAL :: nested, fill_c
7788 INTEGER :: i, j, n, n2, nt
7789 LOGICAL :: sw_corner, se_corner, ne_corner, nw_corner
7790 REAL,
DIMENSION(:, :),
POINTER :: area, area_c, rarea
7791 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg
7792 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v, cosa_s
7793 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
7794 REAL,
DIMENSION(:, :),
POINTER :: rsin_u, rsin_v, rsina
7795 REAL,
DIMENSION(:, :),
POINTER :: f0, rsin2, divg_u, divg_v
7796 REAL,
DIMENSION(:, :),
POINTER :: cosa, dx, dy, dxc, dyc, rdxa, rdya&
7814 area => gridstruct%area
7815 rarea => gridstruct%rarea
7816 sin_sg => gridstruct%sin_sg
7817 cosa_u => gridstruct%cosa_u
7818 cosa_v => gridstruct%cosa_v
7819 cosa_s => gridstruct%cosa_s
7820 sina_u => gridstruct%sina_u
7821 sina_v => gridstruct%sina_v
7822 rsin_u => gridstruct%rsin_u
7823 rsin_v => gridstruct%rsin_v
7824 rsina => gridstruct%rsina
7826 rsin2 => gridstruct%rsin2
7827 divg_u => gridstruct%divg_u
7828 divg_v => gridstruct%divg_v
7829 cosa => gridstruct%cosa
7832 dxc => gridstruct%dxc
7833 dyc => gridstruct%dyc
7834 rdxa => gridstruct%rdxa
7835 rdya => gridstruct%rdya
7836 rdx => gridstruct%rdx
7837 rdy => gridstruct%rdy
7838 sw_corner = gridstruct%sw_corner
7839 se_corner = gridstruct%se_corner
7840 nw_corner = gridstruct%nw_corner
7841 ne_corner = gridstruct%ne_corner
7842 IF (dt .GE. 0.)
THEN 7847 da_min = gridstruct%da_min
7848 da_min_c = gridstruct%da_min_c
7853 npx = flagstruct%npx
7854 npy = flagstruct%npy
7855 nested = gridstruct%nested
7865 IF (npx - 1 .GT. ie + 1)
THEN 7875 IF (nord .EQ. 0)
THEN 7880 ptc(i, j) = (u(i, j)-0.5*(va(i, j-1)+va(i, j))*cosa_v(i, j))&
7881 & *dyc(i, j)*sina_v(i, j)
7886 vort(i, j) = (v(i, j)-0.5*(ua(i-1, j)+ua(i, j))*cosa_u(i, j)&
7887 & )*dxc(i, j)*sina_u(i, j)
7892 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 7894 IF (vc(i, j) .GT. 0)
THEN 7895 ptc(i, j) = u(i, j)*dyc(i, j)*sin_sg(i, j-1, 4)
7897 ptc(i, j) = u(i, j)*dyc(i, j)*sin_sg(i, j, 2)
7902 ptc(i, j) = (u(i, j)-0.5*(va(i, j-1)+va(i, j))*cosa_v(i, j&
7903 & ))*dyc(i, j)*sina_v(i, j)
7909 vort(i, j) = (v(i, j)-0.5*(ua(i-1, j)+ua(i, j))*cosa_u(i, j)&
7910 & )*dxc(i, j)*sina_u(i, j)
7913 IF (uc(1, j) .GT. 0)
THEN 7914 vort(1, j) = v(1, j)*dxc(1, j)*sin_sg(0, j, 3)
7916 vort(1, j) = v(1, j)*dxc(1, j)*sin_sg(1, j, 1)
7919 IF (ie + 1 .EQ. npx)
THEN 7920 IF (uc(npx, j) .GT. 0)
THEN 7921 vort(npx, j) = v(npx, j)*dxc(npx, j)*sin_sg(npx-1, j, 3)
7923 vort(npx, j) = v(npx, j)*dxc(npx, j)*sin_sg(npx, j, 1)
7930 delpc(i, j) = vort(i, j-1) - vort(i, j) + ptc(i-1, j) - ptc(i&
7935 IF (sw_corner) delpc(1, 1) = delpc(1, 1) - vort(1, 0)
7936 IF (se_corner) delpc(npx, 1) = delpc(npx, 1) - vort(npx, 0)
7937 IF (ne_corner) delpc(npx, npy) = delpc(npx, npy) + vort(npx, npy)
7938 IF (nw_corner) delpc(1, npy) = delpc(1, npy) + vort(1, npy)
7941 delpc(i, j) = gridstruct%rarea_c(i, j)*delpc(i, j)
7942 IF (delpc(i, j)*dt .GE. 0.)
THEN 7943 abs2 = delpc(i, j)*dt
7945 abs2 = -(delpc(i, j)*dt)
7948 IF (0.20 .GT. y3)
THEN 7953 IF (d2_bg .LT. y1)
THEN 7958 damp = gridstruct%da_min_c*max1
7959 vort(i, j) = damp*delpc(i, j)
7960 ke(i, j) = ke(i, j) + vort(i, j)
7970 delpc(i, j) = divg_d(i, j)
7977 fill_c = nt .NE. 0 .AND. flagstruct%grid_type .LT. 3 .AND. (((&
7978 & sw_corner .OR. se_corner) .OR. ne_corner) .OR. nw_corner) &
7979 & .AND. (.NOT.nested)
7980 IF (fill_c)
CALL fill_corners(divg_d, npx, npy, fill=xdir, bgrid&
7983 DO i=is-1-nt,ie+1+nt
7984 vc(i, j) = (divg_d(i+1, j)-divg_d(i, j))*divg_u(i, j)
7987 IF (fill_c)
CALL fill_corners(divg_d, npx, npy, fill=ydir, bgrid&
7989 DO j=js-1-nt,je+1+nt
7991 uc(i, j) = (divg_d(i, j+1)-divg_d(i, j))*divg_v(i, j)
7994 IF (fill_c)
CALL fill_corners(vc, uc, npx, npy, dgrid=.true., &
7998 divg_d(i, j) = uc(i, j-1) - uc(i, j) + vc(i-1, j) - vc(i, j)
8002 IF (sw_corner) divg_d(1, 1) = divg_d(1, 1) - uc(1, 0)
8003 IF (se_corner) divg_d(npx, 1) = divg_d(npx, 1) - uc(npx, 0)
8004 IF (ne_corner) divg_d(npx, npy) = divg_d(npx, npy) + uc(npx, npy&
8006 IF (nw_corner) divg_d(1, npy) = divg_d(1, npy) + uc(1, npy)
8007 IF (.NOT.gridstruct%stretched_grid)
THEN 8010 divg_d(i, j) = divg_d(i, j)*gridstruct%rarea_c(i, j)
8016 IF (dddmp .LT. 1.e-5)
THEN 8018 ELSE IF (flagstruct%grid_type .LT. 3)
THEN 8020 CALL a2b_ord4(wk, vort, gridstruct, npx, npy, is, ie, js, je, ng&
8024 IF (dt .GE. 0.)
THEN 8030 arg1 = delpc(i, j)**2 + vort(i, j)**2
8031 result1 = sqrt(arg1)
8032 vort(i, j) = abs0*result1
8036 IF (dt .GE. 0.)
THEN 8042 CALL smag_corner(abs1, u, v, ua, va, vort, bd, npx, npy, &
8045 IF (gridstruct%stretched_grid)
THEN 8048 dd8 = gridstruct%da_min*pwr1
8050 pwx1 = gridstruct%da_min_c*d4_bg
8055 IF (0.20 .GT. dddmp*vort(i, j))
THEN 8056 y2 = dddmp*vort(i, j)
8060 IF (d2_bg .LT. y2)
THEN 8066 damp2 = gridstruct%da_min_c*max2
8067 vort(i, j) = damp2*delpc(i, j) + dd8*divg_d(i, j)
8068 ke(i, j) = ke(i, j) + vort(i, j)
8073 SUBROUTINE smag_corner(dt, u, v, ua, va, smag_c, bd, npx, npy, &
8078 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
8079 REAL,
INTENT(IN) :: dt
8080 INTEGER,
INTENT(IN) :: npx, npy, ng
8081 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
8082 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
8083 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
8084 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: smag_c
8085 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
8087 REAL :: ut(bd%isd:bd%ied+1, bd%jsd:bd%jed)
8088 REAL :: vt(bd%isd:bd%ied, bd%jsd:bd%jed+1)
8090 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
8091 REAL :: sh(bd%isd:bd%ied, bd%jsd:bd%jed)
8094 REAL,
DIMENSION(:, :),
POINTER :: dxc, dyc, dx, dy, rarea, rarea_c
8095 INTEGER :: is, ie, js, je
8096 INTEGER :: isd, ied, jsd, jed
8110 dxc => gridstruct%dxc
8111 dyc => gridstruct%dyc
8114 rarea => gridstruct%rarea
8115 rarea_c => gridstruct%rarea_c
8121 IF (npx - 1 .GT. ie + 1)
THEN 8131 ut(i, j) = u(i, j)*dyc(i, j)
8136 vt(i, j) = v(i, j)*dxc(i, j)
8141 smag_c(i, j) = rarea_c(i, j)*(vt(i, j-1)-vt(i, j)+(ut(i, j)-ut(i&
8149 vt(i, j) = u(i, j)*dx(i, j)
8154 ut(i, j) = v(i, j)*dy(i, j)
8159 wk(i, j) = rarea(i, j)*(vt(i, j)-vt(i, j+1)+(ut(i, j)-ut(i+1, j)&
8163 CALL a2b_ord4(wk, sh, gridstruct, npx, npy, is, ie, js, je, ng, &
8167 arg1 = sh(i, j)**2 + smag_c(i, j)**2
8168 result1 = sqrt(arg1)
8169 smag_c(i, j) = dt*result1
8179 & , dt, vort, vort_tl, ptc, ptc_tl, delpc, delpc_tl, ke, ke_tl, u, &
8180 & u_tl, v, v_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, va, va_tl, divg_d, &
8181 & divg_d_tl, wk, wk_tl, gridstruct, flagstruct, bd)
8184 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
8185 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
8186 TYPE(FV_FLAGS_TYPE),
INTENT(IN),
TARGET :: flagstruct
8187 INTEGER,
INTENT(IN) :: nord
8188 REAL,
INTENT(IN) :: d2_bg, d4_bg, dddmp, dt
8189 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
8190 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua_tl, &
8192 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
8193 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u_tl
8194 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
8195 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v_tl
8197 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: wk
8198 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
8200 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: vort
8201 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
8203 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
8205 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(INOUT) :: &
8207 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
8209 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
8211 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: vc
8212 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
8214 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: uc
8215 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(INOUT) :: &
8217 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
8219 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed+1),
INTENT(INOUT) :: &
8222 REAL :: damp, dd8, damp2, da_min, da_min_c, absdt
8223 REAL :: damp_tl, damp2_tl
8224 INTEGER :: is, ie, js, je, npx, npy, is2, ie1
8225 LOGICAL :: nested, fill_c
8226 INTEGER :: i, j, n, n2, nt
8227 LOGICAL :: sw_corner, se_corner, ne_corner, nw_corner
8228 REAL,
DIMENSION(:, :),
POINTER :: area, area_c, rarea
8229 REAL,
DIMENSION(:, :, :),
POINTER :: sin_sg
8230 REAL,
DIMENSION(:, :),
POINTER :: cosa_u, cosa_v, cosa_s
8231 REAL,
DIMENSION(:, :),
POINTER :: sina_u, sina_v
8232 REAL,
DIMENSION(:, :),
POINTER :: rsin_u, rsin_v, rsina
8233 REAL,
DIMENSION(:, :),
POINTER :: f0, rsin2, divg_u, divg_v
8234 REAL,
DIMENSION(:, :),
POINTER :: cosa, dx, dy, dxc, dyc, rdxa, rdya&
8260 area => gridstruct%area
8261 rarea => gridstruct%rarea
8262 sin_sg => gridstruct%sin_sg
8263 cosa_u => gridstruct%cosa_u
8264 cosa_v => gridstruct%cosa_v
8265 cosa_s => gridstruct%cosa_s
8266 sina_u => gridstruct%sina_u
8267 sina_v => gridstruct%sina_v
8268 rsin_u => gridstruct%rsin_u
8269 rsin_v => gridstruct%rsin_v
8270 rsina => gridstruct%rsina
8272 rsin2 => gridstruct%rsin2
8273 divg_u => gridstruct%divg_u
8274 divg_v => gridstruct%divg_v
8275 cosa => gridstruct%cosa
8278 dxc => gridstruct%dxc
8279 dyc => gridstruct%dyc
8280 rdxa => gridstruct%rdxa
8281 rdya => gridstruct%rdya
8282 rdx => gridstruct%rdx
8283 rdy => gridstruct%rdy
8284 sw_corner = gridstruct%sw_corner
8285 se_corner = gridstruct%se_corner
8286 nw_corner = gridstruct%nw_corner
8287 ne_corner = gridstruct%ne_corner
8288 IF (dt .GE. 0.)
THEN 8293 da_min = gridstruct%da_min
8294 da_min_c = gridstruct%da_min_c
8299 npx = flagstruct%npx
8300 npy = flagstruct%npy
8301 nested = gridstruct%nested
8311 IF (npx - 1 .GT. ie + 1)
THEN 8321 IF (nord .EQ. 0)
THEN 8326 ptc_tl(i, j) = dyc(i, j)*sina_v(i, j)*(u_tl(i, j)-0.5*cosa_v&
8327 & (i, j)*(va_tl(i, j-1)+va_tl(i, j)))
8328 ptc(i, j) = (u(i, j)-0.5*(va(i, j-1)+va(i, j))*cosa_v(i, j))&
8329 & *dyc(i, j)*sina_v(i, j)
8335 vort_tl(i, j) = dxc(i, j)*sina_u(i, j)*(v_tl(i, j)-0.5*&
8336 & cosa_u(i, j)*(ua_tl(i-1, j)+ua_tl(i, j)))
8337 vort(i, j) = (v(i, j)-0.5*(ua(i-1, j)+ua(i, j))*cosa_u(i, j)&
8338 & )*dxc(i, j)*sina_u(i, j)
8343 IF (j .EQ. 1 .OR. j .EQ. npy)
THEN 8345 IF (vc(i, j) .GT. 0)
THEN 8346 ptc_tl(i, j) = dyc(i, j)*sin_sg(i, j-1, 4)*u_tl(i, j)
8347 ptc(i, j) = u(i, j)*dyc(i, j)*sin_sg(i, j-1, 4)
8349 ptc_tl(i, j) = dyc(i, j)*sin_sg(i, j, 2)*u_tl(i, j)
8350 ptc(i, j) = u(i, j)*dyc(i, j)*sin_sg(i, j, 2)
8355 ptc_tl(i, j) = dyc(i, j)*sina_v(i, j)*(u_tl(i, j)-0.5*&
8356 & cosa_v(i, j)*(va_tl(i, j-1)+va_tl(i, j)))
8357 ptc(i, j) = (u(i, j)-0.5*(va(i, j-1)+va(i, j))*cosa_v(i, j&
8358 & ))*dyc(i, j)*sina_v(i, j)
8365 vort_tl(i, j) = dxc(i, j)*sina_u(i, j)*(v_tl(i, j)-0.5*&
8366 & cosa_u(i, j)*(ua_tl(i-1, j)+ua_tl(i, j)))
8367 vort(i, j) = (v(i, j)-0.5*(ua(i-1, j)+ua(i, j))*cosa_u(i, j)&
8368 & )*dxc(i, j)*sina_u(i, j)
8371 IF (uc(1, j) .GT. 0)
THEN 8372 vort_tl(1, j) = dxc(1, j)*sin_sg(0, j, 3)*v_tl(1, j)
8373 vort(1, j) = v(1, j)*dxc(1, j)*sin_sg(0, j, 3)
8375 vort_tl(1, j) = dxc(1, j)*sin_sg(1, j, 1)*v_tl(1, j)
8376 vort(1, j) = v(1, j)*dxc(1, j)*sin_sg(1, j, 1)
8379 IF (ie + 1 .EQ. npx)
THEN 8380 IF (uc(npx, j) .GT. 0)
THEN 8381 vort_tl(npx, j) = dxc(npx, j)*sin_sg(npx-1, j, 3)*v_tl(npx&
8383 vort(npx, j) = v(npx, j)*dxc(npx, j)*sin_sg(npx-1, j, 3)
8385 vort_tl(npx, j) = dxc(npx, j)*sin_sg(npx, j, 1)*v_tl(npx, &
8387 vort(npx, j) = v(npx, j)*dxc(npx, j)*sin_sg(npx, j, 1)
8394 delpc_tl(i, j) = vort_tl(i, j-1) - vort_tl(i, j) + ptc_tl(i-1&
8395 & , j) - ptc_tl(i, j)
8396 delpc(i, j) = vort(i, j-1) - vort(i, j) + (ptc(i-1, j)-ptc(i, &
8402 delpc_tl(1, 1) = delpc_tl(1, 1) - vort_tl(1, 0)
8403 delpc(1, 1) = delpc(1, 1) - vort(1, 0)
8406 delpc_tl(npx, 1) = delpc_tl(npx, 1) - vort_tl(npx, 0)
8407 delpc(npx, 1) = delpc(npx, 1) - vort(npx, 0)
8410 delpc_tl(npx, npy) = delpc_tl(npx, npy) + vort_tl(npx, npy)
8411 delpc(npx, npy) = delpc(npx, npy) + vort(npx, npy)
8414 delpc_tl(1, npy) = delpc_tl(1, npy) + vort_tl(1, npy)
8415 delpc(1, npy) = delpc(1, npy) + vort(1, npy)
8419 delpc_tl(i, j) = gridstruct%rarea_c(i, j)*delpc_tl(i, j)
8420 delpc(i, j) = gridstruct%rarea_c(i, j)*delpc(i, j)
8421 IF (delpc(i, j)*dt .GE. 0.)
THEN 8422 abs2_tl = dt*delpc_tl(i, j)
8423 abs2 = delpc(i, j)*dt
8425 abs2_tl = -(dt*delpc_tl(i, j))
8426 abs2 = -(delpc(i, j)*dt)
8428 y3_tl = dddmp*abs2_tl
8430 IF (0.20 .GT. y3)
THEN 8437 IF (d2_bg .LT. y1)
THEN 8444 damp_tl = gridstruct%da_min_c*max1_tl
8445 damp = gridstruct%da_min_c*max1
8446 vort_tl(i, j) = damp_tl*delpc(i, j) + damp*delpc_tl(i, j)
8447 vort(i, j) = damp*delpc(i, j)
8448 ke_tl(i, j) = ke_tl(i, j) + vort_tl(i, j)
8449 ke(i, j) = ke(i, j) + vort(i, j)
8459 delpc_tl(i, j) = divg_d_tl(i, j)
8460 delpc(i, j) = divg_d(i, j)
8467 fill_c = nt .NE. 0 .AND. flagstruct%grid_type .LT. 3 .AND. (((&
8468 & sw_corner .OR. se_corner) .OR. ne_corner) .OR. nw_corner) &
8469 & .AND. (.NOT.nested)
8471 & fill=xdir, bgrid=.true.)
8473 DO i=is-1-nt,ie+1+nt
8474 vc_tl(i, j) = divg_u(i, j)*(divg_d_tl(i+1, j)-divg_d_tl(i, j&
8476 vc(i, j) = (divg_d(i+1, j)-divg_d(i, j))*divg_u(i, j)
8480 & fill=ydir, bgrid=.true.)
8481 DO j=js-1-nt,je+1+nt
8483 uc_tl(i, j) = divg_v(i, j)*(divg_d_tl(i, j+1)-divg_d_tl(i, j&
8485 uc(i, j) = (divg_d(i, j+1)-divg_d(i, j))*divg_v(i, j)
8489 & , dgrid=.true., vector=.true.)
8492 divg_d_tl(i, j) = uc_tl(i, j-1) - uc_tl(i, j) + vc_tl(i-1, j&
8494 divg_d(i, j) = uc(i, j-1) - uc(i, j) + (vc(i-1, j)-vc(i, j))
8499 divg_d_tl(1, 1) = divg_d_tl(1, 1) - uc_tl(1, 0)
8500 divg_d(1, 1) = divg_d(1, 1) - uc(1, 0)
8503 divg_d_tl(npx, 1) = divg_d_tl(npx, 1) - uc_tl(npx, 0)
8504 divg_d(npx, 1) = divg_d(npx, 1) - uc(npx, 0)
8507 divg_d_tl(npx, npy) = divg_d_tl(npx, npy) + uc_tl(npx, npy)
8508 divg_d(npx, npy) = divg_d(npx, npy) + uc(npx, npy)
8511 divg_d_tl(1, npy) = divg_d_tl(1, npy) + uc_tl(1, npy)
8512 divg_d(1, npy) = divg_d(1, npy) + uc(1, npy)
8514 IF (.NOT.gridstruct%stretched_grid)
THEN 8517 divg_d_tl(i, j) = gridstruct%rarea_c(i, j)*divg_d_tl(i, j)
8518 divg_d(i, j) = divg_d(i, j)*gridstruct%rarea_c(i, j)
8524 IF (dddmp .LT. 1.e-5)
THEN 8527 ELSE IF (flagstruct%grid_type .LT. 3)
THEN 8530 CALL a2b_ord4_tlm(wk, wk_tl, vort, vort_tl, gridstruct, npx, &
8531 & npy, is, ie, js, je, ng, .false.)
8534 IF (dt .GE. 0.)
THEN 8540 arg1_tl = 2*delpc(i, j)*delpc_tl(i, j) + 2*vort(i, j)*&
8542 arg1 = delpc(i, j)**2 + vort(i, j)**2
8543 IF (arg1 .EQ. 0.0)
THEN 8546 result1_tl = arg1_tl/(2.0*sqrt(arg1))
8548 result1 = sqrt(arg1)
8549 vort_tl(i, j) = abs0*result1_tl
8550 vort(i, j) = abs0*result1
8554 IF (dt .GE. 0.)
THEN 8561 & vort_tl, bd, npx, npy, gridstruct, ng)
8563 IF (gridstruct%stretched_grid)
THEN 8566 dd8 = gridstruct%da_min*pwr1
8568 pwx1 = gridstruct%da_min_c*d4_bg
8573 IF (0.20 .GT. dddmp*vort(i, j))
THEN 8574 y2_tl = dddmp*vort_tl(i, j)
8575 y2 = dddmp*vort(i, j)
8580 IF (d2_bg .LT. y2)
THEN 8588 damp2_tl = gridstruct%da_min_c*max2_tl
8589 damp2 = gridstruct%da_min_c*max2
8590 vort_tl(i, j) = damp2_tl*delpc(i, j) + damp2*delpc_tl(i, j) + &
8591 & dd8*divg_d_tl(i, j)
8592 vort(i, j) = damp2*delpc(i, j) + dd8*divg_d(i, j)
8593 ke_tl(i, j) = ke_tl(i, j) + vort_tl(i, j)
8594 ke(i, j) = ke(i, j) + vort(i, j)
8603 & smag_c_tl, bd, npx, npy, gridstruct, ng)
8607 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
8608 REAL,
INTENT(IN) :: dt
8609 INTEGER,
INTENT(IN) :: npx, npy, ng
8610 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u
8611 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1),
INTENT(IN) :: u_tl
8612 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v
8613 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed),
INTENT(IN) :: v_tl
8614 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(IN) :: ua, va
8615 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: smag_c
8616 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed),
INTENT(OUT) :: &
8618 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
8620 REAL :: ut(bd%isd:bd%ied+1, bd%jsd:bd%jed)
8621 REAL :: ut_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed)
8622 REAL :: vt(bd%isd:bd%ied, bd%jsd:bd%jed+1)
8623 REAL :: vt_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1)
8625 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
8626 REAL :: wk_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
8627 REAL :: sh(bd%isd:bd%ied, bd%jsd:bd%jed)
8628 REAL :: sh_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
8631 REAL,
DIMENSION(:, :),
POINTER :: dxc, dyc, dx, dy, rarea, rarea_c
8632 INTEGER :: is, ie, js, je
8633 INTEGER :: isd, ied, jsd, jed
8649 dxc => gridstruct%dxc
8650 dyc => gridstruct%dyc
8653 rarea => gridstruct%rarea
8654 rarea_c => gridstruct%rarea_c
8660 IF (npx - 1 .GT. ie + 1)
THEN 8671 ut_tl(i, j) = dyc(i, j)*u_tl(i, j)
8672 ut(i, j) = u(i, j)*dyc(i, j)
8678 vt_tl(i, j) = dxc(i, j)*v_tl(i, j)
8679 vt(i, j) = v(i, j)*dxc(i, j)
8685 smag_c_tl(i, j) = rarea_c(i, j)*(vt_tl(i, j-1)-vt_tl(i, j)-ut_tl&
8686 & (i-1, j)+ut_tl(i, j))
8687 smag_c(i, j) = rarea_c(i, j)*(vt(i, j-1)-vt(i, j)-ut(i-1, j)+ut(&
8695 vt_tl(i, j) = dx(i, j)*u_tl(i, j)
8696 vt(i, j) = u(i, j)*dx(i, j)
8701 ut_tl(i, j) = dy(i, j)*v_tl(i, j)
8702 ut(i, j) = v(i, j)*dy(i, j)
8708 wk_tl(i, j) = rarea(i, j)*(vt_tl(i, j)-vt_tl(i, j+1)+ut_tl(i, j)&
8710 wk(i, j) = rarea(i, j)*(vt(i, j)-vt(i, j+1)+ut(i, j)-ut(i+1, j))
8714 CALL a2b_ord4_tlm(wk, wk_tl, sh, sh_tl, gridstruct, npx, npy, is&
8715 & , ie, js, je, ng, .false.)
8718 arg1_tl = 2*sh(i, j)*sh_tl(i, j) + 2*smag_c(i, j)*smag_c_tl(i, j&
8720 arg1 = sh(i, j)**2 + smag_c(i, j)**2
8721 IF (arg1 .EQ. 0.0)
THEN 8724 result1_tl = arg1_tl/(2.0*sqrt(arg1))
8726 result1 = sqrt(arg1)
8727 smag_c_tl(i, j) = dt*result1_tl
8728 smag_c(i, j) = dt*result1
subroutine xtp_u_tlm(is, ie, js, je, isd, ied, jsd, jed, c, c_tl, u, u_tl, v, flux, flux_tl, iord, dx, rdx, npx, npy, grid_type, nested)
subroutine, public divergence_corner_tlm(u, u_tl, v, v_tl, ua, ua_tl, va, va_tl, divg_d, divg_d_tl, gridstruct, flagstruct, bd)
subroutine xtp_u(is, ie, js, je, isd, ied, jsd, jed, c, u, v, flux, iord, dx, rdx, npx, npy, grid_type, nested)
subroutine, public fv_tp_2d_tlm(q, q_tl, crx, crx_tl, cry, cry_tl, npx, npy, hord, fx, fx_tl, fy, fy_tl, xfx, xfx_tl, yfx, yfx_tl, gridstruct, bd, ra_x, ra_x_tl, ra_y, ra_y_tl, mfx, mfx_tl, mfy, mfy_tl, mass, mass_tl, nord, damp_c)
subroutine, public d2a2c_vect_tlm(u, u_tl, v, v_tl, ua, ua_tl, va, va_tl, uc, uc_tl, vc, vc_tl, ut, ut_tl, vt, vt_tl, dord4, gridstruct, bd, npx, npy, nested, grid_type)
real(kind=kind_real), parameter f0
Coriolis parameter at southern boundary.
subroutine, public fill_4corners_tlm(q, q_tl, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
subroutine, public a2b_ord4(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine, public divergence_corner_nest(u, v, ua, va, divg_d, gridstruct, flagstruct, bd)
subroutine, public fill_4corners(q, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
subroutine ytp_v(is, ie, js, je, isd, ied, jsd, jed, c, u, v, flux, jord, dy, rdy, npx, npy, grid_type, nested)
subroutine smag_corner(dt, u, v, ua, va, smag_c, bd, npx, npy, gridstruct, ng)
subroutine, public pert_ppm(im, a0, al, ar, iv)
subroutine, public d_sw(delpc, delp, ptc, pt, u, v, w, uc, vc, ua, va, divg_d, xflux, yflux, cx, cy, crx_adv, cry_adv, xfx_adv, yfx_adv, q_con, z_rat, kgb, heat_source, dpx, zvir, sphum, nq, q, k, km, inline_q, dt, hord_tr, hord_mt, hord_vt, hord_tm, hord_dp, nord, nord_v, nord_w, nord_t, dddmp, d2_bg, d4_bg, damp_v, damp_w, damp_t, d_con, hydrostatic, gridstruct, flagstruct, bd, hord_tr_pert, hord_mt_pert, hord_vt_pert, hord_tm_pert, hord_dp_pert, split_damp, nord_pert, nord_v_pert, nord_w_pert, nord_t_pert, dddmp_pert, d2_bg_pert, d4_bg_pert, damp_v_pert, damp_w_pert, damp_t_pert)
subroutine fill2_4corners(q1, q2, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
subroutine, public d2a2c_vect(u, v, ua, va, uc, vc, ut, vt, dord4, gridstruct, bd, npx, npy, nested, grid_type)
subroutine compute_divergence_damping(nord, d2_bg, d4_bg, dddmp, dt, vort, ptc, delpc, ke, u, v, uc, vc, ua, va, divg_d, wk, gridstruct, flagstruct, bd)
real, parameter near_zero
subroutine, public divergence_corner_nest_tlm(u, u_tl, v, v_tl, ua, ua_tl, va, va_tl, divg_d, divg_d_tl, gridstruct, flagstruct, bd)
integer, parameter, public ng
subroutine, public c_sw_tlm(delpc, delpc_tl, delp, delp_tl, ptc, ptc_tl, pt, pt_tl, u, u_tl, v, v_tl, w, w_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, va, va_tl, wc, wc_tl, ut, ut_tl, vt, vt_tl, divg_d, divg_d_tl, nord, dt2, hydrostatic, dord4, bd, gridstruct, flagstruct)
subroutine fill3_4corners(q1, q2, q3, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
subroutine, public copy_corners(q, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
integer, parameter, public r_grid
real function edge_interpolate4_tlm(ua, ua_tl, dxa, edge_interpolate4)
subroutine compute_divergence_damping_tlm(nord, d2_bg, d4_bg, dddmp, dt, vort, vort_tl, ptc, ptc_tl, delpc, delpc_tl, ke, ke_tl, u, u_tl, v, v_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, va, va_tl, divg_d, divg_d_tl, wk, wk_tl, gridstruct, flagstruct, bd)
subroutine, public del6_vt_flux_tlm(nord, npx, npy, damp, q, q_tl, d2, d2_tl, fx2, fx2_tl, fy2, fy2_tl, gridstruct, bd)
subroutine, public a2b_ord4_tlm(qin, qin_tl, qout, qout_tl, gridstruct, npx, npy, is, ie, js, je, ng, replace)
real, parameter big_number
subroutine smag_corner_tlm(dt, u, u_tl, v, v_tl, ua, va, smag_c, smag_c_tl, bd, npx, npy, gridstruct, ng)
integer, public test_case
subroutine ytp_v_tlm(is, ie, js, je, isd, ied, jsd, jed, c, c_tl, u, v, v_tl, flux, flux_tl, jord, dy, rdy, npx, npy, grid_type, nested)
subroutine, public fv_tp_2d(q, crx, cry, npx, npy, hord, fx, fy, xfx, yfx, gridstruct, bd, ra_x, ra_y, mfx, mfy, mass, nord, damp_c)
subroutine, public del6_vt_flux(nord, npx, npy, damp, q, d2, fx2, fy2, gridstruct, bd)
subroutine, public c_sw(delpc, delp, ptc, pt, u, v, w, uc, vc, ua, va, wc, ut, vt, divg_d, nord, dt2, hydrostatic, dord4, bd, gridstruct, flagstruct)
subroutine, public d_sw_tlm(delpc, delpc_tl, delp, delp_tl, ptc, ptc_tl, pt, pt_tl, u, u_tl, v, v_tl, w, w_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, va, va_tl, divg_d, divg_d_tl, xflux, xflux_tl, yflux, yflux_tl, cx, cx_tl, cy, cy_tl, crx_adv, crx_adv_tl, cry_adv, cry_adv_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, q_con, z_rat, z_rat_tl, kgb, heat_source, heat_source_tl, dpx, dpx_tl, zvir, sphum, nq, q, q_tl, k, km, inline_q, dt, hord_tr, hord_mt, hord_vt, hord_tm, hord_dp, nord, nord_v, nord_w, nord_t, dddmp, d2_bg, d4_bg, damp_v, damp_w, damp_t, d_con, hydrostatic, gridstruct, flagstruct, bd, hord_tr_pert, hord_mt_pert, hord_vt_pert, hord_tm_pert, hord_dp_pert, split_damp, nord_pert, nord_v_pert, nord_w_pert, nord_t_pert, dddmp_pert, d2_bg_pert, d4_bg_pert, damp_v_pert, damp_w_pert, damp_t_pert)
subroutine, public copy_corners_tlm(q, q_tl, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
real function edge_interpolate4(ua, dxa)
subroutine, public divergence_corner(u, v, ua, va, divg_d, gridstruct, flagstruct, bd)
subroutine fill2_4corners_tlm(q1, q1_tl, q2, q2_tl, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
Derived type containing the data.
real(kind=kind_real), parameter u2