Because of their nonvolatile nature and simple structure, the interest in MRAM devices has been steadily growing in recent years. Reliable simulation tools, capable of handling complex geometries composed of multiple materials, provide valuable help in improving the design of MRAM cells. In this work, we describe a solver based on the finite element implementation of the Landau–Lifshitz–Gilbert equation coupled to the spin and charge drift-diffusion formalism. The torque acting in all layers from different contributions is computed from a unified expression. In consequence of the versatility of the finite element implementation, the solver is applied to switching simulations of recently proposed structures based on spin-transfer torque, with a double reference layer or an elongated and composite free layer, and of a structure combining spin-transfer and spin-orbit torques.