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