      subroutine roe_solver(ixy,uv,enth,delta,wave_local,s_local,info)
      implicit none

      double precision uv(2),enth, delta(4)
      double precision wave_local(4,3), s_local(3)
      double precision euv, c2, c, u2v2, u,v
      double precision a1, a2, a3, a4, a5
      double precision gamma, gamma1
      integer m, p, mu, mv, ixy, i, j, k, info
      logical in_rpt

      double precision dtcom, dxcom, dycom, tcom
      integer icom, jcom

      common /param/ gamma, gamma1
      common /comxyt/ dtcom,dxcom,dycom,tcom,icom,jcom
      common /comrp/ in_rpt


      info = 0

c     # These are used even in the mapped case, but ixy is
c     # always set to 1;  rotation matrix rot does switches
c     # coordinates for us.
      if (ixy .eq. 1) then
         mu = 2
         mv = 3
      else
         mu = 3
         mv = 2
      endif

      u = uv(mu-1)
      v = uv(mv-1)

      u2v2 = u*u + v*v
      c2 = gamma1*(enth - 0.5d0*u2v2)
      if (c2 .lt. 1e-13) then
         info = 1
         write(6,*) 'Roe solver : '
         write(6,'(A,E16.8, E16.8)') 'c2 .lt. 0; ', c2
         return
c         stop
      endif
      c = sqrt(c2) !! sound speed
      euv = enth - u2v2

      a2 = (gamma1/c2) * (euv*delta(1) + u*delta(mu) + v*delta(mv)
     &      - delta(4))
      a3 = delta(mv) - v*delta(1)
      a4 = (delta(mu) + (c-u)*delta(1) - c*a2) / (2.d0*c)
      a1 = delta(1) - a2 - a4

c     # 1-wave (rarefaction or shock)
      wave_local(1,1)  = a1
      wave_local(mu,1) = a1*(u-c)
      wave_local(mv,1) = a1*v
      wave_local(4,1)  = a1*(enth - u*c)
      s_local(1) = u - c

c     # contact discontinuity
      wave_local(1,2)  = a2
      wave_local(mu,2) = a2*u
      wave_local(mv,2) = a2*v  + a3
      wave_local(4,2)  = a2*0.5d0*u2v2 + a3*v
      s_local(2) = u

c     # 3-wave (rarefaction or shock)
      wave_local(1,3)  = a4
      wave_local(mu,3) = a4*(u+c)
      wave_local(mv,3) = a4*v
      wave_local(4,3)  = a4*(enth + u*c)
      s_local(3) = u + c

      end
