check4nans.f.html CLAWPACK  
 Source file:   check4nans.f
 Directory:   /Users/rjl/git/rjleveque/clawpack-4.6.3/amrclaw/2d/lib
 Converted:   Mon Jan 21 2013 at 20:15:10   using clawcode2html
 This documentation file will not reflect any later changes in the source file.

 
c
c
c =========================================================
      subroutine check4nans(maxmx,maxmy,meqn,mbc,mx,my,q,t,
     &                      ichecknan)
c =========================================================
c
c     # check for NANs in solution q
c
      implicit double precision (a-h,o-z)
      dimension   q(1-mbc:maxmx+mbc,1-mbc:maxmy+mbc, meqn)

c     write(*,*) 'Checking for NANs at ichecknan = ',ichecknan
c     write(*,*) '  maxmx = ',maxmx,'  maxmy = ',maxmy,'  meqn = ',meqn
      
      do i=1-mbc,mx+mbc
        do j=1-mbc,my+mbc
          do m=1,meqn
            if (.not.(q(i,j,m).eq.q(i,j,m))) then
c             # true if q(i,j,m) = NAN
	      write(*,*) 'SOLUTION ERROR --- ABORTING CALCULATION'
	      write(*,*) 'At ichecknan = ',ichecknan
              write(*,*) '   mx,my,t:',mx,my,t
              write(*,*) '   i,j,m:',i,j,m
              write(*,*) '   q(i,j,:) = ',(q(i,j,me), me=1,meqn)
              stop
              endif
            enddo
          enddo
        enddo
c
c     # uncomment the next line if desired when debugging:
c     write(*,*) 'No NANs at ichecknan = ',ichecknan,' at t = ',t

      return
      end