c
c
c     =====================================================
      subroutine rpt2(ixy,maxm,meqn,mwaves,mbc,mx,ql,qr,
     &			 aux1,aux2,aux3,imp,asdq,bmasdq,bpasdq)
c     =====================================================
      implicit double precision (a-h,o-z)
c
c     # Riemann solver in the transverse direction for the acoustics equations.
c     # Split asdq (= A^* \Delta q, where * = + or -)
c     # into down-going flux difference bmasdqb (= B^- A^* \Delta q)
c     #    and up-going flux difference bpasdq (= B^+ A^* \Delta q)
c
c
      dimension     ql(1-mbc:maxm+mbc, meqn)
      dimension     qr(1-mbc:maxm+mbc, meqn)
      dimension   asdq(1-mbc:maxm+mbc, meqn)
      dimension bmasdq(1-mbc:maxm+mbc, meqn)
      dimension bpasdq(1-mbc:maxm+mbc, meqn)
      dimension   aux1(1-mbc:maxm+mbc, 9)
      dimension   aux2(1-mbc:maxm+mbc, 9)
      dimension   aux3(1-mbc:maxm+mbc, 9)
c

c
c
      if (ixy.eq.1) then
	  ixtran = 4
	  iytran = 5
          ilenrat = 6
        else
	  ixtran = 1
	  iytran = 2
          ilenrat = 3
        endif
c 

c
c
      do 20 i=2-mbc,mx+mbc
      if (imp.eq.1) then
          i1 = i-1
	else
	  i1 = i
	endif
c
c
c        # pressure component of asdq:
c
	 asdqp = asdq(i,1) 
c
c        # sound speed in each row of cells:
         cm = aux1(i1,9)
         cp = aux3(i1,9)
c
c        # impedances:
         zm = aux1(i1,8)
         zz = aux2(i1,8)
         zp = aux3(i1,8)


c
c        # up-going:
c
	 xtran = aux3(i,ixtran)
	 ytran = aux3(i,iytran)
c
	 asdqt = xtran*asdq(i,2) + ytran*asdq(i,3)
         a2 = (asdqp + zz*asdqt) / (zz+zp)
         bpasdqp = a2*zp
         bpasdqt = a2

c
	 bpasdq(i,1) = cp * bpasdqp
	 bpasdq(i,2) = cp * xtran*bpasdqt 
	 bpasdq(i,3) = cp * ytran*bpasdqt 
c
c
c        # down-going:
c
	 xtran = aux2(i,ixtran)
	 ytran = aux2(i,iytran)
c
	 asdqt = xtran*asdq(i,2) + ytran*asdq(i,3)
         a1 = (-asdqp + zz*asdqt) / (zm + zz)
         bmasdqp = -a1*zm
         bmasdqt = a1
c
	 bmasdq(i,1) = -cm * bmasdqp
	 bmasdq(i,2) = -cm * xtran*bmasdqt 
	 bmasdq(i,3) = -cm * ytran*bmasdqt 

c
c        # scale by ratio of lengths:
	 do m=1,3
	    bmasdq(i,m) = bmasdq(i,m)*aux2(i,ilenrat)
	    bpasdq(i,m) = bpasdq(i,m)*aux3(i,ilenrat)
	    enddo
   20    continue
      return
      end
