CVODE support for FEniCS
eCSE09-004Key Personnel
PI/Co-I: Dr. Chris Richardson - University of Cambridge, Prof. Hans Fangohr - University of Southampton, Dr. Garth Wells - University of Cambridge
Technical: Chris Hadjigeorgiou - University of Cambridge
Relevant Documents
eCSE Technical Report: CVODE support for FEniCS
Project summary
FEniCS (https://fenicsproject.org) is a widely used platform for solving partial differential equations (PDEs). PDEs describe physical laws, such as how heat travels, or magnetisation varies in a magnetic specimen.
FEniCS is based on the finite element method (FEM). However, support for time-dependent equations in FEniCS has been quite limited. It required the user/developer to implement their own scheme of advancing in time, rather than exploiting a library for a wide range of well tested schemes. In this project, we have extended FEniCS to support the SUNDIALS CVODE . SUNDIALS CVODE provides methods for solving systems of ordinary differential equations, which when coupled to FEniCS provides a wide range of methods for solving time-dependent partial differential equations. Time-stepping schemes for time-dependent equations is essential to model many physical problems, and the development in this project will allow the many researchers use FEniCS to use the more sophisticated time-stepping schemes provided by SUNDIALS CVODE.
Key Features
A scientific driver for this project was the solution of time-dependent micromagnetics equations with FEniCS in parallel. We have provided a Python interface from FEniCS to CVODE and it is now possible to solve time-dependent micromagnetics equations in parallel using FEniCS and CVODE. The user only needs to provide an initial vector and callbacks for computing time derivatives and their Jacobians. The vector is then handled internally, and can be advanced in time by a simple function call. The implemented pattern mirrors that in the CVODE documentation, and is easy to follow.
Computational micromagnetics has become a key tool in research and development in academia and industry. Modelling of magnetic storage media and read-write systems is widely used in the magnetic data storage industry and has significant economic impact. In academia, micromagnetic modelling is also used to advance magnetoelectronics and the emerging skyrmionics; the former having the potential to revolutionise electronic circuits by replacing electric charge of electrons as the carrier of information with spin (magnetisation is closely coupled to the spin), the latter opening up paths towards high capacity data storage using topological field excitations.
In addition to these material and device-based engineering applications of computational micromagnetism, the models are actively used in geophysics (rock magnetism) and increasingly in magnetic sensing and medicine.
Achievement of objectives
The purpose of this project was to interface the SUNDIALS CVODE package from Lawrence Livermore National Laboratory (LLNL) to the open-source FEniCS Project libraries, with particular application to micromagnetics applications.
Implementation
- SUNDIALS/CVODE has been integrated as part of FEniCS build system as an optional dependency.
- A functioning C++ interface in FEniCS to CVODE has been developed.
- Python wrappers for the FEniCS C++ CVODE interface implemented.
- All new code passes new unit tests in C++ and Python.
Validation and Performance of Scientific Code success criteria
- Validation of implementation for correctness, using reference results.
- Demonstrate weak scaling for a diffusion type problem. Shown on CSD3 up to 256 cores.
- Demonstrate micromagnetic prototype (with exchange interaction, and anisotropy or applied field).
- Develop a non-trivial time-dependent FEniCS example and demonstrate provision of Jacobian. An example showing the use of the Jacobian is included in the tutorial documentation.
Dissemination and sustainability success criteria
- All code published on bitbucket.org as part of FEniCS development.
- All tests working with FEniCS online continuous integration tools.
- New code developments in 2018.1.0 FEniCS release (14th June 2018).
- Micromagnetics prototype code with new time integration functionality publicly developed with Southampton group (Hans Fangohr).
- New feature documentation integrated with FEniCS documentation.
- Group discussion at FEniCS 2018 meeting in Oxford.
- Presentation at Cambridge Computation Seminar Day.
Training success criteria
Provide web based training at Cambridge and Southampton. Due to the small size of the micromagnetics community, and the partial relocation of the Southampton team to Germany, communication and training has taken place on #slack in a team called “fenics-cvode”. This has been successful, as it allows asynchronous communication, and continuous contact between the FEniCS developers and users.
Summary of the software
FEniCS is an open source tool for solving differential equations using finite element analysis. It is freely available at https://fenicsproject.org. Packages exist for Ubuntu Linux, and it has been installed on CSD3 in Cambridge and ARCHER. SUNDIALS is a library from LLNL, which is also freely available to download. It is installed as part of Cray-TPSL on ARCHER. When configuring FEniCS, we can set the environment variable SUNDIALS_DIR to point to the installation of SUNDIALS on the system, and the FEniCS CVODE interface will then be available. The latest release of FEniCS (2018.1.0) now includes the code from this project, and can therefore use SUNDIALS.
A module is available on ARCHER in /work/ecse0904/shared/FEniCS/module but it is anticipated that FEniCS with SUNDIALS will become generally available when the 2018.1.0 release is built by ARCHER CSE.