vtf-logo

src/1d/equations/euler/rpznd/chk1euznd.f

c
c
c     ==========================================================
      subroutine chk1euznd(q,mx,lb,ub,lbr,ubr,shaper,meqn,
     &                     mout,mresult)
c     ==========================================================
c
c     # Copyright (C) 2002 Ralf Deiterding
c     # Brandenburgische Universitaet Cottbus
c
c     # Copyright (C) 2003-2007 California Institute of Technology
c     # Ralf Deiterding, ralf@amroc.net
c
      implicit double precision(a-h,o-z)
      common /param/  gamma,gamma1,q0
c
      integer meqn, mx, mout
      dimension q(meqn,mx)
c
      integer  lb(1), ub(1), lbr(1), ubr(1), shaper(1), 
     &         mresult, stride, imin(1), imax(1), i, getindx
c
      stride = (ub(1) - lb(1))/(mx-1)
      imin(1) = max(lb(1), lbr(1))
      imax(1) = min(ub(1), ubr(1))

      if (mod(imin(1)-lb(1),stride) .ne. 0) then
         imin(1) = imin(1) + stride - mod(imin(1)-lb(1),stride) 
      endif
      imin(1) = getindx(imin(1), lb(1), stride)  

      if (mod(imax(1)-lb(1),stride) .ne. 0) then
         imax(1) = imax(1) - mod(imax(1)-lb(1),stride) 
      endif
      imax(1) = getindx(imax(1), lb(1), stride)  

      mresult = 1
      do 10 i = imin(1), imax(1)

         rho  = 0.d0
         do k = 1, 2
            rho  = rho  + q(k,i)
            if (q(k,i).lt.-1.d-15) then
               if (mout.gt.0) write(6,601) k,
     &            lb(1)+(i-imin(1))*stride,q(k,i),
     &            lb(1),ub(1),stride
            end if
         enddo

         if (rho.le.0.d0) then
            write(6,602) lb(1)+(i-imin(1))*stride,rho,
     &                   lb(1),ub(1),stride
            mresult = 0
         end if

         p = gamma1*(q(4,i) - q(2,i)*q0 -
     &       0.5d0*q(3,i)**2/(q(1,i) + q(2,i)))
         if (p.le.0.d0) then
            write(6,603) lb(1)+(i-imin(1))*stride,p,
     &                   lb(1),ub(1),stride
            mresult = 0
         end if

 10   continue         

 601  format('chk1euznd: Error in rho_',i3,' (',i5,')',f16.8,
     &       '   on   [(',i5,'),(',i5,'),(',i3,')]')
 602  format('chk1euznd: Error in rho (',i5,')',f16.8,
     &       '   on   [(',i5,'),(',i5,')](',i3,')]')
 603  format('chk1euznd: Error in p   (',i5,')',f16.8,
     &       '   on   [(',i5,'),(',i5,')](',i3,')]')
      return
      end

<