Welcome to the dune-fem tutorial (for version 2.10)

This module brings python scripting support to Dune. This version describes the bindings for the development version (to become 2.10). The bindings serves three purposes:

  1. High level program control for solving partial differential equations using classes from the Dune core and from Dune-Fem [BBD+08, DKNO10] with a recent update provided in [BBD+21]. The unified form language UFL [ALO+13] is used to describe the mathematical model, all realizations of the Dune grid interface can be used to work with the domain tessellation, and the finite element spaces, operator, and solvers provided by Dune-Fem for the discretizations and solving steps. All of this is available to be used in python scripts or through Jupyter notebooks.

  2. Rapid prototyping of new methods or other parts of a simulation is easy since the interfaces provided are very similar to the Dune C++ interface. This makes it easy to transfer a working prototype from python (easy to develop) to C++ (high efficiency). Small C++ code snippets can be easy called from python using just in time compilation.

  3. Rapid prototyping of new implementations of Dune interfaces. For example new implementations of the Dune grid interface can be easily tested. For Dune-Fem developers, new grid views, discrete function spaces, and scheme classes can be added and tested.

Table of Content



James Ahrens, Berk Geveci, and Charles Law. Paraview: an end-user tool for large data visualization. The visualization handbook, 2005. URL: https://www.paraview.org.


M. Alnaes, A. Logg, K. Olgaard, M. Rognes, and G. Wells. A Unified Form Language: A domain-specific language for weak formulations of partial differential equations. 2013. URL: https://arxiv.org/abs/1211.4047.


P.-E. Angeli, M.-A. Puscas, G. Fauchet, and A. Cartalade. FVCA8 Benchmark for the Stokes and Navier–Stokes Equations with the TrioCFD Code—Benchmark Session. In Clément Cancès and Pascal Omnes, editors, Finite Volumes for Complex Applications VIII - Methods and Theoretical Aspects, 181–202. Springer, 2017. doi:10.1007/978-3-319-57397-7_12.


Satish Balay, Shrirang Abhyankar, Mark F. Adams, Jed Brown, Peter Brune, Kris Buschelman, Lisandro Dalcin, Alp Dener, Victor Eijkhout, William D. Gropp, Dinesh Kaushik, Matthew G. Knepley, Dave A. May, Lois Curfman McInnes, Richard Tran Mills, Todd Munson, Karl Rupp, Patrick Sanan, Barry F. Smith, Stefano Zampini, Hong Zhang, and Hong Zhang. PETSc Web page. http://www.mcs.anl.gov/petsc, 2018. URL: http://www.mcs.anl.gov/petsc.


P. Bastian, M. Blatt, A. Dedner, C. Engwer, R. Klöfkorn, R. Kornhuber, M. Ohlberger, and O. Sander. A Generic Grid Interface for Parallel and Adaptive Scientific Computing. Part II: Implementation and Tests in DUNE. Computing, 82(2–3):121–138, 2008. doi:10.1007/s00607-008-0004-9.


P. Bastian, M. Blatt, M. Dedner, N.-A. Dreier, R. Engwer, Ch. Fritze, C. Gräser, Ch. Grüninger, D. Kempf, R. Klöfkorn, M. Ohlberger, and O. Sander. The Dune framework: Basic concepts and recent developments. CAMWA, 2021. doi:10.1016/j.camwa.2020.06.007.


Michel Bercovier and Michael Engelman. A finite element for the numerical solution of viscous incompressible flows. Journal of Computational Physics, 30(2):181–201, 1979. doi:10.1016/0021-9991(79)90098-6.


Markus Blatt and Peter Bastian. The iterative solver template library. In International Workshop on Applied Parallel Computing, 666–675. Springer, 2006.


S. Brdar, A. Dedner, and R. Klöfkorn. Compact and stable Discontinuous Galerkin methods for convection-diffusion problems. SIAM J. Sci. Comput., 34(1):263–282, 2012. doi:10.1137/100817528.


Lisandro D Dalcin, Rodrigo R Paz, Pablo A Kler, and Alejandro Cosimo. Parallel distributed computing using python. Advances in Water Resources, 34(9):1124–1139, 2011. doi:10.1016/j.advwatres.2011.04.013.


Klaus Deckelnick, Gerhard Dziuk, and Charles M Elliott. Computation of geometric partial differential equations and mean curvature flow. Acta numerica, 14:139–232, 2005. doi:10.1017/S0962492904000224.


A. Dedner and A. Hodson. Robust nonconforming virtual element methods for general fourth-order problems with varying coefficients. IMA Journal of Numerical Analysis, :, 2021. doi:10.1093/imanum/drab003.


A. Dedner, B. Kane, R. Klöfkorn, and M. Nolte. Python framework for hp adaptive discontinuous galerkin methods for two-phase flow in porous media. Applied Mathematical Modelling, 67:, 10 2018. doi:10.1016/j.apm.2018.10.013.


A. Dedner and R. Klöfkorn. Extendible and Efficient Python Framework for Solving Evolution Equations with Stabilized Discontinuous Galerkin Method. Commun. Appl. Math. Comput., 2021. doi:10.1007/s42967-021-00134-5.


A. Dedner, R. Klöfkorn, M. Nolte, and M. Ohlberger. A Generic Interface for Parallel and Adaptive Scientific Computing: Abstraction Principles and the DUNE-FEM Module. Computing, 90(3–4):165–196, 2010. doi:10.1007/s00607-010-0110-3.


A. Dedner and M. Nolte. The DUNE-PYTHON Module. CoRR, 2018. arXiv:1807.05252.


John D Hunter. Matplotlib: a 2d graphics environment. Computing in science and engineering, 9(3):90–95, 2007.


Eric Jones, Travis Oliphant, Pearu Peterson, and others. SciPy: open source scientific tools for Python. 2001–. URL: http://www.scipy.org/.


T. Kieu. Galerkin Finite Element Method for Generalized Forchheimer Equation of Slightly Compressible Fluids in Porous Media. 2015. URL: https://arxiv.org/abs/1508.00294.


Ravi Malladi and James A. Sethian. Image processing: flows under min/max curvature and mean curvature. Graphical models and image processing, 58(2):127–141, 1996.


Travis E Oliphant. A guide to NumPy. Volume 1. Trelgol Publishing USA, 2006.


J. Wenzel, J. Rhinelander, and D. Moldovan. Pybind11 – seamless operability between c++11 and python. 2017. URL: https://github.com/pybind/pybind11.