  GRB 210731A was a long-duration gamma-ray burst discovered by the Burst Alert
Telescope (BAT) aboard the Neil Gehrels Swift observatory. Swift triggered the
wide-field, robotic MeerLICHT optical telescope in Sutherland; it began
observing the BAT error circle 286 seconds after the Swift trigger and
discovered the optical afterglow of GRB 210731A in its first 60-second q-band
exposure. Multi-colour observations of the afterglow with MeerLICHT revealed a
light curve that showed three peaks of similar brightness within the first four
hours. We present the results of our follow-up campaign and interpret our
observations in the framework of the synchrotron forward shock model. We
performed temporal and spectral fits to determine the spectral regime and
external medium density profile, and performed detailed multi-wavelength
theoretical modelling of the afterglow following the last optical peak at 0.2
days to determine the intrinsic blast wave parameters. We find a preference for
a stellar wind density profile consistent with a massive star origin, while our
theoretical modelling results in fairly typical shock microphysics parameters.
Based on the energy released in gamma-rays and the kinetic energy in the blast
wave, we determine a low radiative efficiency of ~0.02. The first peak in the
optical light curve is likely the onset of the afterglow. We find that energy
injection into the forward shock offers the simplest explanation for the
subsequent light curve evolution, and that the blast wave kinetic energy
increasing by a factor of ~1000 from the first peak to the last peak is
indicative of substantial energy injection. Our highest-likelihood theoretical
model overpredicts the 1.4 GHz flux by a factor of approximately three with
respect to our upper limits, possibly implying a population of thermal
electrons within the shocked region.
