vtf-logo

src/1d/equations/euler/rpm/chk1eum.f

c
c
c     ==========================================================
      subroutine chk1eum(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
      double precision gamma, gamma1, p, pinf
c
      stride = (ub(1) - lb(1))/(mx-1)
      imin(1) = max(lb(1), lbr(1))
      imax(1) = min(ub(1), ubr(1))
c
      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)  
c
      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)  
c
      mresult = 1
      do 10 i = imin(1), imax(1)
c 
         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
c
         gamma1 = 1.d0 / q(4,i)
         gamma = gamma1 + 1.d0
         pinf = q(5,i)*gamma1/gamma
         p = gamma1*(q(3,i)-0.5d0*(q(2,i)**2)/q(1,i)-q(5,i))
         if (p+pinf.le.0.d0) then
            if (mout.gt.0) write(6,602) lb(1)+(i-imin(1))*stride,
     &           p+pinf,lb(1),ub(1),stride
            mresult = 0
         end if
c
 10   continue         
c
 601  format('chk1eu: Error in rho (',i5,')',f16.8,
     &     '   on   [(',i5,'),(',i5,'),(',i3,')]')
 602  format('chk1eu: Error in p+pinf (',i5,')',f16.8,
     &     '   on   [(',i5,'),(',i5,')](',i3,')]')
      return
      end
c

<