Abstract:The extended finite element method (XFEM) has been one of the privileged tools for crack analysis due to its significant advantages: (1) Independence of crack geometry on the simulation mesh; (2) no necessity of remeshing when a crack grows; and (3) high accuracy. However, the method is hindered in engineering practices by the partitioning difficulty of discontinuous elements, i.e. the geometric interaction between discontinuous interfaces and solid elements. Though current partitioning algorithms are geometrically exact, they are cumbersome to implement, computationally expensive, and insufficiently robust. To overcome these issues, a templated partitioning algorithm is proposed based on element level sets for subdivision and numerical integration of discontinuous elements. Firstly, a templated partitioning library for standard discontinuous elements is established by enumerating all the patterns of element level set values. Secondly, the pattern of a non-standard element to be partitioned is looked up and the sub-coordinates are interpolated based on the element level set values. Lastly, the non-standard element is efficiently partitioned into sub-triangles based on the standard element template. The algorithm is incorporated into the conventional XFEM and the improved XFEM for analysis of discontinuous problems, i.e. the problems with holes, inclusions, cracks and so forth. Numerical examples indicate that the proposed algorithm achieves favorable accuracy. Without cumbersome geometrical operations, the templated partitioning algorithm is also efficient and robust, thereby enabling itself to support the extended finite element methods in practical engineering problems.