A spectral element method for surface wave dispersion and adjoints