SummaryA finite element formulation is proposed and implemented for analysing the stability of excavated wells using the DiMaggio‐Sandler constitutive elastoplastic model with a typical carbonate reservoir configuration. The quality of the finite element approximation is ensured by applying smooth curved elements adapted to the wellbore geometry, and h − p adaptive finite element meshes in the plastic zone. General purpose procedures are defined to transfer the elastoplastic deformation history to newly created integration points. A breakout damage criterion is proposed based on the second invariant of the deviatoric plastic deformation tensor. This damage criterion is used to apply a mesh movement algorithm to represent material collapse. The automatic successive application of the breakout damage criterion results in elliptical realistically looking geometries obtained in experiments reported in the literature.