vtf-logo

src/1d/equations/euler/rp/chk1eu.f

c
c
c     ==========================================================
      subroutine chk1eu(q,mx,lb,ub,lbr,ubr,shaper,meqn,
     &     mout,mresult)
c     ==========================================================
c
c     # Controls, if density and pressure remain positive. 
c     # An essential debugging tool for AMROC.
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 none
c
      integer meqn, mx, mout
      double precision q(meqn,mx)
c
      integer  lb(1), ub(1), lbr(1), ubr(1), shaper(1), 
     &     mresult, stride, imin(1), imax(1), i, getindx
      common /param/  gamma, gamma1
      double precision gamma, gamma1, p
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)
 
         if (q(1,i).le.0.d0) then
            if (mout.gt.0) write(6,601) lb(1)+(i-imin(1))*stride,
     &           q(1,i),lb(1),ub(1),stride
            mresult = 0
         end if

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

 10   continue         

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

<