varfrac-solvers is distributed as supplemental material to the paper

Linear and nonlinear solvers for variational phase-field models of brittle fracture, P. E. Farrell and C. Maurini

The pdf of the paper can be downloaded here in Open Access.

This repository is distributed to provide a minimal working implementation and examples of the solvers discussed in the paper.


If you use varfrac-solvers in your work we would ask that you consider citing our paper.

@article {NME:NME5300,
author = {Farrell, Patrick and Maurini, Corrado},
title = {Linear and nonlinear solvers for variational phase-field models of brittle fracture},
journal = {International Journal for Numerical Methods in Engineering},
volume = {10
number = {5},
issn = {1097-0207},
url = {},
doi = {10.1002/nme.5300},
pages = {648--667},
keywords = {fracture, damage, variational methods, phase-field, nonlinear Gauss´┐ŻSeidel, Newton's method},
year = {2017},
note = {nme.5300},


  • The directory examples contains a working example (the thermal shock problem reported in the paper).

  • The directory fracture contains the basic solver source files.

Getting started

  • To run the example you should have the following environment variables set:


  • You may need to add the directory of your MPI headers to the include_dirs variable in fracture/

  • Run the example:

    cd examples/thermal-shock python

  • The default parameters are set to run a full simulation in a relatively short time. The key parameters may be set at the command line.

    • The simulation in Figure of the paper can be reproduced with the command-line

      python --user.L 40 --user.H 10 --user.tmax 5. --user.intensity 4.0 --user.overrelaxation 1.0 - To get a list of available user parameters, run with --help - To test the different solvers proposed in the paper you can run with

      python --petsc_args args where args can be selected among the following values (ORAM and ORAM-N refer to the algorithms presented in the paper)

      • am_lu_args (ORAM with ideal linear solver)
      • am_ksp_args (ORAM with iterative linear solver)
      • am_newton_lu_args (ORAM-N with ideal solvers)
      • am_newton_ksp_ideal_args (ORAM-N with iterative outer solver and ideal inner solvers),
      • am_newton_ksp_args (ORAM-N with fully iterative solvers)

      The solver parameters are set through the PETSc command line parameters available in fracture/


The code has been tested against the following git revisions of PETSc and FEniCS.

To run the code you can follow one of the following possibilities

  1. Compile the required version of PETSc and FEniCS on your own by following the instructions here.

  2. Use the provided vagrant/virtualbox virtual machine:

    • Install vagrant []

    • Go to a working directory, download and start the vagrant/virtualbox virtual machine by typing at the command line (attention it needs to download about 3 GB)

      vagrant init cmaurini/fenics-dev-1.7; vagrant up --provider virtualbox

    • Clone this repository and enter the virtual machine

      git clone

      vagrant ssh

      The current working directory will be shared in the /vagrant directory in the virtual machine. The username and password in the virtual machine are both vagrant

    • You have now a terminal run by the virtual machine and you can play with the example:

      cd /vagrant/varfrac-solvers/examples/thermal-shock


  3. Use the docker virtual machine provided in the fenics website. Hence use the code in the branch docker-fenics-2016.2.0.

PETSc/SLEPc's components

FEniCS's components:

Issues and Support

Please use the bugtracker to report any issue.

For support or questions please email


  • Patrick Farrell, Mathematical Institute, University of Oxford, Oxford, UK and Center for Biomedical Computing, Simula Research Laboratory, Oslo, Norway

  • Corrado Maurini, Institut Jean Le Rond d'Alembert, Sorbonne Universit\'es, UPMC, Univ Paris 06, CNRS, UMR 7190, France


varfrac-solvers is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with fenics-shells. If not, see