2D AMRCLAW
Functions/Subroutines
check4nans.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine check4nans (meqn, mbc, mx, my, q, t, ichecknan)
 Check for NANs in solution q. More...
 

Function/Subroutine Documentation

◆ check4nans()

subroutine check4nans ( integer, intent(in)  meqn,
integer, intent(in)  mbc,
integer, intent(in)  mx,
integer, intent(in)  my,
real(kind=8), dimension(meqn,1-mbc:mx+mbc,1-mbc:my+mbc), intent(in)  q,
real(kind=8), intent(in)  t,
integer, intent(in)  ichecknan 
)

Check for NANs in solution q.

Definition at line 4 of file check4nans.f90.

4 
5  implicit none
6 
7  ! Input
8  integer, intent(in) :: meqn, mbc, mx, my, ichecknan
9  real(kind=8), intent(in) :: t, q(meqn,1-mbc:mx+mbc,1-mbc:my+mbc)
10 
11  ! Locals
12  integer :: i, j, m
13 
14  ! print *,'Checking for NANs at ichecknan = ',ichecknan
15  ! print *,' mx = ',mx,' my = ',my,' meqn = ',meqn
16 
17  do i=1-mbc,mx+mbc
18  do j=1-mbc,my+mbc
19  do m=1,meqn
20  if (.not. (q(m,i,j) == q(m,i,j))) then
21  ! true if q(i,j,m) = NAN
22  print *, 'SOLUTION ERROR --- ABORTING CALCULATION'
23  print *, 'At ichecknan = ',ichecknan
24  print *, ' mx,my,t:',mx,my,t
25  print *, ' m,i,j:',m,i,j
26  print *, ' q(m,i,j) = ',q(m,i,j)
27  stop
28  endif
29  enddo
30  enddo
31  enddo
32 
33  ! Uncomment the next line if desired when debugging:
34  ! print *,'No NANs at ichecknan = ',ichecknan,' at t = ',t
35