Time-series spectroscopy of the rapidly oscillating Ap star HR 3831