36 real,
parameter::
r3 = 1./3.
43 real,
parameter::
b1 = 0.0375
44 real,
parameter::
b2 = -7./30.
45 real,
parameter::
b3 = -23./120.
46 real,
parameter::
b4 = 13./30.
47 real,
parameter::
b5 = -11./240.
50 real,
parameter::
b1 = 1./30.
51 real,
parameter::
b2 = -13./60.
52 real,
parameter::
b3 = -13./60.
53 real,
parameter::
b4 = 0.45
54 real,
parameter::
b5 = -0.05
56 real,
parameter::
t11 = 27./28.,
t12 = -13./28.,
t13=3./7.
57 real,
parameter::
s11 = 11./14.,
s14 = 4./7.,
s15=3./14.
62 real,
parameter::
c1 = -2./14.
63 real,
parameter::
c2 = 11./14.
64 real,
parameter::
c3 = 5./14.
68 real,
parameter::
p1 = 7./12.
69 real,
parameter::
p2 = -1./12.
83 SUBROUTINE fv_tp_2d(q, crx, cry, npx, npy, hord, fx, fy, xfx, yfx, &
84 & gridstruct, bd, ra_x, ra_y, mfx, mfy, mass, nord, damp_c)
87 INTEGER,
INTENT(IN) :: npx, npy
88 INTEGER,
INTENT(IN) :: hord
90 REAL,
INTENT(IN) :: crx(bd%is:bd%ie+1, bd%jsd:bd%jed)
92 REAL,
INTENT(IN) :: xfx(bd%is:bd%ie+1, bd%jsd:bd%jed)
94 REAL,
INTENT(IN) :: cry(bd%isd:bd%ied, bd%js:bd%je+1)
96 REAL,
INTENT(IN) :: yfx(bd%isd:bd%ied, bd%js:bd%je+1)
97 REAL,
INTENT(IN) :: ra_x(bd%is:bd%ie, bd%jsd:bd%jed)
98 REAL,
INTENT(IN) :: ra_y(bd%isd:bd%ied, bd%js:bd%je)
100 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
102 REAL,
INTENT(OUT) :: fx(bd%is:bd%ie+1, bd%js:bd%je)
104 REAL,
INTENT(OUT) :: fy(bd%is:bd%ie, bd%js:bd%je+1)
108 REAL,
OPTIONAL,
INTENT(IN) :: mfx(bd%is:bd%ie+1, bd%js:bd%je)
110 REAL,
OPTIONAL,
INTENT(IN) :: mfy(bd%is:bd%ie, bd%js:bd%je+1)
111 REAL,
OPTIONAL,
INTENT(IN) :: mass(bd%isd:bd%ied, bd%jsd:bd%jed)
112 REAL,
OPTIONAL,
INTENT(IN) :: damp_c
113 INTEGER,
OPTIONAL,
INTENT(IN) :: nord
115 INTEGER :: ord_ou, ord_in
116 REAL :: q_i(bd%isd:bd%ied, bd%js:bd%je)
117 REAL :: q_j(bd%is:bd%ie, bd%jsd:bd%jed)
118 REAL :: fx2(bd%is:bd%ie+1, bd%jsd:bd%jed)
119 REAL :: fy2(bd%isd:bd%ied, bd%js:bd%je+1)
120 REAL :: fyy(bd%isd:bd%ied, bd%js:bd%je+1)
121 REAL :: fx1(bd%is:bd%ie+1)
124 INTEGER :: is, ie, js, je, isd, ied, jsd, jed
136 IF (hord .EQ. 10)
THEN 142 IF (.NOT.gridstruct%nested)
CALL copy_corners(q, npx, npy, 2, &
143 & gridstruct%nested, bd, &
144 & gridstruct%sw_corner, &
145 & gridstruct%se_corner, &
146 & gridstruct%nw_corner, &
147 & gridstruct%ne_corner)
148 CALL yppm(fy2, q, cry, ord_in, isd, ied, isd, ied, js, je, jsd, jed&
149 & , npx, npy, gridstruct%dya, gridstruct%nested, gridstruct%&
153 fyy(i, j) = yfx(i, j)*fy2(i, j)
158 q_i(i, j) = (q(i, j)*gridstruct%area(i, j)+fyy(i, j)-fyy(i, j+1)&
162 CALL xppm(fx, q_i, crx(is:ie+1, js:je), ord_ou, is, ie, isd, ied, js&
163 & , je, jsd, jed, npx, npy, gridstruct%dxa, gridstruct%nested, &
164 & gridstruct%grid_type)
165 IF (.NOT.gridstruct%nested)
CALL copy_corners(q, npx, npy, 1, &
166 & gridstruct%nested, bd, &
167 & gridstruct%sw_corner, &
168 & gridstruct%se_corner, &
169 & gridstruct%nw_corner, &
170 & gridstruct%ne_corner)
171 CALL xppm(fx2, q, crx, ord_in, is, ie, isd, ied, jsd, jed, jsd, jed&
172 & , npx, npy, gridstruct%dxa, gridstruct%nested, gridstruct%&
176 fx1(i) = xfx(i, j)*fx2(i, j)
179 q_j(i, j) = (q(i, j)*gridstruct%area(i, j)+fx1(i)-fx1(i+1))/ra_x&
183 CALL yppm(fy, q_j, cry, ord_ou, is, ie, isd, ied, js, je, jsd, jed, &
184 & npx, npy, gridstruct%dya, gridstruct%nested, gridstruct%&
189 IF (
PRESENT(mfx) .AND.
PRESENT(mfy))
THEN 195 fx(i, j) = 0.5*(fx(i, j)+fx2(i, j))*mfx(i, j)
200 fy(i, j) = 0.5*(fy(i, j)+fy2(i, j))*mfy(i, j)
203 IF (
PRESENT(nord) .AND.
PRESENT(damp_c) .AND.
PRESENT(mass))
THEN 204 IF (damp_c .GT. 1.e-4)
THEN 205 pwx1 = damp_c*gridstruct%da_min
208 CALL deln_flux(nord, is, ie, js, je, npx, npy, damp, q, fx, fy&
209 & , gridstruct, bd, mass)
218 fx(i, j) = 0.5*(fx(i, j)+fx2(i, j))*xfx(i, j)
223 fy(i, j) = 0.5*(fy(i, j)+fy2(i, j))*yfx(i, j)
226 IF (
PRESENT(nord) .AND.
PRESENT(damp_c))
THEN 227 IF (damp_c .GT. 1.e-4)
THEN 228 pwx1 = damp_c*gridstruct%da_min
231 CALL deln_flux(nord, is, ie, js, je, npx, npy, damp, q, fx, fy&
237 SUBROUTINE xppm(flux, q, c, iord, is, ie, isd, ied, jfirst, jlast, jsd&
238 & , jed, npx, npy, dxa, nested, grid_type)
240 INTEGER,
INTENT(IN) :: is, ie, isd, ied, jsd, jed
242 INTEGER,
INTENT(IN) :: jfirst, jlast
243 INTEGER,
INTENT(IN) :: iord
244 INTEGER,
INTENT(IN) :: npx, npy
245 REAL,
INTENT(IN) :: q(isd:ied, jfirst:jlast)
247 REAL,
INTENT(IN) :: c(is:ie+1, jfirst:jlast)
248 REAL,
INTENT(IN) :: dxa(isd:ied, jsd:jed)
249 LOGICAL,
INTENT(IN) :: nested
250 INTEGER,
INTENT(IN) :: grid_type
253 REAL,
INTENT(OUT) :: flux(is:ie+1, jfirst:jlast)
255 REAL,
DIMENSION(is-1:ie+1) :: bl, br, b0
257 REAL,
DIMENSION(is:ie+1) :: fx0, fx1
258 LOGICAL,
DIMENSION(is-1:ie+1) :: smt5, smt6
259 REAL :: al(is-1:ie+2)
260 REAL :: dm(is-2:ie+2)
261 REAL :: dq(is-3:ie+2)
262 INTEGER :: i, j, ie3, is1, ie1
263 REAL :: x0, x1, xt, qtmp, pmp_1, lac_1, pmp_2, lac_2
314 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 315 IF (3 .LT. is - 1)
THEN 320 IF (npx - 2 .GT. ie + 2)
THEN 325 IF (npx - 3 .GT. ie + 1)
THEN 339 IF (iord .LT. 8 .OR. iord .EQ. 333)
THEN 343 al(i) =
p1*(q1(i-1)+q1(i)) +
p2*(q1(i-2)+q1(i+1))
345 IF (iord .EQ. 7)
THEN 347 IF (al(i) .LT. 0.) al(i) = 0.5*(q1(i-1)+q1(i))
350 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 352 al(0) =
c1*q1(-2) +
c2*q1(-1) +
c3*q1(0)
353 al(1) = 0.5*(((2.*dxa(0, j)+dxa(-1, j))*q1(0)-dxa(0, j)*q1(-&
354 & 1))/(dxa(-1, j)+dxa(0, j))+((2.*dxa(1, j)+dxa(2, j))*q1(1)&
355 & -dxa(1, j)*q1(2))/(dxa(1, j)+dxa(2, j)))
356 al(2) =
c3*q1(1) +
c2*q1(2) +
c1*q1(3)
357 IF (iord .EQ. 7)
THEN 358 IF (0. .LT. al(0))
THEN 363 IF (0. .LT. al(1))
THEN 368 IF (0. .LT. al(2))
THEN 375 IF (ie + 1 .EQ. npx)
THEN 376 al(npx-1) =
c1*q1(npx-3) +
c2*q1(npx-2) +
c3*q1(npx-1)
377 al(npx) = 0.5*(((2.*dxa(npx-1, j)+dxa(npx-2, j))*q1(npx-1)-&
378 & dxa(npx-1, j)*q1(npx-2))/(dxa(npx-2, j)+dxa(npx-1, j))+((&
379 & 2.*dxa(npx, j)+dxa(npx+1, j))*q1(npx)-dxa(npx, j)*q1(npx+1&
380 & ))/(dxa(npx, j)+dxa(npx+1, j)))
381 al(npx+1) =
c3*q1(npx) +
c2*q1(npx+1) +
c1*q1(npx+2)
382 IF (iord .EQ. 7)
THEN 383 IF (0. .LT. al(npx-1))
THEN 384 al(npx-1) = al(npx-1)
388 IF (0. .LT. al(npx))
THEN 393 IF (0. .LT. al(npx+1))
THEN 394 al(npx+1) = al(npx+1)
401 IF (iord .EQ. 1)
THEN 403 IF (c(i, j) .GT. 0.)
THEN 409 ELSE IF (iord .EQ. 2)
THEN 417 flux(i, j) = qtmp + (1.-xt)*(al(i)-qtmp-xt*(al(i-1)+al(i)-&
421 flux(i, j) = qtmp + (1.+xt)*(al(i)-qtmp+xt*(al(i)+al(i+1)-&
425 ELSE IF (iord .EQ. 333)
THEN 435 flux(i, j) = (2.0*q1(i)+5.0*q1(i-1)-q1(i-2))/6.0 - 0.5*xt*&
436 & (q1(i)-q1(i-1)) + xt*xt/6.0*(q1(i)-2.0*q1(i-1)+q1(i-2))
438 flux(i, j) = (2.0*q1(i-1)+5.0*q1(i)-q1(i+1))/6.0 - 0.5*xt*&
439 & (q1(i)-q1(i-1)) + xt*xt/6.0*(q1(i+1)-2.0*q1(i)+q1(i-1))
442 ELSE IF (iord .EQ. 3)
THEN 444 bl(i) = al(i) - q1(i)
445 br(i) = al(i+1) - q1(i)
446 b0(i) = bl(i) + br(i)
447 IF (b0(i) .GE. 0.)
THEN 452 IF (bl(i) - br(i) .GE. 0.)
THEN 458 smt6(i) = 3.*x0 .LT. xt
467 IF (smt6(i-1) .OR. smt5(i))
THEN 468 fx1(i) = br(i-1) - xt*b0(i-1)
469 ELSE IF (smt5(i-1))
THEN 470 IF (bl(i-1) .GE. 0.)
THEN 475 IF (br(i-1) .GE. 0.)
THEN 486 fx1(i) = sign(min1, br(i-1))
490 IF (smt6(i) .OR. smt5(i-1))
THEN 491 fx1(i) = bl(i) + xt*b0(i)
492 ELSE IF (smt5(i))
THEN 493 IF (bl(i) .GE. 0.)
THEN 498 IF (br(i) .GE. 0.)
THEN 508 fx1(i) = sign(min2, bl(i))
516 flux(i, j) = fx0(i) + (1.-abs0)*fx1(i)
518 ELSE IF (iord .EQ. 4)
THEN 520 bl(i) = al(i) - q1(i)
521 br(i) = al(i+1) - q1(i)
522 b0(i) = bl(i) + br(i)
523 IF (b0(i) .GE. 0.)
THEN 528 IF (bl(i) - br(i) .GE. 0.)
THEN 534 smt6(i) = 3.*x0 .LT. xt
541 IF (c(i, j) .GT. 0.)
THEN 543 IF (smt6(i-1) .OR. smt5(i)) fx1(i) = (1.-c(i, j))*(br(i-1)&
547 IF (smt6(i) .OR. smt5(i-1)) fx1(i) = (1.+c(i, j))*(bl(i)+c&
550 flux(i, j) = fx0(i) + fx1(i)
554 IF (iord .EQ. 5)
THEN 556 bl(i) = al(i) - q1(i)
557 br(i) = al(i+1) - q1(i)
558 b0(i) = bl(i) + br(i)
559 smt5(i) = bl(i)*br(i) .LT. 0.
563 bl(i) = al(i) - q1(i)
564 br(i) = al(i+1) - q1(i)
565 b0(i) = bl(i) + br(i)
566 IF (3.*b0(i) .GE. 0.)
THEN 571 IF (bl(i) - br(i) .GE. 0.)
THEN 574 abs4 = -(bl(i)-br(i))
576 smt5(i) = abs1 .LT. abs4
581 IF (c(i, j) .GT. 0.)
THEN 582 fx1(i) = (1.-c(i, j))*(br(i-1)-c(i, j)*b0(i-1))
585 fx1(i) = (1.+c(i, j))*(bl(i)+c(i, j)*b0(i))
588 IF (smt5(i-1) .OR. smt5(i)) flux(i, j) = flux(i, j) + fx1(i)
597 xt = 0.25*(q1(i+1)-q1(i-1))
603 IF (q1(i-1) .LT. q1(i))
THEN 604 IF (q1(i) .LT. q1(i+1))
THEN 609 ELSE IF (q1(i-1) .LT. q1(i+1))
THEN 615 IF (q1(i-1) .GT. q1(i))
THEN 616 IF (q1(i) .GT. q1(i+1))
THEN 621 ELSE IF (q1(i-1) .GT. q1(i+1))
THEN 633 ELSE IF (x4 .GT. z1)
THEN 638 dm(i) = sign(min3, xt)
641 al(i) = 0.5*(q1(i-1)+q1(i)) +
r3*(dm(i-1)-dm(i))
643 IF (iord .EQ. 8)
THEN 651 IF (al(i) - q1(i) .GE. 0.)
THEN 661 bl(i) = -sign(min4, xt)
667 IF (al(i+1) - q1(i) .GE. 0.)
THEN 670 y5 = -(al(i+1)-q1(i))
677 br(i) = sign(min5, xt)
679 ELSE IF (iord .EQ. 11)
THEN 688 IF (al(i) - q1(i) .GE. 0.)
THEN 698 bl(i) = -sign(min6, xt)
704 IF (al(i+1) - q1(i) .GE. 0.)
THEN 707 y7 = -(al(i+1)-q1(i))
714 br(i) = sign(min7, xt)
718 dq(i) = 2.*(q1(i+1)-q1(i))
721 bl(i) = al(i) - q1(i)
722 br(i) = al(i+1) - q1(i)
723 IF (dm(i-1) .GE. 0.)
THEN 728 IF (dm(i) .GE. 0.)
THEN 733 IF (dm(i+1) .GE. 0.)
THEN 738 IF (abs2 + abs5 + abs7 .LT.
near_zero)
THEN 742 IF (3.*(bl(i)+br(i)) .GE. 0.)
THEN 743 abs3 = 3.*(bl(i)+br(i))
745 abs3 = -(3.*(bl(i)+br(i)))
747 IF (bl(i) - br(i) .GE. 0.)
THEN 750 abs6 = -(bl(i)-br(i))
752 IF (abs3 .GT. abs6)
THEN 754 lac_2 = pmp_2 - 0.75*dq(i-2)
755 IF (0. .LT. pmp_2)
THEN 756 IF (pmp_2 .LT. lac_2)
THEN 761 ELSE IF (0. .LT. lac_2)
THEN 766 IF (0. .GT. pmp_2)
THEN 767 IF (pmp_2 .GT. lac_2)
THEN 772 ELSE IF (0. .GT. lac_2)
THEN 777 IF (br(i) .LT. y14)
THEN 788 lac_1 = pmp_1 + 0.75*dq(i+1)
789 IF (0. .LT. pmp_1)
THEN 790 IF (pmp_1 .LT. lac_1)
THEN 795 ELSE IF (0. .LT. lac_1)
THEN 800 IF (0. .GT. pmp_1)
THEN 801 IF (pmp_1 .GT. lac_1)
THEN 806 ELSE IF (0. .GT. lac_1)
THEN 811 IF (bl(i) .LT. y15)
THEN 816 IF (x10 .GT. y9)
THEN 826 IF (iord .EQ. 9 .OR. iord .EQ. 13)
CALL pert_ppm(ie1 - is1 + 1, &
827 & q1(is1:ie1), bl(is1:&
828 & ie1), br(is1:ie1), 0)
829 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 831 bl(0) =
s14*dm(-1) +
s11*(q1(-1)-q1(0))
832 xt = 0.5*(((2.*dxa(0, j)+dxa(-1, j))*q1(0)-dxa(0, j)*q1(-1))&
833 & /(dxa(-1, j)+dxa(0, j))+((2.*dxa(1, j)+dxa(2, j))*q1(1)-&
834 & dxa(1, j)*q1(2))/(dxa(1, j)+dxa(2, j)))
835 IF (q1(1) .GT. q1(2))
THEN 840 IF (q1(-1) .GT. q1(0))
THEN 841 IF (q1(0) .GT. z2)
THEN 846 ELSE IF (q1(-1) .GT. z2)
THEN 851 IF (xt .LT. y10)
THEN 856 IF (q1(1) .LT. q1(2))
THEN 861 IF (q1(-1) .LT. q1(0))
THEN 862 IF (q1(0) .LT. z3)
THEN 867 ELSE IF (q1(-1) .LT. z3)
THEN 872 IF (xt .GT. y11)
THEN 883 br(2) = al(3) - q1(2)
884 CALL pert_ppm(3, q1(0:2), bl(0:2), br(0:2), 1)
886 IF (ie + 1 .EQ. npx)
THEN 887 bl(npx-2) = al(npx-2) - q1(npx-2)
888 xt =
s15*q1(npx-1) +
s11*q1(npx-2) +
s14*dm(npx-2)
889 br(npx-2) = xt - q1(npx-2)
890 bl(npx-1) = xt - q1(npx-1)
891 xt = 0.5*(((2.*dxa(npx-1, j)+dxa(npx-2, j))*q1(npx-1)-dxa(&
892 & npx-1, j)*q1(npx-2))/(dxa(npx-2, j)+dxa(npx-1, j))+((2.*&
893 & dxa(npx, j)+dxa(npx+1, j))*q1(npx)-dxa(npx, j)*q1(npx+1))/&
894 & (dxa(npx, j)+dxa(npx+1, j)))
895 IF (q1(npx) .GT. q1(npx+1))
THEN 900 IF (q1(npx-2) .GT. q1(npx-1))
THEN 901 IF (q1(npx-1) .GT. z4)
THEN 906 ELSE IF (q1(npx-2) .GT. z4)
THEN 911 IF (xt .LT. y12)
THEN 916 IF (q1(npx) .LT. q1(npx+1))
THEN 921 IF (q1(npx-2) .LT. q1(npx-1))
THEN 922 IF (q1(npx-1) .LT. z5)
THEN 927 ELSE IF (q1(npx-2) .LT. z5)
THEN 932 IF (xt .GT. y13)
THEN 938 br(npx-1) = xt - q1(npx-1)
939 bl(npx) = xt - q1(npx)
940 br(npx) =
s11*(q1(npx+1)-q1(npx)) -
s14*dm(npx+1)
941 CALL pert_ppm(3, q1(npx-2:npx), bl(npx-2:npx), br(npx-2:npx)&
946 IF (c(i, j) .GT. 0.)
THEN 947 flux(i, j) = q1(i-1) + (1.-c(i, j))*(br(i-1)-c(i, j)*(bl(i-1&
950 flux(i, j) = q1(i) + (1.+c(i, j))*(bl(i)+c(i, j)*(bl(i)+br(i&
957 SUBROUTINE yppm(flux, q, c, jord, ifirst, ilast, isd, ied, js, je, jsd&
958 & , jed, npx, npy, dya, nested, grid_type)
961 INTEGER,
INTENT(IN) :: ifirst, ilast
962 INTEGER,
INTENT(IN) :: isd, ied, js, je, jsd, jed
963 INTEGER,
INTENT(IN) :: jord
964 INTEGER,
INTENT(IN) :: npx, npy
965 REAL,
INTENT(IN) :: q(ifirst:ilast, jsd:jed)
967 REAL,
INTENT(IN) :: c(isd:ied, js:je+1)
969 REAL,
INTENT(OUT) :: flux(ifirst:ilast, js:je+1)
970 REAL,
INTENT(IN) :: dya(isd:ied, jsd:jed)
971 LOGICAL,
INTENT(IN) :: nested
972 INTEGER,
INTENT(IN) :: grid_type
974 REAL :: dm(ifirst:ilast, js-2:je+2)
975 REAL :: al(ifirst:ilast, js-1:je+2)
976 REAL,
DIMENSION(ifirst:ilast, js-1:je+1) :: bl, br, b0
977 REAL :: dq(ifirst:ilast, js-3:je+2)
978 REAL,
DIMENSION(ifirst:ilast) :: fx0, fx1
979 LOGICAL,
DIMENSION(ifirst:ilast, js-1:je+1) :: smt5, smt6
980 REAL :: x0, xt, qtmp, pmp_1, lac_1, pmp_2, lac_2, r1
981 INTEGER :: i, j, js1, je3, je1
1032 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 1033 IF (3 .LT. js - 1)
THEN 1038 IF (npy - 2 .GT. je + 2)
THEN 1043 IF (npy - 3 .GT. je + 1)
THEN 1054 IF (jord .LT. 8 .OR. jord .EQ. 333)
THEN 1057 al(i, j) =
p1*(q(i, j-1)+q(i, j)) +
p2*(q(i, j-2)+q(i, j+1))
1060 IF (jord .EQ. 7)
THEN 1063 IF (al(i, j) .LT. 0.) al(i, j) = 0.5*(q(i, j)+q(i, j+1))
1067 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 1070 al(i, 0) =
c1*q(i, -2) +
c2*q(i, -1) +
c3*q(i, 0)
1071 al(i, 1) = 0.5*(((2.*dya(i, 0)+dya(i, -1))*q(i, 0)-dya(i, 0)&
1072 & *q(i, -1))/(dya(i, -1)+dya(i, 0))+((2.*dya(i, 1)+dya(i, 2)&
1073 & )*q(i, 1)-dya(i, 1)*q(i, 2))/(dya(i, 1)+dya(i, 2)))
1074 al(i, 2) =
c3*q(i, 1) +
c2*q(i, 2) +
c1*q(i, 3)
1076 IF (jord .EQ. 7)
THEN 1078 IF (0. .LT. al(i, 0))
THEN 1083 IF (0. .LT. al(i, 1))
THEN 1088 IF (0. .LT. al(i, 2))
THEN 1096 IF (je + 1 .EQ. npy)
THEN 1098 al(i, npy-1) =
c1*q(i, npy-3) +
c2*q(i, npy-2) +
c3*q(i, npy&
1100 al(i, npy) = 0.5*(((2.*dya(i, npy-1)+dya(i, npy-2))*q(i, npy&
1101 & -1)-dya(i, npy-1)*q(i, npy-2))/(dya(i, npy-2)+dya(i, npy-1&
1102 & ))+((2.*dya(i, npy)+dya(i, npy+1))*q(i, npy)-dya(i, npy)*q&
1103 & (i, npy+1))/(dya(i, npy)+dya(i, npy+1)))
1104 al(i, npy+1) =
c3*q(i, npy) +
c2*q(i, npy+1) +
c1*q(i, npy+2&
1107 IF (jord .EQ. 7)
THEN 1109 IF (0. .LT. al(i, npy-1))
THEN 1110 al(i, npy-1) = al(i, npy-1)
1114 IF (0. .LT. al(i, npy))
THEN 1115 al(i, npy) = al(i, npy)
1119 IF (0. .LT. al(i, npy+1))
THEN 1120 al(i, npy+1) = al(i, npy+1)
1128 IF (jord .EQ. 1)
THEN 1131 IF (c(i, j) .GT. 0.)
THEN 1132 flux(i, j) = q(i, j-1)
1134 flux(i, j) = q(i, j)
1138 ELSE IF (jord .EQ. 2)
THEN 1145 IF (xt .GT. 0.)
THEN 1147 flux(i, j) = qtmp + (1.-xt)*(al(i, j)-qtmp-xt*(al(i, j-1)+&
1148 & al(i, j)-(qtmp+qtmp)))
1151 flux(i, j) = qtmp + (1.+xt)*(al(i, j)-qtmp+xt*(al(i, j)+al&
1152 & (i, j+1)-(qtmp+qtmp)))
1156 ELSE IF (jord .EQ. 333)
THEN 1162 IF (xt .GT. 0.)
THEN 1163 flux(i, j) = (2.0*q(i, j)+5.0*q(i, j-1)-q(i, j-2))/6.0 - &
1164 & 0.5*xt*(q(i, j)-q(i, j-1)) + xt*xt/6.0*(q(i, j)-2.0*q(i&
1167 flux(i, j) = (2.0*q(i, j-1)+5.0*q(i, j)-q(i, j+1))/6.0 - &
1168 & 0.5*xt*(q(i, j)-q(i, j-1)) + xt*xt/6.0*(q(i, j+1)-2.0*q(&
1173 ELSE IF (jord .EQ. 3)
THEN 1176 bl(i, j) = al(i, j) - q(i, j)
1177 br(i, j) = al(i, j+1) - q(i, j)
1178 b0(i, j) = bl(i, j) + br(i, j)
1179 IF (b0(i, j) .GE. 0.)
THEN 1184 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 1185 xt = bl(i, j) - br(i, j)
1187 xt = -(bl(i, j)-br(i, j))
1189 smt5(i, j) = x0 .LT. xt
1190 smt6(i, j) = 3.*x0 .LT. xt
1199 IF (xt .GT. 0.)
THEN 1201 IF (smt6(i, j-1) .OR. smt5(i, j))
THEN 1202 fx1(i) = br(i, j-1) - xt*b0(i, j-1)
1203 ELSE IF (smt5(i, j-1))
THEN 1204 IF (bl(i, j-1) .GE. 0.)
THEN 1209 IF (br(i, j-1) .GE. 0.)
THEN 1214 IF (x1 .GT. y1)
THEN 1220 fx1(i) = sign(min1, br(i, j-1))
1224 IF (smt6(i, j) .OR. smt5(i, j-1))
THEN 1225 fx1(i) = bl(i, j) + xt*b0(i, j)
1226 ELSE IF (smt5(i, j))
THEN 1227 IF (bl(i, j) .GE. 0.)
THEN 1232 IF (br(i, j) .GE. 0.)
THEN 1237 IF (x2 .GT. y2)
THEN 1242 fx1(i) = sign(min2, bl(i, j))
1245 IF (xt .GE. 0.)
THEN 1250 flux(i, j) = fx0(i) + (1.-abs0)*fx1(i)
1253 ELSE IF (jord .EQ. 4)
THEN 1256 bl(i, j) = al(i, j) - q(i, j)
1257 br(i, j) = al(i, j+1) - q(i, j)
1258 b0(i, j) = bl(i, j) + br(i, j)
1259 IF (b0(i, j) .GE. 0.)
THEN 1264 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 1265 xt = bl(i, j) - br(i, j)
1267 xt = -(bl(i, j)-br(i, j))
1269 smt5(i, j) = x0 .LT. xt
1270 smt6(i, j) = 3.*x0 .LT. xt
1279 IF (c(i, j) .GT. 0.)
THEN 1281 IF (smt6(i, j-1) .OR. smt5(i, j)) fx1(i) = (1.-c(i, j))*(&
1282 & br(i, j-1)-c(i, j)*b0(i, j-1))
1285 IF (smt6(i, j) .OR. smt5(i, j-1)) fx1(i) = (1.+c(i, j))*(&
1286 & bl(i, j)+c(i, j)*b0(i, j))
1288 flux(i, j) = fx0(i) + fx1(i)
1293 IF (jord .EQ. 5)
THEN 1296 bl(i, j) = al(i, j) - q(i, j)
1297 br(i, j) = al(i, j+1) - q(i, j)
1298 b0(i, j) = bl(i, j) + br(i, j)
1299 smt5(i, j) = bl(i, j)*br(i, j) .LT. 0.
1305 bl(i, j) = al(i, j) - q(i, j)
1306 br(i, j) = al(i, j+1) - q(i, j)
1307 b0(i, j) = bl(i, j) + br(i, j)
1308 IF (3.*b0(i, j) .GE. 0.)
THEN 1311 abs1 = -(3.*b0(i, j))
1313 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 1314 abs4 = bl(i, j) - br(i, j)
1316 abs4 = -(bl(i, j)-br(i, j))
1318 smt5(i, j) = abs1 .LT. abs4
1325 IF (c(i, j) .GT. 0.)
THEN 1326 fx1(i) = (1.-c(i, j))*(br(i, j-1)-c(i, j)*b0(i, j-1))
1327 flux(i, j) = q(i, j-1)
1329 fx1(i) = (1.+c(i, j))*(bl(i, j)+c(i, j)*b0(i, j))
1330 flux(i, j) = q(i, j)
1332 IF (smt5(i, j-1) .OR. smt5(i, j)) flux(i, j) = flux(i, j) + &
1344 xt = 0.25*(q(i, j+1)-q(i, j-1))
1345 IF (xt .GE. 0.)
THEN 1350 IF (q(i, j-1) .LT. q(i, j))
THEN 1351 IF (q(i, j) .LT. q(i, j+1))
THEN 1356 ELSE IF (q(i, j-1) .LT. q(i, j+1))
THEN 1362 IF (q(i, j-1) .GT. q(i, j))
THEN 1363 IF (q(i, j) .GT. q(i, j+1))
THEN 1368 ELSE IF (q(i, j-1) .GT. q(i, j+1))
THEN 1374 IF (x3 .GT. y3)
THEN 1375 IF (y3 .GT. z1)
THEN 1380 ELSE IF (x3 .GT. z1)
THEN 1385 dm(i, j) = sign(min3, xt)
1390 al(i, j) = 0.5*(q(i, j-1)+q(i, j)) +
r3*(dm(i, j-1)-dm(i, j))
1393 IF (jord .EQ. 8)
THEN 1397 IF (xt .GE. 0.)
THEN 1402 IF (al(i, j) - q(i, j) .GE. 0.)
THEN 1403 y4 = al(i, j) - q(i, j)
1405 y4 = -(al(i, j)-q(i, j))
1407 IF (x4 .GT. y4)
THEN 1412 bl(i, j) = -sign(min4, xt)
1413 IF (xt .GE. 0.)
THEN 1418 IF (al(i, j+1) - q(i, j) .GE. 0.)
THEN 1419 y5 = al(i, j+1) - q(i, j)
1421 y5 = -(al(i, j+1)-q(i, j))
1423 IF (x5 .GT. y5)
THEN 1428 br(i, j) = sign(min5, xt)
1431 ELSE IF (jord .EQ. 11)
THEN 1435 IF (xt .GE. 0.)
THEN 1440 IF (al(i, j) - q(i, j) .GE. 0.)
THEN 1441 y6 = al(i, j) - q(i, j)
1443 y6 = -(al(i, j)-q(i, j))
1445 IF (x6 .GT. y6)
THEN 1450 bl(i, j) = -sign(min6, xt)
1451 IF (xt .GE. 0.)
THEN 1456 IF (al(i, j+1) - q(i, j) .GE. 0.)
THEN 1457 y7 = al(i, j+1) - q(i, j)
1459 y7 = -(al(i, j+1)-q(i, j))
1461 IF (x7 .GT. y7)
THEN 1466 br(i, j) = sign(min7, xt)
1472 dq(i, j) = 2.*(q(i, j+1)-q(i, j))
1477 bl(i, j) = al(i, j) - q(i, j)
1478 br(i, j) = al(i, j+1) - q(i, j)
1479 IF (dm(i, j-1) .GE. 0.)
THEN 1484 IF (dm(i, j) .GE. 0.)
THEN 1489 IF (dm(i, j+1) .GE. 0.)
THEN 1494 IF (abs2 + abs5 + abs7 .LT.
near_zero)
THEN 1498 IF (3.*(bl(i, j)+br(i, j)) .GE. 0.)
THEN 1499 abs3 = 3.*(bl(i, j)+br(i, j))
1501 abs3 = -(3.*(bl(i, j)+br(i, j)))
1503 IF (bl(i, j) - br(i, j) .GE. 0.)
THEN 1504 abs6 = bl(i, j) - br(i, j)
1506 abs6 = -(bl(i, j)-br(i, j))
1508 IF (abs3 .GT. abs6)
THEN 1510 lac_2 = pmp_2 - 0.75*dq(i, j-2)
1511 IF (0. .LT. pmp_2)
THEN 1512 IF (pmp_2 .LT. lac_2)
THEN 1517 ELSE IF (0. .LT. lac_2)
THEN 1522 IF (0. .GT. pmp_2)
THEN 1523 IF (pmp_2 .GT. lac_2)
THEN 1528 ELSE IF (0. .GT. lac_2)
THEN 1533 IF (br(i, j) .LT. y14)
THEN 1538 IF (x8 .GT. y8)
THEN 1544 lac_1 = pmp_1 + 0.75*dq(i, j+1)
1545 IF (0. .LT. pmp_1)
THEN 1546 IF (pmp_1 .LT. lac_1)
THEN 1551 ELSE IF (0. .LT. lac_1)
THEN 1556 IF (0. .GT. pmp_1)
THEN 1557 IF (pmp_1 .GT. lac_1)
THEN 1562 ELSE IF (0. .GT. lac_1)
THEN 1567 IF (bl(i, j) .LT. y15)
THEN 1572 IF (x9 .GT. y9)
THEN 1582 IF (jord .EQ. 9 .OR. jord .EQ. 13)
THEN 1585 CALL pert_ppm(ilast - ifirst + 1, q(ifirst:ilast, j), bl(&
1586 & ifirst:ilast, j), br(ifirst:ilast, j), 0)
1589 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 1592 bl(i, 0) =
s14*dm(i, -1) +
s11*(q(i, -1)-q(i, 0))
1593 xt = 0.5*(((2.*dya(i, 0)+dya(i, -1))*q(i, 0)-dya(i, 0)*q(i, &
1594 & -1))/(dya(i, -1)+dya(i, 0))+((2.*dya(i, 1)+dya(i, 2))*q(i&
1595 & , 1)-dya(i, 1)*q(i, 2))/(dya(i, 1)+dya(i, 2)))
1596 IF (q(i, 1) .GT. q(i, 2))
THEN 1601 IF (q(i, -1) .GT. q(i, 0))
THEN 1602 IF (q(i, 0) .GT. z2)
THEN 1607 ELSE IF (q(i, -1) .GT. z2)
THEN 1612 IF (xt .LT. y10)
THEN 1617 IF (q(i, 1) .LT. q(i, 2))
THEN 1622 IF (q(i, -1) .LT. q(i, 0))
THEN 1623 IF (q(i, 0) .LT. z3)
THEN 1628 ELSE IF (q(i, -1) .LT. z3)
THEN 1633 IF (xt .GT. y11)
THEN 1639 br(i, 0) = xt - q(i, 0)
1640 bl(i, 1) = xt - q(i, 1)
1641 xt =
s15*q(i, 1) +
s11*q(i, 2) -
s14*dm(i, 2)
1642 br(i, 1) = xt - q(i, 1)
1643 bl(i, 2) = xt - q(i, 2)
1644 br(i, 2) = al(i, 3) - q(i, 2)
1646 CALL pert_ppm(3*(ilast-ifirst+1), q(ifirst:ilast, 0:2), bl(&
1647 & ifirst:ilast, 0:2), br(ifirst:ilast, 0:2), 1)
1649 IF (je + 1 .EQ. npy)
THEN 1651 bl(i, npy-2) = al(i, npy-2) - q(i, npy-2)
1652 xt =
s15*q(i, npy-1) +
s11*q(i, npy-2) +
s14*dm(i, npy-2)
1653 br(i, npy-2) = xt - q(i, npy-2)
1654 bl(i, npy-1) = xt - q(i, npy-1)
1655 xt = 0.5*(((2.*dya(i, npy-1)+dya(i, npy-2))*q(i, npy-1)-dya(&
1656 & i, npy-1)*q(i, npy-2))/(dya(i, npy-2)+dya(i, npy-1))+((2.*&
1657 & dya(i, npy)+dya(i, npy+1))*q(i, npy)-dya(i, npy)*q(i, npy+&
1658 & 1))/(dya(i, npy)+dya(i, npy+1)))
1659 IF (q(i, npy) .GT. q(i, npy+1))
THEN 1664 IF (q(i, npy-2) .GT. q(i, npy-1))
THEN 1665 IF (q(i, npy-1) .GT. z4)
THEN 1670 ELSE IF (q(i, npy-2) .GT. z4)
THEN 1675 IF (xt .LT. y12)
THEN 1680 IF (q(i, npy) .LT. q(i, npy+1))
THEN 1685 IF (q(i, npy-2) .LT. q(i, npy-1))
THEN 1686 IF (q(i, npy-1) .LT. z5)
THEN 1691 ELSE IF (q(i, npy-2) .LT. z5)
THEN 1696 IF (xt .GT. y13)
THEN 1702 br(i, npy-1) = xt - q(i, npy-1)
1703 bl(i, npy) = xt - q(i, npy)
1704 br(i, npy) =
s11*(q(i, npy+1)-q(i, npy)) -
s14*dm(i, npy+1)
1706 CALL pert_ppm(3*(ilast-ifirst+1), q(ifirst:ilast, npy-2:npy), &
1707 & bl(ifirst:ilast, npy-2:npy), br(ifirst:ilast, npy-2:&
1713 IF (c(i, j) .GT. 0.)
THEN 1714 flux(i, j) = q(i, j-1) + (1.-c(i, j))*(br(i, j-1)-c(i, j)*(&
1715 & bl(i, j-1)+br(i, j-1)))
1717 flux(i, j) = q(i, j) + (1.+c(i, j))*(bl(i, j)+c(i, j)*(bl(i&
1724 SUBROUTINE mp_ghost_ew(im, jm, km, nq, ifirst, ilast, jfirst, jlast, &
1725 & kfirst, klast, ng_w, ng_e, ng_s, ng_n, q_ghst, q)
1729 INTEGER,
INTENT(IN) :: im, jm, km, nq
1730 INTEGER,
INTENT(IN) :: ifirst, ilast
1731 INTEGER,
INTENT(IN) :: jfirst, jlast
1732 INTEGER,
INTENT(IN) :: kfirst, klast
1734 INTEGER,
INTENT(IN) :: ng_e
1736 INTEGER,
INTENT(IN) :: ng_w
1738 INTEGER,
INTENT(IN) :: ng_s
1740 INTEGER,
INTENT(IN) :: ng_n
1741 REAL,
INTENT(INOUT) :: q_ghst(ifirst-ng_w:ilast+ng_e, jfirst-ng_s:&
1742 & jlast+ng_n, kfirst:klast, nq)
1743 REAL,
OPTIONAL,
INTENT(IN) :: q(ifirst:ilast, jfirst:jlast, kfirst:&
1756 INTEGER :: i, j, k, n
1758 IF (
PRESENT(q)) q_ghst(ifirst:ilast, jfirst:jlast, kfirst:klast, 1:&
1759 & nq) = q(ifirst:ilast, jfirst:jlast, kfirst:klast, 1:nq)
1763 DO j=jfirst-ng_s,jlast+ng_n
1765 q_ghst(ifirst-i, j, k, n) = q_ghst(ilast-i+1, j, k, n)
1768 q_ghst(ilast+i, j, k, n) = q_ghst(ifirst+i-1, j, k, n)
1777 SUBROUTINE pert_ppm_tlm(im, a0, al, al_tl, ar, ar_tl, iv)
1779 INTEGER,
INTENT(IN) :: im
1780 INTEGER,
INTENT(IN) :: iv
1781 REAL,
INTENT(IN) :: a0(im)
1782 REAL,
INTENT(INOUT) :: al(im), ar(im)
1783 REAL,
INTENT(INOUT) :: al_tl(im), ar_tl(im)
1785 REAL :: a4, da1, da2, a6da, fmin
1787 REAL,
PARAMETER :: r12=1./12.
1796 IF (a0(i) .LE. 0.)
THEN 1802 a4 = -(3.*(ar(i)+al(i)))
1804 IF (da1 .GE. 0.)
THEN 1809 IF (abs0 .LT. -a4)
THEN 1810 fmin = a0(i) + 0.25/a4*da1**2 + a4*r12
1811 IF (fmin .LT. 0.)
THEN 1812 IF (ar(i) .GT. 0. .AND. al(i) .GT. 0.)
THEN 1817 ELSE IF (da1 .GT. 0.)
THEN 1818 ar_tl(i) = -(2.*al_tl(i))
1821 al_tl(i) = -(2.*ar_tl(i))
1831 IF (al(i)*ar(i) .LT. 0.)
THEN 1834 a6da = 3.*(al(i)+ar(i))*da1
1836 IF (a6da .LT. -da2)
THEN 1837 ar_tl(i) = -(2.*al_tl(i))
1839 ELSE IF (a6da .GT. da2)
THEN 1840 al_tl(i) = -(2.*ar_tl(i))
1853 SUBROUTINE pert_ppm(im, a0, al, ar, iv)
1855 INTEGER,
INTENT(IN) :: im
1856 INTEGER,
INTENT(IN) :: iv
1857 REAL,
INTENT(IN) :: a0(im)
1858 REAL,
INTENT(INOUT) :: al(im), ar(im)
1860 REAL :: a4, da1, da2, a6da, fmin
1862 REAL,
PARAMETER :: r12=1./12.
1871 IF (a0(i) .LE. 0.)
THEN 1875 a4 = -(3.*(ar(i)+al(i)))
1877 IF (da1 .GE. 0.)
THEN 1882 IF (abs0 .LT. -a4)
THEN 1883 fmin = a0(i) + 0.25/a4*da1**2 + a4*r12
1884 IF (fmin .LT. 0.)
THEN 1885 IF (ar(i) .GT. 0. .AND. al(i) .GT. 0.)
THEN 1888 ELSE IF (da1 .GT. 0.)
THEN 1900 IF (al(i)*ar(i) .LT. 0.)
THEN 1903 a6da = 3.*(al(i)+ar(i))*da1
1905 IF (a6da .LT. -da2)
THEN 1907 ELSE IF (a6da .GT. da2)
THEN 1918 SUBROUTINE deln_flux(nord, is, ie, js, je, npx, npy, damp, q, fx, fy, &
1919 & gridstruct, bd, mass)
1928 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
1930 INTEGER,
INTENT(IN) :: nord
1931 INTEGER,
INTENT(IN) :: is, ie, js, je, npx, npy
1932 REAL,
INTENT(IN) :: damp
1934 REAL,
INTENT(IN) :: q(bd%is-ng:bd%ie+ng, bd%js-ng:bd%je+ng)
1935 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
1937 REAL,
OPTIONAL,
INTENT(IN) :: mass(bd%isd:bd%ied, bd%jsd:bd%jed)
1939 REAL,
INTENT(INOUT) :: fx(bd%is:bd%ie+1, bd%js:bd%je), fy(bd%is:bd%&
1940 & ie, bd%js:bd%je+1)
1942 REAL :: fx2(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy2(bd%isd:bd%ied, bd%&
1944 REAL :: d2(bd%isd:bd%ied, bd%jsd:bd%jed)
1946 INTEGER :: i, j, n, nt, i1, i2, j1, j2
1952 IF (.NOT.
PRESENT(mass))
THEN 1955 d2(i, j) = damp*q(i, j)
1965 IF (nord .GT. 0)
CALL copy_corners(d2, npx, npy, 1, gridstruct%&
1966 & nested, bd, gridstruct%sw_corner, &
1967 & gridstruct%se_corner, gridstruct%&
1968 & nw_corner, gridstruct%ne_corner)
1969 DO j=js-nord,je+nord
1970 DO i=is-nord,ie+nord+1
1971 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i-1, j)-d2(i, j))
1974 IF (nord .GT. 0)
CALL copy_corners(d2, npx, npy, 2, gridstruct%&
1975 & nested, bd, gridstruct%sw_corner, &
1976 & gridstruct%se_corner, gridstruct%&
1977 & nw_corner, gridstruct%ne_corner)
1978 DO j=js-nord,je+nord+1
1979 DO i=is-nord,ie+nord
1980 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j-1)-d2(i, j))
1983 IF (nord .GT. 0)
THEN 1989 DO j=js-nt-1,je+nt+1
1990 DO i=is-nt-1,ie+nt+1
1991 d2(i, j) = (fx2(i, j)-fx2(i+1, j)+fy2(i, j)-fy2(i, j+1))*&
1992 & gridstruct%rarea(i, j)
1995 CALL copy_corners(d2, npx, npy, 1, gridstruct%nested, bd, &
1996 & gridstruct%sw_corner, gridstruct%se_corner, &
1997 & gridstruct%nw_corner, gridstruct%ne_corner)
2000 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i, j)-d2(i-1, j))
2003 CALL copy_corners(d2, npx, npy, 2, gridstruct%nested, bd, &
2004 & gridstruct%sw_corner, gridstruct%se_corner, &
2005 & gridstruct%nw_corner, gridstruct%ne_corner)
2008 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j)-d2(i, j-1))
2016 IF (
PRESENT(mass))
THEN 2021 fx(i, j) = fx(i, j) + damp2*(mass(i-1, j)+mass(i, j))*fx2(i, j&
2027 fy(i, j) = fy(i, j) + damp2*(mass(i, j-1)+mass(i, j))*fy2(i, j&
2034 fx(i, j) = fx(i, j) + fx2(i, j)
2039 fy(i, j) = fy(i, j) + fy2(i, j)
2046 SUBROUTINE copy_corners(q, npx, npy, dir, nested, bd, sw_corner, &
2047 & se_corner, nw_corner, ne_corner)
2050 INTEGER,
INTENT(IN) :: npx, npy, dir
2051 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
2052 LOGICAL,
INTENT(IN) :: nested, sw_corner, se_corner, nw_corner, &
2057 ELSE IF (dir .EQ. 1)
THEN 2069 q(i, j) = q(npy-j, i-npx+1)
2076 q(i, j) = q(j, 2*npx-1-i)
2083 q(i, j) = q(npy-j, i-1+npx)
2087 ELSE IF (dir .EQ. 2)
THEN 2099 q(i, j) = q(npy+j-1, npx-i)
2106 q(i, j) = q(2*npy-1-j, i)
2113 q(i, j) = q(j+1-npx, npy-i)
2123 SUBROUTINE fv_tp_2d_tlm(q, q_tl, crx, crx_tl, cry, cry_tl, npx, npy&
2124 & , hord, fx, fx_tl, fy, fy_tl, xfx, xfx_tl, yfx, yfx_tl, gridstruct, &
2125 & bd, ra_x, ra_x_tl, ra_y, ra_y_tl, mfx, mfx_tl, mfy, mfy_tl, mass, &
2126 & mass_tl, nord, damp_c)
2129 INTEGER,
INTENT(IN) :: npx, npy
2130 INTEGER,
INTENT(IN) :: hord
2132 REAL,
INTENT(IN) :: crx(bd%is:bd%ie+1, bd%jsd:bd%jed)
2133 REAL,
INTENT(IN) :: crx_tl(bd%is:bd%ie+1, bd%jsd:bd%jed)
2135 REAL,
INTENT(IN) :: xfx(bd%is:bd%ie+1, bd%jsd:bd%jed)
2136 REAL,
INTENT(IN) :: xfx_tl(bd%is:bd%ie+1, bd%jsd:bd%jed)
2138 REAL,
INTENT(IN) :: cry(bd%isd:bd%ied, bd%js:bd%je+1)
2139 REAL,
INTENT(IN) :: cry_tl(bd%isd:bd%ied, bd%js:bd%je+1)
2141 REAL,
INTENT(IN) :: yfx(bd%isd:bd%ied, bd%js:bd%je+1)
2142 REAL,
INTENT(IN) :: yfx_tl(bd%isd:bd%ied, bd%js:bd%je+1)
2143 REAL,
INTENT(IN) :: ra_x(bd%is:bd%ie, bd%jsd:bd%jed)
2144 REAL,
INTENT(IN) :: ra_x_tl(bd%is:bd%ie, bd%jsd:bd%jed)
2145 REAL,
INTENT(IN) :: ra_y(bd%isd:bd%ied, bd%js:bd%je)
2146 REAL,
INTENT(IN) :: ra_y_tl(bd%isd:bd%ied, bd%js:bd%je)
2148 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
2149 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2151 REAL,
INTENT(OUT) :: fx(bd%is:bd%ie+1, bd%js:bd%je)
2152 REAL,
INTENT(OUT) :: fx_tl(bd%is:bd%ie+1, bd%js:bd%je)
2154 REAL,
INTENT(OUT) :: fy(bd%is:bd%ie, bd%js:bd%je+1)
2155 REAL,
INTENT(OUT) :: fy_tl(bd%is:bd%ie, bd%js:bd%je+1)
2159 REAL,
OPTIONAL,
INTENT(IN) :: mfx(bd%is:bd%ie+1, bd%js:bd%je)
2160 REAL,
OPTIONAL,
INTENT(IN) :: mfx_tl(bd%is:bd%ie+1, bd%js:bd%je)
2162 REAL,
OPTIONAL,
INTENT(IN) :: mfy(bd%is:bd%ie, bd%js:bd%je+1)
2163 REAL,
OPTIONAL,
INTENT(IN) :: mfy_tl(bd%is:bd%ie, bd%js:bd%je+1)
2164 REAL,
OPTIONAL,
INTENT(IN) :: mass(bd%isd:bd%ied, bd%jsd:bd%jed)
2165 REAL,
OPTIONAL,
INTENT(IN) :: mass_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2166 REAL,
OPTIONAL,
INTENT(IN) :: damp_c
2167 INTEGER,
OPTIONAL,
INTENT(IN) :: nord
2169 INTEGER :: ord_ou, ord_in
2170 REAL :: q_i(bd%isd:bd%ied, bd%js:bd%je)
2171 REAL :: q_i_tl(bd%isd:bd%ied, bd%js:bd%je)
2172 REAL :: q_j(bd%is:bd%ie, bd%jsd:bd%jed)
2173 REAL :: q_j_tl(bd%is:bd%ie, bd%jsd:bd%jed)
2174 REAL :: fx2(bd%is:bd%ie+1, bd%jsd:bd%jed)
2175 REAL :: fx2_tl(bd%is:bd%ie+1, bd%jsd:bd%jed)
2176 REAL :: fy2(bd%isd:bd%ied, bd%js:bd%je+1)
2177 REAL :: fy2_tl(bd%isd:bd%ied, bd%js:bd%je+1)
2178 REAL :: fyy(bd%isd:bd%ied, bd%js:bd%je+1)
2179 REAL :: fyy_tl(bd%isd:bd%ied, bd%js:bd%je+1)
2180 REAL :: fx1(bd%is:bd%ie+1)
2181 REAL :: fx1_tl(bd%is:bd%ie+1)
2184 INTEGER :: is, ie, js, je, isd, ied, jsd, jed
2196 IF (hord .EQ. 10)
THEN 2203 & npy, 2, gridstruct%&
2205 & gridstruct%sw_corner&
2207 & se_corner, gridstruct&
2209 & gridstruct%ne_corner)
2211 CALL yppm_tlm(fy2, fy2_tl, q, q_tl, cry, cry_tl, ord_in, isd, ied&
2212 & , isd, ied, js, je, jsd, jed, npx, npy, gridstruct%dya, &
2213 & gridstruct%nested, gridstruct%grid_type)
2217 fyy_tl(i, j) = yfx_tl(i, j)*fy2(i, j) + yfx(i, j)*fy2_tl(i, j)
2218 fyy(i, j) = yfx(i, j)*fy2(i, j)
2224 q_i_tl(i, j) = ((gridstruct%area(i, j)*q_tl(i, j)+fyy_tl(i, j)-&
2225 & fyy_tl(i, j+1))*ra_y(i, j)-(q(i, j)*gridstruct%area(i, j)+fyy(&
2226 & i, j)-fyy(i, j+1))*ra_y_tl(i, j))/ra_y(i, j)**2
2227 q_i(i, j) = (q(i, j)*gridstruct%area(i, j)+fyy(i, j)-fyy(i, j+1)&
2231 CALL xppm_tlm(fx, fx_tl, q_i, q_i_tl, crx(is:ie+1, js:je), crx_tl&
2232 & (is:ie+1, js:je), ord_ou, is, ie, isd, ied, js, je, jsd, &
2233 & jed, npx, npy, gridstruct%dxa, gridstruct%nested, &
2234 & gridstruct%grid_type)
2236 & npy, 1, gridstruct%&
2238 & gridstruct%sw_corner&
2240 & se_corner, gridstruct&
2242 & gridstruct%ne_corner)
2244 CALL xppm_tlm(fx2, fx2_tl, q, q_tl, crx, crx_tl, ord_in, is, ie, &
2245 & isd, ied, jsd, jed, jsd, jed, npx, npy, gridstruct%dxa, &
2246 & gridstruct%nested, gridstruct%grid_type)
2251 fx1_tl(i) = xfx_tl(i, j)*fx2(i, j) + xfx(i, j)*fx2_tl(i, j)
2252 fx1(i) = xfx(i, j)*fx2(i, j)
2255 q_j_tl(i, j) = ((gridstruct%area(i, j)*q_tl(i, j)+fx1_tl(i)-&
2256 & fx1_tl(i+1))*ra_x(i, j)-(q(i, j)*gridstruct%area(i, j)+fx1(i)-&
2257 & fx1(i+1))*ra_x_tl(i, j))/ra_x(i, j)**2
2258 q_j(i, j) = (q(i, j)*gridstruct%area(i, j)+fx1(i)-fx1(i+1))/ra_x&
2262 CALL yppm_tlm(fy, fy_tl, q_j, q_j_tl, cry, cry_tl, ord_ou, is, ie&
2263 & , isd, ied, js, je, jsd, jed, npx, npy, gridstruct%dya, &
2264 & gridstruct%nested, gridstruct%grid_type)
2268 IF (
PRESENT(mfx) .AND.
PRESENT(mfy))
THEN 2274 fx_tl(i, j) = 0.5*((fx_tl(i, j)+fx2_tl(i, j))*mfx(i, j)+(fx(i&
2275 & , j)+fx2(i, j))*mfx_tl(i, j))
2276 fx(i, j) = 0.5*(fx(i, j)+fx2(i, j))*mfx(i, j)
2281 fy_tl(i, j) = 0.5*((fy_tl(i, j)+fy2_tl(i, j))*mfy(i, j)+(fy(i&
2282 & , j)+fy2(i, j))*mfy_tl(i, j))
2283 fy(i, j) = 0.5*(fy(i, j)+fy2(i, j))*mfy(i, j)
2286 IF (
PRESENT(nord) .AND.
PRESENT(damp_c) .AND.
PRESENT(mass))
THEN 2287 IF (damp_c .GT. 1.e-4)
THEN 2288 pwx1 = damp_c*gridstruct%da_min
2292 & , q_tl, fx, fx_tl, fy, fy_tl, gridstruct, bd, &
2302 fx_tl(i, j) = 0.5*((fx_tl(i, j)+fx2_tl(i, j))*xfx(i, j)+(fx(i&
2303 & , j)+fx2(i, j))*xfx_tl(i, j))
2304 fx(i, j) = 0.5*(fx(i, j)+fx2(i, j))*xfx(i, j)
2309 fy_tl(i, j) = 0.5*((fy_tl(i, j)+fy2_tl(i, j))*yfx(i, j)+(fy(i&
2310 & , j)+fy2(i, j))*yfx_tl(i, j))
2311 fy(i, j) = 0.5*(fy(i, j)+fy2(i, j))*yfx(i, j)
2314 IF (
PRESENT(nord) .AND.
PRESENT(damp_c))
THEN 2315 IF (damp_c .GT. 1.e-4)
THEN 2316 pwx1 = damp_c*gridstruct%da_min
2320 & , q_tl, fx, fx_tl, fy, fy_tl, gridstruct, bd)
2328 SUBROUTINE xppm_tlm(flux, flux_tl, q, q_tl, c, c_tl, iord, is, ie, &
2329 & isd, ied, jfirst, jlast, jsd, jed, npx, npy, dxa, nested, grid_type)
2331 INTEGER,
INTENT(IN) :: is, ie, isd, ied, jsd, jed
2333 INTEGER,
INTENT(IN) :: jfirst, jlast
2334 INTEGER,
INTENT(IN) :: iord
2335 INTEGER,
INTENT(IN) :: npx, npy
2336 REAL,
INTENT(IN) :: q(isd:ied, jfirst:jlast)
2337 REAL,
INTENT(IN) :: q_tl(isd:ied, jfirst:jlast)
2339 REAL,
INTENT(IN) :: c(is:ie+1, jfirst:jlast)
2340 REAL,
INTENT(IN) :: c_tl(is:ie+1, jfirst:jlast)
2341 REAL,
INTENT(IN) :: dxa(isd:ied, jsd:jed)
2342 LOGICAL,
INTENT(IN) :: nested
2343 INTEGER,
INTENT(IN) :: grid_type
2346 REAL,
INTENT(OUT) :: flux(is:ie+1, jfirst:jlast)
2347 REAL,
INTENT(OUT) :: flux_tl(is:ie+1, jfirst:jlast)
2349 REAL,
DIMENSION(is-1:ie+1) :: bl, br, b0
2351 REAL :: q1_tl(isd:ied)
2352 REAL,
DIMENSION(is:ie+1) :: fx0, fx1
2353 LOGICAL,
DIMENSION(is-1:ie+1) :: smt5, smt6
2354 REAL :: al(is-1:ie+2)
2355 REAL :: al_tl(is-1:ie+2)
2356 REAL :: dm(is-2:ie+2)
2357 REAL :: dq(is-3:ie+2)
2358 INTEGER :: i, j, ie3, is1, ie1
2359 REAL :: x0, x1, xt, qtmp, pmp_1, lac_1, pmp_2, lac_2
2360 REAL :: xt_tl, qtmp_tl
2363 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 2364 IF (3 .LT. is - 1)
THEN 2369 IF (npx - 2 .GT. ie + 2)
THEN 2374 IF (npx - 3 .GT. ie + 1)
THEN 2390 q1_tl(i) = q_tl(i, j)
2393 IF (iord .LT. 8 .OR. iord .EQ. 333)
THEN 2397 al_tl(i) =
p1*(q1_tl(i-1)+q1_tl(i)) +
p2*(q1_tl(i-2)+q1_tl(i+1&
2399 al(i) =
p1*(q1(i-1)+q1(i)) +
p2*(q1(i-2)+q1(i+1))
2401 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 2403 al_tl(0) =
c1*q1_tl(-2) +
c2*q1_tl(-1) +
c3*q1_tl(0)
2404 al(0) =
c1*q1(-2) +
c2*q1(-1) +
c3*q1(0)
2405 al_tl(1) = 0.5*(((2.*dxa(0, j)+dxa(-1, j))*q1_tl(0)-dxa(0, j&
2406 & )*q1_tl(-1))/(dxa(-1, j)+dxa(0, j))+((2.*dxa(1, j)+dxa(2, &
2407 & j))*q1_tl(1)-dxa(1, j)*q1_tl(2))/(dxa(1, j)+dxa(2, j)))
2408 al(1) = 0.5*(((2.*dxa(0, j)+dxa(-1, j))*q1(0)-dxa(0, j)*q1(-&
2409 & 1))/(dxa(-1, j)+dxa(0, j))+((2.*dxa(1, j)+dxa(2, j))*q1(1)&
2410 & -dxa(1, j)*q1(2))/(dxa(1, j)+dxa(2, j)))
2411 al_tl(2) =
c3*q1_tl(1) +
c2*q1_tl(2) +
c1*q1_tl(3)
2412 al(2) =
c3*q1(1) +
c2*q1(2) +
c1*q1(3)
2414 IF (ie + 1 .EQ. npx)
THEN 2415 al_tl(npx-1) =
c1*q1_tl(npx-3) +
c2*q1_tl(npx-2) +
c3*q1_tl(&
2417 al(npx-1) =
c1*q1(npx-3) +
c2*q1(npx-2) +
c3*q1(npx-1)
2418 al_tl(npx) = 0.5*(((2.*dxa(npx-1, j)+dxa(npx-2, j))*q1_tl(&
2419 & npx-1)-dxa(npx-1, j)*q1_tl(npx-2))/(dxa(npx-2, j)+dxa(npx-&
2420 & 1, j))+((2.*dxa(npx, j)+dxa(npx+1, j))*q1_tl(npx)-dxa(npx&
2421 & , j)*q1_tl(npx+1))/(dxa(npx, j)+dxa(npx+1, j)))
2422 al(npx) = 0.5*(((2.*dxa(npx-1, j)+dxa(npx-2, j))*q1(npx-1)-&
2423 & dxa(npx-1, j)*q1(npx-2))/(dxa(npx-2, j)+dxa(npx-1, j))+((&
2424 & 2.*dxa(npx, j)+dxa(npx+1, j))*q1(npx)-dxa(npx, j)*q1(npx+1&
2425 & ))/(dxa(npx, j)+dxa(npx+1, j)))
2426 al_tl(npx+1) =
c3*q1_tl(npx) +
c2*q1_tl(npx+1) +
c1*q1_tl(&
2428 al(npx+1) =
c3*q1(npx) +
c2*q1(npx+1) +
c1*q1(npx+2)
2431 IF (iord .EQ. 1)
THEN 2433 IF (c(i, j) .GT. 0.)
THEN 2434 flux_tl(i, j) = q1_tl(i-1)
2435 flux(i, j) = q1(i-1)
2437 flux_tl(i, j) = q1_tl(i)
2441 ELSE IF (iord .EQ. 2)
THEN 2447 IF (xt .GT. 0.)
THEN 2448 qtmp_tl = q1_tl(i-1)
2450 flux_tl(i, j) = qtmp_tl + (1.-xt)*(al_tl(i)-qtmp_tl-xt_tl*&
2451 & (al(i-1)+al(i)-(qtmp+qtmp))-xt*(al_tl(i-1)+al_tl(i)-2*&
2452 & qtmp_tl)) - xt_tl*(al(i)-qtmp-xt*(al(i-1)+al(i)-(qtmp+&
2454 flux(i, j) = qtmp + (1.-xt)*(al(i)-qtmp-xt*(al(i-1)+al(i)-&
2459 flux_tl(i, j) = qtmp_tl + xt_tl*(al(i)-qtmp+xt*(al(i)+al(i&
2460 & +1)-(qtmp+qtmp))) + (1.+xt)*(al_tl(i)-qtmp_tl+xt_tl*(al(&
2461 & i)+al(i+1)-(qtmp+qtmp))+xt*(al_tl(i)+al_tl(i+1)-2*&
2463 flux(i, j) = qtmp + (1.+xt)*(al(i)-qtmp+xt*(al(i)+al(i+1)-&
2467 ELSE IF (iord .EQ. 333)
THEN 2473 IF (xt .GT. 0.)
THEN 2474 flux_tl(i, j) = (2.0*q1_tl(i)+5.0*q1_tl(i-1)-q1_tl(i-2))/&
2475 & 6.0 - 0.5*(xt_tl*(q1(i)-q1(i-1))+xt*(q1_tl(i)-q1_tl(i-1)&
2476 & )) + (xt_tl*xt+xt*xt_tl)*(q1(i)-2.0*q1(i-1)+q1(i-2))/6.0&
2477 & + xt**2*(q1_tl(i)-2.0*q1_tl(i-1)+q1_tl(i-2))/6.0
2478 flux(i, j) = (2.0*q1(i)+5.0*q1(i-1)-q1(i-2))/6.0 - 0.5*xt*&
2479 & (q1(i)-q1(i-1)) + xt*xt/6.0*(q1(i)-2.0*q1(i-1)+q1(i-2))
2481 flux_tl(i, j) = (2.0*q1_tl(i-1)+5.0*q1_tl(i)-q1_tl(i+1))/&
2482 & 6.0 - 0.5*(xt_tl*(q1(i)-q1(i-1))+xt*(q1_tl(i)-q1_tl(i-1)&
2483 & )) + (xt_tl*xt+xt*xt_tl)*(q1(i+1)-2.0*q1(i)+q1(i-1))/6.0&
2484 & + xt**2*(q1_tl(i+1)-2.0*q1_tl(i)+q1_tl(i-1))/6.0
2485 flux(i, j) = (2.0*q1(i-1)+5.0*q1(i)-q1(i+1))/6.0 - 0.5*xt*&
2486 & (q1(i)-q1(i-1)) + xt*xt/6.0*(q1(i+1)-2.0*q1(i)+q1(i-1))
2496 SUBROUTINE yppm_tlm(flux, flux_tl, q, q_tl, c, c_tl, jord, ifirst, &
2497 & ilast, isd, ied, js, je, jsd, jed, npx, npy, dya, nested, grid_type)
2500 INTEGER,
INTENT(IN) :: ifirst, ilast
2501 INTEGER,
INTENT(IN) :: isd, ied, js, je, jsd, jed
2502 INTEGER,
INTENT(IN) :: jord
2503 INTEGER,
INTENT(IN) :: npx, npy
2504 REAL,
INTENT(IN) :: q(ifirst:ilast, jsd:jed)
2505 REAL,
INTENT(IN) :: q_tl(ifirst:ilast, jsd:jed)
2507 REAL,
INTENT(IN) :: c(isd:ied, js:je+1)
2508 REAL,
INTENT(IN) :: c_tl(isd:ied, js:je+1)
2510 REAL,
INTENT(OUT) :: flux(ifirst:ilast, js:je+1)
2511 REAL,
INTENT(OUT) :: flux_tl(ifirst:ilast, js:je+1)
2512 REAL,
INTENT(IN) :: dya(isd:ied, jsd:jed)
2513 LOGICAL,
INTENT(IN) :: nested
2514 INTEGER,
INTENT(IN) :: grid_type
2516 REAL :: dm(ifirst:ilast, js-2:je+2)
2517 REAL :: al(ifirst:ilast, js-1:je+2)
2518 REAL :: al_tl(ifirst:ilast, js-1:je+2)
2519 REAL,
DIMENSION(ifirst:ilast, js-1:je+1) :: bl, br, b0
2520 REAL :: dq(ifirst:ilast, js-3:je+2)
2521 REAL,
DIMENSION(ifirst:ilast) :: fx0, fx1
2522 LOGICAL,
DIMENSION(ifirst:ilast, js-1:je+1) :: smt5, smt6
2523 REAL :: x0, xt, qtmp, pmp_1, lac_1, pmp_2, lac_2, r1
2524 REAL :: xt_tl, qtmp_tl
2525 INTEGER :: i, j, js1, je3, je1
2528 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 2529 IF (3 .LT. js - 1)
THEN 2534 IF (npy - 2 .GT. je + 2)
THEN 2539 IF (npy - 3 .GT. je + 1)
THEN 2550 IF (jord .LT. 8 .OR. jord .EQ. 333)
THEN 2554 al_tl(i, j) =
p1*(q_tl(i, j-1)+q_tl(i, j)) +
p2*(q_tl(i, j-2)+&
2556 al(i, j) =
p1*(q(i, j-1)+q(i, j)) +
p2*(q(i, j-2)+q(i, j+1))
2559 IF (.NOT.nested .AND.
grid_type .LT. 3)
THEN 2562 al_tl(i, 0) =
c1*q_tl(i, -2) +
c2*q_tl(i, -1) +
c3*q_tl(i, 0&
2564 al(i, 0) =
c1*q(i, -2) +
c2*q(i, -1) +
c3*q(i, 0)
2565 al_tl(i, 1) = 0.5*(((2.*dya(i, 0)+dya(i, -1))*q_tl(i, 0)-dya&
2566 & (i, 0)*q_tl(i, -1))/(dya(i, -1)+dya(i, 0))+((2.*dya(i, 1)+&
2567 & dya(i, 2))*q_tl(i, 1)-dya(i, 1)*q_tl(i, 2))/(dya(i, 1)+dya&
2569 al(i, 1) = 0.5*(((2.*dya(i, 0)+dya(i, -1))*q(i, 0)-dya(i, 0)&
2570 & *q(i, -1))/(dya(i, -1)+dya(i, 0))+((2.*dya(i, 1)+dya(i, 2)&
2571 & )*q(i, 1)-dya(i, 1)*q(i, 2))/(dya(i, 1)+dya(i, 2)))
2572 al_tl(i, 2) =
c3*q_tl(i, 1) +
c2*q_tl(i, 2) +
c1*q_tl(i, 3)
2573 al(i, 2) =
c3*q(i, 1) +
c2*q(i, 2) +
c1*q(i, 3)
2576 IF (je + 1 .EQ. npy)
THEN 2578 al_tl(i, npy-1) =
c1*q_tl(i, npy-3) +
c2*q_tl(i, npy-2) +
c3&
2580 al(i, npy-1) =
c1*q(i, npy-3) +
c2*q(i, npy-2) +
c3*q(i, npy&
2582 al_tl(i, npy) = 0.5*(((2.*dya(i, npy-1)+dya(i, npy-2))*q_tl(&
2583 & i, npy-1)-dya(i, npy-1)*q_tl(i, npy-2))/(dya(i, npy-2)+dya&
2584 & (i, npy-1))+((2.*dya(i, npy)+dya(i, npy+1))*q_tl(i, npy)-&
2585 & dya(i, npy)*q_tl(i, npy+1))/(dya(i, npy)+dya(i, npy+1)))
2586 al(i, npy) = 0.5*(((2.*dya(i, npy-1)+dya(i, npy-2))*q(i, npy&
2587 & -1)-dya(i, npy-1)*q(i, npy-2))/(dya(i, npy-2)+dya(i, npy-1&
2588 & ))+((2.*dya(i, npy)+dya(i, npy+1))*q(i, npy)-dya(i, npy)*q&
2589 & (i, npy+1))/(dya(i, npy)+dya(i, npy+1)))
2590 al_tl(i, npy+1) =
c3*q_tl(i, npy) +
c2*q_tl(i, npy+1) +
c1*&
2592 al(i, npy+1) =
c3*q(i, npy) +
c2*q(i, npy+1) +
c1*q(i, npy+2&
2597 IF (jord .EQ. 1)
THEN 2600 IF (c(i, j) .GT. 0.)
THEN 2601 flux_tl(i, j) = q_tl(i, j-1)
2602 flux(i, j) = q(i, j-1)
2604 flux_tl(i, j) = q_tl(i, j)
2605 flux(i, j) = q(i, j)
2609 ELSE IF (jord .EQ. 2)
THEN 2617 IF (xt .GT. 0.)
THEN 2618 qtmp_tl = q_tl(i, j-1)
2620 flux_tl(i, j) = qtmp_tl + (1.-xt)*(al_tl(i, j)-qtmp_tl-&
2621 & xt_tl*(al(i, j-1)+al(i, j)-(qtmp+qtmp))-xt*(al_tl(i, j-1&
2622 & )+al_tl(i, j)-2*qtmp_tl)) - xt_tl*(al(i, j)-qtmp-xt*(al(&
2623 & i, j-1)+al(i, j)-(qtmp+qtmp)))
2624 flux(i, j) = qtmp + (1.-xt)*(al(i, j)-qtmp-xt*(al(i, j-1)+&
2625 & al(i, j)-(qtmp+qtmp)))
2627 qtmp_tl = q_tl(i, j)
2629 flux_tl(i, j) = qtmp_tl + xt_tl*(al(i, j)-qtmp+xt*(al(i, j&
2630 & )+al(i, j+1)-(qtmp+qtmp))) + (1.+xt)*(al_tl(i, j)-&
2631 & qtmp_tl+xt_tl*(al(i, j)+al(i, j+1)-(qtmp+qtmp))+xt*(&
2632 & al_tl(i, j)+al_tl(i, j+1)-2*qtmp_tl))
2633 flux(i, j) = qtmp + (1.+xt)*(al(i, j)-qtmp+xt*(al(i, j)+al&
2634 & (i, j+1)-(qtmp+qtmp)))
2638 ELSE IF (jord .EQ. 333)
THEN 2645 IF (xt .GT. 0.)
THEN 2646 flux_tl(i, j) = (2.0*q_tl(i, j)+5.0*q_tl(i, j-1)-q_tl(i, j&
2647 & -2))/6.0 - 0.5*(xt_tl*(q(i, j)-q(i, j-1))+xt*(q_tl(i, j)&
2648 & -q_tl(i, j-1))) + (xt_tl*xt+xt*xt_tl)*(q(i, j)-2.0*q(i, &
2649 & j-1)+q(i, j-2))/6.0 + xt**2*(q_tl(i, j)-2.0*q_tl(i, j-1)&
2650 & +q_tl(i, j-2))/6.0
2651 flux(i, j) = (2.0*q(i, j)+5.0*q(i, j-1)-q(i, j-2))/6.0 - &
2652 & 0.5*xt*(q(i, j)-q(i, j-1)) + xt*xt/6.0*(q(i, j)-2.0*q(i&
2655 flux_tl(i, j) = (2.0*q_tl(i, j-1)+5.0*q_tl(i, j)-q_tl(i, j&
2656 & +1))/6.0 - 0.5*(xt_tl*(q(i, j)-q(i, j-1))+xt*(q_tl(i, j)&
2657 & -q_tl(i, j-1))) + (xt_tl*xt+xt*xt_tl)*(q(i, j+1)-2.0*q(i&
2658 & , j)+q(i, j-1))/6.0 + xt**2*(q_tl(i, j+1)-2.0*q_tl(i, j)&
2659 & +q_tl(i, j-1))/6.0
2660 flux(i, j) = (2.0*q(i, j-1)+5.0*q(i, j)-q(i, j+1))/6.0 - &
2661 & 0.5*xt*(q(i, j)-q(i, j-1)) + xt*xt/6.0*(q(i, j+1)-2.0*q(&
2673 SUBROUTINE deln_flux_tlm(nord, is, ie, js, je, npx, npy, damp, q, &
2674 & q_tl, fx, fx_tl, fy, fy_tl, gridstruct, bd, mass, mass_tl)
2683 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
2685 INTEGER,
INTENT(IN) :: nord
2686 INTEGER,
INTENT(IN) :: is, ie, js, je, npx, npy
2687 REAL,
INTENT(IN) :: damp
2689 REAL,
INTENT(IN) :: q(bd%is-ng:bd%ie+ng, bd%js-ng:bd%je+ng)
2690 REAL,
INTENT(IN) :: q_tl(bd%is-ng:bd%ie+ng, bd%js-ng:bd%je+ng)
2691 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
2693 REAL,
OPTIONAL,
INTENT(IN) :: mass(bd%isd:bd%ied, bd%jsd:bd%jed)
2694 REAL,
OPTIONAL,
INTENT(IN) :: mass_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2696 REAL,
INTENT(INOUT) :: fx(bd%is:bd%ie+1, bd%js:bd%je), fy(bd%is:bd%&
2697 & ie, bd%js:bd%je+1)
2698 REAL,
INTENT(INOUT) :: fx_tl(bd%is:bd%ie+1, bd%js:bd%je), fy_tl(bd%&
2699 & is:bd%ie, bd%js:bd%je+1)
2701 REAL :: fx2(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy2(bd%isd:bd%ied, bd%&
2703 REAL :: fx2_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy2_tl(bd%isd:bd%ied&
2704 & , bd%jsd:bd%jed+1)
2705 REAL :: d2(bd%isd:bd%ied, bd%jsd:bd%jed)
2706 REAL :: d2_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2708 INTEGER :: i, j, n, nt, i1, i2, j1, j2
2714 IF (.NOT.
PRESENT(mass))
THEN 2718 d2_tl(i, j) = damp*q_tl(i, j)
2719 d2(i, j) = damp*q(i, j)
2726 d2_tl(i, j) = q_tl(i, j)
2731 IF (nord .GT. 0)
THEN 2733 & , bd, gridstruct%sw_corner, gridstruct%&
2734 & se_corner, gridstruct%nw_corner, gridstruct%&
2740 DO j=js-nord,je+nord
2741 DO i=is-nord,ie+nord+1
2742 fx2_tl(i, j) = gridstruct%del6_v(i, j)*(d2_tl(i-1, j)-d2_tl(i, j&
2744 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i-1, j)-d2(i, j))
2747 IF (nord .GT. 0)
THEN 2749 & , bd, gridstruct%sw_corner, gridstruct%&
2750 & se_corner, gridstruct%nw_corner, gridstruct%&
2756 DO j=js-nord,je+nord+1
2757 DO i=is-nord,ie+nord
2758 fy2_tl(i, j) = gridstruct%del6_u(i, j)*(d2_tl(i, j-1)-d2_tl(i, j&
2760 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j-1)-d2(i, j))
2763 IF (nord .GT. 0)
THEN 2769 DO j=js-nt-1,je+nt+1
2770 DO i=is-nt-1,ie+nt+1
2771 d2_tl(i, j) = gridstruct%rarea(i, j)*(fx2_tl(i, j)-fx2_tl(i+&
2772 & 1, j)+fy2_tl(i, j)-fy2_tl(i, j+1))
2773 d2(i, j) = (fx2(i, j)-fx2(i+1, j)+fy2(i, j)-fy2(i, j+1))*&
2774 & gridstruct%rarea(i, j)
2778 & nested, bd, gridstruct%sw_corner, gridstruct%&
2779 & se_corner, gridstruct%nw_corner, gridstruct%&
2783 fx2_tl(i, j) = gridstruct%del6_v(i, j)*(d2_tl(i, j)-d2_tl(i-&
2785 fx2(i, j) = gridstruct%del6_v(i, j)*(d2(i, j)-d2(i-1, j))
2789 & nested, bd, gridstruct%sw_corner, gridstruct%&
2790 & se_corner, gridstruct%nw_corner, gridstruct%&
2794 fy2_tl(i, j) = gridstruct%del6_u(i, j)*(d2_tl(i, j)-d2_tl(i&
2796 fy2(i, j) = gridstruct%del6_u(i, j)*(d2(i, j)-d2(i, j-1))
2804 IF (
PRESENT(mass))
THEN 2809 fx_tl(i, j) = fx_tl(i, j) + damp2*((mass_tl(i-1, j)+mass_tl(i&
2810 & , j))*fx2(i, j)+(mass(i-1, j)+mass(i, j))*fx2_tl(i, j))
2811 fx(i, j) = fx(i, j) + damp2*(mass(i-1, j)+mass(i, j))*fx2(i, j&
2817 fy_tl(i, j) = fy_tl(i, j) + damp2*((mass_tl(i, j-1)+mass_tl(i&
2818 & , j))*fy2(i, j)+(mass(i, j-1)+mass(i, j))*fy2_tl(i, j))
2819 fy(i, j) = fy(i, j) + damp2*(mass(i, j-1)+mass(i, j))*fy2(i, j&
2826 fx_tl(i, j) = fx_tl(i, j) + fx2_tl(i, j)
2827 fx(i, j) = fx(i, j) + fx2(i, j)
2832 fy_tl(i, j) = fy_tl(i, j) + fy2_tl(i, j)
2833 fy(i, j) = fy(i, j) + fy2(i, j)
2844 & sw_corner, se_corner, nw_corner, ne_corner)
2847 INTEGER,
INTENT(IN) :: npx, npy, dir
2848 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed)
2849 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2850 LOGICAL,
INTENT(IN) :: nested, sw_corner, se_corner, nw_corner, &
2855 ELSE IF (dir .EQ. 1)
THEN 2860 q_tl(i, j) = q_tl(j, 1-i)
2868 q_tl(i, j) = q_tl(npy-j, i-npx+1)
2869 q(i, j) = q(npy-j, i-npx+1)
2876 q_tl(i, j) = q_tl(j, 2*npx-1-i)
2877 q(i, j) = q(j, 2*npx-1-i)
2884 q_tl(i, j) = q_tl(npy-j, i-1+npx)
2885 q(i, j) = q(npy-j, i-1+npx)
2889 ELSE IF (dir .EQ. 2)
THEN 2894 q_tl(i, j) = q_tl(1-j, i)
2902 q_tl(i, j) = q_tl(npy+j-1, npx-i)
2903 q(i, j) = q(npy+j-1, npx-i)
2910 q_tl(i, j) = q_tl(2*npy-1-j, i)
2911 q(i, j) = q(2*npy-1-j, i)
2918 q_tl(i, j) = q_tl(j+1-npx, npy-i)
2919 q(i, j) = q(j+1-npx, npy-i)
subroutine xppm_tlm(flux, flux_tl, q, q_tl, c, c_tl, iord, is, ie, isd, ied, jfirst, jlast, jsd, jed, npx, npy, dxa, nested, grid_type)
real, parameter ppm_limiter
subroutine xppm(flux, q, c, iord, is, ie, isd, ied, jfirst, jlast, jsd, jed, npx, npy, dxa, nested, grid_type)
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 yppm_tlm(flux, flux_tl, q, q_tl, c, c_tl, jord, ifirst, ilast, isd, ied, js, je, jsd, jed, npx, npy, dya, nested, grid_type)
subroutine yppm(flux, q, c, jord, ifirst, ilast, isd, ied, js, je, jsd, jed, npx, npy, dya, nested, grid_type)
subroutine, public pert_ppm(im, a0, al, ar, iv)
real, parameter, public big_number
integer, parameter, public ng
real, parameter near_zero
subroutine, public copy_corners(q, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
integer, parameter, public r_grid
subroutine mp_ghost_ew(im, jm, km, nq, ifirst, ilast, jfirst, jlast, kfirst, klast, ng_w, ng_e, ng_s, ng_n, q_ghst, q)
subroutine deln_flux_tlm(nord, is, ie, js, je, npx, npy, damp, q, q_tl, fx, fx_tl, fy, fy_tl, gridstruct, bd, mass, mass_tl)
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 copy_corners_tlm(q, q_tl, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
subroutine deln_flux(nord, is, ie, js, je, npx, npy, damp, q, fx, fy, gridstruct, bd, mass)
Derived type containing the data.
subroutine pert_ppm_tlm(im, a0, al, al_tl, ar, ar_tl, iv)