subroutine FishPred(Eb,BeamAtt,FishDens,Larval_m,FishEnc)
implicit none

!Parameters
real*8, parameter:: LarvalShape = 0.2		!Larval width:length ratio
real*8, parameter:: PreyContrast=0.3
real*8, parameter:: EyeSens = 5.d4
real*8, parameter:: Ke = 1.
real*8, parameter:: VisFieldShape = 0.5
real*8, parameter:: FishSwimVel = 0.10		!Fish cruising velocity (m/s)


!Variables
integer	IER
real*8 Eb,BeamAtt,LarvalWidth,Larval_m,FishDens
real*8 Prey_m,Prey_mgdw,PreyPer_m3,PreyImageArea
real*8 VisualRange,pi,FishEnc

pi=acos(-1.)
LarvalWidth = LarvalShape*Larval_m
PreyImageArea = LarvalWidth*Larval_m*0.75		!Larval image area 

!Finding the visual range in m (from AU97)
VisualRange = dsqrt(EyeSens*PreyContrast*PreyImageArea*(Eb/(Ke+Eb))) !Approximation
if(VisualRange>0.05)then	!Exact visual range (above ca 5 cm)
 call getr(VisualRange,BeamAtt,PreyContrast,PreyImageArea,EyeSens,Ke,Eb,IER)
endif

!Calculate lethal encounter rate with fish:
FishEnc = VisFieldShape*pi*(VisualRange**2)*FishSwimVel*FishDens

return
end subroutine FishPred