White dwarf stars are subject to various element transport mechanisms that can cause their surface composition to change radically as they cool, a phenomenon known as spectral evolution. In this paper, we undertake a comprehensive theoretical investigation of the spectral evolution of white dwarfs. First, we introduce STELUM, a new implementation of the stellar evolutionary code developed at the Universit\'e de Montr\'eal. We provide a thorough description of the physical content and numerical techniques of the code, covering the treatment of both stellar evolution and chemical transport. Then, we present two state-of-the-art numerical simulations of element transport in evolving white dwarfs. Atomic diffusion, convective mixing, and mass loss are considered simultaneously as time-dependent diffusive processes and are fully coupled to the cooling. We first model the PG 1159$-$DO$-$DB$-$DQ evolutionary channel: a helium-, carbon-, and oxygen-rich PG 1159 star transforms into a pure-helium DB white dwarf due to gravitational settling, and then into a helium-dominated, carbon-polluted DQ white dwarf through convective dredge-up. We also compute for the first time the full DO$-$DA$-$DC evolutionary channel: a helium-rich DO white dwarf harboring residual hydrogen becomes a pure-hydrogen DA star through the float-up process, and then a helium-dominated, hydrogen-bearing DC star due to convective mixing. We demonstrate that our results are in excellent agreement with available empirical constraints. In particular, our DO$-$DA$-$DC simulation perfectly reproduces the lower branch of the bifurcation observed in the Gaia color-magnitude diagram, which can therefore be interpreted as a signature of spectral evolution.
Comment: 23 pages, 6 figures, accepted for publication in The Astrophysical Journal