  Pseudospectral time domain (PSTD) methods are widely used in many branches of
acoustics for the numerical solution of the wave equation, including biomedical
ultrasound and seismology. The use of the Fourier collocation spectral method
in particular has many computational advantages. However, the use of a discrete
Fourier basis is also inherently restricted to solving problems with periodic
boundary conditions. Here, a family of spectral collocation methods based on
the use of a sine or cosine basis is described. These retain the computational
advantages of the Fourier collocation method but instead allow homogeneous
Dirichlet (sound-soft) and Neumann (sound-hard) boundary conditions to be
imposed. The basis function weights are computed numerically using the discrete
sine and cosine transforms, which can be implemented using O(N log N)
operations analogous to the fast Fourier transform. Practical details of how to
implement spectral methods using discrete sine and cosine transforms are
provided. The technique is then illustrated through the solution of the wave
equation in a rectangular domain subject to different combinations of boundary
conditions. The extension to boundaries with arbitrary real reflection
coefficients or boundaries that are non-reflecting is also demonstrated using
the weighted summation of the solutions with Dirichlet and Neumann boundary
conditions.
