Total: 1
It is well known that a scalar field dark matter with a quadratic potential undergoes fast oscillations when the time period represented by the mass scale in the Klein-Gordon equation becomes much smaller than that set by the Hubble parameter. This makes a solution to the equation numerically intractable. Many works in the literature have addressed the problem by either switching between solving the Klein-Gordon equation in the well-behaved regime to solving the fluid equations at the onset of oscillations, or by introducing a new set of variables that can absorb these oscillations. Despite being successful, these techniques rely on an estimate of when the oscillations start. For large scale scans of a model's parameter space, this can become cumbersome. Furthermore, the techniques have been used mainly for non-interacting dark matter models. In this work, we introduce an averaging technique with an automatic detection of the onset of oscillations, capable of capturing the non-interacting as well as the interacting dark matter scenarios. The technique, implemented in \texttt{CLASS}, is tested on the QCDM model and shows excellent detection and averaging abilities. We also update the cosmological constraints on the model using the most recent public data.