  Massive black holes (BHs) inhabiting galactic nuclei can be described by two
parameters only, i.e. mass and spin, that change through cosmic time in
response to accretion and merger events. While most numerical simulations
accurately track the BH mass, spin evolution is rarely taken into account. In
this work, we implement and validate a self-consistent sub-grid model for the
evolution of the BH mass and spin via gas accretion in the hydrodynamics code
GIZMO. The model assumes that accretion from resolved scales does not occur
instantaneously, but is mediated by a sub-grid geometrically thin
$\alpha$-disc. After validating our model semi-analytically, we test it in an
idealized environment consisting of a circumnuclear disc, where gas accretion
onto the accretion disc is consistently determined by GIZMO. In the absence of
any accretion-related feedback, the spin evolution closely traces that observed
in the semi-analytical models and depends on the free parameters of our
implementation, such as the initial BH spin, angular momentum of the accretion
disc, and the radius at which the gas inflow circularises. In GIZMO, we also
couple our model with the biconical-outflow model presented in a companion
paper, wherein the feedback axis is always aligned with the BH spin. In this
last case, the evolution of the central BH differs significantly from the
previous cases, since the feedback process modifies the gas dynamics and its
inflow rates from resolved scales. Such an interaction cannot be modeled by
simple semi-analytical models and should be treated using full N-body
hydrodynamical simulations.
