vtf-logo

src/3d/equations/euler/rprhok/chk3eurhok.f

c
c     ==========================================================
      subroutine chk3eurhok(q,mx,my,mz,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)
      include  "ck.i"    
c
      integer meqn, mx, my, mz, mout
      double precision q(meqn,mx,my,mz)
c
      integer  lb(3), ub(3), lbr(3), ubr(3), shaper(3), 
     &     mresult, stride, imin(3), imax(3), d, i, j, k, m, 
     &     getindx
c
      stride = (ub(1) - lb(1))/(mx-1)
      do 5 d = 1, 3
         imin(d) = max(lb(d), lbr(d))
         imax(d) = min(ub(d), ubr(d))

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

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

      mresult = 1
      do 10 k = imin(3), imax(3)
         do 10 j = imin(2), imax(2)  
            do 10 i = imin(1), imax(1)
 
               rho  = 0.d0
               rhoW = 0.d0
               do m = 1, Nsp
                  rho  = rho  + q(m,i,j,k)
                  rhoW = rhoW + q(m,i,j,k)/Wk(m)
                  if (q(m,i,j,k).lt.-1.d-15) then
                     if (mout.gt.0) 
     &                    write(6,601) k,lb(1)+(i-imin(1))*stride,
     &                    lb(2)+(j-imin(2))*stride,
     &                    lb(2)+(k-imin(3))*stride,q(m,i,j,k),
     &                    lb(1),lb(2),lb(3),ub(1),ub(2),ub(3),
     &                    stride,stride,stride
               end if
            enddo
            
            if (rho.le.0.d0) then
               if (mout.gt.0) 
     &              write(6,602) lb(1)+(i-imin(1))*stride,
     &              lb(2)+(j-imin(2))*stride,
     &              lb(3)+(k-imin(3))*stride,rho,
     &              lb(1),lb(2),lb(3),ub(1),ub(2),ub(3),
     &              stride,stride,stride
               mresult = 0
            end if

            p = rhoW*RU*q(Nsp+5,i,j,k)
            if (p.le.0.d0) then
               if (mout.gt.0) 
     &              write(6,603) lb(1)+(i-imin(1))*stride,
     &              lb(2)+(j-imin(2))*stride,
     &              lb(3)+(k-imin(3))*stride,p,
     &              lb(1),lb(2),lb(3),ub(1),ub(2),ub(3),
     &              stride,stride,stride
               mresult = 0
            end if

            if ( TabS.gt.q(Nsp+5,i,j,k)*TABFAC .or. 
     &           q(Nsp+5,i,j,k)*TABFAC.gt.TabE ) then
               if (mout.gt.0) 
     &              write(6,604) lb(1)+(i-imin(1))*stride,
     &              lb(2)+(j-imin(2))*stride,
     &              lb(3)+(k-imin(3))*stride,q(Nsp+5,i,j,k),
     &              lb(1),lb(2),lb(3),ub(1),ub(2),ub(3),
     &              stride,stride,stride
               mresult = 0
            end if

 10      continue         
c
 601   format('chk3eurhok: Error in rho_',i3,'(',i5,',',i5,',',i5,
     &        ')',f16.8,'   on   [(',i5,',',i5,',',i5,'),(',
     &        i5,',',i5,',',i5,'),(',i3,',',i3,',',i3,')]')
 602   format('chk3eurhok: Error in rho (',i5,',',i5,',',i5,')',f16.8,
     &      '   on   [(',i5,',',i5,',',i5,'),(',i5,',',i5,',',i5,')](',
     &      i3,',',i3,',',i3,')]')
 603   format('chk3eurhok: Error in p   (',i5,',',i5,',',i5,')',f16.8,
     &      '   on   [(',i5,',',i5,',',i5,'),(',i5,',',i5,',',i5,')](',
     &      i3,',',i3,',',i3,')]')
 604   format('chk3eurhok: Error in T   (',i5,',',i5,',',i5,')',f16.8,
     &      '   on   [(',i5,',',i5,',',i5,'),(',i5,',',i5,',',i5,')](',
     &      i3,',',i3,',',i3,')]')
c
       return
       end
c

<