Different applications of the XFEM in one and two dimensions have been realized in a MATLAB software package and are offered as a free download from this site. This software is published under the (very liberal) ISC-license, which is cited at the bottom of this page.
No support for the software is provided. This code is part of the software package that is used in our short courses on the XFEM. The code is introduced and discussed in the course. In addition to the information given below, there is no documentation. We believe that it is, nevertheless, very useful to understand the XFEM based on a working code.
1. Download the zip-files SemXFEM1d.zip and SemXFEM2d.zip.
2. Unzip the two files. In general, the MATLAB path work/ is a good choice for the location.
3. Start MATLAB and write cd SemXFEM1d/ or cd SemXFEM2d/.
4. Call the main functions for the test cases in 1d and 2d as described below.
Each code for the different test cases is structured into the following steps. Many of these steps also apply to classical finite element codes.
A bi-material bar in one dimension is considered. The weak form of the problem is stated as:
A zero-displacement boundary is prescribed on the left. A horizontal line force and a point force on the right end is present. A sketch of the situation is seen below.
The exact displacement field features a kink, i.e. a weak discontinuity, where the material properties change. The mesh does not consider for the discontinuity. That is, the kink is within an element and is captured by means of the XFEM.
Only the main files that have to be called from the MATLAB command line are mentioned. A list of references we refer to on this page is given below.
XFEM1dAbs_Rod(CASE) realizes (i) the standard abs-enrichment  with well-known problems in blending elements, (ii) the abs-enrichment with assumed strain correction  in the blending elements, and (iii) the modified abs-enrichment  without problems in blending elements. Which method is currently active is set by CaseMethod in XFEM1dAbs_Rod(CASE).
XFEM1dSign_Rod(CASE) realizes the sign-enrichment for this test case. As only a weak discontinuity is present, the continuity has to be enforced by a Lagrange multiplier .
VisResults1D visualizes the results from the above routines.
The input variable CASE defines whether the line loading or the point loading is active. If only the point force on the right is active the solution is piecewise linear and can be found exactly by the enriched approximations.
For the two-dimensional solid test cases, the weak form is stated as
which is also known as the principle of virtual work. Four test cases are considered as sketched in the figure below:
(a) Plate composed by two materials, an extension of the 1d test case from above to 2d.
(b) Plate with a circular inclusion.
(c) Plate with a circular hole.
(d) Plate with edge crack.
Dirichlet boundary conditions are applied along the hatched boundaries in the following figure. In all cases, the domain is discretized by structured meshes that do not consider for the discontinuities.
Only the main files that have to be called from the MATLAB command line are mentioned.
XFEM2dRodBiMat_AbsEnr(CASE) solves test case (a) with the standard abs-enrichment . Results are poor due to problems in blending elements.
XFEM2dRodBiMat_SignEnr_1dLM(CASE) solves test case (a) with the sign-enrichment. The continuity is enforced by Lagrange multipliers .
XFEM2dHoleBiMat_AbsEnrMoes solves test case (b) with the modified abs-enrichment .
XFEM2dHoleBiMat_SignEnr_1dLM solves test case (b) with the sign-enrichment. The continuity is enforced by Lagrange multipliers. The results are only sub-optimal due to an over-constrained primal variable space .
XFEM2dVoid_HeaviEnr solves test case (c) with the Heaviside-enrichment . The Heaviside-enrichment is zero inside the hole so that the region is blended out.
FEM2dVoid solves test case (c). The intention is to show that by simply using the classical FEM and neglecting the region of the hole in the integration of the weak form leads to exactly the same results than with the Heaviside-enrichment of XFEM2dVoid_HeaviEnr. Therefore, the XFEM for voids is, in fact, rather a special case of the classical FEM.
XFEM2dCrack_BranchEnr solves test case (d) with the sign-enrichment along the crack path and the branch-enrichment at the crack tip . Optimal convergence rates in the L2-norm, energy norm and stress intensity factors are achieved.
XFEM2dCrack_SignEnr solves test case (d) with the sign-enrichment along the crack path and at the crack tip . The convergence rates are sub-optimal.
VisResults2D visualizes the results from the above routines for the test cases (a) to (d).
 N. Sukumar, D.L. Chopp, N. Moës, T. Belytschko: Modeling holes and inclusions by level sets in the extended finite-element method, Comp. Methods Appl. Mech. Engrg., 190, 6183–6200, 2001.
 J. Chessa, H. Wang, T. Belytschko: On the construction of blending elements for local partition of unity enriched finite elements, Internat. J. Numer. Methods Engrg., 57, 1015–1038, 2003.
 N. Moës, M. Cloirec, P. Cartraud, J.F. Remacle: A computational approach to handle complex microstructure geometries, Comp. Methods Appl. Mech. Engrg., 192, 3163–3177, 2003.
 H. Ji, J.E. Dolbow: On strategies for enforcing interfacial constraints and evaluating jump conditions with the extended finite element method, Internat. J. Numer. Methods Engrg., 61, 2508–2535, 2004.
 N. Moës, J. Dolbow, T. Belytschko: A finite element method for crack growth without remeshing, Internat. J. Numer. Methods Engrg., 46, 131–150, 1999.
The so-called ISC-license applies to all files published under the links on this page:
Copyright (c) 2010, Thomas-Peter Fries, RWTH Aachen University.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.