Hi,
I’ve made alot of progress debugging my program, and I don’t have anymore (obvious) syntax errors. However, when the compiler gets through the file it gives me the error :
PGF90-F-0000-Internal compiler error. unexpected runtime function call 0 (rieman.F90: 621)
PGF90/x86-64 Linux 10.5-0: compilation aborted
gmake: *** [rieman.o] Error 2
my code is as follows
!!****if* source/physics/Hydro/HydroMain/split/PPM/PPMKernel/rieman
!!
!! NAME
!!
!! rieman
!!
!! SYNOPSIS
!!
!! call rieman ( integer(IN) :: numIntCells,
!! integer(IN) :: numCells,
!! real(OUT) :: rhoav(numCells),
!! real(OUT) :: uav(numCells),
!! real(OUT) :: utav(numCells),
!! real(OUT) :: uttav(numCells),
!! real(OUT) :: pav(numCells),
!! real(OUT) :: urell(numCells),
!! real(IN) :: ugrdl(numCells),
!! real(IN) :: game(numCells),
!! real(OUT) :: gameav(numCells),
!! real(OUT) :: xnav(numCells, hy_numXn),
!! real(IN) :: x(numCells))
!!
!!
!!
!! DESCRIPTION
!!
!! Solve riemann shock tube problem for a general equation of state using
!! the method of Colella and Glaz. Use a two shock approximation, and
!! linearly interpolation between the head and tail of a rarefaction to
!! treat rarefactions.
!!
!! Take as input the effective left and right states, obtained by
!! integrating the parabolic reconstructions of the data over the domain
!! of dependence of each of the characteristics on the respective side
!! of the interface. This is accomplished by states(). Return the
!! solution to Riemann's problem on axis -- this is used in computing
!! the fluxes.
!!
!! The Riemann problem for the Euler's equation produces 4 states,
!! separated by the three characteristics (u - cs, u, u + cs):
!!
!!
!! l_1 t l_2 l_3
!! \ ^ . /
!! \ *L | . *R /
!! \ | . /
!! \ | . /
!! L \ | . / R
!! \ | . /
!! \ |. /
!! \|./
!! ----------+----------------> x
!!
!! l_1 = u - cs eigenvalue
!! l_2 = u eigenvalue (contact)
!! l_3 = u + cs eigenvalue
!!
!! only density jumps across l_2
!!
!! References:
!!
!! CG: Colella & Glaz 1985, JCP, 59, 264.
!!
!! CW: Colella & Woodward 1984, JCP, 54, 174.
!!
!! Fry: Fryxell et al. 2000, ApJS, 131, 273.
!!
!! Toro: Toro 1999, ``Riemann Solvers and Numerical Methods for Fluid
!! Dynamcs: A Practical Introduction, 2nd Ed.'', Springer-Verlag
!!
!! ARGUMENTS
!!
!! numIntCells :
!! numCells :
!! rhoav :
!! uav :
!! utav :
!! uttav :
!! pav :
!! urell :
!! ugrdl :
!! game :
!! gameav :
!! xnav :
!! x :
!!
!!
!!
!!***
module riemanCalc
use cudafor
#include "constants.h"
#include "Flash.h"
contains
subroutine rieman (numIntCells, numCells, &
rhoav, uav, utav, uttav, pav, &
urell, ugrdl, game, gameav, xnav, x)
use Hydro_data, ONLY: hy_numXn, &
hy_gmelft, hy_gmergt, &
hy_plft, hy_prght, &
hy_clft, hy_crght, &
hy_ulft, hy_urght, &
hy_vlft, hy_vrght, &
hy_utlft, hy_utrght, &
hy_uttlft, hy_uttrgt, &
hy_xnlft, hy_xnrght, &
hy_smallp, hy_smallu, &
hy_smlrho, hy_nriem, &
hy_gmclft, hy_gmcrgt,hy_pstor, &
hy_riemanTol
use Driver_interface, ONLY : Driver_abortFlash
implicit none
!! Arguments ----------------------------------
integer, intent (IN) :: numIntCells,numCells
real, intent(IN), DIMENSION(numCells) :: x
real, intent(IN), DIMENSION(numCells) :: ugrdl, game
real, intent(OUT), DIMENSION(numCells) :: uav, rhoav, utav, uttav, pav, &
urell, gameav
real, intent(OUT), DIMENSION(numCells,hy_numXn) :: xnav
!! Local variable ---------------------------------
!--------------------------------------------------------------------------
! We carry around two adiabatic indices (gammas). gamc is usually
! referred to as gamma_1, and is d(log P)/d(log rho) (CG Eq. 7). game
! is CG Eq. 8.
! calculate limits on gamma based on the values in the neighboring zones
! gamfac is the max gamma factor in CG Eq. 31, and is used over and over,
! so store it for efficiency.
real, device, allocatable, DIMENSION(:)::uavDev
real, device, allocatable, DIMENSION(:)::rhoavDev
real, device, allocatable, DIMENSION(:)::utavDev
real, device, allocatable, DIMENSION(:)::uttavDev
real, device, allocatable, DIMENSION(:)::pavDev
real, device, allocatable, DIMENSION(:)::urellDev
real, device, allocatable, DIMENSION(:)::gameavDev
real, device, allocatable, DIMENSION(:)::val1
real, device, allocatable, DIMENSION(:)::val2
real, device, allocatable, DIMENSION(:)::ugrdlDev
real, device, allocatable, DIMENSION(:)::gameDev
real, device, allocatable, DIMENSION(:)::numXn
real, device, allocatable, DIMENSION(:)::gmelft
real, device, allocatable, DIMENSION(:)::gmergt
real, device, allocatable, DIMENSION(:)::plft
real, device, allocatable, DIMENSION(:)::prght
real, device, allocatable, DIMENSION(:)::clft
real, device, allocatable, DIMENSION(:)::crght
real, device, allocatable, DIMENSION(:)::ulft
real, device, allocatable, DIMENSION(:)::vlft
real, device, allocatable, DIMENSION(:)::vrght
real, device, allocatable, DIMENSION(:)::utlft
real, device, allocatable, DIMENSION(:)::uttlft
real, device, allocatable, DIMENSION(:)::utrght
real, device, allocatable, DIMENSION(:)::uttrgt
real, device, allocatable, DIMENSION(:,:)::xnlft
real, device, allocatable, DIMENSION(:,:)::xnrght
real, device, allocatable, DIMENSION(:)::smallp
real, device, allocatable, DIMENSION(:)::smallu
real, device, allocatable, DIMENSION(:)::smlrho
real, device, allocatable, DIMENSION(:)::nriem
real, device, allocatable, DIMENSION(:)::gmclft
real, device, allocatable, DIMENSION(:)::gmcrgt
real, device, allocatable, DIMENSION(:)::pstor
real, device, allocatable, DIMENSION(:)::riemanTol
real, device, allocatable, DIMENSION(:)::errorFlag
real, device, allocatable, DIMENSION(:,:)::xnavDev
integer::numIntCells5
real, DIMENSION(:)::eFlagDev,value
type(dim3)::dimGrid,dimBlock
numIntCells5=numIntCells+5
allocate(xnavDev(numCells,hy_numXn))
allocate(uavDev(numCells))
allocate(rhoavDev(numCells))
allocate(utavDev(numCells))
allocate(uttavDev(numCells))
allocate(pavDev(numCells))
allocate(urellDev(numCells))
allocate(gameavDev(numCells))
allocate(val1(numCells))
allocate(val2(numIntCells5))
allocate(ugrdlDev(numIntCells5))
allocate(gameDev(numIntCells5))
allocate(numXn(numIntCells5))
allocate(gmelft(numIntCells5))
allocate(gmergt(numIntCells5))
allocate(plft(numIntCells5))
allocate(prght(numIntCells5))
allocate(clft(numIntCells5))
allocate(crght(numIntCells5))
allocate(ulft(numIntCells5))
allocate(vlft(numIntCells5))
allocate(vrght(numIntCells5))
allocate(utlft(numIntCells5))
allocate(uttlft(numIntCells5))
allocate(utrght(numIntCells5))
allocate(uttrgt(numIntCells5))
allocate(xnlft(MAXCELLS,numIntCells5))
allocate(xnrght(MAXCELLS,numIntCells5))
allocate(smallp(numIntCells5))
allocate(smallu(numIntCells5))
allocate(smlrho(numIntCells5))
allocate(nriem(numIntCells5))
allocate(gmclft(numIntCells5))
allocate(gmcrgt(numIntCells5))
allocate(pstor(numIntCells5))
allocate(riemanTol(numIntCells5))
allocate(errorFlag(numCells))
val1=numCells
val2=numIntCells5
value=0
xnavDev=xnav(1:numCells,1:hy_numXn)
utavDev=utav(1:numCells)
uttavDev=uttav(1:numCells)
pavDev=pav(1:numCells)
urellDev=urell(1:numCells)
gameavDev=gameav(1:numCells)
rhoavDev=rhoav(1:numCells)
uavDev=uav(1:numCells)
ugrdlDev=ugrdl(1:numIntCells5)
gameDev=game(1:numIntCells5)
numXn=hy_numXn
gmelft=hy_gmelft(1:numIntCells5)
gmergt=hy_gmergt(1:numIntCells5)
plft=hy_plft(1:numIntCells5)
prght=hy_prght(1:numIntCells5)
clft=hy_clft(1:numIntCells5)
crght=hy_crght(1:numIntCells5)
ulft=hy_ulft(1:numIntCells5)
vlft=hy_vlft(1:numIntCells5)
vrght=hy_vrght(1:numIntCells5)
utlft=hy_utlft(1:numIntCells5)
utrght=hy_utrght(1:numIntCells5)
uttlft=hy_uttlft(1:numIntCells5)
uttrgt=hy_uttrgt(1:numIntCells5)
xnlft=hy_xnlft(1:MAXCELLS,1:numIntCells5)
xnrght=hy_xnrght(1:MAXCELLS,1:numIntCells5)
smallp=hy_smallp
smallu=hy_smallu
smlrho=hy_smlrho
nriem=hy_nriem
gmclft=hy_gmclft(1:numIntCells5)
gmcrgt=hy_gmcrgt(1:numIntCells5)
pstor=hy_pstor(1:numIntCells5)
riemanTol=hy_riemanTol
dimGrid=dim3(numIntCells5/16,numIntCells5/16,1)
dimBlock=dim3(16,16,1)
call rieman_kernel<<<dimGrid,dimBlock>>>(val1,val2,ugrdlDev,gameDev,numXn,gmelft,gmergt,plft,prght,clft,crght,ulft,vlft,vrght,utlft,uttlft,utrght,uttrgt,xnlft,xnrght,smallp,smallu,smlrho,nriem,gmclft,gmcrgt,pstor,riemanTol,&
utavDev,uttavDev,pavDev,urellDev,gameavDev,rhoavDev,uavDev,xnavDev)
return
end subroutine rieman
attributes (global) subroutine rieman_kernel(val1,val2,ugrdlDev,gameDev,numXn,gmelft,gmergt,plft,prght,clft,crght,ulft,vlft,vrght,utlft,uttlft,utrght,uttrgt,xnlft,xnrght,smallp,smallu,smlrho,nriem,gmclft,gmcrgt,pstor,riemanTol,&
utavDev,uttavDev,pavDev,urellDev,gameavDev,rhoavDev,uavDev,xnavDev)
real, DIMENSION(:)::val1,val2,ugrdlDev,gameDev,numXn,gmelft,gmergt,plft,prght,clft,crght,ulft,vlft,vrght,utlft,utrght,uttlft,uttrgt,smallp,smallu,smlrho,nriem,gmclft,gmcrgt,pstor,riemanTol,utavDev,uttavDev,pavDev,urellDev,gameavDev,rhoavDev,uavDev
real, DIMENSION(:,:):: xnlft,xnrght,xnavDev
real, DIMENSION(:) :: wlft, wrght, pstar, ustar, vstar, cestar, &
rhostr, westar, ps, us, uts, utts, vs, rhos, ces, ws, wes, &
gmstar, games, gamcs
real, DIMENSION(:) :: pstar1, pstar2, gmstrl, gmstrr, &
& wlft1, wrght1, gmin, gmax, &
& gamfac, aux
real, DIMENSION(:) :: scrch1, scrch2, scrch3, scrch4
real :: ge, gc, ustrl1, ustrr1, ustrl2, ustrr2, &
& delu1, delu2, pres_err,mxVal
integer :: i, j, k, n,ierr,counter
character(len=1), save :: dirs(3) = (/ 'x', 'y', 'z' /)
real, parameter :: small_dp = 1.e2 * epsilon(1.e0)
do i = 5, val2(1)
aux(i) = sqrt (0.5e0 * (gameDev(i) - 1.0e0) / gameDev(i))
ge = 0.5e0 * (gmelft(i) + gmergt(i))
gc = 0.5e0 * (gmclft(i) + gmcrgt(i))
gamfac(i) = (1.e0 - ge / gc) * (ge - 1.e0)
gmin(i) = min (gameDev(i-1), gameDev(i), gameDev(i+1))
gmax(i) = max (gameDev(i-1), gameDev(i), gameDev(i+1))
enddo
! construct first guess for secant iteration by assuming that the nonlinear
! wave speed is equal to the sound speed -- the resulting expression is the
! same as Toro, Eq. 9.28 in the Primitive Variable Riemann Solver (PVRS).
! See also Fry Eq. 72.
do i = 5, val2(1)
pstar1(i) = prght(i) - plft(i) -crght(i) * (urght(i) - ulft(i))
pstar1(i) = plft(i) + pstar1(i) * (clft(i) / (clft(i) + crght(i)))
pstar1(i) = max (smallp(1), pstar1(i))
enddo
! calculate approximation jump in gamma acrosss the interface based on the
! first guess for the pressure jump. There is a left and right 'star' region,
! so we need gamma add both places. Use CG Eq. 31 and 32, with definitions
! as in CG Eq. 33.
do i = 5, val2(1)
gmstrl(i) = gamfac(i) * (pstar1(i) - plft(i))
gmstrl(i) = gmelft(i) + 2.e0 * gmstrl(i) / (pstar1(i) + plft(i))
gmstrr(i) = gamfac(i) * (pstar1(i) - prght(i))
gmstrr(i) = gmergt(i) + 2.e0 * gmstrr(i) / (pstar1(i) + prght(i))
gmstrl(i) = max (gmin(i), min( gmstrl(i), gmax(i)))
gmstrr(i) = max (gmin(i), min( gmstrr(i), gmax(i)))
enddo
! calculate nonlinear wave speeds for the left and right moving waves based
! on the first guess for the pressure jump. Again, there is a left and a
! right wave speed. Compute this using CG Eq. 34.
do i = 5, val2(1)
scrch1(i) = pstar1(i) - (gmstrl(i) - 1.e0) * plft(i) &
& / (gmelft(i) - 1.e0)
if (scrch1(i) .EQ. 0.e0) scrch1(i) = hy_smallp
wlft1(i) = pstar1(i) + 0.5e0 * (gmstrl(i) - 1.e0) &
& * (pstar1(i) + plft(i))
wlft1(i) = (pstar1(i) - plft(i)) * wlft1(i) / (vlft(i) * scrch1(i))
wlft1(i) = sqrt(abs(wlft1(i)))
scrch2(i) = pstar1(i) - (gmstrr(i) - 1.e0) * prght(i) /(gmergt(i) - 1.e0)
if (scrch2(i) .EQ. 0.e0) scrch2(i) = smallp(1)
wrght1(i) = pstar1(i) + 0.5e0 * (gmstrr(i) - 1.e0) &
& * (pstar1(i) + prght(i))
wrght1(i) = (pstar1(i) - prght(i)) * wrght1(i) / (vrght(i) * scrch2(i))
wrght1(i) = sqrt(abs(wrght1(i)))
! if the pressure jump is small, the wave speed is just the sound speed
if (abs (pstar1(i) - plft(i)) < small_dp*(pstar1(i) + plft(i))) wlft1(i) = hy_clft(i)
wlft1(i) = max (wlft1(i), aux(i) * clft(i))
if (abs (pstar1(i) - prght(i)) < small_dp*((pstar1(i) + prght(i)))) wrght1(i) = crght(i)
wrght1(i) = max (wrght1(i), aux(i) * crght(i))
enddo
! construct second guess for the pressure using the nonlinear wave speeds
! from the first guess. This is basically the same thing we did to get
! pstar1, except now we are using the better wave speeds instead of the
! sound speed.
do i = 5, val2(1)
pstar2(i) = prght(i) - plft(i) - wrght1(i) * (urght(i) - ulft(i))
pstar2(i) = plft(i) + pstar2(i) * wlft1(i) / (wlft1(i) + wrght1(i))
pstar2(i) = max (smallp(1), pstar2(i))
enddo
! begin the secant iteration -- see CG Eq. 17 for details. We will continue to
! interate for convergence until the error falls below tol (in which case,
! things are good), or we hit hy_nriem iterations (in which case we have a
! problem, and we spit out an error).
do i = 5, val2(1)
pstor(1) = pstar1(i)
pstor(2) = pstar2(i)
do n = 1, nriem(1)
! new values for the gamma at the "star" state -- again, using CG Eq. 31
gmstrl(i) = gamfac(i) * (pstar2(i) - hy_plft(i))
gmstrl(i) = gmelft(i) + 2.e0 * gmstrl(i) / (pstar2(i) + plft(i))
gmstrr(i) = gamfac(i) * (pstar2(i) - prght(i))
gmstrr(i) = gmergt(i) + 2.e0 * gmstrr(i) / (pstar2(i) + prght(i))
gmstrl(i) = max (gmin(i), min (gmax(i), gmstrl(i)))
gmstrr(i) = max (gmin(i), min (gmax(i), gmstrr(i)))
! new nonlinear wave speeds, using CG Eq. 34 and the updated gammas
scrch1(i) = pstar2(i) - (gmstrl(i) - 1.e0) * plft(i) &
& / (gmelft(i) - 1.e0)
if (scrch1(i) .EQ. 0.e0) scrch1(i) = smallp(1)
wlft(i) = pstar2(i) + 0.5e0 * (gmstrl(i) - 1.e0) &
& * (pstar2(i) + plft(i))
wlft(i) = (pstar2(i) - plft(i)) * wlft(i) / (vlft(i) * scrch1(i))
wlft(i) = sqrt(abs(wlft(i)))
scrch2(i) = pstar2(i) - (gmstrr(i) - 1.e0) * prght(i) /(gmergt(i) - 1.e0)
if (scrch2(i) .EQ. 0.e0) scrch2(i) = smallp(1)
wrght(i) = pstar2(i) + 0.5e0 * (gmstrr(i) - 1.e0) &
& * (pstar2(i) + prght(i))
wrght(i) = (pstar2(i) - prght(i)) * wrght(i) / (vrght(i) * scrch2(i))
wrght(i) = sqrt(abs(wrght(i)))
! if the pressure jump is small, the wave speed is just the sound speed
if (abs (pstar2(i) - hy_plft(i)) < small_dp*(pstar2(i) + plft(i))) wlft(i) = clft(i)
wlft(i) = max (wlft(i), aux(i) * clft(i))
if (abs (pstar2(i) - prght(i)) < small_dp*(pstar2(i) + prght(i))) wrght(i) =crght(i)
wrght(i) = max (wrght(i), aux(i) * crght(i))
! compute the velocities in the "star" state -- using CG Eq. 18 -- ustrl2 and
! ustrr2 are the velocities they define there. ustrl1 and ustrl2 seem to be
! the velocities at the last time, since pstar1 is the old 'star' pressure, and
! wlft1 is the old wave speed.
ustrl1 = ulft(i) - (pstar1(i) - plft(i)) / wlft1(i)
ustrr1 = urght(i) + (pstar1(i) - prght(i)) / wrght1(i)
ustrl2 = ulft(i) - (pstar2(i) - plft(i)) / wlft(i)
ustrr2 = urght(i) + (pstar2(i) - prght(i)) / wrght(i)
delu1 = ustrl1 - ustrr1
delu2 = ustrl2 - ustrr2
scrch1(i) = delu2 - delu1
if (abs(pstar2(i)-pstar1(i)) .le. smallp(1)) scrch1(i) = 0.e0
if (abs(scrch1(i)) .lt. smallu(1)) then
delu2 = 0.e0
scrch1(i) = 1.e0
endif
! pressure at the "star" state -- using CG Eq. 18
pstar(i) = pstar2(i) - delu2 * (pstar2(i) - pstar1(i)) / scrch1(i)
pstar(i) = max (smallp(1), pstar(i))
! check for convergence of iteration, hy_riemanTol is a run-time parameter
pres_err = abs(pstar(i)-pstar2(i)) / pstar(i)
if (pres_err .lt. riemanTol(1)) goto 10
! reset variables for next iteration
pstar1(i) = pstar2(i)
pstar2(i) = pstar(i)
pstor(n+2) = pstar(i)
wlft1(i) = wlft(i)
wrght1(i) = wrght(i)
enddo
n = n - 1
! print error message and stop code if iteration fails to converge
! print *, ' '
! print *, 'Nonconvergence in subroutine rieman'
! print *, ' '
! print *, 'Zone index = ', i
! print *, 'Zone center = ', x(i)
!print *, 'Iterations tried = ', n+2
! print *, 'Pressure error = ', pres_err
! print *, 'rieman_tol = ', hy_riemanTol
! print *, ' '
! print *, 'pL = ', hy_plft(i), ' pR =', hy_prght(i)
! print *, 'uL = ', hy_ulft(i), ' uR =', hy_urght(i)
! print *, 'cL = ', hy_clft(i), ' cR =', hy_crght(i)
! print *, 'gamma_eL = ', hy_gmelft(i), ' gamma_eR =', hy_gmergt(i)
! print *, 'gamma_cL = ', hy_gmclft(i), ' gamma_cR =', hy_gmcrgt(i)
! print *, ' '
! print *, 'Iteration history:'
! print *, ' '
! print '(A4, 2X, A20)', 'n', 'p*'
! do j = 1, n+2
! print '(I4, 2X, E20.12)', j, hy_pstor(j)
! enddo
! print *, ' '
! print *, 'Terminating execution.'
! land here if the iterations have converged
return
10 continue
enddo
! end of secant iteration
! calculate fluid velocity for the "star" state -- this comes from the shock
! jump equations, Fry Eq. 68 and 69. The ustar velocity can be computed
! using either the jump eq. for a left moving or right moving shock -- we use
! the average of the two.
do i = 5, val2(1)
scrch3(i) = ulft (i) - (pstar(i) - plft(i)) / wlft(i)
scrch4(i) = urght(i) + (pstar(i) - prght(i)) / wrght(i)
ustar(i) = 0.5e0 * (scrch3(i) + scrch4(i))
enddo
! account for grid velocity
do i = 5, val2(1)
urellDev(i) = ustar(i) - ugrdl(i)
scrch1(i) = sign (1.e0, urellDev(i))
enddo
! decide which state is located at the zone iterface based on the values
! of the wave speeds. This is just saying that if ustar > 0, then the state
! is U_L. if ustar < 0, then the state on the axis is U_R.
do i = 5, val2(1)
scrch2(i) = 0.5e0 * ( 1.e0 + scrch1(i))
scrch3(i) = 0.5e0 * ( 1.e0 - scrch1(i))
ps(i) = plft(i) * scrch2(i) + prght(i) * scrch3(i)
us(i) = ulft(i) * scrch2(i) + urght(i) * scrch3(i)
uts(i) =utlft(i) * scrch2(i) + utrght(i) * scrch3(i)
utts(i) =uttlft(i) * scrch2(i) + uttrgt(i) * scrch3(i)
vs(i) = vlft(i) * scrch2(i) + vrght(i) * scrch3(i)
games(i) = gmelft(i) * scrch2(i) + gmergt(i) * scrch3(i)
gamcs(i) = gmclft(i) * scrch2(i) + gmcrgt(i) * scrch3(i)
rhos(i) = 1.e0 / vs(i)
rhos(i) = max (smlrho(1), rhos(i))
vs(i) = 1.e0 / rhos(i)
ws(i) = wlft(i) * scrch2(i) + wrght(i) * scrch3(i)
ces(i) = sqrt (gamcs(i) * ps(i) * vs(i))
! compute rhostar, using the shock jump condition (Fry Eq. 80)
vstar(i) = vs(i) - (pstar(i) - ps(i)) / ws(i) / ws(i)
rhostr(i) = 1.e0 / vstar(i)
cestar(i) = sqrt (gamcs(i) * pstar(i) * vstar(i))
! compute some factors, Fry Eq. 81 and 82
wes(i) = ces(i) - scrch1(i) * us(i)
westar(i) = cestar(i) - scrch1(i) * ustar(i)
scrch4(i) = ws(i) * vs(i) - scrch1(i) * us(i)
if (pstar(i) - ps(i) .ge. 0.e0) then
wes(i) = scrch4(i)
westar(i) = scrch4(i)
endif
wes(i) = wes(i) + scrch1(i) * ugrdl(i)
westar(i) = westar(i) + scrch1(i) * ugrdl(i)
enddo
do i = 5, val2(1)
gamfac(i) = (1.e0 - games(i) / gamcs(i)) * (games(i) - 1.e0)
gmstar(i) = gamfac(i) * (pstar(i) - ps(i))
gmstar(i) = games(i) + 2.e0 * gmstar(i) / (pstar(i) + ps(i))
gmstar(i) = max (gmin(i), min (gmax(i), gmstar(i)))
enddo
do n = 1, numXn(1)
do i = 5, val2(1)
xnavDev(i,n) =xnlft(i,n) * scrch2(i) + xnrght(i,n) * scrch3(i)
enddo
enddo
! compute correct state for rarefaction fan by linear interpolation
do i = 5, val2(1)
scrch1(i) = max (wes(i) - westar(i), wes(i) + westar(i), smallu(i))
scrch1(i) = (wes(i) + westar(i)) / scrch1(i)
scrch1(i) = 0.5e0 * (1.e0 + scrch1(i))
scrch2(i) = 1.e0 - scrch1(i)
rhoavDev(i) = scrch1(i) * rhostr(i) + scrch2(i) * rhos (i)
uavDev (i) = scrch1(i) * ustar(i) + scrch2(i) * us(i)
utavDev (i) = uts(i)
uttavDev(i) = utts(i)
pavDev(i) = scrch1(i) * pstar(i) + scrch2(i) * ps(i)
gameavDev(i) = scrch1(i) * gmstar(i) + scrch2(i) * games(i)
enddo
do i = 5, val2(1)
if (westar(i) .ge. 0.e0) then
rhoavDev(i) = rhostr(i)
uavDev(i) = ustar(i)
pavDev(i) = pstar(i)
gameavDev(i) = gmstar(i)
endif
if (wes(i) .lt. 0.e0) then
rhoavDev(i) = rhos(i)
uavDev(i) = us(i)
pavDev(i) = ps(i)
gameavDev(i) = games(i)
endif
urellDev(i) = uavDev(i) - ugrdl(i)
enddo
end subroutine rieman_kernel
end module riemanCalc
The error occurs at the line “end subroutine_rieman_kernel”
Any help would be great!