Skip to content
forked from ngsxfem/ngsxfem

Add-On to NGSolve for unfitted finite element discretizations (XFEM, CutFEM, TraceFEM, etc...)

License

Notifications You must be signed in to change notification settings

ChrLackner/ngsxfem

 
 

Repository files navigation

About ngsxfem

ngsxfem is an Add-on library to 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.

The main features

Numerical integration on implicitly described (via a level set function) geometries which are not fitted to the mesh

Given a level set function φ which describes the geometry (e.g. Ω = { φ < 0 }) a piecewise linear approximation is made. On simplices (triangles and tetrahedra) this gives a planar intersection on every element which allows for an explicit decomposition into simple geometries. On these simple (uncut) geometries standard quadrature rules of arbitrary order can be applied which results in quadrature rules for the (approximated) subdomains where the level set is positive/negative/zero.

Tools to work on an “active mesh” only

In unfitted finite element methods some functions and integrals are only defined on a subset of the mesh. Accordingly finite element spaces and integrals have to be defined only on this active mesh. ngsxfem offers the tools to mark the corresponding elements and facets and use the marking during assembly and definition of finite element spaces. On cut elements one often also uses locally modified finite elements, e.g. by restriction of finite elements on the background mesh.

Higher order representation of implicit level-set geometries

To obtain higher order accuracy, we offer a mesh transformation technique in the spirit of isoparametric finite element methods. Thereby the piecewise linear approximation (which is only of second order) is mapped onto a higher order accurate approximation of the true geometry.

Space-Time Finite Elements for the treatment of moving domain problems

To obtain robust method for PDEs on unfitted moving domain we can formulate space-time discretization. ngsxfem provides necessary tools (so far only in two space dimensions) to define space-time finite element spaces and to integrate on space-time domains. Further, it extends the tools for higher order accurate geometry handling to the space-time setting.

Applications

This section is to be added soon …

Installation

Linux Build Steps

You require Netgen/NGSolve to run and build the xfem module (ngsxfem). You can either install it before hand (default option) or let Netgen/NGSolve be installed as an external dependency.

git clone https://github.com/ngsxfem/ngsxfem.git
cd ngsxfem
mkdir build
cd build

Building xfem with pre-installed NGSolve

You have Netgen/NGSolve installed? Perfect. Then let INSTLOCATION be the location Netgen/NGSolve is already installed to. To install xfem make sure that you have write access to that same directory. Then build ngsxfem with

cmake ../ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=OFF
make
make install

Prerequisites on Ubuntu

On Ubuntu you require python3-dev to build ngsxfem (and similar dependencies as NGSolve has, cf. www.ngsolve.org)

Fix of potential issues

If you have compiling problems or at run time some NGSolve symbols are not found, it may be (happened in some configurations) that the NGSolve compiler and linker wrapper ngscxx and ngsld were not used. In this case you may add

cmake ... -DCMAKE_CXX_COMPILER=ngscxx -DCMAKE_LINKER=ngsld

to the cmake configuration.

ngsxfem on MacOSX

On MacOSX, you need to add the location of the NGSolve cmake configuration files, i.e.:

cmake \
-DCMAKE_INSTALL_PREFIX=NGSOLVE_INSTALLATION_LOCATION \
-DNGSolve_DIR=NGSOLVE_INSTALLATION_LOCATION/Contents/Resources/CMake \
-DBUILD_NGSOLVE=OFF \
..

If NGSolve is installed from the dmg-file NGSOLVE_INSTALLATION_LOCATION is /Applications/Netgen.app.

Building the NGS-Suite and ngsxfem together

If you do not have Netgen/NGSolve installed, you may first call

git submodule update --init

which pulls Netgen/NGSolve as external dependencies. Then, just call

cmake ../ -DCMAKE_INSTALL_PREFIX=INSTLOCATION -DBUILD_NGSOLVE=ON
make
make install

For INSTLOCATION you choose a nice installation location. Afterwards make sure that the installed NGS/xfem-libraries and executable will be found by PATH and python.

Updating ngsxfem

To update ngsxfem, update the sources

git pull origin master

As the ngsolve-version that the updated xfem-version depends on can be updated in the mean time, make sure to update NGSolve. If you build NGSolve as an external dependency update the submodule NGSolve:

git submodule update --init --recursive

Otherwise update your NGSolve version manually. As a rule we try to be compatible to the latest release of NGSolve. To be sure check the version in external_dependencies/ngsolve

Examples

To run the python examples be sure to follow the build steps above. Then navigate into the py_tutorials and run

netgen example.py

where example.py stands for any of the available python files.

Testing

Tests are enabled by default. To run the test navigate to the build directory and run make test or ctest. If you need to see specific tests failing use ctest -V. To run individual tests use ctest -R <regex>. E.g. ctest -R cutint to only run cut integration tests. Note that we use pytest (with python version > 3).

pde vs. py files

From version 1.0.0 on there are no pde-files used in this project anymore. Only python-files are used.

Examples

At https://github.com/ngsxfem/ngsxfem-jupyter you can find tutorial-style jupyter notebooks for ngsxfem. Further, in py_tutorials/ there are some simple examples for some known unfitted discretizations:

  • py_tutorials/cutfem.py : stationary interface problem with a (P1) CutFEM method with Nitsche
  • py_tutorials/nxfem.py : stationary interface problem with a (P1) XFEM method with Nitsche (similar to cutfem.py)
  • py_tutorials/nxfem_higher_order.py : stationary interface problem with a higher order isoparametric unfitted FEM with Nitsche (similar to nxfem.py)
  • py_tutorials/fictdom_ghostpen.py : stationary fictitious domain problem with isoparametric CutFEM, Nitsche and ghost penalty stabilization
  • py_tutorials/fictdom_dg_ghostpen.py : stationary fictitious domain problem with isoparametric Cut-DG-FEM, Nitsche and ghost penalty stabilization
  • py_tutorials/stokesxfem.py : stationary Stokes interface problem with an isoparametric (P2X/P1X) Taylor-Hood-Nitsche-XFEM discretization
  • py_tutorials/tracefem.py : stationary 2D surface PDE problem with a TraceFEM discretization (low order)
  • py_tutorials/tracefem3d.py : stationary 3D surface PDE problem with a TraceFEM discretization (higher order)
  • spacetime/py_tutorials/spacetimeP1P1.py : moving fictitous domain problem using a space time unfitted FEM

Literature

ngsxfem has been used in the following scientific articles (that we are aware of):

  • T. Jankuhn, A. Reusken. Higher order Trace Finite Element Methods for the Surface Stokes Equation pdf
  • T. Jankuhn, A. Reusken. Trace Finite Element Methods for Surface Vector-Laplace Equations pdf
  • E. N. Karatzas, F. Ballarin, G. Rozza. Projection-based reduced order models for a cut finite element method in parametrized domains pdf
  • C. Lehrenfeld, M. A. Olshanskii. An Eulerian finite element method for PDEs in time-dependent domains pdf
  • F. Heimann, C. Lehrenfeld. Numerical integration on hyperrectangles in isoparametric unfitted finite elements. link
  • C. Lehrenfeld, A. Reusken. L2-estimates for a high order unfitted finite element method for elliptic interface problems. http
  • J. Grande, C. Lehrenfeld, A. Reusken. Analysis of a high-order trace finite element method for PDEs on level set surfaces http
  • C. Lehrenfeld, A. Reusken. Analysis of a high order unfitted finite element method for an elliptic interface problem. http
  • C. Lehrenfeld, A. Reusken. Optimal preconditioners for Nitsche-XFEM discretizations of interface problems. http
  • C. Lehrenfeld. High order unfitted finite element methods on level set domains using isoparametric mappings. http
  • C. Lehrenfeld. A higher order isoparametric fictitious domain method for level set domains. http
  • P. Lederer, C.-M. Pfeiler, C. Wintersteiger, C. Lehrenfeld. Higher order unfitted FEM for Stokes interface problems. http
  • C. Lehrenfeld. Removing the stabilization parameter in fitted and unfitted symmetric Nitsche formulations. http

About

Add-On to NGSolve for unfitted finite element discretizations (XFEM, CutFEM, TraceFEM, etc...)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 66.4%
  • Python 31.6%
  • CMake 2.0%