Wave propagation simulation requires a correct implementation of boundary conditions to avoid numerical instabilities. Similar problems are posed by domain decomposition methods where the aim is to find the correct modeling of physical phenomena across the interfaces separating the subdomains. The technique described here is based on physical grounds since it relies on the fact that the wave equation can be decomposed into incoming and outgoing wave modes at the boundary. The result is a modified wave equation for the boundaries which automatically includes the boundary condition. The boundary treatment is applied to a realistic problem of ultrasonic wave propagation through a vertical interface separating an anelastic solid at the surface. The results show that the method correctly describes the anelastic properties of the Rayleigh wave in the presence of a strong contrast in the material properties.