Welcome to the documentation for dune-fem’s python bindings

This module brings python scripting support to Dune. It serves three purposes:

  1. High level program control for solving partial differential equations using classes from the Dune core and from Dune-Fem. The unified form language UFL is used to describe the mathematical model, all realizations of the Dune grid interface can be used to work with the domain tesselation, and the finite element spaces, operator, and solvers provided by Dune-Fem for the descritizations and solving steps. All of this is available within 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. So new implementations of the Dune grid interface can be easily tested. For Dune-Fem developers, new grid views, discrete function spaces, and scheme classes following the Dune-Fem-Howto concept can be added and tested.

An Overwiew of this Document

This document tries to describe the main concepts needed to get a new user started on solving complex partial differential equations using the Dune-Fem python bindings. Some parts are still quite raw and we would greatly appreciate any help improving this document. In addition if you would like to promote your own work then please upload a script showcasing some simulation you did bases on this package - it is possibly as easy as providing us with a Python script. More details on how to help us improve and extend this document see the section on How to showcase your own project.

Here is a quick summary of the different parts of this document - all of the code is available for download in form of both Notebooks and Scripts.

  1. First off some remarks on getting the package to work: an easy way of testing but also developing code within the Dune python framework is to use docker. Working from the git sources is also discussed.
  2. A simple scalar, non linear time dependent partial differential equation is used to describe the basic concepts. This leads through the steps required to set up the problem, solve the system of equations, and visualize the results. After this introduction we discuss how to use different solver backends (including for example scipy and petsc). We then provide more detail on how to use the Dune grid interface, attach data to the grid entities and define general grid functions. Finally, some more examples building up on the general concepts described in the first part. The Notebooks and Scripts used for each of these and the following examples can be downloaded and are hopefully useful as starting point for new projects.
  3. Local grid refinement and coarsening is a central feature of Dune-Fem. Here we show how to use it for stationary and time dependent problems. Grid adaptivity makes use of special grid views. Other views are also available, one of these can be used to deform the grid given an arbitrary (discrete) vector field. This is used to compute the evolution of a surface under mean curvature flow.
  4. Finally other projects are presented some of them developed by the authors of this document, some contributed by other users. If you have used this package then we would like to hear about it and would ask you to contribute to this chapter. Doing so is quite easy (see How to showcase your own project for details).


Indices and Tables