Skip to main content

(ngs)xfem is an Add-on library to Netgen/NGSolve for unfitted/cut FEM.

Project description

GitHub Workflow Status GitHub release (latest by date) jossstatus

PyPI PyPI - Implementation PyPI - Downloads

Docker Pulls badge



A preliminary collection of documentation (demos, tutorials, mini API) can be found here. A simple doxygen collection of NGSolve, ngsxfem and ngstrefftz C++ API can be found here.

About ngsxfem

ngsxfem is an add-on library to the finite element package Netgen/NGSolve which enables the use of unfitted finite element technologies known as XFEM, CutFEM, TraceFEM, Finite Cell, ... . ngsxfem is an academic software. Its primary intention is to facilitate the development and validation of new numerical methods for partial differential equations.

The features of ngsxfem

The main features of ngsxfem are:

  • Tools to work on a subset of the triangulation, the "active mesh" only
  • Numerical integration on geometries that are (implicitly) described through level set functions.
  • Higher order representation of level set geometries
  • Space-Time Finite Elements for the treatment of moving domain problems
  • All these features combined with the usual flexibility and power of NGSolve.

ngsxfem has been used in a variety of applications. In the document doc/ (see also compiled pdf ) more details on the features is given and in doc/ (see also literature ) an overview of the scientific literature where ngsxfem is used is provided.

Not all features of ngsxfem and NGSolve can directly be combined. Here is an overview of ngsxfem and NGSolve features and if they can directly be combined:

Features ⇲ CFE XFE DG Iso MLS ST Gh Ag Hex Tet MPI
CFE: CutFEM form. / / y y y y y y y y y
XFE: XFEM formulation / / y y n n y n y y y
DG: Discont. Galerkin y y / y n y y y y y n
Iso: isoparametric map y y y / n y y y y y y
MLS: multiple level set y n n n / n y y n y y
ST: space-time FEM y n y y n / y n y y y
Gh: Ghost penalty y y y y y y / / y y n
Ag: Agg. FEM y n y y y n / / y y n
Hex: quads / hexes y y y y n y y y / / y
Tet: trigs./tets y y y y y y y y / / y
MPI: MPI y y n y y y n n y y /

Some of the nos are work in progress and some have not been considered so far. If you need a certain combination to work, please contact us and we will see what we can do.

Examples and Documentation

We provide two main sources with which to learn how to use ngsxfem:

  • At you can find tutorial-style jupyter notebooks for ngsxfem. These explain the core functionalities and usage of the tools provided by ngsxfem. You can run those tutorials interactively (without the need of a local installation) through binder.
  • In the demos-directory we provide several examples that demonstrate the usage of ngsxfem features. See demos/ for details.


We provide installation instructions for building/installing through pip and building/installing from sources in Further, a docker image is available which can be used to run ngsxfem through docker.

List of contributing authors

Major contributions:

  • Christoph Lehrenfeld (main author)
  • Fabian Heimann (cut integration, space-time, AggFEM)
  • Henry von Wahl (multiple levelsets, mac support, AggFEM)
  • Janosch Preuss (space-time)
  • Thomas Ludescher (multigrid)
  • Paul Stocker (CI, docu, builds, AggFEM)

Additional contributions:

  • Pedro Costa Klein (CI, docu)
  • Maximilian Zienecker (SIMD, CI)

Community guidelines

If you observe any problems with the software / examples / documentation / installation or want to contribute, you can get in touch with us through either:


If you use ngsxfem for academic work, please consider citing our publication:

C. Lehrenfeld, F. Heimann, J. Preuß and H. von Wahl
ngsxfem: Add-on to NGSolve for geometrically unfitted finite element discretizations
Journal of Open Source Software, 6(64), 3237,

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xfem-2.1.2404.tar.gz (2.2 MB view hashes)

Uploaded Source

Built Distributions

xfem-2.1.2404-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

xfem-2.1.2404-cp312-cp312-macosx_10_15_universal2.whl (2.2 MB view hashes)

Uploaded CPython 3.12 macOS 10.15+ universal2 (ARM64, x86-64)

xfem-2.1.2404-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

xfem-2.1.2404-cp311-cp311-macosx_10_15_universal2.whl (2.2 MB view hashes)

Uploaded CPython 3.11 macOS 10.15+ universal2 (ARM64, x86-64)

xfem-2.1.2404-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

xfem-2.1.2404-cp310-cp310-macosx_10_15_universal2.whl (2.2 MB view hashes)

Uploaded CPython 3.10 macOS 10.15+ universal2 (ARM64, x86-64)

xfem-2.1.2404-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

xfem-2.1.2404-cp39-cp39-macosx_10_15_universal2.whl (2.2 MB view hashes)

Uploaded CPython 3.9 macOS 10.15+ universal2 (ARM64, x86-64)

xfem-2.1.2404-cp38-cp38-win_amd64.whl (806.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

xfem-2.1.2404-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

xfem-2.1.2404-cp38-cp38-macosx_10_15_universal2.whl (2.2 MB view hashes)

Uploaded CPython 3.8 macOS 10.15+ universal2 (ARM64, x86-64)

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page