c ---------------------------------------------

	subroutine  rec_int(x,nx,xr,f,out)

c this routine interpolates linearly a scalar field known at 
c x(0:nx) and y(0:ny) locations to an arbitrary location
c within xmax and ymax.
c The receiver locations are xr,  the scalar input
c field is plane and the function value at xr  is
c out.

	real x(nx)
	real xr,out
	real f(nx)

	do i=1,nx-1
	if(xr .ge. x(i) .and. xr .lt. x(i+1) ) then
	ilow=i
	iup =i+1
	dx=x(i+1)-x(i)
	hx=xr-x(i)
	endif
	enddo

	f1=f(ilow)
	f2=f(iup)

	out = f1 + (f2-f1)/dx*hx

	return
	end

