Skip to content
Mikael Mortensen edited this page Aug 15, 2017 · 50 revisions

Welcome to the fenicstools wiki!

The fenicstools repository contains tools for the FEniCS problem solving environment. The tools were developed originally because of an interesting problem we faced when our simulations were becoming larger on remote clusters, whereas our laptops were still relatively small. We could run simulations, but not visualize our results! With fenicstools it is possible to slice any geometry and store these slices to vtk-files. A simulation we did of cerebrospinal fluid illustrates this nicely. The simulation used 30 million elements divided up between approximately 100 compute cores, and if we stored the entire solution to a vtk-file, then it certainly required more RAM memory than available on our laptops to have a look at it. Storing the results in only certain slices of the geometry, visualization could be performed easily. The figure below shows the velocity magnitude throughout the spine:

CSF flow

As evident from the figure data in the slice outside of the mesh is set to zero. Alternatively one may also extract data for a 3D box for some interesting part of the geometry. The data can still be dumped to vtk and visualized using, e.g., ParaView.

The tools in this repository have mainly been developed to be used for large scale simulations of fluid flow in general and especially turbulent flow. However, the tools should be applicable for all sorts of simulations using the FEniCS problem solving environment.

The backbone of the Probe functionality lies in the Probe folder that contains C++ implementations of 4 classes called

The last two are intended only for turbulence simulations. And don't worry, the classes are compiled and linked automatically at runtime using instant. All you need to do to use it is to clone and then put the path to the repository on your PYTHONPATH. To import it:

from fenicstools import *

Other than these classes there are some convenience functions and classes in the python file Probe.py. The most important is the class StructuredGrid, which can be used to set probes in a 2D slice or a 3D box.

The module WeightedGradient.py contains a function that computes a weighted gradient matrix

The module GaussDivergence.py contains a function that computes divergence using Gauss divergence theorem.

The module DofMapPlotter.py can be used to visualize maps of degrees of freedom of FE function spaces.