The top side boundary condition loop is

do 150 i=2,nxd-1 u3(i,nzd) = u2(i,nzd)+u2(i,nzd-1)-u1(i,nzd-1)- x cb(i,nzd)*(u2(i,nzd)-u2(i,nzd-1)- x u1(i,nzd-1)+u1(i,nzd-2)) 150 continueCode Fragment III

The bottom side boundary condition loop is

do 130 i=2,nxd-1 u3(i,nzd) = u2(i,nzd)+u2(i,nzd-1)-u1(i,nzd-1)- x cb(i,nzd)*(u2(i,nzd)-u2(i,nzd-1)- x u1(i,nzd-1)+u1(i,nzd-2)) 130 continueCode Fragment IV

The difficulty the one way wave equation has for waves which arrive at angles other than normal could be fixed by making an angle dependent method.

The wave field is used to determine an incoming wave direction, and the wave field is decomposed into two parts, normal and tangential. If more than one wave is active in the boundary region, it makes the direction and decomposition quite complex. A considerable amount of work has been done in developing boundary conditions and angle dependent boundary conditions; students are not encouraged to plow this old ground. The damping method, presented next, is suitable for most modeling methods and overcomes the angle dependent difficulty in an elegant way; ``it does not care where the wave comes from''. Further, it is independent of the degree of approximation for the wave equation.