c
c
c
c ==================================================================
subroutine rpn3ad1(ixyz,maxm,meqn,mwaves,mbc,mx,ql,qr,
& maux,auxl,auxr,wave,s,amdq,apdq)
c ==================================================================
c
c # Riemann-solver for the advection equation
c # q_t + u*q_x + v*q_y + w*q_z = 0
c # where u and v are a given velocity field.
c
c -----------------------------------------------------------
c # In advective form, with interface velocities specified in
c # the auxiliary variable
c # aux(i,j,1) = u-velocity at left edge of cell (i,j,k)
c # aux(i,j,2) = v-velocity at bottom edge of cell (i,j,k)
c # aux(i,j,3) = w-velocity at back edge of cell (i,j,k)
c -----------------------------------------------------------
c
c # solve Riemann problems along one slice of data.
c # This data is along a slice in the x-direction if ixyz=1
c # the y-direction if ixyz=2.
c # the z-direction if ixyz=3.
c
c # On input, ql contains the state vector at the left edge of each cell
c # qr contains the state vector at the right edge of each cell
c
c # auxl(i,ma,2) contains auxiliary data for cells along this slice,
c # where ma=1,maux in the case where maux=method(7) > 0.
c # auxl(i,ma,1) and auxl(i,ma,3) contain auxiliary data along
c # neighboring slices that generally aren't needed in the rpn3 routine.
c
c # On output, wave contains the waves, s the speeds,
c # and amdq, apdq the left-going and right-going flux differences,
c # respectively. Note that in this advective form, the sum of
c # amdq and apdq is not equal to a difference of fluxes except in the
c # case of constant velocities.
c
c # Note that the i'th Riemann problem has left state qr(i-1,:)
c # and right state ql(i,:)
c # From the basic clawpack routines, this routine is called with ql = qr
c
implicit double precision(a-h,o-z)
c
dimension wave(1-mbc:maxm+mbc, meqn, mwaves)
dimension s(1-mbc:maxm+mbc, mwaves)
dimension ql(1-mbc:maxm+mbc, meqn)
dimension qr(1-mbc:maxm+mbc, meqn)
dimension amdq(1-mbc:maxm+mbc, meqn)
dimension apdq(1-mbc:maxm+mbc, meqn)
dimension auxl(1-mbc:maxm+mbc, maux, 3)
dimension auxr(1-mbc:maxm+mbc, maux, 3)
c
c # Riemann solver returns flux differences
c ------------
common /rpnflx/ mrpnflx
mrpnflx = 0
c
c # Set wave, speed, and flux differences:
c ------------------------------------------
c
do 30 i = 2-mbc, mx+mbc
wave(i,1,1) = ql(i,1) - qr(i-1,1)
s(i,1) = auxl(i,ixyz,2)
c # The flux difference df = s*wave all goes in the downwind direction:
amdq(i,1) = dmin1(auxl(i,ixyz,2), 0.d0) * wave(i,1,1)
apdq(i,1) = dmax1(auxl(i,ixyz,2), 0.d0) * wave(i,1,1)
30 continue
c
return
end