35 real,
parameter::
r3 = 1./3.
42 real,
parameter::
b1 = 0.0375
43 real,
parameter::
b2 = -7./30.
44 real,
parameter::
b3 = -23./120.
45 real,
parameter::
b4 = 13./30.
46 real,
parameter::
b5 = -11./240.
49 real,
parameter::
b1 = 1./30.
50 real,
parameter::
b2 = -13./60.
51 real,
parameter::
b3 = -13./60.
52 real,
parameter::
b4 = 0.45
53 real,
parameter::
b5 = -0.05
55 real,
parameter::
t11 = 27./28.,
t12 = -13./28.,
t13=3./7.
56 real,
parameter::
s11 = 11./14.,
s14 = 4./7.,
s15=3./14.
61 real,
parameter::
c1 = -2./14.
62 real,
parameter::
c2 = 11./14.
63 real,
parameter::
c3 = 5./14.
67 real,
parameter::
p1 = 7./12.
68 real,
parameter::
p2 = -1./12.
78 subroutine fv_tp_2d(q, crx, cry, npx, npy, hord, fx, fy, xfx, yfx, &
79 gridstruct, bd, ra_x, ra_y, mfx, mfy, mass, nord, damp_c)
81 integer,
intent(in):: npx, npy
82 integer,
intent(in)::hord
84 real,
intent(in):: crx(bd%is:bd%ie+1,bd%jsd:bd%jed)
85 real,
intent(in):: xfx(bd%is:bd%ie+1,bd%jsd:bd%jed)
86 real,
intent(in):: cry(bd%isd:bd%ied,bd%js:bd%je+1 )
87 real,
intent(in):: yfx(bd%isd:bd%ied,bd%js:bd%je+1 )
88 real,
intent(in):: ra_x(bd%is:bd%ie,bd%jsd:bd%jed)
89 real,
intent(in):: ra_y(bd%isd:bd%ied,bd%js:bd%je)
90 real,
intent(inout):: q(bd%isd:bd%ied,bd%jsd:bd%jed)
91 real,
intent(out)::fx(bd%is:bd%ie+1 ,bd%js:bd%je)
92 real,
intent(out)::fy(bd%is:bd%ie, bd%js:bd%je+1 )
96 real,
OPTIONAL,
intent(in):: mfx(bd%is:bd%ie+1,bd%js:bd%je )
97 real,
OPTIONAL,
intent(in):: mfy(bd%is:bd%ie ,bd%js:bd%je+1)
98 real,
OPTIONAL,
intent(in):: mass(bd%isd:bd%ied,bd%jsd:bd%jed)
99 real,
OPTIONAL,
intent(in):: damp_c
100 integer,
OPTIONAL,
intent(in):: nord
102 integer ord_ou, ord_in
103 real q_i(bd%isd:bd%ied,bd%js:bd%je)
104 real q_j(bd%is:bd%ie,bd%jsd:bd%jed)
105 real fx2(bd%is:bd%ie+1,bd%jsd:bd%jed)
106 real fy2(bd%isd:bd%ied,bd%js:bd%je+1)
107 real fyy(bd%isd:bd%ied,bd%js:bd%je+1)
108 real fx1(bd%is:bd%ie+1)
112 integer:: is, ie, js, je, isd, ied, jsd, jed
123 if ( hord == 10 )
then 130 if (.not. gridstruct%nested)
call copy_corners(q, npx, npy, 2, gridstruct%nested, bd, &
131 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
133 call yppm(fy2, q, cry, ord_in, isd,ied,isd,ied, js,je,jsd,jed, npx,npy, gridstruct%dya, gridstruct%nested, gridstruct%grid_type)
137 fyy(i,j) = yfx(i,j) * fy2(i,j)
142 q_i(i,j) = (q(i,j)*gridstruct%area(i,j) + fyy(i,j)-fyy(i,j+1))/ra_y(i,j)
146 call xppm(fx, q_i, crx(is,js), ord_ou, is,ie,isd,ied, js,je,jsd,jed, npx,npy, gridstruct%dxa, gridstruct%nested, gridstruct%grid_type)
148 if (.not. gridstruct%nested)
call copy_corners(q, npx, npy, 1, gridstruct%nested, bd, &
149 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
151 call xppm(fx2, q, crx, ord_in, is,ie,isd,ied, jsd,jed,jsd,jed, npx,npy, gridstruct%dxa, gridstruct%nested, gridstruct%grid_type)
155 fx1(i) = xfx(i,j) * fx2(i,j)
158 q_j(i,j) = (q(i,j)*gridstruct%area(i,j) + fx1(i)-fx1(i+1))/ra_x(i,j)
162 call yppm(fy, q_j, cry, ord_ou, is,ie,isd,ied, js,je,jsd,jed, npx, npy, gridstruct%dya, gridstruct%nested, gridstruct%grid_type)
168 if (
present(mfx) .and.
present(mfy) )
then 174 fx(i,j) = 0.5*(fx(i,j) + fx2(i,j)) * mfx(i,j)
179 fy(i,j) = 0.5*(fy(i,j) + fy2(i,j)) * mfy(i,j)
182 if (
present(nord) .and.
present(damp_c) .and.
present(mass) )
then 183 if ( damp_c > 1.e-4 )
then 184 damp = (damp_c * gridstruct%da_min)**(nord+1)
185 call deln_flux(nord, is,ie,js,je, npx, npy, damp, q, fx, fy, gridstruct, bd, mass )
194 fx(i,j) = 0.5*(fx(i,j) + fx2(i,j)) * xfx(i,j)
199 fy(i,j) = 0.5*(fy(i,j) + fy2(i,j)) * yfx(i,j)
202 if (
present(nord) .and.
present(damp_c) )
then 203 if ( damp_c > 1.e-4 )
then 204 damp = (damp_c * gridstruct%da_min)**(nord+1)
205 call deln_flux(nord, is,ie,js,je, npx, npy, damp, q, fx, fy, gridstruct, bd)
215 sw_corner, se_corner, nw_corner, ne_corner)
217 integer,
intent(in):: npx, npy, dir
218 real,
intent(inout):: q(bd%isd:bd%ied,bd%jsd:bd%jed)
219 logical,
intent(IN) :: nested, sw_corner, se_corner, nw_corner, ne_corner
226 if ( sw_corner )
then 233 if ( se_corner )
then 236 q(i,j) = q(npy-j,i-npx+1)
240 if ( ne_corner )
then 243 q(i,j) = q(j,2*npx-1-i)
247 if ( nw_corner )
then 250 q(i,j) = q(npy-j,i-1+npx)
255 elseif ( dir == 2 )
then 258 if ( sw_corner )
then 265 if ( se_corner )
then 268 q(i,j) = q(npy+j-1,npx-i)
272 if ( ne_corner )
then 275 q(i,j) = q(2*npy-1-j,i)
279 if ( nw_corner )
then 282 q(i,j) = q(j+1-npx,npy-i)
291 subroutine xppm(flux, q, c, iord, is,ie,isd,ied, jfirst,jlast,jsd,jed, npx, npy, dxa, nested, grid_type)
292 integer,
INTENT(IN) :: is, ie, isd, ied, jsd, jed
293 integer,
INTENT(IN) :: jfirst, jlast
294 integer,
INTENT(IN) :: iord
295 integer,
INTENT(IN) :: npx, npy
296 real ,
INTENT(IN) :: q(isd:ied,jfirst:jlast)
297 real ,
INTENT(IN) :: c(is:ie+1,jfirst:jlast)
298 real ,
intent(IN) :: dxa(isd:ied,jsd:jed)
299 logical,
intent(IN) :: nested
300 integer,
intent(IN) :: grid_type
302 real ,
INTENT(OUT) :: flux(is:ie+1,jfirst:jlast)
304 real,
dimension(is-1:ie+1):: bl, br, b0
306 real,
dimension(is:ie+1):: fx0, fx1
307 logical,
dimension(is-1:ie+1):: smt5, smt6
311 integer:: i, j, ie3, is1, ie1
312 real:: x0, x1, xt, qtmp, pmp_1, lac_1, pmp_2, lac_2
314 if ( .not. nested .and.
grid_type<3 )
then 315 is1 =
max(3,is-1); ie3 =
min(npx-2,ie+2)
316 ie1 =
min(npx-3,ie+1)
318 is1 = is-1; ie3 = ie+2
322 do 666 j=jfirst,jlast
333 al(i) =
p1*(q1(i-1)+q1(i)) +
p2*(q1(i-2)+q1(i+1))
337 if ( al(i)<0. ) al(i) = 0.5*(q1(i-1)+q1(i))
341 if ( .not.nested .and.
grid_type<3 )
then 343 al(0) =
c1*q1(-2) +
c2*q1(-1) +
c3*q1(0)
344 al(1) = 0.5*(((2.*dxa(0,j)+dxa(-1,j))*q1(0)-dxa(0,j)*q1(-1))/(dxa(-1,j)+dxa(0,j)) &
345 + ((2.*dxa(1,j)+dxa( 2,j))*q1(1)-dxa(1,j)*q1( 2))/(dxa(1, j)+dxa(2,j)))
346 al(2) =
c3*q1(1) +
c2*q1(2) +
c1*q1(3)
348 al(0) =
max(0., al(0))
349 al(1) =
max(0., al(1))
350 al(2) =
max(0., al(2))
353 if ( (ie+1)==npx )
then 354 al(npx-1) =
c1*q1(npx-3) +
c2*q1(npx-2) +
c3*q1(npx-1)
355 al(npx) = 0.5*(((2.*dxa(npx-1,j)+dxa(npx-2,j))*q1(npx-1)-dxa(npx-1,j)*q1(npx-2))/(dxa(npx-2,j)+dxa(npx-1,j)) &
356 + ((2.*dxa(npx, j)+dxa(npx+1,j))*q1(npx )-dxa(npx, j)*q1(npx+1))/(dxa(npx, j)+dxa(npx+1,j)))
357 al(npx+1) =
c3*q1(npx) +
c2*q1(npx+1) +
c1*q1(npx+2)
359 al(npx-1) =
max(0., al(npx-1))
360 al(npx ) =
max(0., al(npx ))
361 al(npx+1) =
max(0., al(npx+1))
374 flux(i,j) = qtmp + (1.-xt)*(al(i)-qtmp-xt*(al(i-1)+al(i)-(qtmp+qtmp)))
377 flux(i,j) = qtmp + (1.+xt)*(al(i)-qtmp+xt*(al(i)+al(i+1)-(qtmp+qtmp)))
385 elseif ( iord==3 )
then 387 bl(i) = al(i) - q1(i)
388 br(i) = al(i+1) - q1(i)
389 b0(i) = bl(i) + br(i)
391 xt = abs(bl(i)-br(i))
402 if ( smt6(i-1).or.smt5(i) )
then 403 fx1(i) = br(i-1) - xt*b0(i-1)
404 elseif ( smt5(i-1) )
then 405 fx1(i) = sign(
min(abs(bl(i-1)),abs(br(i-1))), br(i-1))
409 if ( smt6(i).or.smt5(i-1) )
then 410 fx1(i) = bl(i) + xt*b0(i)
411 elseif ( smt5(i) )
then 412 fx1(i) = sign(
min(abs(bl(i)), abs(br(i))), bl(i))
415 flux(i,j) = fx0(i) + (1.-abs(xt))*fx1(i)
417 elseif ( iord==4 )
then 419 bl(i) = al(i) - q1(i)
420 br(i) = al(i+1) - q1(i)
421 b0(i) = bl(i) + br(i)
423 xt = abs(bl(i)-br(i))
432 if ( c(i,j) > 0. )
then 434 if ( smt6(i-1).or.smt5(i) ) fx1(i) = (1.-c(i,j))*(br(i-1) - c(i,j)*b0(i-1))
437 if ( smt6(i).or.smt5(i-1) ) fx1(i) = (1.+c(i,j))*(bl(i) + c(i,j)*b0(i))
439 flux(i,j) = fx0(i) + fx1(i)
445 bl(i) = al(i) - q1(i)
446 br(i) = al(i+1) - q1(i)
447 b0(i) = bl(i) + br(i)
448 smt5(i) = bl(i)*br(i) < 0.
452 bl(i) = al(i) - q1(i)
453 br(i) = al(i+1) - q1(i)
454 b0(i) = bl(i) + br(i)
455 smt5(i) = abs(3.*b0(i)) < abs(bl(i)-br(i))
460 if ( c(i,j) > 0. )
then 461 fx1(i) = (1.-c(i,j))*(br(i-1) - c(i,j)*b0(i-1))
464 fx1(i) = (1.+c(i,j))*(bl(i) + c(i,j)*b0(i))
467 if (smt5(i-1).or.smt5(i)) flux(i,j) = flux(i,j) + fx1(i)
480 xt = 0.25*(q1(i+1) - q1(i-1))
481 dm(i) = sign(
min(abs(xt),
max(q1(i-1), q1(i), q1(i+1)) - q1(i), &
482 q1(i) -
min(q1(i-1), q1(i), q1(i+1))), xt)
485 al(i) = 0.5*(q1(i-1)+q1(i)) +
r3*(dm(i-1)-dm(i))
491 bl(i) = -sign(
min(abs(xt), abs(al(i )-q1(i))), xt)
492 br(i) = sign(
min(abs(xt), abs(al(i+1)-q1(i))), xt)
494 elseif ( iord==11 )
then 498 bl(i) = -sign(
min(abs(xt), abs(al(i )-q1(i))), xt)
499 br(i) = sign(
min(abs(xt), abs(al(i+1)-q1(i))), xt)
503 dq(i) = 2.*(q1(i+1) - q1(i))
506 bl(i) = al(i ) - q1(i)
507 br(i) = al(i+1) - q1(i)
508 if ( abs(dm(i-1))+abs(dm(i))+abs(dm(i+1)) <
near_zero )
then 511 elseif( abs(3.*(bl(i)+br(i))) > abs(bl(i)-br(i)) )
then 513 lac_2 = pmp_2 - 0.75*dq(i-2)
514 br(i) =
min(
max(0., pmp_2, lac_2),
max(br(i),
min(0., pmp_2, lac_2)) )
516 lac_1 = pmp_1 + 0.75*dq(i+1)
517 bl(i) =
min(
max(0., pmp_1, lac_1),
max(bl(i),
min(0., pmp_1, lac_1)) )
522 if(iord==9 .or. iord==13)
call pert_ppm(ie1-is1+1, q1(is1), bl(is1), br(is1), 0)
526 bl(0) =
s14*dm(-1) +
s11*(q1(-1)-q1(0))
528 xt = 0.5*(((2.*dxa(0,j)+dxa(-1,j))*q1(0)-dxa(0,j)*q1(-1))/(dxa(-1,j)+dxa(0,j)) &
529 + ((2.*dxa(1,j)+dxa( 2,j))*q1(1)-dxa(1,j)*q1( 2))/(dxa(1, j)+dxa(2,j)))
531 xt =
max(xt,
min(q1(-1),q1(0),q1(1),q1(2)))
532 xt =
min(xt,
max(q1(-1),q1(0),q1(1),q1(2)))
540 br(2) = al(3) - q1(2)
541 call pert_ppm(3, q1(0), bl(0), br(0), 1)
543 if ( (ie+1)==npx )
then 544 bl(npx-2) = al(npx-2) - q1(npx-2)
546 xt =
s15*q1(npx-1) +
s11*q1(npx-2) +
s14*dm(npx-2)
547 br(npx-2) = xt - q1(npx-2)
548 bl(npx-1) = xt - q1(npx-1)
550 xt = 0.5*(((2.*dxa(npx-1,j)+dxa(npx-2,j))*q1(npx-1)-dxa(npx-1,j)*q1(npx-2))/(dxa(npx-2,j)+dxa(npx-1,j)) &
551 + ((2.*dxa(npx, j)+dxa(npx+1,j))*q1(npx )-dxa(npx, j)*q1(npx+1))/(dxa(npx, j)+dxa(npx+1,j)))
553 xt =
max(xt,
min(q1(npx-2),q1(npx-1),q1(npx),q1(npx+1)))
554 xt =
min(xt,
max(q1(npx-2),q1(npx-1),q1(npx),q1(npx+1)))
556 br(npx-1) = xt - q1(npx-1)
557 bl(npx ) = xt - q1(npx )
559 br(npx) =
s11*(q1(npx+1)-q1(npx)) -
s14*dm(npx+1)
560 call pert_ppm(3, q1(npx-2), bl(npx-2), br(npx-2), 1)
568 flux(i,j) = q1(i-1) + (1.-c(i,j))*(br(i-1)-c(i,j)*(bl(i-1)+br(i-1)))
570 flux(i,j) = q1(i ) + (1.+c(i,j))*(bl(i )+c(i,j)*(bl(i)+br(i)))
579 subroutine yppm(flux, q, c, jord, ifirst,ilast, isd,ied, js,je,jsd,jed, npx, npy, dya, nested, grid_type)
580 integer,
INTENT(IN) :: ifirst,ilast
581 integer,
INTENT(IN) :: isd,ied, js,je,jsd,jed
582 integer,
INTENT(IN) :: jord
583 integer,
INTENT(IN) :: npx, npy
584 real ,
INTENT(IN) :: q(ifirst:ilast,jsd:jed)
585 real ,
intent(in) :: c(isd:ied,js:je+1 )
586 real ,
INTENT(OUT):: flux(ifirst:ilast,js:je+1)
587 real ,
intent(IN) :: dya(isd:ied,jsd:jed)
588 logical,
intent(IN) :: nested
589 integer,
intent(IN) :: grid_type
591 real:: dm(ifirst:ilast,js-2:je+2)
592 real:: al(ifirst:ilast,js-1:je+2)
593 real,
dimension(ifirst:ilast,js-1:je+1):: bl, br, b0
594 real:: dq(ifirst:ilast,js-3:je+2)
595 real,
dimension(ifirst:ilast):: fx0, fx1
596 logical,
dimension(ifirst:ilast,js-1:je+1):: smt5, smt6
597 real:: x0, xt, qtmp, pmp_1, lac_1, pmp_2, lac_2, r1
598 integer:: i, j, js1, je3, je1
600 if ( .not.nested .and.
grid_type < 3 )
then 602 js1 =
max(3,js-1); je3 =
min(npy-2,je+2)
603 je1 =
min(npy-3,je+1)
606 js1 = js-1; je3 = je+2
614 al(i,j) =
p1*(q(i,j-1)+q(i,j)) +
p2*(q(i,j-2)+q(i,j+1))
620 if ( al(i,j)<0. ) al(i,j) = 0.5*(q(i,j)+q(i,j+1))
625 if ( .not. nested .and.
grid_type<3 )
then 628 al(i,0) =
c1*q(i,-2) +
c2*q(i,-1) +
c3*q(i,0)
629 al(i,1) = 0.5*(((2.*dya(i,0)+dya(i,-1))*q(i,0)-dya(i,0)*q(i,-1))/(dya(i,-1)+dya(i,0)) &
630 + ((2.*dya(i,1)+dya(i,2))*q(i,1)-dya(i,1)*q(i,2))/(dya(i,1)+dya(i,2)))
631 al(i,2) =
c3*q(i,1) +
c2*q(i,2) +
c1*q(i,3)
635 al(i,0) =
max(0., al(i,0))
636 al(i,1) =
max(0., al(i,1))
637 al(i,2) =
max(0., al(i,2))
641 if( (je+1)==npy )
then 643 al(i,npy-1) =
c1*q(i,npy-3) +
c2*q(i,npy-2) +
c3*q(i,npy-1)
644 al(i,npy) = 0.5*(((2.*dya(i,npy-1)+dya(i,npy-2))*q(i,npy-1)-dya(i,npy-1)*q(i,npy-2))/(dya(i,npy-2)+dya(i,npy-1)) &
645 + ((2.*dya(i,npy)+dya(i,npy+1))*q(i,npy)-dya(i,npy)*q(i,npy+1))/(dya(i,npy)+dya(i,npy+1)))
646 al(i,npy+1) =
c3*q(i,npy) +
c2*q(i,npy+1) +
c1*q(i,npy+2)
650 al(i,npy-1) =
max(0., al(i,npy-1))
651 al(i,npy ) =
max(0., al(i,npy ))
652 al(i,npy+1) =
max(0., al(i,npy+1))
667 flux(i,j) = qtmp + (1.-xt)*(al(i,j)-qtmp-xt*(al(i,j-1)+al(i,j)-(qtmp+qtmp)))
670 flux(i,j) = qtmp + (1.+xt)*(al(i,j)-qtmp+xt*(al(i,j)+al(i,j+1)-(qtmp+qtmp)))
675 elseif ( jord==3 )
then 678 bl(i,j) = al(i,j ) - q(i,j)
679 br(i,j) = al(i,j+1) - q(i,j)
680 b0(i,j) = bl(i,j) + br(i,j)
682 xt = abs(bl(i,j)-br(i,j))
684 smt6(i,j) = 3.*x0 < xt
695 if( smt6(i,j-1).or.smt5(i,j) )
then 696 fx1(i) = br(i,j-1) - xt*b0(i,j-1)
697 elseif ( smt5(i,j-1) )
then 698 fx1(i) = sign(
min(abs(bl(i,j-1)),abs(br(i,j-1))),br(i,j-1))
702 if( smt6(i,j).or.smt5(i,j-1) )
then 703 fx1(i) = bl(i,j) + xt*b0(i,j)
704 elseif ( smt5(i,j) )
then 705 fx1(i) = sign(
min(abs(bl(i,j)),abs(br(i,j))), bl(i,j))
708 flux(i,j) = fx0(i) + (1.-abs(xt))*fx1(i)
712 elseif ( jord==4 )
then 715 bl(i,j) = al(i,j ) - q(i,j)
716 br(i,j) = al(i,j+1) - q(i,j)
717 b0(i,j) = bl(i,j) + br(i,j)
719 xt = abs(bl(i,j)-br(i,j))
721 smt6(i,j) = 3.*x0 < xt
730 if ( c(i,j) > 0. )
then 732 if( smt6(i,j-1).or.smt5(i,j) ) fx1(i) = (1.-c(i,j))*(br(i,j-1) - c(i,j)*b0(i,j-1))
735 if( smt6(i,j).or.smt5(i,j-1) ) fx1(i) = (1.+c(i,j))*(bl(i,j) + c(i,j)*b0(i,j))
737 flux(i,j) = fx0(i) + fx1(i)
745 bl(i,j) = al(i,j ) - q(i,j)
746 br(i,j) = al(i,j+1) - q(i,j)
747 b0(i,j) = bl(i,j) + br(i,j)
748 smt5(i,j) = bl(i,j)*br(i,j) < 0.
754 bl(i,j) = al(i,j ) - q(i,j)
755 br(i,j) = al(i,j+1) - q(i,j)
756 b0(i,j) = bl(i,j) + br(i,j)
757 smt5(i,j) = abs(3.*b0(i,j)) < abs(bl(i,j)-br(i,j))
764 if ( c(i,j) > 0. )
then 765 fx1(i) = (1.-c(i,j))*(br(i,j-1) - c(i,j)*b0(i,j-1))
768 fx1(i) = (1.+c(i,j))*(bl(i,j) + c(i,j)*b0(i,j))
771 if (smt5(i,j-1).or.smt5(i,j)) flux(i,j) = flux(i,j) + fx1(i)
784 xt = 0.25*(q(i,j+1) - q(i,j-1))
785 dm(i,j) = sign(
min(abs(xt),
max(q(i,j-1), q(i,j), q(i,j+1)) - q(i,j), &
786 q(i,j) -
min(q(i,j-1), q(i,j), q(i,j+1))), xt)
791 al(i,j) = 0.5*(q(i,j-1)+q(i,j)) +
r3*(dm(i,j-1) - dm(i,j))
799 bl(i,j) = -sign(
min(abs(xt), abs(al(i,j)-q(i,j))), xt)
800 br(i,j) = sign(
min(abs(xt), abs(al(i,j+1)-q(i,j))), xt)
803 elseif ( jord==11 )
then 807 bl(i,j) = -sign(
min(abs(xt), abs(al(i,j)-q(i,j))), xt)
808 br(i,j) = sign(
min(abs(xt), abs(al(i,j+1)-q(i,j))), xt)
814 dq(i,j) = 2.*(q(i,j+1) - q(i,j))
819 bl(i,j) = al(i,j ) - q(i,j)
820 br(i,j) = al(i,j+1) - q(i,j)
821 if ( abs(dm(i,j-1))+abs(dm(i,j))+abs(dm(i,j+1)) <
near_zero )
then 824 elseif( abs(3.*(bl(i,j)+br(i,j))) > abs(bl(i,j)-br(i,j)) )
then 826 lac_2 = pmp_2 - 0.75*dq(i,j-2)
827 br(i,j) =
min(
max(0.,pmp_2,lac_2),
max(br(i,j),
min(0.,pmp_2,lac_2)))
829 lac_1 = pmp_1 + 0.75*dq(i,j+1)
830 bl(i,j) =
min(
max(0.,pmp_1,lac_1),
max(bl(i,j),
min(0.,pmp_1,lac_1)))
835 if ( jord==9 .or. jord==13 )
then 838 call pert_ppm(ilast-ifirst+1, q(ifirst,j), bl(ifirst,j), br(ifirst,j), 0)
845 bl(i,0) =
s14*dm(i,-1) +
s11*(q(i,-1)-q(i,0))
847 xt = 0.5*(((2.*dya(i,0)+dya(i,-1))*q(i,0)-dya(i,0)*q(i,-1))/(dya(i,-1)+dya(i,0)) &
848 + ((2.*dya(i,1)+dya(i,2))*q(i,1)-dya(i,1)*q(i,2))/(dya(i,1)+dya(i,2)))
850 xt =
max(xt,
min(q(i,-1),q(i,0),q(i,1),q(i,2)))
851 xt =
min(xt,
max(q(i,-1),q(i,0),q(i,1),q(i,2)))
853 br(i,0) = xt - q(i,0)
854 bl(i,1) = xt - q(i,1)
856 xt =
s15*q(i,1) +
s11*q(i,2) -
s14*dm(i,2)
857 br(i,1) = xt - q(i,1)
858 bl(i,2) = xt - q(i,2)
860 br(i,2) = al(i,3) - q(i,2)
862 call pert_ppm(3*(ilast-ifirst+1), q(ifirst,0), bl(ifirst,0), br(ifirst,0), 1)
864 if( (je+1)==npy )
then 866 bl(i,npy-2) = al(i,npy-2) - q(i,npy-2)
868 xt =
s15*q(i,npy-1) +
s11*q(i,npy-2) +
s14*dm(i,npy-2)
869 br(i,npy-2) = xt - q(i,npy-2)
870 bl(i,npy-1) = xt - q(i,npy-1)
872 xt = 0.5*(((2.*dya(i,npy-1)+dya(i,npy-2))*q(i,npy-1)-dya(i,npy-1)*q(i,npy-2))/(dya(i,npy-2)+dya(i,npy-1)) &
873 + ((2.*dya(i,npy)+dya(i,npy+1))*q(i,npy)-dya(i,npy)*q(i,npy+1))/(dya(i,npy)+dya(i,npy+1)))
875 xt =
max(xt,
min(q(i,npy-2),q(i,npy-1),q(i,npy),q(i,npy+1)))
876 xt =
min(xt,
max(q(i,npy-2),q(i,npy-1),q(i,npy),q(i,npy+1)))
878 br(i,npy-1) = xt - q(i,npy-1)
879 bl(i,npy ) = xt - q(i,npy)
881 br(i,npy) =
s11*(q(i,npy+1)-q(i,npy)) -
s14*dm(i,npy+1)
883 call pert_ppm(3*(ilast-ifirst+1), q(ifirst,npy-2), bl(ifirst,npy-2), br(ifirst,npy-2), 1)
892 flux(i,j) = q(i,j-1) + (1.-c(i,j))*(br(i,j-1)-c(i,j)*(bl(i,j-1)+br(i,j-1)))
894 flux(i,j) = q(i,j ) + (1.+c(i,j))*(bl(i,j )+c(i,j)*(bl(i,j)+br(i,j)))
903 subroutine mp_ghost_ew(im, jm, km, nq, ifirst, ilast, jfirst, jlast, &
904 kfirst, klast, ng_w, ng_e, ng_s, ng_n, q_ghst, q)
907 integer,
intent(in):: im, jm, km, nq
908 integer,
intent(in):: ifirst, ilast
909 integer,
intent(in):: jfirst, jlast
910 integer,
intent(in):: kfirst, klast
911 integer,
intent(in):: ng_e
912 integer,
intent(in):: ng_w
913 integer,
intent(in):: ng_s
914 integer,
intent(in):: ng_n
915 real,
intent(inout):: q_ghst(ifirst-ng_w:ilast+ng_e,jfirst-ng_s:jlast+ng_n,kfirst:klast,nq)
916 real,
optional,
intent(in):: q(ifirst:ilast,jfirst:jlast,kfirst:klast,nq)
931 q_ghst(ifirst:ilast,jfirst:jlast,kfirst:klast,1:nq) = &
932 q(ifirst:ilast,jfirst:jlast,kfirst:klast,1:nq)
938 do j=jfirst-ng_s,jlast+ng_n
940 q_ghst(ifirst-i,j,k,n) = q_ghst(ilast-i+1,j,k,n)
943 q_ghst(ilast+i,j,k,n) = q_ghst(ifirst+i-1,j,k,n)
953 subroutine pert_ppm(im, a0, al, ar, iv)
954 integer,
intent(in):: im
955 integer,
intent(in):: iv
956 real,
intent(in) :: a0(im)
957 real,
intent(inout):: al(im), ar(im)
959 real a4, da1, da2, a6da, fmin
961 real,
parameter:: r12 = 1./12.
970 if ( a0(i) <= 0. )
then 974 a4 = -3.*(ar(i) + al(i))
976 if( abs(da1) < -a4 )
then 977 fmin = a0(i) + 0.25/a4*da1**2 + a4*r12
979 if( ar(i)>0. .and. al(i)>0. )
then 982 elseif( da1 > 0. )
then 994 if ( al(i)*ar(i) < 0. )
then 997 a6da = 3.*(al(i)+ar(i))*da1
999 if( a6da < -da2 )
then 1001 elseif( a6da > da2 )
then 1015 subroutine deln_flux(nord,is,ie,js,je, npx, npy, damp, q, fx, fy, gridstruct, bd, mass )
1023 type(fv_grid_bounds_type),
intent(IN) :: bd
1024 integer,
intent(in):: nord
1025 integer,
intent(in):: is,ie,js,je, npx, npy
1026 real,
intent(in):: damp
1027 real,
intent(in):: q(bd%is-ng:bd%ie+ng, bd%js-ng:bd%je+ng)
1028 type(fv_grid_type),
intent(IN),
target :: gridstruct
1029 real,
optional,
intent(in):: mass(bd%isd:bd%ied, bd%jsd:bd%jed)
1031 real,
intent(inout):: fx(bd%is:bd%ie+1,bd%js:bd%je), fy(bd%is:bd%ie,bd%js:bd%je+1)
1033 real fx2(bd%isd:bd%ied+1,bd%jsd:bd%jed), fy2(bd%isd:bd%ied,bd%jsd:bd%jed+1)
1034 real d2(bd%isd:bd%ied,bd%jsd:bd%jed)
1036 integer i,j, n, nt, i1, i2, j1, j2
1039 real,
pointer,
dimension(:,:) :: dx, dy, rdxc, rdyc
1040 real,
pointer,
dimension(:,:,:) :: sin_sg
1043 rdxc => gridstruct%rdxc
1044 rdyc => gridstruct%rdyc
1045 sin_sg => gridstruct%sin_sg
1048 i1 = is-1-nord; i2 = ie+1+nord
1049 j1 = js-1-nord; j2 = je+1+nord
1051 if ( .not.
present(mass) )
then 1054 d2(i,j) = damp*q(i,j)
1065 if( nord>0 )
call copy_corners(d2, npx, npy, 1, gridstruct%nested, bd, &
1066 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
1068 do j=js-nord,je+nord
1069 do i=is-nord,ie+nord+1
1071 fx2(i,j) = 0.5*(sin_sg(i-1,j,3)+sin_sg(i,j,1))*dy(i,j)*(d2(i-1,j)-d2(i,j))*rdxc(i,j)
1073 fx2(i,j) = gridstruct%del6_v(i,j)*(d2(i-1,j)-d2(i,j))
1078 if( nord>0 )
call copy_corners(d2, npx, npy, 2, gridstruct%nested, bd, &
1079 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
1080 do j=js-nord,je+nord+1
1081 do i=is-nord,ie+nord
1083 fy2(i,j) = 0.5*(sin_sg(i,j-1,4)+sin_sg(i,j,2))*dx(i,j)*(d2(i,j-1)-d2(i,j))*rdyc(i,j)
1085 fy2(i,j) = gridstruct%del6_u(i,j)*(d2(i,j-1)-d2(i,j))
1100 do j=js-nt-1,je+nt+1
1101 do i=is-nt-1,ie+nt+1
1102 d2(i,j) = (fx2(i,j)-fx2(i+1,j)+fy2(i,j)-fy2(i,j+1))*gridstruct%rarea(i,j)
1106 call copy_corners(d2, npx, npy, 1, gridstruct%nested, bd, &
1107 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
1111 fx2(i,j) = 0.5*(sin_sg(i-1,j,3)+sin_sg(i,j,1))*dy(i,j)*(d2(i,j)-d2(i-1,j))*rdxc(i,j)
1113 fx2(i,j) = gridstruct%del6_v(i,j)*(d2(i,j)-d2(i-1,j))
1118 call copy_corners(d2, npx, npy, 2, gridstruct%nested, bd, &
1119 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
1123 fy2(i,j) = 0.5*(sin_sg(i,j-1,4)+sin_sg(i,j,2))*dx(i,j)*(d2(i,j)-d2(i,j-1))*rdyc(i,j)
1125 fy2(i,j) = gridstruct%del6_u(i,j)*(d2(i,j)-d2(i,j-1))
1137 if (
present(mass) )
then 1142 fx(i,j) = fx(i,j) + damp2*(mass(i-1,j)+mass(i,j))*fx2(i,j)
1147 fy(i,j) = fy(i,j) + damp2*(mass(i,j-1)+mass(i,j))*fy2(i,j)
1153 fx(i,j) = fx(i,j) + fx2(i,j)
1158 fy(i,j) = fy(i,j) + fy2(i,j)
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, public pert_ppm(im, a0, al, ar, iv)
real, parameter ppm_limiter
real, parameter near_zero
subroutine deln_flux(nord, is, ie, js, je, npx, npy, damp, q, fx, fy, gridstruct, bd, mass)
real, parameter, public big_number
integer, parameter, public ng
subroutine xppm(flux, q, c, iord, is, ie, isd, ied, jfirst, jlast, jsd, jed, npx, npy, dxa, nested, grid_type)
subroutine, public copy_corners(q, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
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 yppm(flux, q, c, jord, ifirst, ilast, isd, ied, js, je, jsd, jed, npx, npy, dya, nested, grid_type)
Derived type containing the data.