# Fenics¶

This uses Singularity containers, so you should refer to that page first for general information.

Fenics-images are based on these images.

## Usage¶

This example shows how you can run a fenics example. To run example one should first copy the examples from the image to a suitable folder:

mkdir -p $WRKDIR/fenics cd$WRKDIR/fenics
module load singularity-fenics
singularity_wrapper exec cp -r /usr/local/share/dolfin/demo demo


The examples try to use interactive windows to plot the results. This is not available in the batch queue so to fix this one needs to specify an alternative matplotlib backend. This patch file fixes example demo_poisson.py. Download it into \$WRKDIR/fenics and run

patch -d demo -p1 < fenics_matplotlib.patch


to fix the example. After this one can run the example with the following Slurm script:

#!/bin/bash
#SBATCH -p short
#SBATCH -t 00:15:00
#SBATCH -n 1
#SBATCH --mem=1G
#SBATCH -o fenics_out.out

module purge
module load singularity-fenics

cd demo/documented/poisson/python/

srun singularity_wrapper run demo_poisson.py



To submit the script one only needs to run:

sbatch fenics.slrm


Resulting image can be checked with e.g.:

eog demo/documented/poisson/python/poisson.png